Skip to content

Commit 2b9e769

Browse files
committed
fix(Cluster): handle cluster error in meta requests
1 parent e3dfcba commit 2b9e769

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

src/containers/Cluster/Cluster.tsx

Lines changed: 6 additions & 1 deletion
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}
131+
/>
127132
<div className={b('tabs-sticky-wrapper')}>
128133
<Tabs
129134
size="l"

src/containers/Cluster/ClusterDashboard/ClusterDashboard.scss

Lines changed: 6 additions & 0 deletions
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

Lines changed: 6 additions & 0 deletions
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;
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/services/parsers/parseMetaCluster.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import {traceCheckSchema, traceViewSchema} from '../../types/api/trace';
55
export const parseMetaCluster = (data: MetaCluster): TClusterInfo => {
66
const {cluster = {}} = data;
77

8+
if (cluster.cluster?.error) {
9+
throw new Error(cluster.cluster.error);
10+
}
11+
812
const {
913
cluster: generalClusterInfo,
1014
balancer,

0 commit comments

Comments
 (0)