Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Cluster): handle cluster error in meta requests #1525

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading