@@ -21,6 +21,19 @@ const formatTabletMetricsItem = createInfoFormatter({
21
21
defaultValueFormatter : formatNumber ,
22
22
} ) ;
23
23
24
+ const formatFollowerGroupItem = createInfoFormatter ( {
25
+ values : {
26
+ FollowerCount : formatNumber ,
27
+ } ,
28
+ } ) ;
29
+
30
+ const formatPartitionConfigItem = createInfoFormatter ( {
31
+ values : {
32
+ FollowerCount : formatNumber ,
33
+ CrossDataCenterFollowerCount : formatNumber ,
34
+ } ,
35
+ } ) ;
36
+
24
37
const formatTableStatsItem = createInfoFormatter ( {
25
38
values : {
26
39
DataSize : formatBytes ,
@@ -57,7 +70,7 @@ class SchemaInfoViewer extends React.Component {
57
70
58
71
renderContent ( data ) {
59
72
const { PathDescription = { } } = data ;
60
- const { TableStats = { } , TabletMetrics = { } } = PathDescription ;
73
+ const { TableStats = { } , TabletMetrics = { } , Table : { PartitionConfig = { } } = { } } = PathDescription ;
61
74
const {
62
75
PartCount,
63
76
RowCount,
@@ -82,6 +95,7 @@ class SchemaInfoViewer extends React.Component {
82
95
83
96
...restTableStats
84
97
} = TableStats ;
98
+ const { FollowerGroups, FollowerCount, CrossDataCenterFollowerCount} = PartitionConfig ;
85
99
86
100
const tableStatsInfo = [
87
101
formatTableStats ( {
@@ -116,8 +130,25 @@ class SchemaInfoViewer extends React.Component {
116
130
formatTabletMetricsItem ( key , TabletMetrics [ key ] )
117
131
) ;
118
132
133
+ const partitionConfigInfo = [ ] ;
134
+
135
+ if ( Array . isArray ( FollowerGroups ) && FollowerGroups . length > 0 ) {
136
+ partitionConfigInfo . push ( ...Object . keys ( FollowerGroups [ 0 ] ) . map ( ( key ) =>
137
+ formatFollowerGroupItem ( key , FollowerGroups [ 0 ] [ key ] )
138
+ ) ) ;
139
+ } else if ( FollowerCount !== undefined ) {
140
+ partitionConfigInfo . push (
141
+ formatPartitionConfigItem ( 'FollowerCount' , FollowerCount )
142
+ ) ;
143
+ } else if ( CrossDataCenterFollowerCount !== undefined ) {
144
+ partitionConfigInfo . push (
145
+ formatPartitionConfigItem ( 'CrossDataCenterFollowerCount' , CrossDataCenterFollowerCount )
146
+ ) ;
147
+ }
148
+
119
149
if ( [
120
150
tabletMetricsInfo ,
151
+ partitionConfigInfo ,
121
152
tableStatsInfo . flat ( ) ,
122
153
] . flat ( ) . length === 0 ) {
123
154
return (
@@ -127,9 +158,10 @@ class SchemaInfoViewer extends React.Component {
127
158
128
159
return (
129
160
< div className = { b ( 'row' ) } >
130
- { tabletMetricsInfo . length > 0 ? (
161
+ { tabletMetricsInfo . length > 0 || partitionConfigInfo . length > 0 ? (
131
162
< div className = { b ( 'col' ) } >
132
163
{ this . renderItem ( tabletMetricsInfo , 'Tablet Metrics' ) }
164
+ { this . renderItem ( partitionConfigInfo , 'Partition Config' ) }
133
165
</ div >
134
166
) : null }
135
167
< div className = { b ( 'col' ) } >
0 commit comments