1+ import { Text } from '@gravity-ui/uikit' ;
2+ import omit from 'lodash/omit' ;
3+
14import type { InfoViewerItem } from '../../../../../components/InfoViewer' ;
25import { formatObject } from '../../../../../components/InfoViewer' ;
36import {
@@ -17,6 +20,8 @@ import {EPathType} from '../../../../../types/api/schema';
1720import { formatBytes , formatNumber } from '../../../../../utils/dataFormatters/dataFormatters' ;
1821import { formatDurationToShortTimeFormat } from '../../../../../utils/timeParsers' ;
1922
23+ import i18n from './i18n' ;
24+
2025const isInStoreColumnTable = ( table : TColumnTableDescription ) => {
2126 // SchemaPresetId could be 0
2227 return table . SchemaPresetName && table . SchemaPresetId !== undefined ;
@@ -25,14 +30,12 @@ const isInStoreColumnTable = (table: TColumnTableDescription) => {
2530const prepareTTL = ( ttl : TTTLSettings | TColumnDataLifeCycle ) => {
2631 // ExpireAfterSeconds could be 0
2732 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} ;
3639 }
3740 return undefined ;
3841} ;
@@ -41,12 +44,22 @@ function prepareColumnTableGeneralInfo(columnTable: TColumnTableDescription) {
4144 const columnTableGeneralInfo : InfoViewerItem [ ] = [ ] ;
4245
4346 columnTableGeneralInfo . push ( {
44- label : 'Standalone' ,
47+ label : i18n ( 'label.standalone' ) ,
4548 value : String ( ! isInStoreColumnTable ( columnTable ) ) ,
4649 } ) ;
4750
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+ } ) ;
5063 }
5164
5265 if ( columnTable . TtlSettings ) {
@@ -66,25 +79,27 @@ const prepareTableGeneralInfo = (PartitionConfig: TPartitionConfig, TTLSettings?
6679
6780 const partitioningBySize =
6881 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' ) ;
7186
7287 const partitioningByLoad = PartitioningPolicy . SplitByLoadSettings ?. Enabled
73- ? 'Enabled'
74- : 'Disabled' ;
88+ ? i18n ( 'enabled' )
89+ : i18n ( 'disabled' ) ;
7590
7691 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 } ,
7994 {
80- label : 'Min number of partitions' ,
95+ label : i18n ( 'label. partitions-min' ) ,
8196 value : formatNumber ( PartitioningPolicy . MinPartitionsCount || 0 ) ,
8297 } ,
8398 ) ;
8499
85100 if ( PartitioningPolicy . MaxPartitionsCount ) {
86101 generalTableInfo . push ( {
87- label : 'Max number of partitions' ,
102+ label : i18n ( 'label. partitions-max' ) ,
88103 value : formatNumber ( PartitioningPolicy . MaxPartitionsCount ) ,
89104 } ) ;
90105 }
@@ -101,7 +116,7 @@ const prepareTableGeneralInfo = (PartitionConfig: TPartitionConfig, TTLSettings?
101116 readReplicasConfig = `ANY_AZ: ${ FollowerCount } ` ;
102117 }
103118
104- generalTableInfo . push ( { label : 'Read replicas (followers)' , value : readReplicasConfig } ) ;
119+ generalTableInfo . push ( { label : i18n ( 'label.read- replicas' ) , value : readReplicasConfig } ) ;
105120 }
106121
107122 if ( TTLSettings ) {
@@ -112,8 +127,8 @@ const prepareTableGeneralInfo = (PartitionConfig: TPartitionConfig, TTLSettings?
112127 }
113128
114129 generalTableInfo . push ( {
115- label : 'Bloom filter',
116- value : EnableFilterByKey ? 'Enabled' : 'Disabled' ,
130+ label : i18n ( 'label.bloom- filter') ,
131+ value : EnableFilterByKey ? i18n ( 'enabled' ) : i18n ( 'disabled' ) ,
117132 } ) ;
118133
119134 return generalTableInfo ;
@@ -200,8 +215,15 @@ export const prepareTableInfo = (data?: TEvDescribeSchemeResult, type?: EPathTyp
200215 } ) ,
201216 ] ;
202217
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+ ) ;
205227
206228 let partitionConfigInfo : InfoViewerItem [ ] = [ ] ;
207229
0 commit comments