@@ -5,16 +5,17 @@ import {
55 EmphaseText ,
66 LargerText ,
77 SmallerText ,
8- Tooltip ,
98 StatusWrapper ,
109 Loader ,
1110 AppContainer ,
1211 spacing ,
1312 Stack ,
14- Icon ,
13+ IconHelp ,
1514} from '@scality/core-ui' ;
16- import { GlobalHealthBar } from '@scality/core-ui/dist/components/globalhealthbar/GlobalHealthBar.component' ;
17-
15+ import {
16+ Alert ,
17+ GlobalHealthBar as GlobalHealthBarRecharts ,
18+ } from '@scality/core-ui/dist/components/globalhealthbar/GlobalHealthBarRecharts.component' ;
1819import {
1920 highestAlertToStatus ,
2021 useAlertLibrary ,
@@ -38,12 +39,16 @@ const PlatformStatusIcon = styled.div`
3839 font-size: 2rem;
3940` ;
4041
42+ const StyledEmphaseText = styled ( EmphaseText ) `
43+ letter-spacing: ${ spacing . r2 } ;
44+ ` ;
45+
4146const DashboardGlobalHealth = ( ) => {
4247 const intl = useIntl ( ) ;
4348 const { startingTimeISO, currentTimeISO } = useStartingTimeStamp ( ) ;
4449 const alertsLibrary = useAlertLibrary ( ) ;
4550 const { duration } = useMetricsTimeSpan ( ) ;
46- const { data : alertSegments , status : historyAlertStatus } = useQuery (
51+ const { data : alerts , status : historyAlertStatus } = useQuery (
4752 getClusterAlertSegmentQuery ( duration ) ,
4853 ) ;
4954 const platformHighestSeverityAlert = useHighestSeverityAlerts (
@@ -68,87 +73,63 @@ const DashboardGlobalHealth = () => {
6873 </ Box >
6974 < Box flex = "2" >
7075 < HealthBarContainer >
71- < div
76+ < Stack
7277 style = { {
7378 display : 'flex' ,
7479 alignItems : 'center' ,
7580 } }
81+ gap = "r20"
7682 >
77- < Box
78- style = { {
79- display : 'flex' ,
80- alignItems : 'center' ,
81- } }
82- mr = { 20 }
83- >
84- < Box
85- mr = { 8 }
86- style = { {
87- letterSpacing : spacing . r2 ,
88- } }
89- >
90- < EmphaseText > Global Health</ EmphaseText >
91- </ Box >
83+ < StyledEmphaseText > Global Health</ StyledEmphaseText >
9284
93- < Tooltip
94- placement = "bottom"
95- overlay = {
96- < SmallerText >
97- { intl
98- . formatMessage ( {
99- id : 'global_health_explanation' ,
100- } )
101- . split ( '\n' )
102- . map ( ( line , key ) => (
103- < Box key = { `globalheathexplanation-${ key } ` } mb = { 8 } >
104- { line }
105- </ Box >
106- ) ) }
107- </ SmallerText >
108- }
109- overlayStyle = { {
110- minWidth : '30rem' ,
111- display : 'block' ,
112- } }
113- >
114- < Icon name = "Info" color = "buttonSecondary" / >
115- </ Tooltip >
85+ < IconHelp
86+ placement = "bottom"
87+ tooltipMessage = {
88+ < Stack direction = "vertical" gap = "r4" >
89+ { intl
90+ . formatMessage ( {
91+ id : 'global_health_explanation' ,
92+ } )
93+ . split ( '\n' )
94+ . map ( ( line , key ) => (
95+ < SmallerText key = { `globalheathexplanation-${ key } ` } >
96+ { line }
97+ </ SmallerText >
98+ ) ) }
99+ </ Stack >
100+ }
101+ />
102+ < CircleStatus status = { platformStatus } />
103+ </ Stack >
104+
105+ { historyAlertStatus === 'loading' ? (
106+ < Box ml = { 8 } height = { 50 } >
107+ < Loader size = { 'larger' } / >
116108 </ Box >
117- < EmphaseText >
118- < CircleStatus status = { platformStatus } />
119- </ EmphaseText >
120- { historyAlertStatus === 'loading' && (
121- < Box ml = { 8 } >
122- < Loader size = { 'larger' } />
123- </ Box >
124- ) }
125- </ div >
126- < Box mr = { 20 } >
127- < GlobalHealthBar
109+ ) : (
110+ < GlobalHealthBarRecharts
128111 id = { 'platform_globalhealth' }
129112 alerts = {
130113 historyAlertStatus === 'error'
131- ? [
114+ ? ( [
132115 {
133116 startsAt : startingTimeISO ,
134117 endsAt : currentTimeISO ,
135118 severity : 'unavailable' ,
136119 description :
137120 'Failed to load alert history for the selected period' ,
138121 } ,
139- ]
140- : alertSegments || [ ]
122+ ] as Alert [ ] )
123+ : alerts || [ ]
141124 }
142- start = { startingTimeISO }
143- end = { currentTimeISO }
125+ start = { new Date ( startingTimeISO ) }
126+ end = { new Date ( currentTimeISO ) }
144127 />
145- </ Box >
128+ ) }
146129 </ HealthBarContainer >
147130 </ Box >
148- < Box flex = "2" >
149- < Box ml = { 24 } >
150- < DashboardAlerts />
151- </ Box >
131+ < Box flex = "2" ml = { 24 } >
132+ < DashboardAlerts />
152133 </ Box >
153134 </ Stack >
154135 </ AppContainer . OverallSummary >
0 commit comments