mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Fix import UI to not fail silently when a record other than index-pattern and search is missing (#33080) (#34442)
* Fix import UI to not fail silently when a record other than index-pattern and search is missing * Reduce code for error handler
This commit is contained in:
parent
b7ce1cf8b1
commit
405fbd3142
1 changed files with 6 additions and 11 deletions
|
@ -236,17 +236,12 @@ export async function resolveSavedObjects(savedObjects, overwriteAll, services,
|
|||
importedObjectCount++;
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof SavedObjectNotFound) {
|
||||
if (error.savedObjectType === 'search') {
|
||||
failedImports.push({ obj, error });
|
||||
}
|
||||
if (error.savedObjectType === 'index-pattern') {
|
||||
if (obj.savedSearchId) {
|
||||
conflictedSavedObjectsLinkedToSavedSearches.push(obj);
|
||||
} else {
|
||||
conflictedIndexPatterns.push({ obj, doc: otherDoc });
|
||||
}
|
||||
}
|
||||
const isIndexPatternNotFound = error instanceof SavedObjectNotFound &&
|
||||
error.savedObjectType === 'index-pattern';
|
||||
if (isIndexPatternNotFound && obj.savedSearchId) {
|
||||
conflictedSavedObjectsLinkedToSavedSearches.push(obj);
|
||||
} else if (isIndexPatternNotFound) {
|
||||
conflictedIndexPatterns.push({ obj, doc: otherDoc });
|
||||
} else {
|
||||
failedImports.push({ obj, error });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue