Skip to content

Commit 45201b8

Browse files
committed
MK8S-197 - Add banner in case of failed to retrieve alerts
1 parent 0dc64c6 commit 45201b8

File tree

1 file changed

+39
-19
lines changed

1 file changed

+39
-19
lines changed

ui/src/components/DashboardAlerts.tsx

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { spacing, Text, TextBadge } from '@scality/core-ui';
1+
import { Banner, Icon, spacing, Text, TextBadge } from '@scality/core-ui';
22
import { Box } from '@scality/core-ui/dist/next';
33
import { useMemo } from 'react';
44
import { useIntl } from 'react-intl';
@@ -61,25 +61,45 @@ const DashboardAlerts = () => {
6161
const totalAlerts = criticalAlerts.length + warningAlerts.length;
6262
return (
6363
<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+
)}
75101
</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 : (
83103
<Box pr={24}>
84104
<BadgesContainer>
85105
<div>

0 commit comments

Comments
 (0)