Skip to content

Commit

Permalink
Fix warning when there is no data in the vulnerability tab
Browse files Browse the repository at this point in the history
  • Loading branch information
jbiset committed Dec 15, 2023
1 parent 7095400 commit a43b514
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const useCheckIndexFields = (

checkIndexFields();
}
}, [indexPatternId]);
}, [indexPatternId, query]);

return {
isError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const DashboardVulsComponent: React.FC = () => {
<>
<I18nProvider>
<>
<h1>{resultIndexData?.hits?.total}</h1>
{isLoading || isLoadingSearchbar ? <LoadingSpinner /> : null}
{!isLoading && !isLoadingSearchbar ? (
<SearchBar
Expand All @@ -62,10 +63,16 @@ const DashboardVulsComponent: React.FC = () => {
) : null}
{!isLoadingSearchbar &&
!isLoading &&
(isError || resultIndexData?.hits?.total === 0) ? (
(isError ||
!resultIndexData?.hits?.total ||
resultIndexData?.hits?.total === 0) ? (
<DiscoverNoResults message={error?.message} />
) : null}
{!isLoadingSearchbar && !isLoading && isSuccess ? (
{!isLoadingSearchbar &&
!isLoading &&
isSuccess &&
resultIndexData?.hits?.total &&
resultIndexData?.hits?.total > 0 ? (
<>
<div className='vulnerability-dashboard-filters-wrapper'>
<DashboardByRenderer
Expand Down

0 comments on commit a43b514

Please sign in to comment.