|
1 | | -import { spacing, Text, TextBadge } from '@scality/core-ui'; |
| 1 | +import { Banner, Icon, spacing, Text, TextBadge } from '@scality/core-ui'; |
2 | 2 | import { Box } from '@scality/core-ui/dist/next'; |
3 | 3 | import { useMemo } from 'react'; |
4 | 4 | import { useIntl } from 'react-intl'; |
@@ -61,25 +61,45 @@ const DashboardAlerts = () => { |
61 | 61 | const totalAlerts = criticalAlerts.length + warningAlerts.length; |
62 | 62 | return ( |
63 | 63 | <AlertsContainer> |
64 | | - <div> |
65 | | - <Text isEmphazed> |
66 | | - {intl.formatMessage({ |
67 | | - id: 'platform_active_alerts', |
68 | | - })} |
69 | | - </Text> |
70 | | - <TextBadge |
71 | | - variant="infoPrimary" |
72 | | - data-testid="all-alert-badge" |
73 | | - text={totalAlerts} |
74 | | - /> |
| 64 | + <div style={{ display: 'flex', alignItems: 'center', gap: spacing.r8 }}> |
| 65 | + <div> |
| 66 | + <Text isEmphazed> |
| 67 | + {intl.formatMessage({ |
| 68 | + id: 'platform_active_alerts', |
| 69 | + })} |
| 70 | + </Text> |
| 71 | + <TextBadge |
| 72 | + variant="infoPrimary" |
| 73 | + data-testid="all-alert-badge" |
| 74 | + text={totalAlerts} |
| 75 | + /> |
| 76 | + {totalAlerts === 0 && ( |
| 77 | + <div> |
| 78 | + <Text variant="Smaller" color="textSecondary"> |
| 79 | + {intl.formatMessage({ |
| 80 | + id: 'no_active_alerts', |
| 81 | + })} |
| 82 | + </Text> |
| 83 | + </div> |
| 84 | + )} |
| 85 | + </div> |
| 86 | + {alerts.error && ( |
| 87 | + <div style={{ flex: 1 }}> |
| 88 | + <Banner |
| 89 | + variant="warning" |
| 90 | + icon={<Icon name="Exclamation-circle" />} |
| 91 | + title={intl.formatMessage({ |
| 92 | + id: 'monitoring_information_unavailable', |
| 93 | + })} |
| 94 | + > |
| 95 | + {intl.formatMessage({ |
| 96 | + id: 'some_data_not_retrieved', |
| 97 | + })} |
| 98 | + </Banner> |
| 99 | + </div> |
| 100 | + )} |
75 | 101 | </div> |
76 | | - {totalAlerts === 0 ? ( |
77 | | - <Text variant="Smaller" color="textSecondary"> |
78 | | - {intl.formatMessage({ |
79 | | - id: 'no_active_alerts', |
80 | | - })} |
81 | | - </Text> |
82 | | - ) : ( |
| 102 | + {totalAlerts === 0 ? null : ( |
83 | 103 | <Box pr={24}> |
84 | 104 | <BadgesContainer> |
85 | 105 | <div> |
|
0 commit comments