Skip to content

Commit

Permalink
fix(Cluster): handle cluster error in meta requests (#1525)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raubzeug authored Oct 23, 2024
1 parent ea4d3a9 commit 71b254e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/containers/Cluster/Cluster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ export function Cluster({
<div className={b('sticky-wrapper')}>
<AutoRefreshControl className={b('auto-refresh-control')} />
</div>
<ClusterDashboard cluster={cluster} groupStats={groupsStats} loading={infoLoading} />
<ClusterDashboard
cluster={cluster}
groupStats={groupsStats}
loading={infoLoading}
error={clusterError || cluster?.error}
/>
<div className={b('tabs-sticky-wrapper')}>
<Tabs
size="l"
Expand Down
6 changes: 6 additions & 0 deletions src/containers/Cluster/ClusterDashboard/ClusterDashboard.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
@import '../../../styles/mixins.scss';

.ydb-cluster-dashboard {
position: sticky;
left: 0;

padding-top: 16px;

&__error {
@include body-2-typography();
}
&__card {
display: flex;
flex-direction: column;
Expand Down
6 changes: 6 additions & 0 deletions src/containers/Cluster/ClusterDashboard/ClusterDashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {Flex, Text} from '@gravity-ui/uikit';

import {ResponseError} from '../../../components/Errors/ResponseError';
import {Tags} from '../../../components/Tags';
import type {ClusterGroupsStats} from '../../../store/reducers/cluster/types';
import {isClusterInfoV2} from '../../../types/api/cluster';
import type {TClusterInfo} from '../../../types/api/cluster';
import type {IResponseError} from '../../../types/api/error';
import {valueIsDefined} from '../../../utils';
import {formatNumber} from '../../../utils/dataFormatters/dataFormatters';
import i18n from '../i18n';
Expand Down Expand Up @@ -41,9 +43,13 @@ interface ClusterDashboardProps {
cluster: TClusterInfo;
groupStats?: ClusterGroupsStats;
loading?: boolean;
error?: IResponseError | string;
}

export function ClusterDashboard(props: ClusterDashboardProps) {
if (props.error) {
return <ResponseError error={props.error} className={b('error')} />;
}
return (
<div className={b()}>
<Flex gap={4} wrap>
Expand Down
1 change: 1 addition & 0 deletions src/types/api/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {TTraceCheck, TTraceView} from './trace';
* source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
*/
export interface TClusterInfoV1 {
error?: string;
Name?: string;
Overall?: EFlag;
NodesTotal?: number;
Expand Down

0 comments on commit 71b254e

Please sign in to comment.