Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
This commit is contained in:
parent
8e759783e7
commit
6ea81a35fd
|
@ -91,7 +91,7 @@ export const getListHandler: RequestHandler = async (context, request, response)
|
|||
allDashboards[pkgSavedObject.id] = dashboards;
|
||||
return allDashboards;
|
||||
}, {});
|
||||
const allDashboardSavedObjects = await context.core.savedObjects.client.bulkGet<{
|
||||
const allDashboardSavedObjectsResponse = await context.core.savedObjects.client.bulkGet<{
|
||||
title?: string;
|
||||
}>(
|
||||
Object.values(dashboardIdsByPackageName).reduce<SavedObjectsBulkGetObject[]>(
|
||||
|
@ -107,8 +107,19 @@ export const getListHandler: RequestHandler = async (context, request, response)
|
|||
[]
|
||||
)
|
||||
);
|
||||
// Ignore dashboards not found
|
||||
const allDashboardSavedObjects = allDashboardSavedObjectsResponse.saved_objects.filter((so) => {
|
||||
if (so.error) {
|
||||
if (so.error.statusCode === 404) {
|
||||
return false;
|
||||
}
|
||||
throw so.error;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
const allDashboardSavedObjectsById = keyBy(
|
||||
allDashboardSavedObjects.saved_objects,
|
||||
allDashboardSavedObjects,
|
||||
(dashboardSavedObject) => dashboardSavedObject.id
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue