Skip to content

Commit 2ee7889

Browse files
fix(Overview): display titles for topic, stream and tableIndex
1 parent 5f73eed commit 2ee7889

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

src/components/InfoViewer/InfoViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const InfoViewer = ({title, info, dots = true, size, className}: InfoViewerProps
3535
))}
3636
</div>
3737
) : (
38-
<>no {title} data</>
38+
<>No {title} data</>
3939
)}
4040
</div>
4141
);

src/components/InfoViewer/schemaInfo/CDCStreamInfo.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {TEvDescribeSchemeResult, TCdcStreamDescription} from '../../../types/api/schema';
22
import {useTypedSelector} from '../../../utils/hooks';
33
import {selectSchemaData} from '../../../store/reducers/schema';
4+
import {getEntityName} from '../../../containers/Tenant/utils';
45

56
import {formatCdcStreamItem, formatPQGroupItem, formatCommonItem} from '../formatters';
67
import {InfoViewer, InfoViewerItem} from '..';
@@ -15,8 +16,10 @@ interface CDCStreamInfoProps {
1516
export const CDCStreamInfo = ({data, childrenPaths}: CDCStreamInfoProps) => {
1617
const pqGroupData = useTypedSelector((state) => selectSchemaData(state, childrenPaths?.[0]));
1718

19+
const entityName = getEntityName(data?.PathDescription);
20+
1821
if (!data || !pqGroupData) {
19-
return <div className="error">No Changefeed data</div>;
22+
return <div className="error">No {entityName} data</div>;
2023
}
2124

2225
const cdcStream = data.PathDescription?.CdcStreamDescription;
@@ -41,5 +44,5 @@ export const CDCStreamInfo = ({data, childrenPaths}: CDCStreamInfoProps) => {
4144
),
4245
);
4346

44-
return <InfoViewer title={'Changefeed'} info={info} />;
47+
return <InfoViewer title={entityName} info={info} />;
4548
};
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import type {TEvDescribeSchemeResult} from '../../../types/api/schema';
2+
import {getEntityName} from '../../../containers/Tenant/utils';
23

3-
import {formatCommonItem, formatPQGroupItem} from '../formatters';
4+
import {formatPQGroupItem} from '../formatters';
45
import {InfoViewer, InfoViewerItem} from '..';
56

67
interface PersQueueGrouopInfoProps {
78
data?: TEvDescribeSchemeResult;
89
}
910

1011
export const PersQueueGroupInfo = ({data}: PersQueueGrouopInfoProps) => {
12+
const entityName = getEntityName(data?.PathDescription);
13+
1114
if (!data) {
12-
return <div className="error">No PersQueueGroup data</div>;
15+
return <div className="error">No {entityName} data</div>;
1316
}
1417

1518
const pqGroup = data.PathDescription?.PersQueueGroup;
1619
const info: Array<InfoViewerItem> = [];
1720

18-
info.push(formatCommonItem('PathType', data.PathDescription?.Self?.PathType));
19-
2021
info.push(formatPQGroupItem('Partitions', pqGroup?.Partitions || []));
2122
info.push(
2223
formatPQGroupItem(
@@ -25,5 +26,5 @@ export const PersQueueGroupInfo = ({data}: PersQueueGrouopInfoProps) => {
2526
),
2627
);
2728

28-
return <>{info.length ? <InfoViewer info={info}></InfoViewer> : <>Empty</>}</>;
29+
return <InfoViewer title={entityName} info={info} />;
2930
};

src/components/InfoViewer/schemaInfo/TableIndexInfo.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type {TEvDescribeSchemeResult, TIndexDescription} from '../../../types/api/schema';
2+
import {getEntityName} from '../../../containers/Tenant/utils';
23

34
import {formatTableIndexItem} from '../formatters';
45
import {InfoViewer, InfoViewerItem} from '..';
@@ -16,8 +17,10 @@ interface TableIndexInfoProps {
1617
}
1718

1819
export const TableIndexInfo = ({data}: TableIndexInfoProps) => {
20+
const entityName = getEntityName(data?.PathDescription);
21+
1922
if (!data) {
20-
return <div className="error">no index data</div>;
23+
return <div className="error">No {entityName} data</div>;
2124
}
2225

2326
const TableIndex = data.PathDescription?.TableIndex;
@@ -30,5 +33,5 @@ export const TableIndexInfo = ({data}: TableIndexInfoProps) => {
3033
}
3134
}
3235

33-
return <>{info.length ? <InfoViewer info={info}></InfoViewer> : <>Empty</>}</>;
36+
return <InfoViewer title={entityName} info={info} />;
3437
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {TPathDescription} from '../../../types/api/schema';
2+
import {mapPathTypeToEntityName} from './schema';
3+
4+
export const getEntityName = (pathDescription?: TPathDescription) => {
5+
const {PathType, PathSubType} = pathDescription?.Self || {};
6+
7+
return mapPathTypeToEntityName(PathType, PathSubType);
8+
};

0 commit comments

Comments
 (0)