From f08a511d4b74ecd082a91c4d073f71ebf930394d Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Tue, 15 Aug 2017 07:37:32 -0700 Subject: [PATCH] Prevents canceling index pattern modal from throwing error (#13488) * Prevents canceling modal from throwing error Fixes #12818 Signed-off-by: Tyler Smalley * Prevents refresh and removes returned promise Signed-off-by: Tyler Smalley --- src/ui/public/index_patterns/_index_pattern.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ui/public/index_patterns/_index_pattern.js b/src/ui/public/index_patterns/_index_pattern.js index 0b75052b22ea4..7882b9532bb2f 100644 --- a/src/ui/public/index_patterns/_index_pattern.js +++ b/src/ui/public/index_patterns/_index_pattern.js @@ -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'; @@ -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();