Show warning when importing a missing type (#10521)

* show warning when importing a missing type

* remove template string concatenation
This commit is contained in:
Joe Fleming 2017-02-23 10:36:03 -07:00 committed by Joe Fleming
parent 103a5bf8ef
commit 40a8d0142c

View file

@ -134,7 +134,19 @@ uiModules.get('apps/management')
}
return Promise.map(docs, function (doc) {
const service = find($scope.services, {type: doc._type}).service;
const { service } = find($scope.services, { type: doc._type }) || {};
if (!service) {
const msg = `Skipped import of "${doc._source.title}" (${doc._id})`;
const reason = `Invalid type: "${doc._type}"`;
notify.warning(`${msg}, ${reason}`, {
lifetime: 0,
});
return;
}
return service.get().then(function (obj) {
obj.id = doc._id;
return obj.applyESResp(doc).then(function () {
@ -143,7 +155,8 @@ uiModules.get('apps/management')
});
})
.then(refreshIndex)
.then(refreshData, notify.error);
.then(refreshData)
.catch(notify.error);
};
function refreshIndex() {