1
+ import { Text } from '@gravity-ui/uikit' ;
2
+ import omit from 'lodash/omit' ;
3
+
1
4
import type { InfoViewerItem } from '../../../../../components/InfoViewer' ;
2
5
import { formatObject } from '../../../../../components/InfoViewer' ;
3
6
import {
@@ -17,6 +20,8 @@ import {EPathType} from '../../../../../types/api/schema';
17
20
import { formatBytes , formatNumber } from '../../../../../utils/dataFormatters/dataFormatters' ;
18
21
import { formatDurationToShortTimeFormat } from '../../../../../utils/timeParsers' ;
19
22
23
+ import i18n from './i18n' ;
24
+
20
25
const isInStoreColumnTable = ( table : TColumnTableDescription ) => {
21
26
// SchemaPresetId could be 0
22
27
return table . SchemaPresetName && table . SchemaPresetId !== undefined ;
@@ -25,14 +30,12 @@ const isInStoreColumnTable = (table: TColumnTableDescription) => {
25
30
const prepareTTL = ( ttl : TTTLSettings | TColumnDataLifeCycle ) => {
26
31
// ExpireAfterSeconds could be 0
27
32
if ( ttl . Enabled && ttl . Enabled . ColumnName && ttl . Enabled . ExpireAfterSeconds !== undefined ) {
28
- const value = `column: '${
29
- ttl . Enabled . ColumnName
30
- } ', expire after: ${ formatDurationToShortTimeFormat (
31
- ttl . Enabled . ExpireAfterSeconds * 1000 ,
32
- 1 ,
33
- ) } `;
34
-
35
- return { label : 'TTL for rows' , value} ;
33
+ const value = i18n ( 'value.ttl' , {
34
+ columnName : ttl . Enabled . ColumnName ,
35
+ expireTime : formatDurationToShortTimeFormat ( ttl . Enabled . ExpireAfterSeconds * 1000 , 1 ) ,
36
+ } ) ;
37
+
38
+ return { label : i18n ( 'label.ttl' ) , value} ;
36
39
}
37
40
return undefined ;
38
41
} ;
@@ -41,12 +44,22 @@ function prepareColumnTableGeneralInfo(columnTable: TColumnTableDescription) {
41
44
const columnTableGeneralInfo : InfoViewerItem [ ] = [ ] ;
42
45
43
46
columnTableGeneralInfo . push ( {
44
- label : 'Standalone' ,
47
+ label : i18n ( 'label.standalone' ) ,
45
48
value : String ( ! isInStoreColumnTable ( columnTable ) ) ,
46
49
} ) ;
47
50
48
- if ( columnTable . Sharding && columnTable . Sharding . HashSharding ) {
49
- columnTableGeneralInfo . push ( { label : 'Sharding' , value : 'hash' } ) ;
51
+ if ( columnTable . Sharding ?. HashSharding ?. Columns ) {
52
+ const columns = columnTable . Sharding . HashSharding . Columns . join ( ', ' ) ;
53
+ const content = `PARTITION BY HASH(${ columns } )` ;
54
+
55
+ columnTableGeneralInfo . push ( {
56
+ label : i18n ( 'label.partitioning' ) ,
57
+ value : (
58
+ < Text variant = "code-2" wordBreak = "break-word" >
59
+ { content }
60
+ </ Text >
61
+ ) ,
62
+ } ) ;
50
63
}
51
64
52
65
if ( columnTable . TtlSettings ) {
@@ -66,25 +79,27 @@ const prepareTableGeneralInfo = (PartitionConfig: TPartitionConfig, TTLSettings?
66
79
67
80
const partitioningBySize =
68
81
PartitioningPolicy . SizeToSplit && Number ( PartitioningPolicy . SizeToSplit ) > 0
69
- ? `Enabled, split size: ${ formatBytes ( PartitioningPolicy . SizeToSplit ) } `
70
- : 'Disabled' ;
82
+ ? i18n ( 'value.partitioning-by-size.enabled' , {
83
+ size : formatBytes ( PartitioningPolicy . SizeToSplit ) ,
84
+ } )
85
+ : i18n ( 'disabled' ) ;
71
86
72
87
const partitioningByLoad = PartitioningPolicy . SplitByLoadSettings ?. Enabled
73
- ? 'Enabled'
74
- : 'Disabled' ;
88
+ ? i18n ( 'enabled' )
89
+ : i18n ( 'disabled' ) ;
75
90
76
91
generalTableInfo . push (
77
- { label : 'Partitioning by size', value : partitioningBySize } ,
78
- { label : 'Partitioning by load', value : partitioningByLoad } ,
92
+ { label : i18n ( 'label.partitioning-by- size') , value : partitioningBySize } ,
93
+ { label : i18n ( 'label.partitioning-by- load') , value : partitioningByLoad } ,
79
94
{
80
- label : 'Min number of partitions' ,
95
+ label : i18n ( 'label. partitions-min' ) ,
81
96
value : formatNumber ( PartitioningPolicy . MinPartitionsCount || 0 ) ,
82
97
} ,
83
98
) ;
84
99
85
100
if ( PartitioningPolicy . MaxPartitionsCount ) {
86
101
generalTableInfo . push ( {
87
- label : 'Max number of partitions' ,
102
+ label : i18n ( 'label. partitions-max' ) ,
88
103
value : formatNumber ( PartitioningPolicy . MaxPartitionsCount ) ,
89
104
} ) ;
90
105
}
@@ -101,7 +116,7 @@ const prepareTableGeneralInfo = (PartitionConfig: TPartitionConfig, TTLSettings?
101
116
readReplicasConfig = `ANY_AZ: ${ FollowerCount } ` ;
102
117
}
103
118
104
- generalTableInfo . push ( { label : 'Read replicas (followers)' , value : readReplicasConfig } ) ;
119
+ generalTableInfo . push ( { label : i18n ( 'label.read- replicas' ) , value : readReplicasConfig } ) ;
105
120
}
106
121
107
122
if ( TTLSettings ) {
@@ -112,8 +127,8 @@ const prepareTableGeneralInfo = (PartitionConfig: TPartitionConfig, TTLSettings?
112
127
}
113
128
114
129
generalTableInfo . push ( {
115
- label : 'Bloom filter',
116
- value : EnableFilterByKey ? 'Enabled' : 'Disabled' ,
130
+ label : i18n ( 'label.bloom- filter') ,
131
+ value : EnableFilterByKey ? i18n ( 'enabled' ) : i18n ( 'disabled' ) ,
117
132
} ) ;
118
133
119
134
return generalTableInfo ;
@@ -200,8 +215,15 @@ export const prepareTableInfo = (data?: TEvDescribeSchemeResult, type?: EPathTyp
200
215
} ) ,
201
216
] ;
202
217
203
- //@ts -expect-error
204
- const tabletMetricsInfo = formatObject ( formatTabletMetricsItem , TabletMetrics ) ;
218
+ const tabletMetricsInfo = formatObject (
219
+ formatTabletMetricsItem ,
220
+ omit ( TabletMetrics , [
221
+ 'GroupReadIops' ,
222
+ 'GroupReadThroughput' ,
223
+ 'GroupWriteIops' ,
224
+ 'GroupWriteThroughput' ,
225
+ ] ) ,
226
+ ) ;
205
227
206
228
let partitionConfigInfo : InfoViewerItem [ ] = [ ] ;
207
229
0 commit comments