@@ -4,24 +4,30 @@ import {Checkbox, RadioButton} from '@gravity-ui/uikit';
4
4
5
5
import { Loader } from '../../components/Loader' ;
6
6
import { nodesApi } from '../../store/reducers/nodes/nodes' ;
7
+ import type { TClusterInfo } from '../../types/api/cluster' ;
7
8
import type { VersionToColorMap } from '../../types/versions' ;
8
9
import { cn } from '../../utils/cn' ;
9
10
import { useAutoRefreshInterval } from '../../utils/hooks' ;
11
+ import { VersionsBar } from '../Cluster/VersionsBar/VersionsBar' ;
10
12
11
13
import { GroupedNodesTree } from './GroupedNodesTree/GroupedNodesTree' ;
12
14
import { getGroupedStorageNodes , getGroupedTenantNodes , getOtherNodes } from './groupNodes' ;
15
+ import i18n from './i18n' ;
13
16
import { GroupByValue } from './types' ;
17
+ import { useGetVersionValues } from './utils' ;
14
18
15
19
import './Versions.scss' ;
16
20
17
21
const b = cn ( 'ydb-versions' ) ;
18
22
19
23
interface VersionsProps {
20
24
versionToColor ?: VersionToColorMap ;
25
+ cluster ?: TClusterInfo ;
21
26
}
22
27
23
- export const Versions = ( { versionToColor} : VersionsProps ) => {
28
+ export const Versions = ( { versionToColor, cluster } : VersionsProps ) => {
24
29
const [ autoRefreshInterval ] = useAutoRefreshInterval ( ) ;
30
+ const versionsValues = useGetVersionValues ( cluster , versionToColor ) ;
25
31
const { currentData, isLoading : isNodesLoading } = nodesApi . useGetNodesQuery (
26
32
{ tablets : false } ,
27
33
{ pollingInterval : autoRefreshInterval } ,
@@ -74,7 +80,7 @@ export const Versions = ({versionToColor}: VersionsProps) => {
74
80
const otherNodes = getOtherNodes ( nodes , versionToColor ) ;
75
81
const storageNodesContent = storageNodes ?. length ? (
76
82
< React . Fragment >
77
- < h3 > Storage nodes </ h3 >
83
+ < h4 > { i18n ( 'title_storage' ) } </ h4 >
78
84
{ storageNodes . map ( ( { title, nodes : itemNodes , items, versionColor} ) => (
79
85
< GroupedNodesTree
80
86
key = { `storage-nodes-${ title } ` }
@@ -88,7 +94,7 @@ export const Versions = ({versionToColor}: VersionsProps) => {
88
94
) : null ;
89
95
const tenantNodesContent = tenantNodes ?. length ? (
90
96
< React . Fragment >
91
- < h3 > Database nodes </ h3 >
97
+ < h4 > { i18n ( 'title_database' ) } </ h4 >
92
98
{ renderControls ( ) }
93
99
{ tenantNodes . map ( ( { title, nodes : itemNodes , items, versionColor, versionsValues} ) => (
94
100
< GroupedNodesTree
@@ -105,7 +111,7 @@ export const Versions = ({versionToColor}: VersionsProps) => {
105
111
) : null ;
106
112
const otherNodesContent = otherNodes ?. length ? (
107
113
< React . Fragment >
108
- < h3 > Other nodes </ h3 >
114
+ < h4 > { i18n ( 'title_other' ) } </ h4 >
109
115
{ otherNodes . map ( ( { title, nodes : itemNodes , items, versionColor, versionsValues} ) => (
110
116
< GroupedNodesTree
111
117
key = { `other-nodes-${ title } ` }
@@ -119,8 +125,22 @@ export const Versions = ({versionToColor}: VersionsProps) => {
119
125
</ React . Fragment >
120
126
) : null ;
121
127
128
+ const overallContent = (
129
+ < React . Fragment >
130
+ < h4 > { i18n ( 'title_overall' ) } </ h4 >
131
+ < div className = { b ( 'overall-wrapper' ) } >
132
+ < VersionsBar
133
+ progressClassName = { b ( 'overall-progress' ) }
134
+ versionsValues = { versionsValues . filter ( ( el ) => el . title !== 'unknown' ) }
135
+ size = "m"
136
+ />
137
+ </ div >
138
+ </ React . Fragment >
139
+ ) ;
140
+
122
141
return (
123
- < div className = { b ( 'versions' ) } >
142
+ < div className = { b ( ) } >
143
+ { overallContent }
124
144
{ storageNodesContent }
125
145
{ tenantNodesContent }
126
146
{ otherNodesContent }
0 commit comments