@@ -17,6 +17,7 @@ import {PageMetaWithAutorefresh} from '../../components/PageMeta/PageMeta';
1717import { getPDiskPagePath } from '../../routes' ;
1818import { api } from '../../store/reducers/api' ;
1919import { selectIsUserAllowedToMakeChanges } from '../../store/reducers/authentication/authentication' ;
20+ import { useDiskPagesAvailable } from '../../store/reducers/capabilities/hooks' ;
2021import { setHeaderBreadcrumbs } from '../../store/reducers/header/header' ;
2122import { pDiskApi } from '../../store/reducers/pdisk/pdisk' ;
2223import type { EDecommitStatus } from '../../types/api/pdisk' ;
@@ -61,6 +62,7 @@ export function PDiskPage() {
6162 const dispatch = useTypedDispatch ( ) ;
6263
6364 const isUserAllowedToMakeChanges = useTypedSelector ( selectIsUserAllowedToMakeChanges ) ;
65+ const newDiskApiAvailable = useDiskPagesAvailable ( ) ;
6466
6567 const [ { nodeId, pDiskId, activeTab} ] = useQueryParams ( {
6668 activeTab : StringParam ,
@@ -87,7 +89,9 @@ export function PDiskPage() {
8789
8890 const handleRestart = async ( isRetry ?: boolean ) => {
8991 if ( pDiskParamsDefined ) {
90- const response = await window . api . restartPDisk ( { nodeId, pDiskId, force : isRetry } ) ;
92+ const response = await window . api [
93+ newDiskApiAvailable ? 'restartPDisk' : 'restartPDiskOld'
94+ ] ( { nodeId, pDiskId, force : isRetry } ) ;
9195
9296 if ( response ?. result === false ) {
9397 const err = {
@@ -188,13 +192,15 @@ export function PDiskPage() {
188192 < Icon data = { ArrowRotateLeft } />
189193 { pDiskPageKeyset ( 'restart-pdisk-button' ) }
190194 </ ButtonWithConfirmDialog >
191- < DecommissionButton
192- decommission = { DecommitStatus }
193- onConfirmAction = { handleDecommissionChange }
194- onConfirmActionSuccess = { handleAfterAction }
195- buttonDisabled = { ! pDiskParamsDefined || ! isUserAllowedToMakeChanges }
196- popoverDisabled = { isUserAllowedToMakeChanges }
197- />
195+ { newDiskApiAvailable ? (
196+ < DecommissionButton
197+ decommission = { DecommitStatus }
198+ onConfirmAction = { handleDecommissionChange }
199+ onConfirmActionSuccess = { handleAfterAction }
200+ buttonDisabled = { ! pDiskParamsDefined || ! isUserAllowedToMakeChanges }
201+ popoverDisabled = { isUserAllowedToMakeChanges }
202+ />
203+ ) : null }
198204 </ div >
199205 ) ;
200206 } ;
0 commit comments