Skip to content

Commit 708cbb5

Browse files
authored
feat(ShardsTable): add explanation for column DataSize (#3781)
1 parent f4d3ae1 commit 708cbb5

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/components/ShardsTable/columns.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import DataTable from '@gravity-ui/react-data-table';
33
import {EMPTY_DATA_PLACEHOLDER} from '../../utils/constants';
44
import {formatNumber, roundToPrecision} from '../../utils/dataFormatters/dataFormatters';
55
import {getUsageSeverity} from '../../utils/generateEvaluator';
6+
import {LabelWithPopover} from '../LabelWithPopover/LabelWithPopover';
67
import {LinkToSchemaObject} from '../LinkToSchemaObject/LinkToSchemaObject';
78
import {NodeId} from '../NodeId/NodeId';
89
import {TabletNameWrapper} from '../TabletNameWrapper/TabletNameWrapper';
910
import {UsageLabel} from '../UsageLabel/UsageLabel';
1011

1112
import type {TopShardsColumnId} from './constants';
1213
import {TOP_SHARDS_COLUMNS_IDS, TOP_SHARDS_COLUMNS_TITLES} from './constants';
14+
import i18n from './i18n';
1315
import type {GetShardsColumn} from './types';
1416
import {prepareDateTimeValue} from './utils';
1517

@@ -31,7 +33,12 @@ export const getPathColumn: GetShardsColumn = ({databaseFullPath = ''}) => {
3133
export const getDataSizeColumn: GetShardsColumn = () => {
3234
return {
3335
name: TOP_SHARDS_COLUMNS_IDS.DataSize,
34-
header: TOP_SHARDS_COLUMNS_TITLES.DataSize,
36+
header: (
37+
<LabelWithPopover
38+
text={TOP_SHARDS_COLUMNS_TITLES.DataSize}
39+
popoverContent={i18n('context_data-size')}
40+
/>
41+
),
3542
render: ({row}) => {
3643
return formatNumber(row.DataSize);
3744
},

src/components/ShardsTable/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"tablet-id": "TabletId",
33
"cpu-cores": "CPUCores",
44
"data-size": "DataSize (B)",
5+
"context_data-size": "The total data size in bytes for a single table shard",
56
"path": "Path",
67
"node-id": "NodeId",
78
"peak-time": "PeakTime",

tests/suites/tenant/diagnostics/Diagnostics.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,16 @@ export class Table {
106106
const headerCount = await headers.count();
107107
const headerNames = [];
108108
for (let i = 0; i < headerCount; i++) {
109-
headerNames.push(await headers.nth(i).innerText());
109+
const headerText = await headers.nth(i).evaluate((node) => {
110+
const title = node.getAttribute('title');
111+
if (title) {
112+
return title;
113+
}
114+
115+
const textContainer = node.querySelector('.data-table__head-cell > div');
116+
return textContainer?.textContent || '';
117+
});
118+
headerNames.push(headerText.replace(/\s+/g, ' ').trim());
110119
}
111120
return headerNames;
112121
}

0 commit comments

Comments
 (0)