Skip to content

Commit d1aed44

Browse files
committed
feat(Tenant): cdc streams overview
1 parent cd645c6 commit d1aed44

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import type {TEvDescribeSchemeResult, TCdcStreamDescription} from '../../../types/api/schema';
2+
3+
import {InfoViewer, InfoViewerItem} from '..';
4+
import {formatCdcStreamItem, formatCommonItem} from '../formatters';
5+
6+
const DISPLAYED_FIELDS: Set<keyof TCdcStreamDescription> = new Set([
7+
'Mode',
8+
'Format',
9+
]);
10+
11+
interface CDCStreamOverviewProps {
12+
data?: TEvDescribeSchemeResult;
13+
}
14+
15+
export const CDCStreamOverview = ({data}: CDCStreamOverviewProps) => {
16+
if (!data) {
17+
return (
18+
<div className="error">No CDC Stream data</div>
19+
);
20+
}
21+
22+
const TableIndex = data.PathDescription?.CdcStreamDescription;
23+
const info: Array<InfoViewerItem> = [];
24+
25+
info.push(formatCommonItem('PathType', data.PathDescription?.Self?.PathType));
26+
info.push(formatCommonItem('CreateStep', data.PathDescription?.Self?.CreateStep));
27+
28+
let key: keyof TCdcStreamDescription;
29+
for (key in TableIndex) {
30+
if (DISPLAYED_FIELDS.has(key)) {
31+
info.push(formatCdcStreamItem(key, TableIndex?.[key]));
32+
}
33+
}
34+
35+
return (
36+
<>
37+
{info.length ? (
38+
<InfoViewer info={info}></InfoViewer>
39+
) : (
40+
<>Empty</>
41+
)}
42+
</>
43+
);
44+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './CDCStreamOverview';

src/containers/Tenant/ObjectSummary/ObjectSummary.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Acl from '../Acl/Acl';
1414
import SchemaViewer from '../Schema/SchemaViewer/SchemaViewer';
1515
import CopyToClipboard from '../../../components/CopyToClipboard/CopyToClipboard';
1616
import InfoViewer from '../../../components/InfoViewer/InfoViewer';
17+
import {CDCStreamOverview} from '../../../components/InfoViewer/schemaOverview';
1718
import Icon from '../../../components/Icon/Icon';
1819

1920
import {EPathSubType, EPathType, TDirEntry} from '../../../types/api/schema';
@@ -162,7 +163,7 @@ function ObjectSummary(props: ObjectSummaryProps) {
162163
[EPathType.EPathTypeExtSubDomain]: undefined,
163164
[EPathType.EPathTypeColumnStore]: undefined,
164165
[EPathType.EPathTypeColumnTable]: undefined,
165-
[EPathType.EPathTypeCdcStream]: () => undefined,
166+
[EPathType.EPathTypeCdcStream]: () => <CDCStreamOverview data={data[currentSchemaPath]} />,
166167
};
167168

168169
let component = currentSchemaData?.PathType && pathTypeToComponent[currentSchemaData.PathType]?.();

0 commit comments

Comments
 (0)