|
1 |
| -import type {ValueOf} from '../types/common'; |
2 |
| - |
3 |
| -const TOP_SHARDS_SORT_VALUES = { |
4 |
| - CPUCores: 'CPUCores', |
5 |
| - DataSize: 'DataSize', |
6 |
| - InFlightTxCount: 'InFlightTxCount', |
7 |
| -} as const; |
8 |
| - |
9 |
| -const TOP_QUERIES_SORT_VALUES = { |
10 |
| - CPUTimeUs: 'CPUTimeUs', |
| 1 | +export const TOP_QUERIES_COLUMNS_IDS = { |
| 2 | + CPUTimeUs: 'CPUTime', |
| 3 | + QueryText: 'QueryText', |
11 | 4 | EndTime: 'EndTime',
|
12 | 5 | ReadRows: 'ReadRows',
|
13 | 6 | ReadBytes: 'ReadBytes',
|
14 | 7 | UserSID: 'UserSID',
|
| 8 | + OneLineQueryText: 'OneLineQueryText', |
| 9 | + QueryHash: 'QueryHash', |
15 | 10 | Duration: 'Duration',
|
16 |
| -} as const; |
| 11 | +}; |
| 12 | + |
| 13 | +export const TOP_SHARD_COLUMNS_IDS = { |
| 14 | + TabletId: 'TabletId', |
| 15 | + CPUCores: 'CPUCores', |
| 16 | + DataSize: 'DataSize', |
| 17 | + Path: 'Path', |
| 18 | + NodeId: 'NodeId', |
| 19 | + PeakTime: 'PeakTime', |
| 20 | + InFlightTxCount: 'InFlightTxCount', |
| 21 | + IntervalEnd: 'IntervalEnd', |
| 22 | +}; |
| 23 | + |
| 24 | +const TOP_SHARDS_SORT_VALUES = [ |
| 25 | + TOP_SHARD_COLUMNS_IDS.CPUCores, |
| 26 | + TOP_SHARD_COLUMNS_IDS.DataSize, |
| 27 | + TOP_SHARD_COLUMNS_IDS.InFlightTxCount, |
| 28 | +]; |
17 | 29 |
|
18 |
| -type TopShardsSortValue = ValueOf<typeof TOP_SHARDS_SORT_VALUES>; |
19 |
| -type TopQueriesSortValue = ValueOf<typeof TOP_QUERIES_SORT_VALUES>; |
| 30 | +const TOP_QUERIES_SORT_VALUES = [ |
| 31 | + TOP_QUERIES_COLUMNS_IDS.CPUTimeUs, |
| 32 | + TOP_QUERIES_COLUMNS_IDS.EndTime, |
| 33 | + TOP_QUERIES_COLUMNS_IDS.ReadRows, |
| 34 | + TOP_QUERIES_COLUMNS_IDS.ReadBytes, |
| 35 | + TOP_QUERIES_COLUMNS_IDS.UserSID, |
| 36 | + TOP_QUERIES_COLUMNS_IDS.Duration, |
| 37 | +]; |
20 | 38 |
|
21 |
| -export const isSortableTopShardsProperty = (value: string): value is TopShardsSortValue => |
22 |
| - Object.values(TOP_SHARDS_SORT_VALUES).includes(value as TopShardsSortValue); |
| 39 | +export const isSortableTopShardsProperty = (value: string) => |
| 40 | + Object.values(TOP_SHARDS_SORT_VALUES).includes(value); |
23 | 41 |
|
24 |
| -export const isSortableTopQueriesProperty = (value: string): value is TopQueriesSortValue => |
25 |
| - Object.values(TOP_QUERIES_SORT_VALUES).includes(value as TopQueriesSortValue); |
| 42 | +export const isSortableTopQueriesProperty = (value: string) => |
| 43 | + Object.values(TOP_QUERIES_SORT_VALUES).includes(value); |
0 commit comments