Skip to content

Commit

Permalink
Prevents canceling index pattern modal from throwing error (#13488)
Browse files Browse the repository at this point in the history
* Prevents canceling modal from throwing error

Fixes #12818

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>

* Prevents refresh and removes returned promise

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
  • Loading branch information
tylersmalley authored and Tyler Smalley committed Aug 15, 2017
1 parent ab66d4a commit f08a511
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/ui/public/index_patterns/_index_pattern.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import { SavedObjectNotFound, DuplicateField, IndexPatternAlreadyExists, IndexPatternMissingIndices } from 'ui/errors';
import { SavedObjectNotFound, DuplicateField, IndexPatternMissingIndices } from 'ui/errors';
import angular from 'angular';
import { RegistryFieldFormatsProvider } from 'ui/registry/field_formats';
import UtilsMappingSetupProvider from 'ui/utils/mapping_setup';
Expand Down Expand Up @@ -368,18 +368,17 @@ export function IndexPatternProvider(Private, $http, config, kbnIndex, Promise,

return confirmModalPromise(confirmMessage, { confirmButtonText: 'Edit existing pattern' })
.then(() => {
kbnUrl.change('/management/kibana/indices/{{id}}', { id: duplicate.id });
kbnUrl.redirect('/management/kibana/indices/{{id}}', { id: duplicate.id });
return true;
}).catch(() => {
return true;
})
.catch(() => {
throw new IndexPatternAlreadyExists(this.title);
});
});
}

create() {
return this.warnIfDuplicateTitle().then((duplicate) => {
if (duplicate) return;
return this.warnIfDuplicateTitle().then((isDuplicate) => {
if (isDuplicate) return;

const body = this.prepBody();

Expand Down

0 comments on commit f08a511

Please sign in to comment.