File tree Expand file tree Collapse file tree 5 files changed +44
-4
lines changed
containers/Cluster/ClusterInfo Expand file tree Collapse file tree 5 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import {cn} from '../../../utils/cn';
2525import { DEVELOPER_UI_TITLE } from '../../../utils/constants' ;
2626import { formatStorageValues } from '../../../utils/dataFormatters/dataFormatters' ;
2727import { useTypedSelector } from '../../../utils/hooks' ;
28- import { parseNodesToVersionsValues } from '../../../utils/versions' ;
28+ import { parseNodeGroupsToVersionsValues , parseNodesToVersionsValues } from '../../../utils/versions' ;
2929import { VersionsBar } from '../VersionsBar/VersionsBar' ;
3030import i18n from '../i18n' ;
3131
@@ -214,12 +214,18 @@ export const ClusterInfo = ({
214214
215215 const { currentData} = nodesApi . useGetNodesQuery ( {
216216 tablets : false ,
217+ group : 'Version' ,
217218 } ) ;
218219
219- const nodes = currentData ?. Nodes ;
220220 const versionsValues = React . useMemo ( ( ) => {
221- return parseNodesToVersionsValues ( nodes , versionToColor ) ;
222- } , [ nodes , versionToColor ] ) ;
221+ if ( ! currentData ) {
222+ return [ ] ;
223+ }
224+ if ( Array . isArray ( currentData . NodeGroups ) ) {
225+ return parseNodeGroupsToVersionsValues ( currentData . NodeGroups , versionToColor ) ;
226+ }
227+ return parseNodesToVersionsValues ( currentData . Nodes , versionToColor ) ;
228+ } , [ currentData , versionToColor ] ) ;
223229
224230 let internalLink = backend + '/internal' ;
225231
Original file line number Diff line number Diff line change @@ -76,15 +76,22 @@ export interface NodesApiRequestParams extends NodesGeneralRequestParams {
7676 visibleEntities ?: VisibleEntities ; // "with" param
7777 storage ?: boolean ;
7878 tablets ?: boolean ;
79+ group ?: string ;
7980}
8081
8182export interface ComputeApiRequestParams extends NodesGeneralRequestParams {
8283 path : string ;
8384 version ?: EVersion ; // only v2 works with filters
8485}
8586
87+ export interface NodesGroup {
88+ name : string ;
89+ count : number ;
90+ }
91+
8692export interface NodesHandledResponse {
8793 Nodes ?: NodesPreparedEntity [ ] ;
94+ NodeGroups ?: NodesGroup [ ] ;
8895 TotalNodes : number ;
8996 FoundNodes ?: number ;
9097}
Original file line number Diff line number Diff line change @@ -67,8 +67,14 @@ export const prepareNodesData = (data: TNodesInfo): NodesHandledResponse => {
6767 } ;
6868 } ) ;
6969
70+ const preparedGroups = data . NodeGroups ?. map ( ( group ) => ( {
71+ name : group . GroupName ,
72+ count : group . NodeCount ,
73+ } ) ) ;
74+
7075 return {
7176 Nodes : preparedNodes ,
77+ NodeGroups : preparedGroups ,
7278 TotalNodes : Number ( data . TotalNodes ) || preparedNodes . length ,
7379 FoundNodes : Number ( data . FoundNodes ) ,
7480 } ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import type {TVDiskStateInfo} from './vdisk';
1111export interface TNodesInfo {
1212 Overall ?: EFlag ;
1313 Nodes ?: TNodeInfo [ ] ;
14+ NodeGroups ?: TNodesGroup [ ] ;
1415
1516 /** uint64 */
1617 TotalNodes : string ;
@@ -26,6 +27,11 @@ export interface TNodeInfo {
2627 Tablets ?: TTabletStateInfo [ ] ;
2728}
2829
30+ export interface TNodesGroup {
31+ GroupName : string ;
32+ NodeCount : number ;
33+ }
34+
2935/**
3036 * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/protos/node_whiteboard.proto
3137 */
Original file line number Diff line number Diff line change 1+ import type { NodesGroup } from '../../store/reducers/nodes/types' ;
12import type { TSystemStateInfo } from '../../types/api/nodes' ;
23import type { VersionToColorMap , VersionValue } from '../../types/versions' ;
34
@@ -27,3 +28,17 @@ export const parseNodesToVersionsValues = (
2728 } ;
2829 } ) ;
2930} ;
31+
32+ export function parseNodeGroupsToVersionsValues (
33+ groups : NodesGroup [ ] ,
34+ versionsToColor ?: VersionToColorMap ,
35+ ) {
36+ return groups . map ( ( group ) => {
37+ return {
38+ title : group . name ,
39+ version : group . name ,
40+ color : versionsToColor ?. get ( group . name ) ,
41+ value : group . count ,
42+ } ;
43+ } ) ;
44+ }
You can’t perform that action at this time.
0 commit comments