Skip to content

Commit

Permalink
fix(PDiskPage): explicit error on failed restart (#821)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemmufazalov authored May 14, 2024
1 parent 2615f7e commit fb81b29
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/components/CriticalActionDialog/CriticalActionDialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@
&__body {
display: flex;
align-items: center;

padding: 16px 16px 0;
}
}
7 changes: 6 additions & 1 deletion src/containers/PDiskPage/PDiskPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ export function PDiskPage() {

const handleRestart = async () => {
if (valueIsDefined(nodeId) && valueIsDefined(pDiskId)) {
return window.api.restartPDisk(nodeId, pDiskId);
return window.api.restartPDisk(nodeId, pDiskId).then((res) => {
if (res?.result === false) {
const err = {statusText: res.error};
throw err;
}
});
}

return undefined;
Expand Down
3 changes: 2 additions & 1 deletion src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {
Schemas,
} from '../types/api/query';
import type {JsonRenderRequestParams, JsonRenderResponse} from '../types/api/render';
import type {RestartPDiskResponse} from '../types/api/restartPDisk';
import type {TEvDescribeSchemeResult} from '../types/api/schema';
import type {TStorageInfo} from '../types/api/storage';
import type {TEvSystemStateResponse} from '../types/api/systemState';
Expand Down Expand Up @@ -509,7 +510,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
host: this.getPath(''),
});

return this.post(
return this.post<RestartPDiskResponse>(
pDiskPath,
'restartPDisk=',
{},
Expand Down
6 changes: 6 additions & 0 deletions src/types/api/restartPDisk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface RestartPDiskResponse {
// true if successful, false if not
result?: boolean;
// Error message, example: "GroupId# 2181038081 ExpectedStatus# DISINTEGRATED"
error?: string;
}

0 comments on commit fb81b29

Please sign in to comment.