From 849a7eb2ba7a43735b6e77de57aff618122fc098 Mon Sep 17 00:00:00 2001 From: YanJin Date: Tue, 20 Apr 2021 17:22:22 +0200 Subject: [PATCH] ui: Fix the bug cause by the empty alertlist --- ui/src/containers/NodePageRSP.js | 4 ++-- ui/src/containers/VolumePageContent.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/containers/NodePageRSP.js b/ui/src/containers/NodePageRSP.js index 4bce87c28e..2c504ba7aa 100644 --- a/ui/src/containers/NodePageRSP.js +++ b/ui/src/containers/NodePageRSP.js @@ -126,7 +126,7 @@ const NodePageRSP = (props) => { instance: `${instanceIP}:${PORT_NODE_EXPORTER}`, }); - const alertsNode = alertList && alertList.alerts || []; + const alertsNode = (alertList && alertList.alerts) || []; const isHealthTabActive = location.pathname.endsWith('/overview'); const isAlertsTabActive = location.pathname.endsWith('/alerts'); @@ -151,7 +151,7 @@ const NodePageRSP = (props) => { title: ( {intl.translate('alerts')} - {alertsNode.length ? ( + {alertsNode && alertsNode.length ? ( {alertsNode.length} ) : null} diff --git a/ui/src/containers/VolumePageContent.js b/ui/src/containers/VolumePageContent.js index 978a98dca0..8d92e0b80c 100644 --- a/ui/src/containers/VolumePageContent.js +++ b/ui/src/containers/VolumePageContent.js @@ -176,7 +176,7 @@ const VolumePageContent = (props) => { title: ( {intl.translate('alerts')} - {alertlist.length ? ( + {alertlist && alertlist.length ? ( {alertlist.length} ) : null}