@@ -4,7 +4,7 @@ const PieChart = require('react-svg-piechart').default;
44import { COLORS } from '../../../shared/components' ;
55import * as models from '../../../shared/models' ;
66import { HealthStatusCode , SyncStatusCode } from '../../../shared/models' ;
7- import { ComparisonStatusIcon , HealthStatusIcon } from '../utils' ;
7+ import { ComparisonStatusIcon , HealthStatusIcon , HydrateOperationPhaseIcon } from '../utils' ;
88
99const healthColors = new Map < models . HealthStatusCode , string > ( ) ;
1010healthColors . set ( 'Unknown' , COLORS . health . unknown ) ;
@@ -19,11 +19,22 @@ syncColors.set('Unknown', COLORS.sync.unknown);
1919syncColors . set ( 'Synced' , COLORS . sync . synced ) ;
2020syncColors . set ( 'OutOfSync' , COLORS . sync . out_of_sync ) ;
2121
22+ const hydratorColors = new Map < string , string > ( ) ;
23+ hydratorColors . set ( 'Hydrating' , COLORS . operation . running ) ;
24+ hydratorColors . set ( 'Hydrated' , COLORS . operation . success ) ;
25+ hydratorColors . set ( 'Failed' , COLORS . operation . failed ) ;
26+ hydratorColors . set ( 'None' , COLORS . sync . unknown ) ;
27+
2228export const ApplicationsSummary = ( { applications} : { applications : models . Application [ ] } ) => {
2329 const sync = new Map < string , number > ( ) ;
2430 applications . forEach ( app => sync . set ( app . status . sync . status , ( sync . get ( app . status . sync . status ) || 0 ) + 1 ) ) ;
2531 const health = new Map < string , number > ( ) ;
2632 applications . forEach ( app => health . set ( app . status . health . status , ( health . get ( app . status . health . status ) || 0 ) + 1 ) ) ;
33+ const hydrator = new Map < string , number > ( ) ;
34+ applications . forEach ( app => {
35+ const phase = app . status . sourceHydrator ?. currentOperation ?. phase || 'None' ;
36+ hydrator . set ( phase , ( hydrator . get ( phase ) || 0 ) + 1 ) ;
37+ } ) ;
2738
2839 const attributes = [
2940 {
@@ -38,6 +49,10 @@ export const ApplicationsSummary = ({applications}: {applications: models.Applic
3849 title : 'HEALTHY' ,
3950 value : applications . filter ( app => app . status . health . status === 'Healthy' ) . length
4051 } ,
52+ {
53+ title : 'HYDRATED' ,
54+ value : applications . filter ( app => app . status . sourceHydrator ?. currentOperation ?. phase === 'Hydrated' ) . length
55+ } ,
4156 {
4257 title : 'CLUSTERS' ,
4358 value : new Set ( applications . map ( app => app . spec . destination . server || app . spec . destination . name ) ) . size
@@ -58,6 +73,11 @@ export const ApplicationsSummary = ({applications}: {applications: models.Applic
5873 title : 'Health' ,
5974 data : Array . from ( health . keys ( ) ) . map ( key => ( { title : key , value : health . get ( key ) , color : healthColors . get ( key as models . HealthStatusCode ) } ) ) ,
6075 legend : healthColors as Map < string , string >
76+ } ,
77+ {
78+ title : 'Hydrator' ,
79+ data : Array . from ( hydrator . keys ( ) ) . map ( key => ( { title : key , value : hydrator . get ( key ) , color : hydratorColors . get ( key ) } ) ) ,
80+ legend : hydratorColors as Map < string , string >
6181 }
6282 ] ;
6383 return (
@@ -97,6 +117,21 @@ export const ApplicationsSummary = ({applications}: {applications: models.Applic
97117 < li style = { { listStyle : 'none' , whiteSpace : 'nowrap' } } key = { key } >
98118 { chart . title === 'Health' && < HealthStatusIcon state = { { status : key as HealthStatusCode , message : '' } } noSpin = { true } /> }
99119 { chart . title === 'Sync' && < ComparisonStatusIcon status = { key as SyncStatusCode } noSpin = { true } /> }
120+ { chart . title === 'Hydrator' && key !== 'None' && (
121+ < HydrateOperationPhaseIcon
122+ operationState = { {
123+ phase : key as any ,
124+ startedAt : '' ,
125+ message : '' ,
126+ drySHA : '' ,
127+ hydratedSHA : '' ,
128+ sourceHydrator : { } as any
129+ } }
130+ />
131+ ) }
132+ { chart . title === 'Hydrator' && key === 'None' && (
133+ < i className = 'fa fa-minus-circle' style = { { color : hydratorColors . get ( key ) } } />
134+ ) }
100135 { ` ${ key } (${ getLegendValue ( key ) } )` }
101136 </ li >
102137 ) ) }
0 commit comments