11import React from 'react' ;
22import styled from 'styled-components' ;
3- import { Button } from '@scality/core-ui/dist/next' ;
3+ import { Box , Button } from '@scality/core-ui/dist/next' ;
44import { padding } from '@scality/core-ui/dist/style/theme' ;
55import { useIntl } from 'react-intl' ;
66import { GRAFANA_DASHBOARDS } from '../constants' ;
@@ -14,7 +14,7 @@ import DashboardChartSystemLoad from './DashboardChartSystemLoad';
1414import DashboardChartMemory from './DashboardChartMemory' ;
1515import { useShowQuantileChart , useTypedSelector } from '../hooks' ;
1616import { DashboardScrollableArea } from '../containers/DashboardPage' ;
17- import { Tooltip , Icon , SmallerText , SpacedBox } from '@scality/core-ui' ;
17+ import { Icon , SmallerText , Stack , IconHelp , spacing } from '@scality/core-ui' ;
1818const MetricsContainer = styled . div `
1919 padding: 2px ${ padding . smaller } ;
2020 display: flex;
@@ -29,6 +29,29 @@ const PanelActions = styled.div`
2929 justify-content: space-between;
3030` ;
3131
32+ export const QuantileHelpTooltip = ( ) => {
33+ const intl = useIntl ( ) ;
34+ return (
35+ < IconHelp
36+ placement = "bottom"
37+ tooltipMessage = {
38+ < Stack direction = "vertical" gap = "r8" >
39+ { intl
40+ . formatMessage ( {
41+ id : 'metric_quantile_explanation' ,
42+ } )
43+ . split ( '\n' )
44+ . map ( ( line , key ) => (
45+ < SmallerText key = { `globalheathexplanation-${ key } ` } >
46+ { line }
47+ </ SmallerText >
48+ ) ) }
49+ </ Stack >
50+ }
51+ />
52+ ) ;
53+ } ;
54+
3255const DashboardMetrics = ( ) => {
3356 const intl = useIntl ( ) ;
3457 // App config, used to generated Advanced metrics button link
@@ -38,40 +61,12 @@ const DashboardMetrics = () => {
3861 < MetricsContainer id = "dashboard-metrics-container" >
3962 < PanelActions >
4063 < PageSubtitle >
41- < SpacedBox mr = { 8 } >
42- { ' ' }
64+ < Box mr = { spacing . r8 } >
4365 { intl . formatMessage ( {
4466 id : 'metrics' ,
4567 } ) }
46- </ SpacedBox >
47- { isShowQuantileChart && (
48- < Tooltip
49- placement = "bottom"
50- overlay = {
51- < SmallerText
52- // @ts -expect-error - FIXME when you are working on it
53- style = { {
54- minWidth : '30rem' ,
55- display : 'block' ,
56- textAlign : 'left' ,
57- } }
58- >
59- { intl
60- . formatMessage ( {
61- id : 'metric_quantile_explanation' ,
62- } )
63- . split ( '\n' )
64- . map ( ( line , key ) => (
65- < SpacedBox key = { `globalheathexplanation-${ key } ` } mb = { 8 } >
66- { line }
67- </ SpacedBox >
68- ) ) }
69- </ SmallerText >
70- }
71- >
72- < Icon name = "Info" color = "buttonSecondary" />
73- </ Tooltip >
74- ) }
68+ </ Box >
69+ { isShowQuantileChart && < QuantileHelpTooltip /> }
7570 </ PageSubtitle >
7671
7772 { url_grafana && (
0 commit comments