Skip to content

Commit 914702b

Browse files
feat(Diagnostics): add Partitions tab
1 parent 4ab65e3 commit 914702b

File tree

20 files changed

+901
-2
lines changed

20 files changed

+901
-2
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type {ReactNode} from 'react';
2+
3+
import {HelpPopover} from '@gravity-ui/uikit';
4+
5+
interface LabelWithPopoverProps {
6+
headerText: string;
7+
popoverContent: ReactNode;
8+
className?: string;
9+
}
10+
11+
export const LabelWithPopover = ({
12+
headerText,
13+
popoverContent,
14+
className,
15+
}: LabelWithPopoverProps) => (
16+
<div className={className}>
17+
{headerText}
18+
<HelpPopover content={popoverContent} />
19+
</div>
20+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './LabelWithPopover';

src/containers/Tenant/Diagnostics/Diagnostics.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {Nodes} from '../../Nodes';
2727
//@ts-ignore
2828
import {Tablets} from '../../Tablets';
2929
import {Consumers} from './Consumers';
30+
import {PartitionsWrapper} from './Partitions';
3031

3132
import routes, {createHref} from '../../../routes';
3233
import type {EPathType} from '../../../types/api/schema';
@@ -156,6 +157,9 @@ function Diagnostics(props: DiagnosticsProps) {
156157
case GeneralPagesIds.consumers: {
157158
return <Consumers path={currentSchemaPath} type={type} />;
158159
}
160+
case GeneralPagesIds.partitions: {
161+
return <PartitionsWrapper path={currentSchemaPath} type={type} />;
162+
}
159163
default: {
160164
return <div>No data...</div>;
161165
}

src/containers/Tenant/Diagnostics/DiagnosticsPages.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export enum GeneralPagesIds {
1212
'hotKeys' = 'hotKeys',
1313
'graph' = 'graph',
1414
'consumers' = 'consumers',
15+
'partitions' = 'partitions',
1516
}
1617

1718
type Page = {
@@ -72,6 +73,11 @@ const consumers = {
7273
title: 'Consumers',
7374
};
7475

76+
const partitions = {
77+
id: GeneralPagesIds.partitions,
78+
title: 'Partitions',
79+
};
80+
7581
export const DATABASE_PAGES = [
7682
overview,
7783
topQueries,
@@ -87,8 +93,8 @@ export const TABLE_PAGES = [overview, topShards, graph, tablets, hotKeys, descri
8793

8894
export const DIR_PAGES = [overview, topShards, describe];
8995

90-
export const CDC_STREAM_PAGES = [overview, consumers, describe];
91-
export const TOPIC_PAGES = [overview, consumers, describe];
96+
export const CDC_STREAM_PAGES = [overview, consumers, partitions, describe];
97+
export const TOPIC_PAGES = [overview, consumers, partitions, describe];
9298

9399
// verbose mapping to guarantee correct tabs for new path types
94100
// TS will error when a new type is added but not mapped here
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.ydb-diagnostics-partitions-columns-header {
2+
&__multiline {
3+
white-space: normal;
4+
}
5+
6+
&__read-session {
7+
width: 80px;
8+
9+
white-space: normal;
10+
}
11+
12+
&__lags {
13+
white-space: nowrap;
14+
}
15+
16+
&__messages {
17+
width: 90px;
18+
19+
white-space: normal;
20+
}
21+
22+
&__lags-popover-content {
23+
max-width: 300px;
24+
25+
div:nth-child(1) {
26+
margin-bottom: 10px;
27+
}
28+
}
29+
30+
&__messages-popover-content {
31+
max-width: 200px;
32+
}
33+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import block from 'bem-cn-lite';
2+
3+
import {LabelWithPopover} from '../../../../../components/LabelWithPopover';
4+
import {WriteLagImage, ReadLagImage} from '../../../../../components/LagImages';
5+
6+
import {PARTITIONS_COLUMNS_IDS, PARTITIONS_COLUMNS_TITILES} from '../utils/constants';
7+
8+
import i18n from '../i18n';
9+
10+
import './Headers.scss';
11+
12+
const b = block('ydb-diagnostics-partitions-columns-header');
13+
14+
interface MultilineHeaderProps {
15+
title: string;
16+
}
17+
18+
export const MultilineHeader = ({title}: MultilineHeaderProps) => (
19+
<div className={b('multiline')}>{title}</div>
20+
);
21+
22+
export const ReadSessionHeader = () => (
23+
<div className={b('read-session')}>
24+
{PARTITIONS_COLUMNS_TITILES[PARTITIONS_COLUMNS_IDS.READ_SESSION_ID]}
25+
</div>
26+
);
27+
28+
export const WriteLagsHeader = () => (
29+
<LabelWithPopover
30+
className={b('lags')}
31+
headerText={PARTITIONS_COLUMNS_TITILES[PARTITIONS_COLUMNS_IDS.READ_LAGS]}
32+
popoverContent={
33+
<div className={b('lags-popover-content')}>
34+
<div>{i18n('lagsPopover.writeLags')}</div>
35+
<div>
36+
<WriteLagImage />
37+
</div>
38+
</div>
39+
}
40+
/>
41+
);
42+
43+
export const ReadLagsHeader = () => (
44+
<LabelWithPopover
45+
className={b('lags')}
46+
headerText={PARTITIONS_COLUMNS_TITILES[PARTITIONS_COLUMNS_IDS.WRITE_LAGS]}
47+
popoverContent={
48+
<div className={b('lags-popover-content')}>
49+
<div>{i18n('lagsPopover.readLags')}</div>
50+
<div>
51+
<ReadLagImage />
52+
</div>
53+
</div>
54+
}
55+
/>
56+
);
57+
58+
export const UnreadMessagesHeader = () => (
59+
<LabelWithPopover
60+
className={b('messages')}
61+
headerText={PARTITIONS_COLUMNS_TITILES[PARTITIONS_COLUMNS_IDS.UNREAD_MESSAGES]}
62+
popoverContent={
63+
<div className={b('messages-popover-content')}>{i18n('headers.unread')}</div>
64+
}
65+
/>
66+
);
67+
68+
export const UncommitedMessagesHeader = () => (
69+
<LabelWithPopover
70+
className={b('messages')}
71+
headerText={PARTITIONS_COLUMNS_TITILES[PARTITIONS_COLUMNS_IDS.UNCOMMITED_MESSAGES]}
72+
popoverContent={
73+
<div className={b('messages-popover-content')}>{i18n('headers.uncommited')}</div>
74+
}
75+
/>
76+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './Headers';
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@import '../../../../styles/mixins.scss';
2+
3+
.ydb-diagnostics-partitions {
4+
overflow: auto;
5+
flex-grow: 1;
6+
7+
height: 100%;
8+
9+
@include flex-container();
10+
11+
&__controls {
12+
@include controls();
13+
}
14+
15+
&__consumer-select {
16+
width: 220px;
17+
}
18+
19+
&__search {
20+
@include search();
21+
&_partition {
22+
width: 100px;
23+
}
24+
&_general {
25+
width: 280px;
26+
}
27+
}
28+
29+
&__table-settings .yc-icon {
30+
width: 20px;
31+
}
32+
33+
&__table-wrapper {
34+
overflow: auto;
35+
@include flex-container();
36+
}
37+
38+
&__table-content {
39+
overflow: auto;
40+
41+
height: 100%;
42+
43+
@include freeze-nth-column(1);
44+
}
45+
}

0 commit comments

Comments
 (0)