From d29df6d0cd4f21ebc270425bbed130fc8775503b Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Thu, 23 Jan 2020 13:32:27 +0300 Subject: [PATCH 1/6] Use src/plugins/inspector instead of ui/inspector --- .../core_plugins/kibana/public/discover/kibana_services.ts | 3 --- .../kibana/public/discover/np_ready/angular/discover.js | 2 +- .../public/discover/np_ready/embeddable/search_embeddable.ts | 3 +-- x-pack/legacy/plugins/maps/public/angular/map_controller.js | 2 +- .../plugins/maps/public/inspector/views/register_views.js | 2 +- .../plugins/maps/public/reducers/non_serializable_instances.js | 2 +- 6 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts b/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts index d2eefba2cecdd..889ffd8563fd4 100644 --- a/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts +++ b/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts @@ -71,8 +71,6 @@ export { export { intervalOptions } from 'ui/agg_types/buckets/_interval_options'; // @ts-ignore export { migrateLegacyQuery } from 'ui/utils/migrate_legacy_query'; -// @ts-ignore -export { RequestAdapter } from 'ui/inspector/adapters'; export { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_save_modal'; export { showSaveModal } from 'ui/saved_objects/show_saved_object_save_modal'; export { stateMonitorFactory } from 'ui/state_management/state_monitor_factory'; @@ -98,7 +96,6 @@ export { IFieldType, } from '../../../../../plugins/data/public'; export { ElasticSearchHit } from './np_ready/doc_views/doc_views_types'; -export { Adapters } from 'ui/inspector/types'; export { Chrome, IInjector } from 'ui/chrome'; export { registerTimefilterWithGlobalStateFactory } from 'ui/timefilter/setup_router'; export { FieldName } from 'ui/directives/field_name/field_name'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js index cde0b5d27bdc5..78a12d2c62247 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js @@ -25,6 +25,7 @@ import dateMath from '@elastic/datemath'; import { i18n } from '@kbn/i18n'; import '../components/field_chooser/field_chooser'; +import { RequestAdapter } from '../../../../../../../plugins/inspector/public'; // doc table import './doc_table'; import { getSort } from './doc_table/lib/get_sort'; @@ -46,7 +47,6 @@ import { intervalOptions, isDefaultTypeIndexPattern, migrateLegacyQuery, - RequestAdapter, showSaveModal, unhashUrl, stateMonitorFactory, diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts index 3aa8dea816694..5d4d41c61240c 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts @@ -21,6 +21,7 @@ import * as Rx from 'rxjs'; import { Subscription } from 'rxjs'; import { i18n } from '@kbn/i18n'; import { TExecuteTriggerActions } from 'src/plugins/ui_actions/public'; +import { RequestAdapter, Adapters } from 'src/plugins/inspector/public'; import { esFilters, TimeRange, @@ -43,13 +44,11 @@ import { ISearchEmbeddable, SearchInput, SearchOutput } from './types'; import { SortOrder } from '../angular/doc_table/components/table_header/helpers'; import { getSortForSearchSource } from '../angular/doc_table/lib/get_sort_for_search_source'; import { - Adapters, angular, getRequestInspectorStats, getResponseInspectorStats, getServices, IndexPattern, - RequestAdapter, ISearchSource, } from '../../kibana_services'; import { SEARCH_EMBEDDABLE_TYPE } from './constants'; diff --git a/x-pack/legacy/plugins/maps/public/angular/map_controller.js b/x-pack/legacy/plugins/maps/public/angular/map_controller.js index ece775f5a7e25..53b3e00ead86b 100644 --- a/x-pack/legacy/plugins/maps/public/angular/map_controller.js +++ b/x-pack/legacy/plugins/maps/public/angular/map_controller.js @@ -43,7 +43,7 @@ import { getLayerListRaw, } from '../selectors/map_selectors'; import { getInspectorAdapters } from '../reducers/non_serializable_instances'; -import { Inspector } from 'ui/inspector'; +import { Inspector } from '../../../../../../src/plugins/inspector/public'; import { docTitle } from 'ui/doc_title'; import { indexPatternService } from '../kibana_services'; import { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_save_modal'; diff --git a/x-pack/legacy/plugins/maps/public/inspector/views/register_views.js b/x-pack/legacy/plugins/maps/public/inspector/views/register_views.js index 6cca73f899cfd..80ce84fa5383b 100644 --- a/x-pack/legacy/plugins/maps/public/inspector/views/register_views.js +++ b/x-pack/legacy/plugins/maps/public/inspector/views/register_views.js @@ -6,6 +6,6 @@ import { MapView } from './map_view'; -import { viewRegistry } from 'ui/inspector'; +import { viewRegistry } from '../../../../../../../src/plugins/inspector/public'; viewRegistry.register(MapView); diff --git a/x-pack/legacy/plugins/maps/public/reducers/non_serializable_instances.js b/x-pack/legacy/plugins/maps/public/reducers/non_serializable_instances.js index 689212b8e5ff0..c7de2beff0cf6 100644 --- a/x-pack/legacy/plugins/maps/public/reducers/non_serializable_instances.js +++ b/x-pack/legacy/plugins/maps/public/reducers/non_serializable_instances.js @@ -5,7 +5,7 @@ */ import chrome from 'ui/chrome'; -import { RequestAdapter } from 'ui/inspector/adapters'; +import { RequestAdapter } from '../../../../../../src/plugins/inspector/public'; import { MapAdapter } from '../inspector/adapters/map_adapter'; const REGISTER_CANCEL_CALLBACK = 'REGISTER_CANCEL_CALLBACK'; From 1026ba78147edeba8048e9f9c7352e180e226445 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Thu, 23 Jan 2020 13:33:48 +0300 Subject: [PATCH 2/6] Remove unused ui/inspector --- src/legacy/ui/public/inspector/README.md | 6 --- .../ui/public/inspector/adapters/index.ts | 27 ------------ src/legacy/ui/public/inspector/index.ts | 22 ---------- src/legacy/ui/public/inspector/inspector.tsx | 42 ------------------- src/legacy/ui/public/inspector/types.ts | 33 --------------- .../public/inspector/ui/inspector_panel.tsx | 27 ------------ .../inspector/ui/inspector_view_chooser.tsx | 27 ------------ .../ui/public/inspector/view_registry.ts | 34 --------------- 8 files changed, 218 deletions(-) delete mode 100644 src/legacy/ui/public/inspector/README.md delete mode 100644 src/legacy/ui/public/inspector/adapters/index.ts delete mode 100644 src/legacy/ui/public/inspector/index.ts delete mode 100644 src/legacy/ui/public/inspector/inspector.tsx delete mode 100644 src/legacy/ui/public/inspector/types.ts delete mode 100644 src/legacy/ui/public/inspector/ui/inspector_panel.tsx delete mode 100644 src/legacy/ui/public/inspector/ui/inspector_view_chooser.tsx delete mode 100644 src/legacy/ui/public/inspector/view_registry.ts diff --git a/src/legacy/ui/public/inspector/README.md b/src/legacy/ui/public/inspector/README.md deleted file mode 100644 index c8133d0d9238d..0000000000000 --- a/src/legacy/ui/public/inspector/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Inspector - -- Inspector has been moved to `inspector` New Platform plugin. -- You can find its documentation in `src/plugins/inspector/README.md`. -- This folder will be deleted soon, it is deprecated, do not use anything from here. -- This folder is ready to be deleted, as soon as nothing imports from here anymore. diff --git a/src/legacy/ui/public/inspector/adapters/index.ts b/src/legacy/ui/public/inspector/adapters/index.ts deleted file mode 100644 index 55df5a33a178b..0000000000000 --- a/src/legacy/ui/public/inspector/adapters/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* eslint-disable */ - -/** - * Do not use this, use NP `inspector` plugin instead. - * - * @deprecated - */ -export * from '../../../../../plugins/inspector/public/adapters/index'; diff --git a/src/legacy/ui/public/inspector/index.ts b/src/legacy/ui/public/inspector/index.ts deleted file mode 100644 index db82508f36ada..0000000000000 --- a/src/legacy/ui/public/inspector/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { Inspector } from './inspector'; -export { viewRegistry } from './view_registry'; -export { Adapters } from './types'; diff --git a/src/legacy/ui/public/inspector/inspector.tsx b/src/legacy/ui/public/inspector/inspector.tsx deleted file mode 100644 index d65245c11cfe1..0000000000000 --- a/src/legacy/ui/public/inspector/inspector.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { npStart } from '../new_platform'; -export { InspectorSession } from '../../../../plugins/inspector/public'; - -/** - * @deprecated - * - * Do not use this, use New Platform `inspector` plugin instead. - */ -export const Inspector = { - /** - * @deprecated - * - * Do not use this, use New Platform `inspector` plugin instead. - */ - isAvailable: npStart.plugins.inspector.isAvailable, - - /** - * @deprecated - * - * Do not use this, use New Platform `inspector` plugin instead. - */ - open: npStart.plugins.inspector.open, -}; diff --git a/src/legacy/ui/public/inspector/types.ts b/src/legacy/ui/public/inspector/types.ts deleted file mode 100644 index 98f2cf487eb43..0000000000000 --- a/src/legacy/ui/public/inspector/types.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Do not import these types from here, instead import them from `inspector` plugin. - * - * ```ts - * import { InspectorViewDescription } from 'src/plugins/inspector/public'; - * ``` - * - * @deprecated - */ -export { - Adapters, - InspectorViewProps, - InspectorViewDescription, -} from '../../../../plugins/inspector/public'; diff --git a/src/legacy/ui/public/inspector/ui/inspector_panel.tsx b/src/legacy/ui/public/inspector/ui/inspector_panel.tsx deleted file mode 100644 index 92ed169bf15e8..0000000000000 --- a/src/legacy/ui/public/inspector/ui/inspector_panel.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* eslint-disable */ - -/** - * Do not use this, use NP `inspector` plugin instead. - * - * @deprecated - */ -export * from '../../../../../plugins/inspector/public/ui/inspector_panel'; diff --git a/src/legacy/ui/public/inspector/ui/inspector_view_chooser.tsx b/src/legacy/ui/public/inspector/ui/inspector_view_chooser.tsx deleted file mode 100644 index 017e5c91095f6..0000000000000 --- a/src/legacy/ui/public/inspector/ui/inspector_view_chooser.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* eslint-disable */ - -/** - * Do not use this, use NP `inspector` plugin instead. - * - * @deprecated - */ -export * from '../../../../../plugins/inspector/public/ui/inspector_view_chooser'; diff --git a/src/legacy/ui/public/inspector/view_registry.ts b/src/legacy/ui/public/inspector/view_registry.ts deleted file mode 100644 index 5958be66ca184..0000000000000 --- a/src/legacy/ui/public/inspector/view_registry.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { npSetup } from 'ui/new_platform'; -export { InspectorViewDescription } from './types'; - -/** - * Do not use this, instead use `inspector` plugin directly. - * - * ```ts - * import { npSetup } from 'ui/new_platform'; - * - * npSetup.plugins.inspector.registerView(view); - * ``` - * - * @deprecated - */ -export const viewRegistry = npSetup.plugins.inspector.__LEGACY.views; From 2673963253698f51d9dc51dd8eed0ca029cee460 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Thu, 23 Jan 2020 14:08:21 +0300 Subject: [PATCH 3/6] Use `inspector` plugin directly to register view --- .../discover/np_ready/embeddable/search_embeddable.ts | 2 +- x-pack/legacy/plugins/maps/index.js | 1 - .../maps/public/inspector/views/register_views.js | 11 ----------- x-pack/legacy/plugins/maps/public/plugin.ts | 3 +++ 4 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 x-pack/legacy/plugins/maps/public/inspector/views/register_views.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts index 5d4d41c61240c..d949d69e24433 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts @@ -21,7 +21,7 @@ import * as Rx from 'rxjs'; import { Subscription } from 'rxjs'; import { i18n } from '@kbn/i18n'; import { TExecuteTriggerActions } from 'src/plugins/ui_actions/public'; -import { RequestAdapter, Adapters } from 'src/plugins/inspector/public'; +import { RequestAdapter, Adapters } from '../../../../../../../plugins/inspector/public'; import { esFilters, TimeRange, diff --git a/x-pack/legacy/plugins/maps/index.js b/x-pack/legacy/plugins/maps/index.js index 4f679905fc352..9478db2945b34 100644 --- a/x-pack/legacy/plugins/maps/index.js +++ b/x-pack/legacy/plugins/maps/index.js @@ -53,7 +53,6 @@ export function maps(kibana) { }; }, embeddableFactories: ['plugins/maps/embeddable/map_embeddable_factory'], - inspectorViews: ['plugins/maps/inspector/views/register_views'], home: ['plugins/maps/register_feature'], styleSheetPaths: `${__dirname}/public/index.scss`, savedObjectSchemas: { diff --git a/x-pack/legacy/plugins/maps/public/inspector/views/register_views.js b/x-pack/legacy/plugins/maps/public/inspector/views/register_views.js deleted file mode 100644 index 80ce84fa5383b..0000000000000 --- a/x-pack/legacy/plugins/maps/public/inspector/views/register_views.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { MapView } from './map_view'; - -import { viewRegistry } from '../../../../../../../src/plugins/inspector/public'; - -viewRegistry.register(MapView); diff --git a/x-pack/legacy/plugins/maps/public/plugin.ts b/x-pack/legacy/plugins/maps/public/plugin.ts index 0df7109852486..6bc73d0cffee8 100644 --- a/x-pack/legacy/plugins/maps/public/plugin.ts +++ b/x-pack/legacy/plugins/maps/public/plugin.ts @@ -11,6 +11,7 @@ import { wrapInI18nContext } from 'ui/i18n'; import { MapListing } from './components/map_listing'; // @ts-ignore import { setLicenseId } from './kibana_services'; +import { MapView } from './inspector/views/map_view'; /** * These are the interfaces with your public contracts. You should export these @@ -37,6 +38,8 @@ export class MapsPlugin implements Plugin { if (licensing) { licensing.license$.subscribe(({ uid }: { uid: string }) => setLicenseId(uid)); } + + plugins.inspector.registerView(MapView); } public start(core: CoreStart, plugins: any) {} From 698b82978d0b5508f7e434c23d9edfac8cf78972 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Thu, 23 Jan 2020 17:10:43 +0300 Subject: [PATCH 4/6] Fix path --- src/legacy/ui/public/agg_types/agg_type.ts | 2 +- x-pack/legacy/plugins/maps/public/plugin.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/legacy/ui/public/agg_types/agg_type.ts b/src/legacy/ui/public/agg_types/agg_type.ts index 39be1983223bc..607bdddffb11a 100644 --- a/src/legacy/ui/public/agg_types/agg_type.ts +++ b/src/legacy/ui/public/agg_types/agg_type.ts @@ -25,7 +25,7 @@ import { initParams } from './agg_params'; import { AggConfig } from '../vis'; import { AggConfigs } from './agg_configs'; import { ISearchSource } from '../courier'; -import { Adapters } from '../inspector'; +import { Adapters } from '../../../../plugins/inspector/public'; import { BaseParamType } from './param_types/base'; import { AggParamType } from '../agg_types/param_types/agg'; import { KBN_FIELD_TYPES, FieldFormat } from '../../../../plugins/data/public'; diff --git a/x-pack/legacy/plugins/maps/public/plugin.ts b/x-pack/legacy/plugins/maps/public/plugin.ts index 6bc73d0cffee8..0440d9ddc8a06 100644 --- a/x-pack/legacy/plugins/maps/public/plugin.ts +++ b/x-pack/legacy/plugins/maps/public/plugin.ts @@ -11,6 +11,7 @@ import { wrapInI18nContext } from 'ui/i18n'; import { MapListing } from './components/map_listing'; // @ts-ignore import { setLicenseId } from './kibana_services'; +// @ts-ignore import { MapView } from './inspector/views/map_view'; /** @@ -26,7 +27,7 @@ export class MapsPlugin implements Plugin { public setup(core: any, plugins: any) { const { __LEGACY: { uiModules }, - np: { licensing }, + np: { licensing, inspector }, } = plugins; uiModules @@ -39,7 +40,7 @@ export class MapsPlugin implements Plugin { licensing.license$.subscribe(({ uid }: { uid: string }) => setLicenseId(uid)); } - plugins.inspector.registerView(MapView); + inspector.registerView(MapView); } public start(core: CoreStart, plugins: any) {} From 03f672c35e57c5036883d4218191d4559a5b508b Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Thu, 23 Jan 2020 18:31:38 +0300 Subject: [PATCH 5/6] Use inspector from NP --- .../editor_frame_plugin/embeddable/embeddable.test.tsx | 2 +- x-pack/legacy/plugins/maps/public/angular/map_controller.js | 5 ++--- x-pack/legacy/plugins/maps/public/kibana_services.js | 6 ++++++ x-pack/legacy/plugins/maps/public/plugin.ts | 6 ++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable.test.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable.test.tsx index bc61c6ae34ce5..1f0620c43f7f7 100644 --- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable.test.tsx +++ b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable.test.tsx @@ -9,7 +9,7 @@ import { ExpressionRendererProps } from 'src/plugins/expressions/public'; import { Query, TimeRange, esFilters } from 'src/plugins/data/public'; import { Document } from '../../persistence'; -jest.mock('../../../../../../../src/legacy/ui/public/inspector', () => ({ +jest.mock('../../../../../../../src/plugins/inspector/public/', () => ({ isAvailable: false, open: false, })); diff --git a/x-pack/legacy/plugins/maps/public/angular/map_controller.js b/x-pack/legacy/plugins/maps/public/angular/map_controller.js index 53b3e00ead86b..5f058e2ba7806 100644 --- a/x-pack/legacy/plugins/maps/public/angular/map_controller.js +++ b/x-pack/legacy/plugins/maps/public/angular/map_controller.js @@ -43,9 +43,8 @@ import { getLayerListRaw, } from '../selectors/map_selectors'; import { getInspectorAdapters } from '../reducers/non_serializable_instances'; -import { Inspector } from '../../../../../../src/plugins/inspector/public'; import { docTitle } from 'ui/doc_title'; -import { indexPatternService } from '../kibana_services'; +import { indexPatternService, getInspector } from '../kibana_services'; import { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_save_modal'; import { showSaveModal } from 'ui/saved_objects/show_saved_object_save_modal'; import { toastNotifications } from 'ui/notify'; @@ -510,7 +509,7 @@ app.controller( testId: 'openInspectorButton', run() { const inspectorAdapters = getInspectorAdapters(store.getState()); - Inspector.open(inspectorAdapters, {}); + getInspector().open(inspectorAdapters, {}); }, }, ...(capabilities.get().maps.save diff --git a/x-pack/legacy/plugins/maps/public/kibana_services.js b/x-pack/legacy/plugins/maps/public/kibana_services.js index 1ec7565df6f26..d7fb78dd791ff 100644 --- a/x-pack/legacy/plugins/maps/public/kibana_services.js +++ b/x-pack/legacy/plugins/maps/public/kibana_services.js @@ -21,6 +21,12 @@ export const getLicenseId = () => { return licenseId; }; +let inspector; +export const setInspector = newInspector => (inspector = newInspector); +export const getInspector = () => { + return inspector; +}; + export async function fetchSearchSourceAndRecordWithInspector({ searchSource, requestId, diff --git a/x-pack/legacy/plugins/maps/public/plugin.ts b/x-pack/legacy/plugins/maps/public/plugin.ts index 0440d9ddc8a06..c5e359ad263d5 100644 --- a/x-pack/legacy/plugins/maps/public/plugin.ts +++ b/x-pack/legacy/plugins/maps/public/plugin.ts @@ -10,7 +10,7 @@ import { wrapInI18nContext } from 'ui/i18n'; // @ts-ignore import { MapListing } from './components/map_listing'; // @ts-ignore -import { setLicenseId } from './kibana_services'; +import { setLicenseId, setInspector } from './kibana_services'; // @ts-ignore import { MapView } from './inspector/views/map_view'; @@ -43,5 +43,7 @@ export class MapsPlugin implements Plugin { inspector.registerView(MapView); } - public start(core: CoreStart, plugins: any) {} + public start(core: CoreStart, plugins: any) { + setInspector(plugins.np.inspector); + } } From 93ddaf16263a0a2c87729d8de0694f8caf43d282 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Mon, 27 Jan 2020 18:54:11 +0300 Subject: [PATCH 6/6] Revert view registration to a separate file --- x-pack/legacy/plugins/maps/index.js | 1 + .../maps/public/inspector/views/register_views.ts | 12 ++++++++++++ x-pack/legacy/plugins/maps/public/plugin.ts | 6 +----- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 x-pack/legacy/plugins/maps/public/inspector/views/register_views.ts diff --git a/x-pack/legacy/plugins/maps/index.js b/x-pack/legacy/plugins/maps/index.js index 9478db2945b34..4f679905fc352 100644 --- a/x-pack/legacy/plugins/maps/index.js +++ b/x-pack/legacy/plugins/maps/index.js @@ -53,6 +53,7 @@ export function maps(kibana) { }; }, embeddableFactories: ['plugins/maps/embeddable/map_embeddable_factory'], + inspectorViews: ['plugins/maps/inspector/views/register_views'], home: ['plugins/maps/register_feature'], styleSheetPaths: `${__dirname}/public/index.scss`, savedObjectSchemas: { diff --git a/x-pack/legacy/plugins/maps/public/inspector/views/register_views.ts b/x-pack/legacy/plugins/maps/public/inspector/views/register_views.ts new file mode 100644 index 0000000000000..59c0595668300 --- /dev/null +++ b/x-pack/legacy/plugins/maps/public/inspector/views/register_views.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { npSetup } from 'ui/new_platform'; + +// @ts-ignore +import { MapView } from './map_view'; + +npSetup.plugins.inspector.registerView(MapView); diff --git a/x-pack/legacy/plugins/maps/public/plugin.ts b/x-pack/legacy/plugins/maps/public/plugin.ts index c5e359ad263d5..e5f765a11d219 100644 --- a/x-pack/legacy/plugins/maps/public/plugin.ts +++ b/x-pack/legacy/plugins/maps/public/plugin.ts @@ -11,8 +11,6 @@ import { wrapInI18nContext } from 'ui/i18n'; import { MapListing } from './components/map_listing'; // @ts-ignore import { setLicenseId, setInspector } from './kibana_services'; -// @ts-ignore -import { MapView } from './inspector/views/map_view'; /** * These are the interfaces with your public contracts. You should export these @@ -27,7 +25,7 @@ export class MapsPlugin implements Plugin { public setup(core: any, plugins: any) { const { __LEGACY: { uiModules }, - np: { licensing, inspector }, + np: { licensing }, } = plugins; uiModules @@ -39,8 +37,6 @@ export class MapsPlugin implements Plugin { if (licensing) { licensing.license$.subscribe(({ uid }: { uid: string }) => setLicenseId(uid)); } - - inspector.registerView(MapView); } public start(core: CoreStart, plugins: any) {