Skip to content

Commit 71b254e

Browse files
authored
fix(Cluster): handle cluster error in meta requests (#1525)
1 parent ea4d3a9 commit 71b254e

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

src/containers/Cluster/Cluster.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,12 @@ export function Cluster({
123123
<div className={b('sticky-wrapper')}>
124124
<AutoRefreshControl className={b('auto-refresh-control')} />
125125
</div>
126-
<ClusterDashboard cluster={cluster} groupStats={groupsStats} loading={infoLoading} />
126+
<ClusterDashboard
127+
cluster={cluster}
128+
groupStats={groupsStats}
129+
loading={infoLoading}
130+
error={clusterError || cluster?.error}
131+
/>
127132
<div className={b('tabs-sticky-wrapper')}>
128133
<Tabs
129134
size="l"

src/containers/Cluster/ClusterDashboard/ClusterDashboard.scss

+6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
@import '../../../styles/mixins.scss';
2+
13
.ydb-cluster-dashboard {
24
position: sticky;
35
left: 0;
46

57
padding-top: 16px;
8+
9+
&__error {
10+
@include body-2-typography();
11+
}
612
&__card {
713
display: flex;
814
flex-direction: column;

src/containers/Cluster/ClusterDashboard/ClusterDashboard.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import {Flex, Text} from '@gravity-ui/uikit';
22

3+
import {ResponseError} from '../../../components/Errors/ResponseError';
34
import {Tags} from '../../../components/Tags';
45
import type {ClusterGroupsStats} from '../../../store/reducers/cluster/types';
56
import {isClusterInfoV2} from '../../../types/api/cluster';
67
import type {TClusterInfo} from '../../../types/api/cluster';
8+
import type {IResponseError} from '../../../types/api/error';
79
import {valueIsDefined} from '../../../utils';
810
import {formatNumber} from '../../../utils/dataFormatters/dataFormatters';
911
import i18n from '../i18n';
@@ -41,9 +43,13 @@ interface ClusterDashboardProps {
4143
cluster: TClusterInfo;
4244
groupStats?: ClusterGroupsStats;
4345
loading?: boolean;
46+
error?: IResponseError | string;
4447
}
4548

4649
export function ClusterDashboard(props: ClusterDashboardProps) {
50+
if (props.error) {
51+
return <ResponseError error={props.error} className={b('error')} />;
52+
}
4753
return (
4854
<div className={b()}>
4955
<Flex gap={4} wrap>

src/types/api/cluster.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type {TTraceCheck, TTraceView} from './trace';
88
* source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
99
*/
1010
export interface TClusterInfoV1 {
11+
error?: string;
1112
Name?: string;
1213
Overall?: EFlag;
1314
NodesTotal?: number;

0 commit comments

Comments
 (0)