Skip to content

Commit 5c1c094

Browse files
author
Aaron Caldwell
authored
[7.x] [Maps] Move layers to np maps (#61877) (#62697)
* Move layers to new location * Update layer path refs * Update np kibana services to cover all required services * Init np kibana services in legacy plugin. Port init functions to np * Path updates, supporting file moves, general clean up * More moves of related files and clean-up of legacy refs * Path updates. Typescript warning fixes * Update test paths * Clean up unused kibana services usage in legacy * Remove unused http ref * Test fixes and clean up * Remove unused snapshots * Add np service init to embeddables too * Move validate color picker to NP
1 parent 8c6f0c2 commit 5c1c094

File tree

261 files changed

+417
-318
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+417
-318
lines changed

x-pack/legacy/plugins/maps/public/actions/map_actions.d.ts

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,4 @@
55
*/
66
/* eslint-disable @typescript-eslint/consistent-type-definitions */
77

8-
import { Filter, Query, TimeRange } from 'src/plugins/data/public';
9-
import { AnyAction } from 'redux';
10-
import { LAYER_TYPE } from '../../common/constants';
11-
import { DataMeta, MapFilters } from '../../common/descriptor_types';
12-
import {
13-
MapCenterAndZoom,
14-
MapRefreshConfig,
15-
} from '../../../../../plugins/maps/common/descriptor_types';
16-
17-
export type SyncContext = {
18-
startLoading(dataId: string, requestToken: symbol, meta: DataMeta): void;
19-
stopLoading(dataId: string, requestToken: symbol, data: unknown, meta: DataMeta): void;
20-
onLoadError(dataId: string, requestToken: symbol, errorMessage: string): void;
21-
updateSourceData(newData: unknown): void;
22-
isRequestStillActive(dataId: string, requestToken: symbol): boolean;
23-
registerCancelCallback(requestToken: symbol, callback: () => void): void;
24-
dataFilters: MapFilters;
25-
};
26-
27-
export function updateSourceProp(
28-
layerId: string,
29-
propName: string,
30-
value: unknown,
31-
newLayerType?: LAYER_TYPE
32-
): void;
33-
34-
export function setGotoWithCenter(config: MapCenterAndZoom): AnyAction;
35-
36-
export function replaceLayerList(layerList: unknown[]): AnyAction;
37-
38-
export type QueryGroup = {
39-
filters: Filter[];
40-
query?: Query;
41-
timeFilters?: TimeRange;
42-
refresh?: boolean;
43-
};
44-
45-
export function setQuery(query: QueryGroup): AnyAction;
46-
47-
export function setRefreshConfig(config: MapRefreshConfig): AnyAction;
48-
49-
export function disableScrollZoom(): AnyAction;
50-
51-
export function disableInteractive(): AnyAction;
52-
53-
export function disableTooltipControl(): AnyAction;
54-
55-
export function hideToolbarOverlay(): AnyAction;
56-
57-
export function hideLayerControl(): AnyAction;
58-
59-
export function hideViewControl(): AnyAction;
60-
61-
export function setHiddenLayers(hiddenLayerIds: string[]): AnyAction;
62-
63-
export function addLayerWithoutDataSync(layerDescriptor: unknown): AnyAction;
8+
export * from '../../../../../plugins/maps/public/actions/map_actions';

x-pack/legacy/plugins/maps/public/angular/get_initial_layers.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import _ from 'lodash';
7-
import { KibanaTilemapSource } from '../layers/sources/kibana_tilemap_source';
8-
import { EMSTMSSource } from '../layers/sources/ems_tms_source';
7+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
8+
import { KibanaTilemapSource } from '../../../../../plugins/maps/public/layers/sources/kibana_tilemap_source';
9+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
10+
import { EMSTMSSource } from '../../../../../plugins/maps/public/layers/sources/ems_tms_source';
911
import { getInjectedVarFunc } from '../kibana_services';
10-
import { getKibanaTileMap } from '../meta';
12+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
13+
import { getKibanaTileMap } from '../../../../../plugins/maps/public/meta';
1114

1215
export function getInitialLayers(layerListJSON, initialLayers = []) {
1316
if (layerListJSON) {

x-pack/legacy/plugins/maps/public/angular/get_initial_layers.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
jest.mock('../meta', () => {
7+
jest.mock('../../../../../plugins/maps/public/meta', () => {
88
return {};
99
});
1010
jest.mock('../kibana_services');
@@ -32,7 +32,7 @@ describe('Saved object has layer list', () => {
3232

3333
describe('kibana.yml configured with map.tilemap.url', () => {
3434
beforeAll(() => {
35-
require('../meta').getKibanaTileMap = () => {
35+
require('../../../../../plugins/maps/public/meta').getKibanaTileMap = () => {
3636
return {
3737
url: 'myTileUrl',
3838
};
@@ -62,7 +62,7 @@ describe('kibana.yml configured with map.tilemap.url', () => {
6262

6363
describe('EMS is enabled', () => {
6464
beforeAll(() => {
65-
require('../meta').getKibanaTileMap = () => {
65+
require('../../../../../plugins/maps/public/meta').getKibanaTileMap = () => {
6666
return null;
6767
};
6868
require('../kibana_services').getInjectedVarFunc = () => key => {
@@ -106,7 +106,7 @@ describe('EMS is enabled', () => {
106106

107107
describe('EMS is not enabled', () => {
108108
beforeAll(() => {
109-
require('../meta').getKibanaTileMap = () => {
109+
require('../../../../../plugins/maps/public/meta').getKibanaTileMap = () => {
110110
return null;
111111
};
112112

x-pack/legacy/plugins/maps/public/angular/services/saved_gis_map.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import {
1717
getFilters,
1818
} from '../../selectors/map_selectors';
1919
import { getIsLayerTOCOpen, getOpenTOCDetails } from '../../selectors/ui_selectors';
20-
import { convertMapExtentToPolygon } from '../../elasticsearch_geo_utils';
20+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
21+
import { convertMapExtentToPolygon } from '../../../../../../plugins/maps/public/elasticsearch_geo_utils';
2122
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
2223
import { copyPersistentState } from '../../../../../../plugins/maps/public/reducers/util';
2324
import { extractReferences, injectReferences } from '../../../common/migrations/references';

x-pack/legacy/plugins/maps/public/connected_components/gis_map/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
import React from 'react';
88
import { Filter } from 'src/plugins/data/public';
9-
import { RenderToolTipContent } from '../../layers/tooltips/tooltip_property';
9+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
10+
import { RenderToolTipContent } from '../../../../../../plugins/maps/public/layers/tooltips/tooltip_property';
1011

1112
export const GisMap: React.ComponentType<{
1213
addFilters: ((filters: Filter[]) => void) | null;

x-pack/legacy/plugins/maps/public/connected_components/gis_map/view.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { LayerPanel } from '../layer_panel/index';
1313
import { AddLayerPanel } from '../layer_addpanel/index';
1414
import { EuiFlexGroup, EuiFlexItem, EuiCallOut } from '@elastic/eui';
1515
import { ExitFullScreenButton } from 'ui/exit_full_screen';
16-
import { getIndexPatternsFromIds } from '../../index_pattern_util';
16+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
17+
import { getIndexPatternsFromIds } from '../../../../../../plugins/maps/public/index_pattern_util';
1718
import { ES_GEO_FIELD_TYPE } from '../../../common/constants';
1819
import { indexPatterns as indexPatternsUtils } from '../../../../../../../src/plugins/data/public';
1920
import { i18n } from '@kbn/i18n';

x-pack/legacy/plugins/maps/public/connected_components/layer_addpanel/import_editor/view.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import React, { Fragment } from 'react';
88
import { EuiSpacer, EuiPanel, EuiButtonEmpty } from '@elastic/eui';
99
import { FormattedMessage } from '@kbn/i18n/react';
10-
import { uploadLayerWizardConfig } from '../../../layers/sources/client_file_source';
10+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
11+
import { uploadLayerWizardConfig } from '../../../../../../../plugins/maps/public/layers/sources/client_file_source';
1112

1213
export const ImportEditor = ({ clearSource, isIndexingTriggered, ...props }) => {
1314
const editorProperties = getEditorProperties({ isIndexingTriggered, ...props });

x-pack/legacy/plugins/maps/public/connected_components/layer_addpanel/source_select/source_select.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
*/
66

77
import React, { Fragment } from 'react';
8-
import { getLayerWizards } from '../../../layers/layer_wizard_registry';
8+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
9+
import { getLayerWizards } from '../../../../../../../plugins/maps/public/layers/layer_wizard_registry';
910
import { EuiTitle, EuiSpacer, EuiCard, EuiIcon } from '@elastic/eui';
1011
import { FormattedMessage } from '@kbn/i18n/react';
1112
import _ from 'lodash';

x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join_expression.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ import {
1616
EuiFormHelpText,
1717
} from '@elastic/eui';
1818
import { i18n } from '@kbn/i18n';
19-
import { SingleFieldSelect } from '../../../../components/single_field_select';
19+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
20+
import { SingleFieldSelect } from '../../../../../../../../plugins/maps/public/components/single_field_select';
2021
import { FormattedMessage } from '@kbn/i18n/react';
21-
import { getTermsFields } from '../../../../index_pattern_util';
22+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
23+
import { getTermsFields } from '../../../../../../../../plugins/maps/public/index_pattern_util';
2224
import {
2325
getIndexPatternService,
2426
getIndexPatternSelectComponent,

x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/metrics_expression.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
EuiFormErrorText,
1515
EuiFormHelpText,
1616
} from '@elastic/eui';
17-
import { MetricsEditor } from '../../../../components/metrics_editor';
17+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
18+
import { MetricsEditor } from '../../../../../../../../plugins/maps/public/components/metrics_editor';
1819
import { FormattedMessage } from '@kbn/i18n/react';
1920
import { AGG_TYPE } from '../../../../../common/constants';
2021

0 commit comments

Comments
 (0)