Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NP Cleanup] Remove ui/public/inspector #55677

Merged
merged 9 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ export { getRequestInspectorStats, getResponseInspectorStats } from '../../../da
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';
Expand Down Expand Up @@ -92,7 +90,6 @@ export {
SortDirection,
} from '../../../../../plugins/data/public';
export { ElasticSearchHit } from './np_ready/doc_views/doc_views_types';
export { Adapters } from 'ui/inspector/types';
export { registerTimefilterWithGlobalStateFactory } from 'ui/timefilter/setup_router';
export { FieldName } from 'ui/directives/field_name/field_name';
export { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -46,7 +47,6 @@ import {
hasSearchStategyForIndexPattern,
intervalOptions,
migrateLegacyQuery,
RequestAdapter,
showSaveModal,
unhashUrl,
stateMonitorFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '../../../../../../../plugins/inspector/public';
import {
esFilters,
TimeRange,
Expand All @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/ui/public/agg_types/agg_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { initParams } from './agg_params';

import { AggConfig } from '../vis';
import { AggConfigs } from './agg_configs';
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, fieldFormats, ISearchSource } from '../../../../plugins/data/public';
Expand Down
6 changes: 0 additions & 6 deletions src/legacy/ui/public/inspector/README.md

This file was deleted.

27 changes: 0 additions & 27 deletions src/legacy/ui/public/inspector/adapters/index.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/legacy/ui/public/inspector/index.ts

This file was deleted.

42 changes: 0 additions & 42 deletions src/legacy/ui/public/inspector/inspector.tsx

This file was deleted.

33 changes: 0 additions & 33 deletions src/legacy/ui/public/inspector/types.ts

This file was deleted.

27 changes: 0 additions & 27 deletions src/legacy/ui/public/inspector/ui/inspector_panel.tsx

This file was deleted.

27 changes: 0 additions & 27 deletions src/legacy/ui/public/inspector/ui/inspector_view_chooser.tsx

This file was deleted.

34 changes: 0 additions & 34 deletions src/legacy/ui/public/inspector/view_registry.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
}));
Expand Down
5 changes: 2 additions & 3 deletions x-pack/legacy/plugins/maps/public/angular/map_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ import {
getLayerListRaw,
} from '../selectors/map_selectors';
import { getInspectorAdapters } from '../reducers/non_serializable_instances';
import { Inspector } from 'ui/inspector';
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';
Expand Down Expand Up @@ -510,7 +509,7 @@ app.controller(
testId: 'openInspectorButton',
run() {
const inspectorAdapters = getInspectorAdapters(store.getState());
Inspector.open(inspectorAdapters, {});
getInspector().open(inspectorAdapters, {});
},
},
...(capabilities.get().maps.save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { MapView } from './map_view';
import { npSetup } from 'ui/new_platform';

import { viewRegistry } from 'ui/inspector';
// @ts-ignore
import { MapView } from './map_view';

viewRegistry.register(MapView);
npSetup.plugins.inspector.registerView(MapView);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to move it to plugin.ts but there was an issue (an empty plugin page) when the uiExport was specified as inspectorViews: ['plugins/maps/legacy']. So I left view registration in a separate file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably because that caused the maps plugin to be loaded twice. Definitely fine for the scope of this PR to leave it as is.

6 changes: 6 additions & 0 deletions x-pack/legacy/plugins/maps/public/kibana_services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions x-pack/legacy/plugins/maps/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
* These are the interfaces with your public contracts. You should export these
Expand Down Expand Up @@ -39,5 +39,7 @@ export class MapsPlugin implements Plugin<MapsPluginSetup, MapsPluginStart> {
}
}

public start(core: CoreStart, plugins: any) {}
public start(core: CoreStart, plugins: any) {
setInspector(plugins.np.inspector);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down