From 7be941d0ab1eb5530e1270763ef69c44657c3c42 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Thu, 30 May 2024 18:40:12 +0200 Subject: [PATCH] fixes bpa if never run --- .../tenant/standards/BestPracticeAnalyser.jsx | 198 ++++++++++-------- 1 file changed, 107 insertions(+), 91 deletions(-) diff --git a/src/views/tenant/standards/BestPracticeAnalyser.jsx b/src/views/tenant/standards/BestPracticeAnalyser.jsx index 10e7c480c29f..801cd1eb6838 100644 --- a/src/views/tenant/standards/BestPracticeAnalyser.jsx +++ b/src/views/tenant/standards/BestPracticeAnalyser.jsx @@ -346,99 +346,115 @@ const BestPracticeAnalyser = () => { refreshFunction={setRefreshValue} /> - {graphrequest.data.Columns.map((info, idx) => ( - - - - {info.name} - - - - {info.formatter === 'bool' && ( - - - {graphrequest.data.Data[0][info.value] ? 'Yes' : 'No'} - - )} - {info.formatter === 'reverseBool' && ( - - - {graphrequest.data.Data[0][info.value] ? 'No' : 'Yes'} - - )} - {info.formatter === 'warnBool' && ( - - - {graphrequest.data.Data[0][info.value] ? 'Yes' : 'No'} - - )} + {graphrequest.data?.Data[0] && + Object.keys(graphrequest.data.Data[0]).length === 0 ? ( + + + Best Practice Report + + + + No Data Found for this tenant. Please refresh the tenant data. + + + + ) : ( + graphrequest.data.Columns.map((info, idx) => ( + + + + {info.name} + + + + {info.formatter === 'bool' && ( + + + {graphrequest.data.Data[0][info.value] ? 'Yes' : 'No'} + + )} + {info.formatter === 'reverseBool' && ( + + + {graphrequest.data.Data[0][info.value] ? 'No' : 'Yes'} + + )} + {info.formatter === 'warnBool' && ( + + + {graphrequest.data.Data[0][info.value] ? 'Yes' : 'No'} + + )} - {info.formatter === 'table' && ( - <> - - - )} + {info.formatter === 'table' && ( + <> + + + )} - {info.formatter === 'number' && ( -

- {getNestedValue(graphrequest.data.Data[0], info.value)} -

- )} -
- - {info.desc} - -
-
-
- ))} + {info.formatter === 'number' && ( +

+ {getNestedValue(graphrequest.data.Data[0], info.value)} +

+ )} +
+ + {info.desc} + +
+
+
+ )) + )} )}