From d733daed9da723ce89f9fd6a0277f40b5ddaf651 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 15 Sep 2022 16:33:01 +0100 Subject: [PATCH] [WIFI-10857] Fixed display when there are no entries Signed-off-by: Charles --- .../StatisticsChartList.js | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/components/InterfaceStatistics/StatisticsChartList.js b/src/components/InterfaceStatistics/StatisticsChartList.js index a7a2533..beae98d 100644 --- a/src/components/InterfaceStatistics/StatisticsChartList.js +++ b/src/components/InterfaceStatistics/StatisticsChartList.js @@ -246,18 +246,33 @@ const StatisticsChartList = ({ deviceSerialNumber, setOptions, section, time }) setOptions([...sectionOptions, { value: 'memory', label: t('statistics.memory') }]); setStatOptions({ ...newOptions }); } - setError(false); + setError(undefined); } catch (e) { - setError(true); + if (data?.length === 0) { + setError('nodata'); + } else { + setError('error'); + } } }; const getInterface = useCallback(() => { - if (error) { + if (error === 'error') { return ( - - Error while parsing statistics - +
+ + Error while parsing statistics + +
+ ); + } + if (error === 'nodata') { + return ( +
+ + No available statistics during this time period + +
); } if (statOptions.interfaceList.length === 0) return

N/A

;