Skip to content

Commit

Permalink
Merge branch 'newplatform/data-plugin/ip-cleanup-service' into newpla…
Browse files Browse the repository at this point in the history
…tform/data-plugin/move-action
  • Loading branch information
Liza K committed Dec 4, 2019
2 parents 899cd88 + acbf9cf commit cc3839b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

import { SavedObjectNotFound } from '../../../../../../../../plugins/kibana_utils/public';
import { i18n } from '@kbn/i18n';

async function getSavedObject(doc, services) {
Expand Down Expand Up @@ -255,7 +254,8 @@ export async function resolveSavedObjects(savedObjects, overwriteAll, services,
importedObjectCount++;
}
} catch (error) {
if (error instanceof SavedObjectNotFound) {

if (error.constructor.name === 'SavedObjectNotFound') {
if (error.savedObjectType === 'index-pattern') {
conflictedIndexPatterns.push({ obj, doc: searchDoc });
} else {
Expand All @@ -275,7 +275,7 @@ export async function resolveSavedObjects(savedObjects, overwriteAll, services,
importedObjectCount++;
}
} catch (error) {
const isIndexPatternNotFound = error instanceof SavedObjectNotFound &&
const isIndexPatternNotFound = error.constructor.name === 'SavedObjectNotFound' &&
error.savedObjectType === 'index-pattern';
if (isIndexPatternNotFound && obj.savedSearchId) {
conflictedSavedObjectsLinkedToSavedSearches.push(obj);
Expand Down
11 changes: 8 additions & 3 deletions src/test_utils/public/stub_index_pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,23 @@ import sinon from 'sinon';
// TODO: We should not be importing from the data plugin directly here; this is only necessary
// because it is one of the few places that we need to access the IndexPattern class itself, rather
// than just the type. Doing this as a temporary measure; it will be left behind when migrating to NP.

import {
FieldList,
} from 'ui/index_patterns';
import {
FIELD_FORMAT_IDS,
IndexPattern,
indexPatterns,
} from '../../plugins/data/public';

import { setFieldFormats } from '../../plugins/data/public/services';

setFieldFormats({
getDefaultInstance: () => {},
});

import { getFieldFormatsRegistry } from './stub_field_formats';

export default function StubIndexPattern(pattern, getConfig, timeField, fields, uiSettings) {
export default function StubIndexPattern(pattern, getConfig, timeField, fields, uiSettings) {
const registeredFieldFormats = getFieldFormatsRegistry(uiSettings);

this.id = pattern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import routes from 'ui/routes';
import { capabilities } from 'ui/capabilities';
import { kfetch } from 'ui/kfetch';
import { fatalError, toastNotifications } from 'ui/notify';
import { npStart } from 'ui/new_platform';
import template from 'plugins/security/views/management/edit_role/edit_role.html';
import 'plugins/security/services/shield_user';
import 'plugins/security/services/shield_role';
import 'plugins/security/services/shield_indices';
import { start as data } from '../../../../../../../../src/legacy/core_plugins/data/public/legacy';
import { xpackInfo } from 'plugins/xpack_main/services/xpack_info';
import { SpacesManager } from '../../../../../spaces/public/lib';
import { ROLES_PATH, CLONE_ROLES_PATH, EDIT_ROLES_PATH } from '../management_urls';
Expand Down Expand Up @@ -75,8 +75,7 @@ const routeDefinition = (action) => ({
.then(users => _.map(users, 'username'));
},
indexPatterns() {
const { indexPatterns } = data.indexPatterns;
return indexPatterns.getTitles();
return npStart.plugins.data.indexPatterns.getTitles();
},
spaces(spacesEnabled) {
if (spacesEnabled) {
Expand Down

0 comments on commit cc3839b

Please sign in to comment.