Skip to content

Commit fb81b29

Browse files
fix(PDiskPage): explicit error on failed restart (#821)
1 parent 2615f7e commit fb81b29

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/components/CriticalActionDialog/CriticalActionDialog.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@
1515
&__body {
1616
display: flex;
1717
align-items: center;
18-
19-
padding: 16px 16px 0;
2018
}
2119
}

src/containers/PDiskPage/PDiskPage.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ export function PDiskPage() {
5858

5959
const handleRestart = async () => {
6060
if (valueIsDefined(nodeId) && valueIsDefined(pDiskId)) {
61-
return window.api.restartPDisk(nodeId, pDiskId);
61+
return window.api.restartPDisk(nodeId, pDiskId).then((res) => {
62+
if (res?.result === false) {
63+
const err = {statusText: res.error};
64+
throw err;
65+
}
66+
});
6267
}
6368

6469
return undefined;

src/services/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
Schemas,
2525
} from '../types/api/query';
2626
import type {JsonRenderRequestParams, JsonRenderResponse} from '../types/api/render';
27+
import type {RestartPDiskResponse} from '../types/api/restartPDisk';
2728
import type {TEvDescribeSchemeResult} from '../types/api/schema';
2829
import type {TStorageInfo} from '../types/api/storage';
2930
import type {TEvSystemStateResponse} from '../types/api/systemState';
@@ -509,7 +510,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
509510
host: this.getPath(''),
510511
});
511512

512-
return this.post(
513+
return this.post<RestartPDiskResponse>(
513514
pDiskPath,
514515
'restartPDisk=',
515516
{},

src/types/api/restartPDisk.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface RestartPDiskResponse {
2+
// true if successful, false if not
3+
result?: boolean;
4+
// Error message, example: "GroupId# 2181038081 ExpectedStatus# DISINTEGRATED"
5+
error?: string;
6+
}

0 commit comments

Comments
 (0)