From 3312ae20bc0f912a4a2b28572e1833efdb770a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9C=D1=83=D1=84=D0=B0?= =?UTF-8?q?=D0=B7=D0=B0=D0=BB=D0=BE=D0=B2?= <67755036+artemmufazalov@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:50:03 +0300 Subject: [PATCH] fix(VDiskPage): fix evict action (#1817) --- src/containers/VDiskPage/VDiskPage.tsx | 33 +++++++++++++++----------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/containers/VDiskPage/VDiskPage.tsx b/src/containers/VDiskPage/VDiskPage.tsx index 49591f284..7c0542aca 100644 --- a/src/containers/VDiskPage/VDiskPage.tsx +++ b/src/containers/VDiskPage/VDiskPage.tsx @@ -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'; @@ -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 = () => {