Skip to content

Commit dde82b0

Browse files
feat(TopShards): colorize usage (#2003)
1 parent 290bb18 commit dde82b0

File tree

1 file changed

+7
-24
lines changed
  • src/containers/Tenant/Diagnostics/TopShards/columns

1 file changed

+7
-24
lines changed

src/containers/Tenant/Diagnostics/TopShards/columns/columns.tsx

+7-24
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ import {getDefaultNodePath} from '../../../../Node/NodePages';
1313

1414
import {TOP_SHARDS_COLUMNS_IDS, TOP_SHARDS_COLUMNS_TITLES} from './constants';
1515

16-
function prepareCPUWorkloadValue(value: string | number) {
17-
return `${roundToPrecision(Number(value) * 100, 2)}%`;
18-
}
19-
2016
const getPathColumn = (schemaPath: string, location: Location): Column<KeyValueRow> => ({
2117
name: TOP_SHARDS_COLUMNS_IDS.Path,
2218
header: TOP_SHARDS_COLUMNS_TITLES.Path,
@@ -32,15 +28,6 @@ const getPathColumn = (schemaPath: string, location: Location): Column<KeyValueR
3228
width: 300,
3329
});
3430

35-
const cpuCoresColumn: Column<KeyValueRow> = {
36-
name: TOP_SHARDS_COLUMNS_IDS.CPUCores,
37-
header: TOP_SHARDS_COLUMNS_TITLES.CPUCores,
38-
render: ({row}) => {
39-
return prepareCPUWorkloadValue(row.CPUCores || 0);
40-
},
41-
align: DataTable.RIGHT,
42-
};
43-
4431
const dataSizeColumn: Column<KeyValueRow> = {
4532
name: TOP_SHARDS_COLUMNS_IDS.DataSize,
4633
header: TOP_SHARDS_COLUMNS_TITLES.DataSize,
@@ -75,21 +62,17 @@ const nodeIdColumn: Column<KeyValueRow> = {
7562
align: DataTable.RIGHT,
7663
};
7764

78-
const topShardsCpuCoresColumn: Column<KeyValueRow> = {
65+
const cpuCoresColumn: Column<KeyValueRow> = {
7966
name: TOP_SHARDS_COLUMNS_IDS.CPUCores,
8067
header: TOP_SHARDS_COLUMNS_TITLES.CPUCores,
8168
render: ({row}) => {
82-
return (
83-
<UsageLabel
84-
value={roundToPrecision(Number(row.CPUCores) * 100, 2)}
85-
theme={getUsageSeverity(Number(row.CPUCores) * 100)}
86-
/>
87-
);
69+
const usage = Number(row.CPUCores) * 100 || 0;
70+
71+
return <UsageLabel value={roundToPrecision(usage, 2)} theme={getUsageSeverity(usage)} />;
8872
},
8973
align: DataTable.RIGHT,
90-
sortable: false,
91-
width: 140,
92-
resizeMinWidth: 140,
74+
width: 110,
75+
resizeMinWidth: 110,
9376
};
9477

9578
const inFlightTxCountColumn: Column<KeyValueRow> = {
@@ -111,5 +94,5 @@ export const getShardsWorkloadColumns = (schemaPath: string, location: Location)
11194
};
11295

11396
export const getTopShardsColumns = (schemaPath: string, location: Location) => {
114-
return [tabletIdColumn, getPathColumn(schemaPath, location), topShardsCpuCoresColumn];
97+
return [tabletIdColumn, getPathColumn(schemaPath, location), cpuCoresColumn];
11598
};

0 commit comments

Comments
 (0)