mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* Refines hasAnyData check for alerts * Fixes type refinements * Applies review feedback * Naming is hard Co-authored-by: Claudio Procida <claudio.procida@gmail.com>
This commit is contained in:
parent
f4be80ff06
commit
6cafc358bd
2 changed files with 7 additions and 4 deletions
|
@ -556,7 +556,7 @@ describe('HasDataContextProvider', () => {
|
|||
status: 'success',
|
||||
},
|
||||
},
|
||||
hasAnyData: false,
|
||||
hasAnyData: true,
|
||||
isAllRequestsComplete: true,
|
||||
forceUpdate: expect.any(String),
|
||||
onRefreshTimeRange: expect.any(Function),
|
||||
|
|
|
@ -146,9 +146,12 @@ export function HasDataContextProvider({ children }: { children: React.ReactNode
|
|||
return appStatus !== undefined && appStatus !== FETCH_STATUS.LOADING;
|
||||
});
|
||||
|
||||
const hasAnyData = (Object.keys(hasDataMap) as ObservabilityFetchDataPlugins[]).some(
|
||||
(app) => hasDataMap[app]?.hasData === true
|
||||
);
|
||||
const hasAnyData = (Object.keys(hasDataMap) as ObservabilityFetchDataPlugins[]).some((app) => {
|
||||
const appHasData = hasDataMap[app]?.hasData;
|
||||
return (
|
||||
appHasData === true || (Array.isArray(appHasData) && (appHasData as Alert[])?.length > 0)
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<HasDataContext.Provider
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue