Skip to content

Commit

Permalink
fix(VDiskPage): fix evict action (#1817)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemmufazalov authored Jan 13, 2025
1 parent e5be605 commit 3312ae2
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/containers/VDiskPage/VDiskPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {selectIsUserAllowedToMakeChanges} from '../../store/reducers/authenticat
import {useDiskPagesAvailable} from '../../store/reducers/capabilities/hooks';
import {setHeaderBreadcrumbs} from '../../store/reducers/header/header';
import {vDiskApi} from '../../store/reducers/vdisk/vdisk';
import type {ModifyDiskResponse} from '../../types/api/modifyDisk';
import {valueIsDefined} from '../../utils';
import {cn} from '../../utils/cn';
import {getSeverityColor, getVDiskSlotBasedId} from '../../utils/disks/helpers';
Expand Down Expand Up @@ -70,27 +71,31 @@ export function VDiskPage() {

const handleEvictVDisk = async (isRetry?: boolean) => {
if (vDiskIdParamsDefined) {
return (
newDiskApiAvailable ? window.api.vdisk.evictVDisk : window.api.tablets.evictVDiskOld
)({
const requestParams = {
groupId: GroupID,
groupGeneration: GroupGeneration,
failRealmIdx: Ring,
failDomainIdx: Domain,
vDiskIdx: VDisk,
force: isRetry,
}).then((response) => {
if (response?.result === false) {
const err = {
statusText: response.error,
retryPossible: response.forceRetryPossible,
};
throw err;
}
});
};

let response: ModifyDiskResponse;

if (newDiskApiAvailable) {
response = await window.api.vdisk.evictVDisk(requestParams);
} else {
response = await window.api.tablets.evictVDiskOld(requestParams);
}

if (response?.result === false) {
const err = {
statusText: response.error,
retryPossible: response.forceRetryPossible,
};
throw err;
}
}

return undefined;
};

const handleAfterEvictVDisk = () => {
Expand Down

0 comments on commit 3312ae2

Please sign in to comment.