[Maps] Migrate remaining maps client files to NP (except routi… (#63859)

* Move actions over

* Move connected components over

* Move components over

* Move selectors over

* Move embeddables over. Set up legacy presence to keep legacy maps embeddables working

* Move angular and services over. Some additional top-level files

* Some file moves. Move styles over to NP

* Handle feature catalogue entry in NP. Add plugin deps to kibana.json

* Move vis registration to NP

* Clean up linting comments. Add linting comments to route controller. Move common to NP

* Add back in i18n context for embeddable

* Fix jest test paths. Fix TS lint errors

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Aaron Caldwell 2020-04-20 16:58:33 -06:00 committed by GitHub
parent 35dab183ab
commit 2af0c6d47e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
209 changed files with 1617 additions and 1749 deletions

View file

@ -1,8 +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.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export * from '../../../../plugins/maps/common/constants';

View file

@ -1,8 +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.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export * from '../../../../plugins/maps/common/descriptor_types';

View file

@ -1,8 +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.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export * from '../../../../plugins/maps/common/get_join_key';

View file

@ -1,8 +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.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export * from '../../../../plugins/maps/common/i18n_getters';

View file

@ -1,8 +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.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export * from '../../../../plugins/maps/common/parse_xml_string';

View file

@ -9,9 +9,14 @@ import mappings from './mappings.json';
import { i18n } from '@kbn/i18n';
import { resolve } from 'path';
import { migrations } from './migrations';
import { getAppTitle } from './common/i18n_getters';
import { getAppTitle } from '../../../plugins/maps/common/i18n_getters';
import { MapPlugin } from './server/plugin';
import { APP_ID, APP_ICON, createMapPath, MAP_SAVED_OBJECT_TYPE } from './common/constants';
import {
APP_ID,
APP_ICON,
createMapPath,
MAP_SAVED_OBJECT_TYPE,
} from '../../../plugins/maps/common/constants';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
export function maps(kibana) {
@ -53,7 +58,6 @@ export function maps(kibana) {
};
},
embeddableFactories: ['plugins/maps/embeddable/map_embeddable_factory'],
home: ['plugins/maps/legacy_register_feature'],
styleSheetPaths: `${__dirname}/public/index.scss`,
savedObjectSchemas: {
'maps-telemetry': {
@ -78,7 +82,6 @@ export function maps(kibana) {
},
mappings,
migrations,
hacks: ['plugins/maps/register_vis_type_alias'],
},
config(Joi) {
return Joi.object({

View file

@ -4,14 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { extractReferences } from './common/migrations/references';
import { emsRasterTileToEmsVectorTile } from './common/migrations/ems_raster_tile_to_ems_vector_tile';
import { topHitsTimeToSort } from './common/migrations/top_hits_time_to_sort';
import { moveApplyGlobalQueryToSources } from './common/migrations/move_apply_global_query';
import { addFieldMetaOptions } from './common/migrations/add_field_meta_options';
import { migrateSymbolStyleDescriptor } from './common/migrations/migrate_symbol_style_descriptor';
import { migrateUseTopHitsToScalingType } from './common/migrations/scaling_type';
import { migrateJoinAggKey } from './common/migrations/join_agg_key';
import { extractReferences } from '../../../plugins/maps/common/migrations/references';
import { emsRasterTileToEmsVectorTile } from '../../../plugins/maps/common/migrations/ems_raster_tile_to_ems_vector_tile';
import { topHitsTimeToSort } from '../../../plugins/maps/common/migrations/top_hits_time_to_sort';
import { moveApplyGlobalQueryToSources } from '../../../plugins/maps/common/migrations/move_apply_global_query';
import { addFieldMetaOptions } from '../../../plugins/maps/common/migrations/add_field_meta_options';
import { migrateSymbolStyleDescriptor } from '../../../plugins/maps/common/migrations/migrate_symbol_style_descriptor';
import { migrateUseTopHitsToScalingType } from '../../../plugins/maps/common/migrations/scaling_type';
import { migrateJoinAggKey } from '../../../plugins/maps/common/migrations/join_agg_key';
export const migrations = {
map: {

View file

@ -1,8 +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.
*/
/* eslint-disable @typescript-eslint/consistent-type-definitions */
export * from '../../../../../plugins/maps/public/actions/map_actions';

View file

@ -1,978 +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 _ from 'lodash';
import turf from 'turf';
import turfBooleanContains from '@turf/boolean-contains';
import uuid from 'uuid/v4';
import {
getLayerList,
getLayerListRaw,
getDataFilters,
getSelectedLayerId,
getMapReady,
getWaitingForMapReadyLayerListRaw,
getTransientLayerId,
getOpenTooltips,
getQuery,
getDataRequestDescriptor,
} from '../selectors/map_selectors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { FLYOUT_STATE } from '../../../../../plugins/maps/public/reducers/ui';
import {
cancelRequest,
registerCancelCallback,
unregisterCancelCallback,
getEventHandlers,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../plugins/maps/public/reducers/non_serializable_instances';
import { updateFlyout } from '../actions/ui_actions';
import {
FEATURE_ID_PROPERTY_NAME,
LAYER_TYPE,
SOURCE_DATA_ID_ORIGIN,
} from '../../common/constants';
import {
SET_SELECTED_LAYER,
SET_TRANSIENT_LAYER,
UPDATE_LAYER_ORDER,
ADD_LAYER,
SET_LAYER_ERROR_STATUS,
ADD_WAITING_FOR_MAP_READY_LAYER,
CLEAR_WAITING_FOR_MAP_READY_LAYER_LIST,
REMOVE_LAYER,
SET_LAYER_VISIBILITY,
MAP_EXTENT_CHANGED,
MAP_READY,
MAP_DESTROYED,
LAYER_DATA_LOAD_STARTED,
LAYER_DATA_LOAD_ENDED,
LAYER_DATA_LOAD_ERROR,
UPDATE_SOURCE_DATA_REQUEST,
SET_JOINS,
SET_QUERY,
TRIGGER_REFRESH_TIMER,
UPDATE_LAYER_PROP,
UPDATE_LAYER_STYLE,
SET_LAYER_STYLE_META,
UPDATE_SOURCE_PROP,
SET_REFRESH_CONFIG,
SET_MOUSE_COORDINATES,
CLEAR_MOUSE_COORDINATES,
SET_GOTO,
CLEAR_GOTO,
TRACK_CURRENT_LAYER_STATE,
ROLLBACK_TO_TRACKED_LAYER_STATE,
REMOVE_TRACKED_LAYER_STATE,
SET_OPEN_TOOLTIPS,
UPDATE_DRAW_STATE,
SET_SCROLL_ZOOM,
SET_MAP_INIT_ERROR,
SET_INTERACTIVE,
DISABLE_TOOLTIP_CONTROL,
HIDE_TOOLBAR_OVERLAY,
HIDE_LAYER_CONTROL,
HIDE_VIEW_CONTROL,
SET_WAITING_FOR_READY_HIDDEN_LAYERS,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../plugins/maps/public/actions/map_actions';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export * from '../../../../../plugins/maps/public/actions/map_actions';
function getLayerLoadingCallbacks(dispatch, getState, layerId) {
return {
startLoading: (dataId, requestToken, meta) =>
dispatch(startDataLoad(layerId, dataId, requestToken, meta)),
stopLoading: (dataId, requestToken, data, meta) =>
dispatch(endDataLoad(layerId, dataId, requestToken, data, meta)),
onLoadError: (dataId, requestToken, errorMessage) =>
dispatch(onDataLoadError(layerId, dataId, requestToken, errorMessage)),
updateSourceData: newData => {
dispatch(updateSourceDataRequest(layerId, newData));
},
isRequestStillActive: (dataId, requestToken) => {
const dataRequest = getDataRequestDescriptor(getState(), layerId, dataId);
if (!dataRequest) {
return false;
}
return dataRequest.dataRequestToken === requestToken;
},
registerCancelCallback: (requestToken, callback) =>
dispatch(registerCancelCallback(requestToken, callback)),
};
}
function getLayerById(layerId, state) {
return getLayerList(state).find(layer => {
return layerId === layer.getId();
});
}
async function syncDataForAllLayers(dispatch, getState, dataFilters) {
const state = getState();
const layerList = getLayerList(state);
const syncs = layerList.map(layer => {
const loadingFunctions = getLayerLoadingCallbacks(dispatch, getState, layer.getId());
return layer.syncData({ ...loadingFunctions, dataFilters });
});
await Promise.all(syncs);
}
export function cancelAllInFlightRequests() {
return (dispatch, getState) => {
getLayerList(getState()).forEach(layer => {
dispatch(clearDataRequests(layer));
});
};
}
function clearDataRequests(layer) {
return dispatch => {
layer.getInFlightRequestTokens().forEach(requestToken => {
dispatch(cancelRequest(requestToken));
});
dispatch({
type: UPDATE_LAYER_PROP,
id: layer.getId(),
propName: '__dataRequests',
newValue: [],
});
};
}
export function setMapInitError(errorMessage) {
return {
type: SET_MAP_INIT_ERROR,
errorMessage,
};
}
export function trackCurrentLayerState(layerId) {
return {
type: TRACK_CURRENT_LAYER_STATE,
layerId: layerId,
};
}
export function rollbackToTrackedLayerStateForSelectedLayer() {
return async (dispatch, getState) => {
const layerId = getSelectedLayerId(getState());
await dispatch({
type: ROLLBACK_TO_TRACKED_LAYER_STATE,
layerId: layerId,
});
// Ensure updateStyleMeta is triggered
// syncDataForLayer may not trigger endDataLoad if no re-fetch is required
dispatch(updateStyleMeta(layerId));
dispatch(syncDataForLayer(layerId));
};
}
export function removeTrackedLayerStateForSelectedLayer() {
return (dispatch, getState) => {
const layerId = getSelectedLayerId(getState());
dispatch({
type: REMOVE_TRACKED_LAYER_STATE,
layerId: layerId,
});
};
}
export function replaceLayerList(newLayerList) {
return (dispatch, getState) => {
const isMapReady = getMapReady(getState());
if (!isMapReady) {
dispatch({
type: CLEAR_WAITING_FOR_MAP_READY_LAYER_LIST,
});
} else {
getLayerListRaw(getState()).forEach(({ id }) => {
dispatch(removeLayerFromLayerList(id));
});
}
newLayerList.forEach(layerDescriptor => {
dispatch(addLayer(layerDescriptor));
});
};
}
export function cloneLayer(layerId) {
return async (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (!layer) {
return;
}
const clonedDescriptor = await layer.cloneDescriptor();
dispatch(addLayer(clonedDescriptor));
};
}
export function addLayer(layerDescriptor) {
return (dispatch, getState) => {
const isMapReady = getMapReady(getState());
if (!isMapReady) {
dispatch({
type: ADD_WAITING_FOR_MAP_READY_LAYER,
layer: layerDescriptor,
});
return;
}
dispatch({
type: ADD_LAYER,
layer: layerDescriptor,
});
dispatch(syncDataForLayer(layerDescriptor.id));
};
}
// Do not use when rendering a map. Method exists to enable selectors for getLayerList when
// rendering is not needed.
export function addLayerWithoutDataSync(layerDescriptor) {
return {
type: ADD_LAYER,
layer: layerDescriptor,
};
}
function setLayerDataLoadErrorStatus(layerId, errorMessage) {
return dispatch => {
dispatch({
type: SET_LAYER_ERROR_STATUS,
isInErrorState: errorMessage !== null,
layerId,
errorMessage,
});
};
}
export function cleanTooltipStateForLayer(layerId, layerFeatures = []) {
return (dispatch, getState) => {
let featuresRemoved = false;
const openTooltips = getOpenTooltips(getState())
.map(tooltipState => {
const nextFeatures = tooltipState.features.filter(tooltipFeature => {
if (tooltipFeature.layerId !== layerId) {
// feature from another layer, keep it
return true;
}
// Keep feature if it is still in layer
return layerFeatures.some(layerFeature => {
return layerFeature.properties[FEATURE_ID_PROPERTY_NAME] === tooltipFeature.id;
});
});
if (tooltipState.features.length !== nextFeatures.length) {
featuresRemoved = true;
}
return { ...tooltipState, features: nextFeatures };
})
.filter(tooltipState => {
return tooltipState.features.length > 0;
});
if (featuresRemoved) {
dispatch({
type: SET_OPEN_TOOLTIPS,
openTooltips,
});
}
};
}
export function setLayerVisibility(layerId, makeVisible) {
return async (dispatch, getState) => {
//if the current-state is invisible, we also want to sync data
//e.g. if a layer was invisible at start-up, it won't have any data loaded
const layer = getLayerById(layerId, getState());
// If the layer visibility is already what we want it to be, do nothing
if (!layer || layer.isVisible() === makeVisible) {
return;
}
if (!makeVisible) {
dispatch(cleanTooltipStateForLayer(layerId));
}
await dispatch({
type: SET_LAYER_VISIBILITY,
layerId,
visibility: makeVisible,
});
if (makeVisible) {
dispatch(syncDataForLayer(layerId));
}
};
}
export function toggleLayerVisible(layerId) {
return async (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (!layer) {
return;
}
const makeVisible = !layer.isVisible();
dispatch(setLayerVisibility(layerId, makeVisible));
};
}
export function setSelectedLayer(layerId) {
return async (dispatch, getState) => {
const oldSelectedLayer = getSelectedLayerId(getState());
if (oldSelectedLayer) {
await dispatch(rollbackToTrackedLayerStateForSelectedLayer());
}
if (layerId) {
dispatch(trackCurrentLayerState(layerId));
}
dispatch({
type: SET_SELECTED_LAYER,
selectedLayerId: layerId,
});
};
}
export function removeTransientLayer() {
return async (dispatch, getState) => {
const transientLayerId = getTransientLayerId(getState());
if (transientLayerId) {
await dispatch(removeLayerFromLayerList(transientLayerId));
await dispatch(setTransientLayer(null));
}
};
}
export function setTransientLayer(layerId) {
return {
type: SET_TRANSIENT_LAYER,
transientLayerId: layerId,
};
}
export function clearTransientLayerStateAndCloseFlyout() {
return async dispatch => {
await dispatch(updateFlyout(FLYOUT_STATE.NONE));
await dispatch(setSelectedLayer(null));
await dispatch(removeTransientLayer());
};
}
export function updateLayerOrder(newLayerOrder) {
return {
type: UPDATE_LAYER_ORDER,
newLayerOrder,
};
}
export function mapReady() {
return (dispatch, getState) => {
dispatch({
type: MAP_READY,
});
getWaitingForMapReadyLayerListRaw(getState()).forEach(layerDescriptor => {
dispatch(addLayer(layerDescriptor));
});
dispatch({
type: CLEAR_WAITING_FOR_MAP_READY_LAYER_LIST,
});
};
}
export function mapDestroyed() {
return {
type: MAP_DESTROYED,
};
}
export function mapExtentChanged(newMapConstants) {
return async (dispatch, getState) => {
const state = getState();
const dataFilters = getDataFilters(state);
const { extent, zoom: newZoom } = newMapConstants;
const { buffer, zoom: currentZoom } = dataFilters;
if (extent) {
let doesBufferContainExtent = false;
if (buffer) {
const bufferGeometry = turf.bboxPolygon([
buffer.minLon,
buffer.minLat,
buffer.maxLon,
buffer.maxLat,
]);
const extentGeometry = turf.bboxPolygon([
extent.minLon,
extent.minLat,
extent.maxLon,
extent.maxLat,
]);
doesBufferContainExtent = turfBooleanContains(bufferGeometry, extentGeometry);
}
if (!doesBufferContainExtent || currentZoom !== newZoom) {
const scaleFactor = 0.5; // TODO put scale factor in store and fetch with selector
const width = extent.maxLon - extent.minLon;
const height = extent.maxLat - extent.minLat;
dataFilters.buffer = {
minLon: extent.minLon - width * scaleFactor,
minLat: extent.minLat - height * scaleFactor,
maxLon: extent.maxLon + width * scaleFactor,
maxLat: extent.maxLat + height * scaleFactor,
};
}
}
dispatch({
type: MAP_EXTENT_CHANGED,
mapState: {
...dataFilters,
...newMapConstants,
},
});
const newDataFilters = { ...dataFilters, ...newMapConstants };
await syncDataForAllLayers(dispatch, getState, newDataFilters);
};
}
export function closeOnClickTooltip(tooltipId) {
return (dispatch, getState) => {
dispatch({
type: SET_OPEN_TOOLTIPS,
openTooltips: getOpenTooltips(getState()).filter(({ id }) => {
return tooltipId !== id;
}),
});
};
}
export function openOnClickTooltip(tooltipState) {
return (dispatch, getState) => {
const openTooltips = getOpenTooltips(getState()).filter(({ features, location, isLocked }) => {
return (
isLocked &&
!_.isEqual(location, tooltipState.location) &&
!_.isEqual(features, tooltipState.features)
);
});
openTooltips.push({
...tooltipState,
isLocked: true,
id: uuid(),
});
dispatch({
type: SET_OPEN_TOOLTIPS,
openTooltips,
});
};
}
export function closeOnHoverTooltip() {
return (dispatch, getState) => {
if (getOpenTooltips(getState()).length) {
dispatch({
type: SET_OPEN_TOOLTIPS,
openTooltips: [],
});
}
};
}
export function openOnHoverTooltip(tooltipState) {
return {
type: SET_OPEN_TOOLTIPS,
openTooltips: [
{
...tooltipState,
isLocked: false,
id: uuid(),
},
],
};
}
export function setMouseCoordinates({ lat, lon }) {
let safeLon = lon;
if (lon > 180) {
const overlapWestOfDateLine = lon - 180;
safeLon = -180 + overlapWestOfDateLine;
} else if (lon < -180) {
const overlapEastOfDateLine = Math.abs(lon) - 180;
safeLon = 180 - overlapEastOfDateLine;
}
return {
type: SET_MOUSE_COORDINATES,
lat,
lon: safeLon,
};
}
export function clearMouseCoordinates() {
return { type: CLEAR_MOUSE_COORDINATES };
}
export function disableScrollZoom() {
return { type: SET_SCROLL_ZOOM, scrollZoom: false };
}
export function fitToLayerExtent(layerId) {
return async function(dispatch, getState) {
const targetLayer = getLayerById(layerId, getState());
if (targetLayer) {
const dataFilters = getDataFilters(getState());
const bounds = await targetLayer.getBounds(dataFilters);
if (bounds) {
await dispatch(setGotoWithBounds(bounds));
}
}
};
}
export function setGotoWithBounds(bounds) {
return {
type: SET_GOTO,
bounds: bounds,
};
}
export function setGotoWithCenter({ lat, lon, zoom }) {
return {
type: SET_GOTO,
center: { lat, lon, zoom },
};
}
export function clearGoto() {
return { type: CLEAR_GOTO };
}
export function startDataLoad(layerId, dataId, requestToken, meta = {}) {
return (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (layer) {
dispatch(cancelRequest(layer.getPrevRequestToken(dataId)));
}
const eventHandlers = getEventHandlers(getState());
if (eventHandlers && eventHandlers.onDataLoad) {
eventHandlers.onDataLoad({
layerId,
dataId,
});
}
dispatch({
meta,
type: LAYER_DATA_LOAD_STARTED,
layerId,
dataId,
requestToken,
});
};
}
export function updateSourceDataRequest(layerId, newData) {
return dispatch => {
dispatch({
type: UPDATE_SOURCE_DATA_REQUEST,
dataId: SOURCE_DATA_ID_ORIGIN,
layerId,
newData,
});
dispatch(updateStyleMeta(layerId));
};
}
export function endDataLoad(layerId, dataId, requestToken, data, meta) {
return async (dispatch, getState) => {
dispatch(unregisterCancelCallback(requestToken));
const features = data && data.features ? data.features : [];
const eventHandlers = getEventHandlers(getState());
if (eventHandlers && eventHandlers.onDataLoadEnd) {
const layer = getLayerById(layerId, getState());
const resultMeta = {};
if (layer && layer.getType() === LAYER_TYPE.VECTOR) {
resultMeta.featuresCount = features.length;
}
eventHandlers.onDataLoadEnd({
layerId,
dataId,
resultMeta,
});
}
dispatch(cleanTooltipStateForLayer(layerId, features));
dispatch({
type: LAYER_DATA_LOAD_ENDED,
layerId,
dataId,
data,
meta,
requestToken,
});
//Clear any data-load errors when there is a succesful data return.
//Co this on end-data-load iso at start-data-load to avoid blipping the error status between true/false.
//This avoids jitter in the warning icon of the TOC when the requests continues to return errors.
dispatch(setLayerDataLoadErrorStatus(layerId, null));
dispatch(updateStyleMeta(layerId));
};
}
export function onDataLoadError(layerId, dataId, requestToken, errorMessage) {
return async (dispatch, getState) => {
dispatch(unregisterCancelCallback(requestToken));
const eventHandlers = getEventHandlers(getState());
if (eventHandlers && eventHandlers.onDataLoadError) {
eventHandlers.onDataLoadError({
layerId,
dataId,
errorMessage,
});
}
dispatch(cleanTooltipStateForLayer(layerId));
dispatch({
type: LAYER_DATA_LOAD_ERROR,
data: null,
layerId,
dataId,
requestToken,
});
dispatch(setLayerDataLoadErrorStatus(layerId, errorMessage));
};
}
export function updateSourceProp(layerId, propName, value, newLayerType) {
return async dispatch => {
dispatch({
type: UPDATE_SOURCE_PROP,
layerId,
propName,
value,
});
if (newLayerType) {
dispatch(updateLayerType(layerId, newLayerType));
}
await dispatch(clearMissingStyleProperties(layerId));
dispatch(syncDataForLayer(layerId));
};
}
function updateLayerType(layerId, newLayerType) {
return (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (!layer || layer.getType() === newLayerType) {
return;
}
dispatch(clearDataRequests(layer));
dispatch({
type: UPDATE_LAYER_PROP,
id: layerId,
propName: 'type',
newValue: newLayerType,
});
};
}
export function syncDataForLayer(layerId) {
return async (dispatch, getState) => {
const targetLayer = getLayerById(layerId, getState());
if (targetLayer) {
const dataFilters = getDataFilters(getState());
const loadingFunctions = getLayerLoadingCallbacks(dispatch, getState, layerId);
await targetLayer.syncData({
...loadingFunctions,
dataFilters,
});
}
};
}
export function updateLayerLabel(id, newLabel) {
return {
type: UPDATE_LAYER_PROP,
id,
propName: 'label',
newValue: newLabel,
};
}
export function updateLayerMinZoom(id, minZoom) {
return {
type: UPDATE_LAYER_PROP,
id,
propName: 'minZoom',
newValue: minZoom,
};
}
export function updateLayerMaxZoom(id, maxZoom) {
return {
type: UPDATE_LAYER_PROP,
id,
propName: 'maxZoom',
newValue: maxZoom,
};
}
export function updateLayerAlpha(id, alpha) {
return {
type: UPDATE_LAYER_PROP,
id,
propName: 'alpha',
newValue: alpha,
};
}
export function setLayerQuery(id, query) {
return dispatch => {
dispatch({
type: UPDATE_LAYER_PROP,
id,
propName: 'query',
newValue: query,
});
dispatch(syncDataForLayer(id));
};
}
export function removeSelectedLayer() {
return (dispatch, getState) => {
const state = getState();
const layerId = getSelectedLayerId(state);
dispatch(removeLayer(layerId));
};
}
export function removeLayer(layerId) {
return async (dispatch, getState) => {
const state = getState();
const selectedLayerId = getSelectedLayerId(state);
if (layerId === selectedLayerId) {
dispatch(updateFlyout(FLYOUT_STATE.NONE));
await dispatch(setSelectedLayer(null));
}
dispatch(removeLayerFromLayerList(layerId));
};
}
function removeLayerFromLayerList(layerId) {
return (dispatch, getState) => {
const layerGettingRemoved = getLayerById(layerId, getState());
if (!layerGettingRemoved) {
return;
}
layerGettingRemoved.getInFlightRequestTokens().forEach(requestToken => {
dispatch(cancelRequest(requestToken));
});
dispatch(cleanTooltipStateForLayer(layerId));
layerGettingRemoved.destroy();
dispatch({
type: REMOVE_LAYER,
id: layerId,
});
};
}
export function setQuery({ query, timeFilters, filters = [], refresh = false }) {
function generateQueryTimestamp() {
return new Date().toISOString();
}
return async (dispatch, getState) => {
const prevQuery = getQuery(getState());
const prevTriggeredAt =
prevQuery && prevQuery.queryLastTriggeredAt
? prevQuery.queryLastTriggeredAt
: generateQueryTimestamp();
dispatch({
type: SET_QUERY,
timeFilters,
query: {
...query,
// ensure query changes to trigger re-fetch when "Refresh" clicked
queryLastTriggeredAt: refresh ? generateQueryTimestamp() : prevTriggeredAt,
},
filters,
});
const dataFilters = getDataFilters(getState());
await syncDataForAllLayers(dispatch, getState, dataFilters);
};
}
export function setRefreshConfig({ isPaused, interval }) {
return {
type: SET_REFRESH_CONFIG,
isPaused,
interval,
};
}
export function triggerRefreshTimer() {
return async (dispatch, getState) => {
dispatch({
type: TRIGGER_REFRESH_TIMER,
});
const dataFilters = getDataFilters(getState());
await syncDataForAllLayers(dispatch, getState, dataFilters);
};
}
export function clearMissingStyleProperties(layerId) {
return async (dispatch, getState) => {
const targetLayer = getLayerById(layerId, getState());
if (!targetLayer) {
return;
}
const style = targetLayer.getCurrentStyle();
if (!style) {
return;
}
const nextFields = await targetLayer.getFields(); //take into account all fields, since labels can be driven by any field (source or join)
const { hasChanges, nextStyleDescriptor } = style.getDescriptorWithMissingStylePropsRemoved(
nextFields
);
if (hasChanges) {
dispatch(updateLayerStyle(layerId, nextStyleDescriptor));
}
};
}
export function updateLayerStyle(layerId, styleDescriptor) {
return dispatch => {
dispatch({
type: UPDATE_LAYER_STYLE,
layerId,
style: {
...styleDescriptor,
},
});
// Ensure updateStyleMeta is triggered
// syncDataForLayer may not trigger endDataLoad if no re-fetch is required
dispatch(updateStyleMeta(layerId));
// Style update may require re-fetch, for example ES search may need to retrieve field used for dynamic styling
dispatch(syncDataForLayer(layerId));
};
}
export function updateStyleMeta(layerId) {
return async (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (!layer) {
return;
}
const sourceDataRequest = layer.getSourceDataRequest();
const style = layer.getCurrentStyle();
if (!style || !sourceDataRequest) {
return;
}
const styleMeta = await style.pluckStyleMetaFromSourceDataRequest(sourceDataRequest);
dispatch({
type: SET_LAYER_STYLE_META,
layerId,
styleMeta,
});
};
}
export function updateLayerStyleForSelectedLayer(styleDescriptor) {
return (dispatch, getState) => {
const selectedLayerId = getSelectedLayerId(getState());
if (!selectedLayerId) {
return;
}
dispatch(updateLayerStyle(selectedLayerId, styleDescriptor));
};
}
export function setJoinsForLayer(layer, joins) {
return async dispatch => {
await dispatch({
type: SET_JOINS,
layer: layer,
joins: joins,
});
await dispatch(clearMissingStyleProperties(layer.getId()));
dispatch(syncDataForLayer(layer.getId()));
};
}
export function updateDrawState(drawState) {
return dispatch => {
if (drawState !== null) {
dispatch({ type: SET_OPEN_TOOLTIPS, openTooltips: [] }); // tooltips just get in the way
}
dispatch({
type: UPDATE_DRAW_STATE,
drawState: drawState,
});
};
}
export function disableInteractive() {
return { type: SET_INTERACTIVE, disableInteractive: true };
}
export function disableTooltipControl() {
return { type: DISABLE_TOOLTIP_CONTROL, disableTooltipControl: true };
}
export function hideToolbarOverlay() {
return { type: HIDE_TOOLBAR_OVERLAY, hideToolbarOverlay: true };
}
export function hideLayerControl() {
return { type: HIDE_LAYER_CONTROL, hideLayerControl: true };
}
export function hideViewControl() {
return { type: HIDE_VIEW_CONTROL, hideViewControl: true };
}
export function setHiddenLayers(hiddenLayerIds) {
return (dispatch, getState) => {
const isMapReady = getMapReady(getState());
if (!isMapReady) {
dispatch({ type: SET_WAITING_FOR_READY_HIDDEN_LAYERS, hiddenLayerIds });
} else {
getLayerListRaw(getState()).forEach(layer =>
dispatch(setLayerVisibility(layer.id, !hiddenLayerIds.includes(layer.id)))
);
}
};
}

View file

@ -1,91 +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 {
UPDATE_FLYOUT,
CLOSE_SET_VIEW,
OPEN_SET_VIEW,
SET_IS_LAYER_TOC_OPEN,
SET_FULL_SCREEN,
SET_READ_ONLY,
SET_OPEN_TOC_DETAILS,
SHOW_TOC_DETAILS,
HIDE_TOC_DETAILS,
UPDATE_INDEXING_STAGE,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../plugins/maps/public/actions/ui_actions';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export * from '../../../../../plugins/maps/public/actions/ui_actions';
export function exitFullScreen() {
return {
type: SET_FULL_SCREEN,
isFullScreen: false,
};
}
export function updateFlyout(display) {
return {
type: UPDATE_FLYOUT,
display,
};
}
export function closeSetView() {
return {
type: CLOSE_SET_VIEW,
};
}
export function openSetView() {
return {
type: OPEN_SET_VIEW,
};
}
export function setIsLayerTOCOpen(isLayerTOCOpen) {
return {
type: SET_IS_LAYER_TOC_OPEN,
isLayerTOCOpen,
};
}
export function enableFullScreen() {
return {
type: SET_FULL_SCREEN,
isFullScreen: true,
};
}
export function setReadOnly(isReadOnly) {
return {
type: SET_READ_ONLY,
isReadOnly,
};
}
export function setOpenTOCDetails(layerIds) {
return {
type: SET_OPEN_TOC_DETAILS,
layerIds,
};
}
export function showTOCDetails(layerId) {
return {
type: SHOW_TOC_DETAILS,
layerId,
};
}
export function hideTOCDetails(layerId) {
return {
type: HIDE_TOC_DETAILS,
layerId,
};
}
export function updateIndexingStage(stage) {
return {
type: UPDATE_INDEXING_STAGE,
stage,
};
}

View file

@ -1,54 +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 _ from 'lodash';
// Import each layer type, even those not used, to init in registry
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import '../../../../../plugins/maps/public/layers/sources/wms_source';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import '../../../../../plugins/maps/public/layers/sources/ems_file_source';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import '../../../../../plugins/maps/public/layers/sources/es_search_source';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import '../../../../../plugins/maps/public/layers/sources/es_pew_pew_source/es_pew_pew_source';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import '../../../../../plugins/maps/public/layers/sources/kibana_regionmap_source';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import '../../../../../plugins/maps/public/layers/sources/es_geo_grid_source';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import '../../../../../plugins/maps/public/layers/sources/xyz_tms_source';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { KibanaTilemapSource } from '../../../../../plugins/maps/public/layers/sources/kibana_tilemap_source';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { EMSTMSSource } from '../../../../../plugins/maps/public/layers/sources/ems_tms_source';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInjectedVarFunc } from '../../../../../plugins/maps/public/kibana_services';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getKibanaTileMap } from '../../../../../plugins/maps/public/meta';
export function getInitialLayers(layerListJSON, initialLayers = []) {
if (layerListJSON) {
return JSON.parse(layerListJSON);
}
const tilemapSourceFromKibana = getKibanaTileMap();
if (_.get(tilemapSourceFromKibana, 'url')) {
const sourceDescriptor = KibanaTilemapSource.createDescriptor();
const source = new KibanaTilemapSource(sourceDescriptor);
const layer = source.createDefaultLayer();
return [layer.toLayerDescriptor(), ...initialLayers];
}
const isEmsEnabled = getInjectedVarFunc()('isEmsEnabled', true);
if (isEmsEnabled) {
const descriptor = EMSTMSSource.createDescriptor({ isAutoSelect: true });
const source = new EMSTMSSource(descriptor);
const layer = source.createDefaultLayer();
return [layer.toLayerDescriptor(), ...initialLayers];
}
return initialLayers;
}

View file

@ -28,8 +28,10 @@ import {
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { createMapStore } from '../../../../../plugins/maps/public/reducers/store';
import { Provider } from 'react-redux';
import { GisMap } from '../connected_components/gis_map';
import { addHelpMenuToAppChrome } from '../help_menu_util';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { GisMap } from '../../../../../plugins/maps/public/connected_components/gis_map';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { addHelpMenuToAppChrome } from '../../../../../plugins/maps/public/help_menu_util';
import {
setSelectedLayer,
setRefreshConfig,
@ -37,7 +39,8 @@ import {
replaceLayerList,
setQuery,
clearTransientLayerStateAndCloseFlyout,
} from '../actions/map_actions';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../plugins/maps/public/actions/map_actions';
import {
DEFAULT_IS_LAYER_TOC_OPEN,
FLYOUT_STATE,
@ -49,22 +52,29 @@ import {
setReadOnly,
setIsLayerTOCOpen,
setOpenTOCDetails,
} from '../actions/ui_actions';
import { getIsFullScreen } from '../selectors/ui_selectors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../plugins/maps/public/actions/ui_actions';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getIsFullScreen } from '../../../../../plugins/maps/public/selectors/ui_selectors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { copyPersistentState } from '../../../../../plugins/maps/public/reducers/util';
import {
getQueryableUniqueIndexPatternIds,
hasDirtyState,
getLayerListRaw,
} from '../selectors/map_selectors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../plugins/maps/public/selectors/map_selectors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInspectorAdapters } from '../../../../../plugins/maps/public/reducers/non_serializable_instances';
import { getInitialLayers } from './get_initial_layers';
import { getInitialQuery } from './get_initial_query';
import { getInitialTimeFilters } from './get_initial_time_filters';
import { getInitialRefreshConfig } from './get_initial_refresh_config';
import { MAP_SAVED_OBJECT_TYPE, MAP_APP_PATH } from '../../common/constants';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInitialLayers } from '../../../../../plugins/maps/public/angular/get_initial_layers';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInitialQuery } from '../../../../../plugins/maps/public/angular/get_initial_query';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInitialTimeFilters } from '../../../../../plugins/maps/public/angular/get_initial_time_filters';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInitialRefreshConfig } from '../../../../../plugins/maps/public/angular/get_initial_refresh_config';
import { MAP_SAVED_OBJECT_TYPE, MAP_APP_PATH } from '../../../../../plugins/maps/common/constants';
import { npSetup, npStart } from 'ui/new_platform';
import { esFilters } from '../../../../../../src/plugins/data/public';
import {

View file

@ -1,3 +0,0 @@
@import './metric_editors';
@import './geometry_filter';
@import './tooltip_selector';

View file

@ -1,6 +0,0 @@
@import './gis_map/gis_map';
@import './layer_addpanel/source_select/index';
@import './layer_panel/index';
@import './widget_overlay/index';
@import './toolbar_overlay/index';
@import './map/features_tooltip/index';

View file

@ -1,4 +0,0 @@
@import './layer_panel';
@import './filter_editor/filter_editor';
@import './join_editor/resources/join';
@import './style_settings/style_settings';

View file

@ -1,8 +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.
*/
/* eslint-disable @typescript-eslint/consistent-type-definitions */
export * from '../../../../../../plugins/maps/public/connected_components/layer_panel/view';

View file

@ -1,107 +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 _ from 'lodash';
import {
loadSpriteSheetImageData,
addSpriteSheetToMapFromImageData,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../../../plugins/maps/public/connected_components/map/mb/utils';
export { loadSpriteSheetImageData, addSpriteSheetToMapFromImageData };
export function removeOrphanedSourcesAndLayers(mbMap, layerList) {
const mbStyle = mbMap.getStyle();
const mbLayerIdsToRemove = [];
mbStyle.layers.forEach(mbLayer => {
const layer = layerList.find(layer => {
return layer.ownsMbLayerId(mbLayer.id);
});
if (!layer) {
mbLayerIdsToRemove.push(mbLayer.id);
}
});
mbLayerIdsToRemove.forEach(mbLayerId => mbMap.removeLayer(mbLayerId));
const mbSourcesToRemove = [];
for (const mbSourceId in mbStyle.sources) {
if (mbStyle.sources.hasOwnProperty(mbSourceId)) {
const layer = layerList.find(layer => {
return layer.ownsMbSourceId(mbSourceId);
});
if (!layer) {
mbSourcesToRemove.push(mbSourceId);
}
}
}
mbSourcesToRemove.forEach(mbSourceId => mbMap.removeSource(mbSourceId));
}
/**
* This is function assumes only a single layer moved in the layerList, compared to mbMap
* It is optimized to minimize the amount of mbMap.moveLayer calls.
* @param mbMap
* @param layerList
*/
export function syncLayerOrderForSingleLayer(mbMap, layerList) {
if (!layerList || layerList.length === 0) {
return;
}
const mbLayers = mbMap.getStyle().layers.slice();
const layerIds = mbLayers.map(mbLayer => {
const layer = layerList.find(layer => layer.ownsMbLayerId(mbLayer.id));
return layer.getId();
});
const currentLayerOrderLayerIds = _.uniq(layerIds);
const newLayerOrderLayerIdsUnfiltered = layerList.map(l => l.getId());
const newLayerOrderLayerIds = newLayerOrderLayerIdsUnfiltered.filter(layerId =>
currentLayerOrderLayerIds.includes(layerId)
);
let netPos = 0;
let netNeg = 0;
const movementArr = currentLayerOrderLayerIds.reduce((accu, id, idx) => {
const movement = newLayerOrderLayerIds.findIndex(newOId => newOId === id) - idx;
movement > 0 ? netPos++ : movement < 0 && netNeg++;
accu.push({ id, movement });
return accu;
}, []);
if (netPos === 0 && netNeg === 0) {
return;
}
const movedLayerId =
(netPos >= netNeg && movementArr.find(l => l.movement < 0).id) ||
(netPos < netNeg && movementArr.find(l => l.movement > 0).id);
const nextLayerIdx = newLayerOrderLayerIds.findIndex(layerId => layerId === movedLayerId) + 1;
let nextMbLayerId;
if (nextLayerIdx === newLayerOrderLayerIds.length) {
nextMbLayerId = null;
} else {
const foundLayer = mbLayers.find(({ id: mbLayerId }) => {
const layerId = newLayerOrderLayerIds[nextLayerIdx];
const layer = layerList.find(layer => layer.getId() === layerId);
return layer.ownsMbLayerId(mbLayerId);
});
nextMbLayerId = foundLayer.id;
}
const movedLayer = layerList.find(layer => layer.getId() === movedLayerId);
mbLayers.forEach(({ id: mbLayerId }) => {
if (movedLayer.ownsMbLayerId(mbLayerId)) {
mbMap.moveLayer(mbLayerId, nextMbLayerId);
}
});
}
export async function addSpritesheetToMap(json, imgUrl, mbMap) {
const imgData = await loadSpriteSheetImageData(imgUrl);
addSpriteSheetToMapFromImageData(json, imgData, mbMap);
}

View file

@ -1,6 +0,0 @@
@import './mixins';
@import './widget_overlay';
@import './attribution_control/attribution_control';
@import './layer_control/index';
@import './view_control/view_control';

View file

@ -1,2 +0,0 @@
@import './layer_control';
@import './layer_toc/toc_entry/toc_entry';

View file

@ -4,153 +4,25 @@
* you may not use this file except in compliance with the Elastic License.
*/
import _ from 'lodash';
import { i18n } from '@kbn/i18n';
/*
Maintain legacy embeddable legacy present while apps switch over
*/
import { npSetup, npStart } from 'ui/new_platform';
import { IIndexPattern } from 'src/plugins/data/public';
// @ts-ignore
import { getMapsSavedObjectLoader } from '../angular/services/gis_map_saved_object_loader';
import { MapEmbeddable, MapEmbeddableInput } from './map_embeddable';
import {
getIndexPatternService,
getHttp,
getMapsCapabilities,
bindSetupCoreAndPlugins,
bindStartCoreAndPlugins,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../plugins/maps/public/kibana_services';
import {
EmbeddableFactoryDefinition,
IContainer,
} from '../../../../../../src/plugins/embeddable/public';
import { createMapPath, MAP_SAVED_OBJECT_TYPE, APP_ICON } from '../../common/constants';
} from '../../../../../plugins/maps/public/plugin';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { createMapStore } from '../../../../../plugins/maps/public/reducers/store';
import { addLayerWithoutDataSync } from '../actions/map_actions';
import { getQueryableUniqueIndexPatternIds } from '../selectors/map_selectors';
import { getInitialLayers } from '../angular/get_initial_layers';
import { mergeInputWithSavedMap } from './merge_input_with_saved_map';
import '../angular/services/gis_map_saved_object_loader';
// @ts-ignore
import {
bindSetupCoreAndPlugins as bindNpSetupCoreAndPlugins,
bindStartCoreAndPlugins as bindNpStartCoreAndPlugins,
} from '../../../../../plugins/maps/public/plugin'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { MAP_SAVED_OBJECT_TYPE } from '../../../../../plugins/maps/common/constants';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { MapEmbeddableFactory } from '../../../../../plugins/maps/public/embeddable';
export class MapEmbeddableFactory implements EmbeddableFactoryDefinition {
type = MAP_SAVED_OBJECT_TYPE;
savedObjectMetaData = {
name: i18n.translate('xpack.maps.mapSavedObjectLabel', {
defaultMessage: 'Map',
}),
type: MAP_SAVED_OBJECT_TYPE,
getIconForSavedObject: () => APP_ICON,
};
constructor() {
// Init required services. Necessary while in legacy
bindNpSetupCoreAndPlugins(npSetup.core, npSetup.plugins);
bindNpStartCoreAndPlugins(npStart.core, npStart.plugins);
}
bindSetupCoreAndPlugins(npSetup.core, npSetup.plugins);
bindStartCoreAndPlugins(npStart.core, npStart.plugins);
async isEditable() {
return getMapsCapabilities().save as boolean;
}
// Not supported yet for maps types.
canCreateNew() {
return false;
}
getDisplayName() {
return i18n.translate('xpack.maps.embeddableDisplayName', {
defaultMessage: 'map',
});
}
async _getIndexPatterns(layerList: unknown[]): Promise<IIndexPattern[]> {
// Need to extract layerList from store to get queryable index pattern ids
const store = createMapStore();
let queryableIndexPatternIds;
try {
layerList.forEach((layerDescriptor: unknown) => {
store.dispatch(addLayerWithoutDataSync(layerDescriptor));
});
queryableIndexPatternIds = getQueryableUniqueIndexPatternIds(store.getState());
} catch (error) {
throw new Error(
i18n.translate('xpack.maps.mapEmbeddableFactory.invalidLayerList', {
defaultMessage: 'Unable to load map, malformed layer list',
})
);
}
const promises = queryableIndexPatternIds.map(async indexPatternId => {
try {
return await getIndexPatternService().get(indexPatternId);
} catch (error) {
// Unable to load index pattern, better to not throw error so map embeddable can render
// Error will be surfaced by map embeddable since it too will be unable to locate the index pattern
return null;
}
});
const indexPatterns = await Promise.all(promises);
return _.compact(indexPatterns) as IIndexPattern[];
}
async _fetchSavedMap(savedObjectId: string) {
const savedObjectLoader = getMapsSavedObjectLoader();
return await savedObjectLoader.get(savedObjectId);
}
createFromSavedObject = async (
savedObjectId: string,
input: MapEmbeddableInput,
parent?: IContainer
) => {
const savedMap = await this._fetchSavedMap(savedObjectId);
const layerList = getInitialLayers(savedMap.layerListJSON);
const indexPatterns = await this._getIndexPatterns(layerList);
const embeddable = new MapEmbeddable(
{
layerList,
title: savedMap.title,
editUrl: getHttp().basePath.prepend(createMapPath(savedObjectId)),
indexPatterns,
editable: await this.isEditable(),
},
input,
parent
);
try {
embeddable.updateInput(mergeInputWithSavedMap(input, savedMap));
} catch (error) {
throw new Error(
i18n.translate('xpack.maps.mapEmbeddableFactory.invalidSavedObject', {
defaultMessage: 'Unable to load map, malformed saved object',
})
);
}
return embeddable;
};
create = async (input: MapEmbeddableInput, parent?: IContainer) => {
const layerList = getInitialLayers();
const indexPatterns = await this._getIndexPatterns(layerList);
return new MapEmbeddable(
{
layerList,
title: input.title ?? '',
indexPatterns,
editable: false,
},
input,
parent
);
};
}
export * from '../../../../../plugins/maps/public/embeddable/map_embeddable_factory';
npSetup.plugins.embeddable.registerEmbeddableFactory(
MAP_SAVED_OBJECT_TYPE,

View file

@ -1,17 +1,3 @@
// Import the EUI global scope so we can use EUI constants
@import 'src/legacy/ui/public/styles/_styling_constants';
/* GIS plugin styles */
// Prefix all styles with "map" to avoid conflicts.
// Examples
// mapChart
// mapChart__legend
// mapChart__legend--small
// mapChart__legend-isLoading
@import './main';
@import './mapbox_hacks';
@import './connected_components/index';
@import './components/index';
@import '../../../../plugins/maps/public/layers/index';
@import '../../../../plugins/maps/public/index';

View file

@ -15,15 +15,14 @@ import 'uiExports/embeddableActions';
import 'ui/autoload/all';
import 'react-vis/dist/style.css';
import './angular/services/gis_map_saved_object_loader';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import '../../../../plugins/maps/public/angular/services/gis_map_saved_object_loader';
import './angular/map_controller';
import './routes';
// @ts-ignore
import { PluginInitializerContext } from 'kibana/public';
import { MapsPlugin } from './plugin';
export const plugin = (initializerContext: PluginInitializerContext) => {
export const plugin = () => {
return new MapsPlugin();
};
@ -32,4 +31,4 @@ export {
RenderTooltipContentParams,
ITooltipProperty,
} from '../../../../plugins/maps/public/layers/tooltips/tooltip_property';
export { MapEmbeddable, MapEmbeddableInput } from './embeddable';
export { MapEmbeddable, MapEmbeddableInput } from '../../../../plugins/maps/public/embeddable';

View file

@ -7,10 +7,9 @@
import { npSetup, npStart } from 'ui/new_platform';
// @ts-ignore Untyped Module
import { uiModules } from 'ui/modules';
import { PluginInitializerContext } from 'kibana/public'; // eslint-disable-line import/order
import { plugin } from '.';
const pluginInstance = plugin({} as PluginInitializerContext);
const pluginInstance = plugin();
const setupPlugins = {
__LEGACY: {

View file

@ -1,14 +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 { npSetup } from 'ui/new_platform';
import { featureCatalogueEntry } from './feature_catalogue_entry';
const {
plugins: { home },
} = npSetup;
home.featureCatalogue.register(featureCatalogueEntry);

View file

@ -10,7 +10,7 @@ import { Start as InspectorStartContract } from 'src/plugins/inspector/public';
// @ts-ignore
import { wrapInI18nContext } from 'ui/i18n';
// @ts-ignore
import { MapListing } from './components/map_listing';
import { MapListing } from '../../../../plugins/maps/public/components/map_listing'; // eslint-disable-line @kbn/eslint/no-restricted-paths
// @ts-ignore
import {
bindSetupCoreAndPlugins as bindNpSetupCoreAndPlugins,
@ -18,7 +18,6 @@ import {
} from '../../../../plugins/maps/public/plugin'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { HomePublicPluginSetup } from '../../../../../src/plugins/home/public';
import { LicensingPluginSetup } from '../../../../plugins/licensing/public';
import { featureCatalogueEntry } from './feature_catalogue_entry';
import {
DataPublicPluginSetup,
DataPublicPluginStart,
@ -57,8 +56,6 @@ export class MapsPlugin implements Plugin<MapsPluginSetup, MapsPluginStart> {
});
bindNpSetupCoreAndPlugins(core, np);
np.home.featureCatalogue.register(featureCatalogueEntry);
}
public start(core: CoreStart, plugins: MapsPluginStartDependencies) {

View file

@ -1,49 +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 { i18n } from '@kbn/i18n';
import { APP_ID, APP_ICON, MAP_BASE_URL } from '../common/constants';
import {
getInjectedVarFunc,
getVisualizations,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../plugins/maps/public/kibana_services';
import { npSetup } from 'ui/new_platform';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { bindSetupCoreAndPlugins } from '../../../../plugins/maps/public/plugin';
bindSetupCoreAndPlugins(npSetup.core, npSetup.plugins);
const showMapVisualizationTypes = getInjectedVarFunc()('showMapVisualizationTypes', false);
const description = i18n.translate('xpack.maps.visTypeAlias.description', {
defaultMessage: 'Create and style maps with multiple layers and indices.',
});
const legacyMapVisualizationWarning = i18n.translate(
'xpack.maps.visTypeAlias.legacyMapVizWarning',
{
defaultMessage: `Use the Maps app instead of Coordinate Map and Region Map.
The Maps app offers more functionality and is easier to use.`,
}
);
getVisualizations().registerAlias({
aliasUrl: MAP_BASE_URL,
name: APP_ID,
title: i18n.translate('xpack.maps.visTypeAlias.title', {
defaultMessage: 'Maps',
}),
description: showMapVisualizationTypes
? `${description} ${legacyMapVisualizationWarning}`
: description,
icon: APP_ICON,
stage: 'production',
});
if (!showMapVisualizationTypes) {
getVisualizations().hideTypes(['region_map', 'tile_map']);
}

View file

@ -6,15 +6,18 @@
import { i18n } from '@kbn/i18n';
import routes from 'ui/routes';
import listingTemplate from './angular/listing_ng_wrapper.html';
import mapTemplate from './angular/map.html';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import listingTemplate from '../../../../plugins/maps/public/angular/listing_ng_wrapper.html';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import mapTemplate from '../../../../plugins/maps/public/angular/map.html';
import {
getSavedObjectsClient,
getCoreChrome,
getMapsCapabilities,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../plugins/maps/public/kibana_services';
import { getMapsSavedObjectLoader } from './angular/services/gis_map_saved_object_loader';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getMapsSavedObjectLoader } from '../../../../plugins/maps/public/angular/services/gis_map_saved_object_loader';
routes.enable();

View file

@ -5,7 +5,10 @@
*/
import _ from 'lodash';
import { DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_INNER_RESULT_WINDOW } from '../../common/constants';
import {
DEFAULT_MAX_RESULT_WINDOW,
DEFAULT_MAX_INNER_RESULT_WINDOW,
} from '../../../../../plugins/maps/common/constants';
export function getIndexPatternSettings(indicesSettingsResp) {
let maxResultWindow = Infinity;

View file

@ -5,7 +5,10 @@
*/
import { getIndexPatternSettings } from './get_index_pattern_settings';
import { DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_INNER_RESULT_WINDOW } from '../../common/constants';
import {
DEFAULT_MAX_RESULT_WINDOW,
DEFAULT_MAX_INNER_RESULT_WINDOW,
} from '../../../../../plugins/maps/common/constants';
describe('max_result_window and max_inner_result_window are not set', () => {
test('Should provide default values when values not set', () => {

View file

@ -9,7 +9,7 @@ import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { SavedObjectsClientContract } from 'src/core/server';
import { getMapsTelemetry } from '../maps_telemetry';
// @ts-ignore
import { TELEMETRY_TYPE } from '../../../common/constants';
import { TELEMETRY_TYPE } from '../../../../../../plugins/maps/common/constants';
export function registerMapsUsageCollector(
usageCollection: UsageCollectionSetup,

View file

@ -16,8 +16,8 @@ import {
ES_GEO_FIELD_TYPE,
MAP_SAVED_OBJECT_TYPE,
TELEMETRY_TYPE,
} from '../../common/constants';
import { LayerDescriptor } from '../../common/descriptor_types';
} from '../../../../../plugins/maps/common/constants';
import { LayerDescriptor } from '../../../../../plugins/maps/common/descriptor_types';
import { MapSavedObject } from '../../../../../plugins/maps/common/map_saved_object_type';
interface IStats {

View file

@ -4,7 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
import { APP_ID, APP_ICON, createMapPath, MAP_SAVED_OBJECT_TYPE } from '../common/constants';
import {
APP_ID,
APP_ICON,
createMapPath,
MAP_SAVED_OBJECT_TYPE,
} from '../../../../plugins/maps/common/constants';
import { getEcommerceSavedObjects } from './sample_data/ecommerce_saved_objects';
import { getFlightsSavedObjects } from './sample_data/flights_saved_objects.js';
import { getWebLogsSavedObjects } from './sample_data/web_logs_saved_objects.js';

View file

@ -21,7 +21,7 @@ import {
GIS_API_PATH,
EMS_SPRITES_PATH,
INDEX_SETTINGS_API_PATH,
} from '../common/constants';
} from '../../../../plugins/maps/common/constants';
import { EMSClient } from '@elastic/ems-client';
import fetch from 'node-fetch';
import { i18n } from '@kbn/i18n';

View file

@ -20,7 +20,7 @@ import {
LayerDescriptor,
VectorLayerDescriptor,
} from '../descriptor_types';
import { MapSavedObjectAttributes } from '../../../../../plugins/maps/common/map_saved_object_type';
import { MapSavedObjectAttributes } from '../map_saved_object_type';
const GROUP_BY_DELIMITER = '_groupby_';

View file

@ -7,7 +7,7 @@
import _ from 'lodash';
import { SOURCE_TYPES, SCALING_TYPES } from '../constants';
import { LayerDescriptor, ESSearchSourceDescriptor } from '../descriptor_types';
import { MapSavedObjectAttributes } from '../../../../../plugins/maps/common/map_saved_object_type';
import { MapSavedObjectAttributes } from '../map_saved_object_type';
function isEsDocumentSource(layerDescriptor: LayerDescriptor) {
const sourceType = _.get(layerDescriptor, 'sourceDescriptor.type');

View file

@ -3,6 +3,14 @@
"version": "8.0.0",
"kibanaVersion": "kibana",
"configPath": ["xpack", "maps"],
"requiredPlugins": ["inspector"],
"requiredPlugins": [
"inspector",
"home",
"data",
"fileUpload",
"uiActions",
"navigation",
"visualizations"
],
"ui": true
}

View file

@ -4,6 +4,37 @@
* you may not use this file except in compliance with the Elastic License.
*/
import _ from 'lodash';
import turf from 'turf';
import turfBooleanContains from '@turf/boolean-contains';
import uuid from 'uuid/v4';
import {
getLayerList,
getLayerListRaw,
getDataFilters,
getSelectedLayerId,
getMapReady,
getWaitingForMapReadyLayerListRaw,
getTransientLayerId,
getOpenTooltips,
getQuery,
getDataRequestDescriptor,
} from '../selectors/map_selectors';
import { FLYOUT_STATE } from '../reducers/ui';
import {
cancelRequest,
registerCancelCallback,
unregisterCancelCallback,
getEventHandlers,
} from '../reducers/non_serializable_instances';
import { updateFlyout } from './ui_actions';
import {
FEATURE_ID_PROPERTY_NAME,
LAYER_TYPE,
SOURCE_DATA_ID_ORIGIN,
} from '../../common/constants';
export const SET_SELECTED_LAYER = 'SET_SELECTED_LAYER';
export const SET_TRANSIENT_LAYER = 'SET_TRANSIENT_LAYER';
export const UPDATE_LAYER_ORDER = 'UPDATE_LAYER_ORDER';
@ -45,3 +76,897 @@ export const HIDE_TOOLBAR_OVERLAY = 'HIDE_TOOLBAR_OVERLAY';
export const HIDE_LAYER_CONTROL = 'HIDE_LAYER_CONTROL';
export const HIDE_VIEW_CONTROL = 'HIDE_VIEW_CONTROL';
export const SET_WAITING_FOR_READY_HIDDEN_LAYERS = 'SET_WAITING_FOR_READY_HIDDEN_LAYERS';
function getLayerLoadingCallbacks(dispatch, getState, layerId) {
return {
startLoading: (dataId, requestToken, meta) =>
dispatch(startDataLoad(layerId, dataId, requestToken, meta)),
stopLoading: (dataId, requestToken, data, meta) =>
dispatch(endDataLoad(layerId, dataId, requestToken, data, meta)),
onLoadError: (dataId, requestToken, errorMessage) =>
dispatch(onDataLoadError(layerId, dataId, requestToken, errorMessage)),
updateSourceData: newData => {
dispatch(updateSourceDataRequest(layerId, newData));
},
isRequestStillActive: (dataId, requestToken) => {
const dataRequest = getDataRequestDescriptor(getState(), layerId, dataId);
if (!dataRequest) {
return false;
}
return dataRequest.dataRequestToken === requestToken;
},
registerCancelCallback: (requestToken, callback) =>
dispatch(registerCancelCallback(requestToken, callback)),
};
}
function getLayerById(layerId, state) {
return getLayerList(state).find(layer => {
return layerId === layer.getId();
});
}
async function syncDataForAllLayers(dispatch, getState, dataFilters) {
const state = getState();
const layerList = getLayerList(state);
const syncs = layerList.map(layer => {
const loadingFunctions = getLayerLoadingCallbacks(dispatch, getState, layer.getId());
return layer.syncData({ ...loadingFunctions, dataFilters });
});
await Promise.all(syncs);
}
export function cancelAllInFlightRequests() {
return (dispatch, getState) => {
getLayerList(getState()).forEach(layer => {
dispatch(clearDataRequests(layer));
});
};
}
function clearDataRequests(layer) {
return dispatch => {
layer.getInFlightRequestTokens().forEach(requestToken => {
dispatch(cancelRequest(requestToken));
});
dispatch({
type: UPDATE_LAYER_PROP,
id: layer.getId(),
propName: '__dataRequests',
newValue: [],
});
};
}
export function setMapInitError(errorMessage) {
return {
type: SET_MAP_INIT_ERROR,
errorMessage,
};
}
export function trackCurrentLayerState(layerId) {
return {
type: TRACK_CURRENT_LAYER_STATE,
layerId: layerId,
};
}
export function rollbackToTrackedLayerStateForSelectedLayer() {
return async (dispatch, getState) => {
const layerId = getSelectedLayerId(getState());
await dispatch({
type: ROLLBACK_TO_TRACKED_LAYER_STATE,
layerId: layerId,
});
// Ensure updateStyleMeta is triggered
// syncDataForLayer may not trigger endDataLoad if no re-fetch is required
dispatch(updateStyleMeta(layerId));
dispatch(syncDataForLayer(layerId));
};
}
export function removeTrackedLayerStateForSelectedLayer() {
return (dispatch, getState) => {
const layerId = getSelectedLayerId(getState());
dispatch({
type: REMOVE_TRACKED_LAYER_STATE,
layerId: layerId,
});
};
}
export function replaceLayerList(newLayerList) {
return (dispatch, getState) => {
const isMapReady = getMapReady(getState());
if (!isMapReady) {
dispatch({
type: CLEAR_WAITING_FOR_MAP_READY_LAYER_LIST,
});
} else {
getLayerListRaw(getState()).forEach(({ id }) => {
dispatch(removeLayerFromLayerList(id));
});
}
newLayerList.forEach(layerDescriptor => {
dispatch(addLayer(layerDescriptor));
});
};
}
export function cloneLayer(layerId) {
return async (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (!layer) {
return;
}
const clonedDescriptor = await layer.cloneDescriptor();
dispatch(addLayer(clonedDescriptor));
};
}
export function addLayer(layerDescriptor) {
return (dispatch, getState) => {
const isMapReady = getMapReady(getState());
if (!isMapReady) {
dispatch({
type: ADD_WAITING_FOR_MAP_READY_LAYER,
layer: layerDescriptor,
});
return;
}
dispatch({
type: ADD_LAYER,
layer: layerDescriptor,
});
dispatch(syncDataForLayer(layerDescriptor.id));
};
}
// Do not use when rendering a map. Method exists to enable selectors for getLayerList when
// rendering is not needed.
export function addLayerWithoutDataSync(layerDescriptor) {
return {
type: ADD_LAYER,
layer: layerDescriptor,
};
}
function setLayerDataLoadErrorStatus(layerId, errorMessage) {
return dispatch => {
dispatch({
type: SET_LAYER_ERROR_STATUS,
isInErrorState: errorMessage !== null,
layerId,
errorMessage,
});
};
}
export function cleanTooltipStateForLayer(layerId, layerFeatures = []) {
return (dispatch, getState) => {
let featuresRemoved = false;
const openTooltips = getOpenTooltips(getState())
.map(tooltipState => {
const nextFeatures = tooltipState.features.filter(tooltipFeature => {
if (tooltipFeature.layerId !== layerId) {
// feature from another layer, keep it
return true;
}
// Keep feature if it is still in layer
return layerFeatures.some(layerFeature => {
return layerFeature.properties[FEATURE_ID_PROPERTY_NAME] === tooltipFeature.id;
});
});
if (tooltipState.features.length !== nextFeatures.length) {
featuresRemoved = true;
}
return { ...tooltipState, features: nextFeatures };
})
.filter(tooltipState => {
return tooltipState.features.length > 0;
});
if (featuresRemoved) {
dispatch({
type: SET_OPEN_TOOLTIPS,
openTooltips,
});
}
};
}
export function setLayerVisibility(layerId, makeVisible) {
return async (dispatch, getState) => {
//if the current-state is invisible, we also want to sync data
//e.g. if a layer was invisible at start-up, it won't have any data loaded
const layer = getLayerById(layerId, getState());
// If the layer visibility is already what we want it to be, do nothing
if (!layer || layer.isVisible() === makeVisible) {
return;
}
if (!makeVisible) {
dispatch(cleanTooltipStateForLayer(layerId));
}
await dispatch({
type: SET_LAYER_VISIBILITY,
layerId,
visibility: makeVisible,
});
if (makeVisible) {
dispatch(syncDataForLayer(layerId));
}
};
}
export function toggleLayerVisible(layerId) {
return async (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (!layer) {
return;
}
const makeVisible = !layer.isVisible();
dispatch(setLayerVisibility(layerId, makeVisible));
};
}
export function setSelectedLayer(layerId) {
return async (dispatch, getState) => {
const oldSelectedLayer = getSelectedLayerId(getState());
if (oldSelectedLayer) {
await dispatch(rollbackToTrackedLayerStateForSelectedLayer());
}
if (layerId) {
dispatch(trackCurrentLayerState(layerId));
}
dispatch({
type: SET_SELECTED_LAYER,
selectedLayerId: layerId,
});
};
}
export function removeTransientLayer() {
return async (dispatch, getState) => {
const transientLayerId = getTransientLayerId(getState());
if (transientLayerId) {
await dispatch(removeLayerFromLayerList(transientLayerId));
await dispatch(setTransientLayer(null));
}
};
}
export function setTransientLayer(layerId) {
return {
type: SET_TRANSIENT_LAYER,
transientLayerId: layerId,
};
}
export function clearTransientLayerStateAndCloseFlyout() {
return async dispatch => {
await dispatch(updateFlyout(FLYOUT_STATE.NONE));
await dispatch(setSelectedLayer(null));
await dispatch(removeTransientLayer());
};
}
export function updateLayerOrder(newLayerOrder) {
return {
type: UPDATE_LAYER_ORDER,
newLayerOrder,
};
}
export function mapReady() {
return (dispatch, getState) => {
dispatch({
type: MAP_READY,
});
getWaitingForMapReadyLayerListRaw(getState()).forEach(layerDescriptor => {
dispatch(addLayer(layerDescriptor));
});
dispatch({
type: CLEAR_WAITING_FOR_MAP_READY_LAYER_LIST,
});
};
}
export function mapDestroyed() {
return {
type: MAP_DESTROYED,
};
}
export function mapExtentChanged(newMapConstants) {
return async (dispatch, getState) => {
const state = getState();
const dataFilters = getDataFilters(state);
const { extent, zoom: newZoom } = newMapConstants;
const { buffer, zoom: currentZoom } = dataFilters;
if (extent) {
let doesBufferContainExtent = false;
if (buffer) {
const bufferGeometry = turf.bboxPolygon([
buffer.minLon,
buffer.minLat,
buffer.maxLon,
buffer.maxLat,
]);
const extentGeometry = turf.bboxPolygon([
extent.minLon,
extent.minLat,
extent.maxLon,
extent.maxLat,
]);
doesBufferContainExtent = turfBooleanContains(bufferGeometry, extentGeometry);
}
if (!doesBufferContainExtent || currentZoom !== newZoom) {
const scaleFactor = 0.5; // TODO put scale factor in store and fetch with selector
const width = extent.maxLon - extent.minLon;
const height = extent.maxLat - extent.minLat;
dataFilters.buffer = {
minLon: extent.minLon - width * scaleFactor,
minLat: extent.minLat - height * scaleFactor,
maxLon: extent.maxLon + width * scaleFactor,
maxLat: extent.maxLat + height * scaleFactor,
};
}
}
dispatch({
type: MAP_EXTENT_CHANGED,
mapState: {
...dataFilters,
...newMapConstants,
},
});
const newDataFilters = { ...dataFilters, ...newMapConstants };
await syncDataForAllLayers(dispatch, getState, newDataFilters);
};
}
export function closeOnClickTooltip(tooltipId) {
return (dispatch, getState) => {
dispatch({
type: SET_OPEN_TOOLTIPS,
openTooltips: getOpenTooltips(getState()).filter(({ id }) => {
return tooltipId !== id;
}),
});
};
}
export function openOnClickTooltip(tooltipState) {
return (dispatch, getState) => {
const openTooltips = getOpenTooltips(getState()).filter(({ features, location, isLocked }) => {
return (
isLocked &&
!_.isEqual(location, tooltipState.location) &&
!_.isEqual(features, tooltipState.features)
);
});
openTooltips.push({
...tooltipState,
isLocked: true,
id: uuid(),
});
dispatch({
type: SET_OPEN_TOOLTIPS,
openTooltips,
});
};
}
export function closeOnHoverTooltip() {
return (dispatch, getState) => {
if (getOpenTooltips(getState()).length) {
dispatch({
type: SET_OPEN_TOOLTIPS,
openTooltips: [],
});
}
};
}
export function openOnHoverTooltip(tooltipState) {
return {
type: SET_OPEN_TOOLTIPS,
openTooltips: [
{
...tooltipState,
isLocked: false,
id: uuid(),
},
],
};
}
export function setMouseCoordinates({ lat, lon }) {
let safeLon = lon;
if (lon > 180) {
const overlapWestOfDateLine = lon - 180;
safeLon = -180 + overlapWestOfDateLine;
} else if (lon < -180) {
const overlapEastOfDateLine = Math.abs(lon) - 180;
safeLon = 180 - overlapEastOfDateLine;
}
return {
type: SET_MOUSE_COORDINATES,
lat,
lon: safeLon,
};
}
export function clearMouseCoordinates() {
return { type: CLEAR_MOUSE_COORDINATES };
}
export function disableScrollZoom() {
return { type: SET_SCROLL_ZOOM, scrollZoom: false };
}
export function fitToLayerExtent(layerId) {
return async function(dispatch, getState) {
const targetLayer = getLayerById(layerId, getState());
if (targetLayer) {
const dataFilters = getDataFilters(getState());
const bounds = await targetLayer.getBounds(dataFilters);
if (bounds) {
await dispatch(setGotoWithBounds(bounds));
}
}
};
}
export function setGotoWithBounds(bounds) {
return {
type: SET_GOTO,
bounds: bounds,
};
}
export function setGotoWithCenter({ lat, lon, zoom }) {
return {
type: SET_GOTO,
center: { lat, lon, zoom },
};
}
export function clearGoto() {
return { type: CLEAR_GOTO };
}
export function startDataLoad(layerId, dataId, requestToken, meta = {}) {
return (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (layer) {
dispatch(cancelRequest(layer.getPrevRequestToken(dataId)));
}
const eventHandlers = getEventHandlers(getState());
if (eventHandlers && eventHandlers.onDataLoad) {
eventHandlers.onDataLoad({
layerId,
dataId,
});
}
dispatch({
meta,
type: LAYER_DATA_LOAD_STARTED,
layerId,
dataId,
requestToken,
});
};
}
export function updateSourceDataRequest(layerId, newData) {
return dispatch => {
dispatch({
type: UPDATE_SOURCE_DATA_REQUEST,
dataId: SOURCE_DATA_ID_ORIGIN,
layerId,
newData,
});
dispatch(updateStyleMeta(layerId));
};
}
export function endDataLoad(layerId, dataId, requestToken, data, meta) {
return async (dispatch, getState) => {
dispatch(unregisterCancelCallback(requestToken));
const features = data && data.features ? data.features : [];
const eventHandlers = getEventHandlers(getState());
if (eventHandlers && eventHandlers.onDataLoadEnd) {
const layer = getLayerById(layerId, getState());
const resultMeta = {};
if (layer && layer.getType() === LAYER_TYPE.VECTOR) {
resultMeta.featuresCount = features.length;
}
eventHandlers.onDataLoadEnd({
layerId,
dataId,
resultMeta,
});
}
dispatch(cleanTooltipStateForLayer(layerId, features));
dispatch({
type: LAYER_DATA_LOAD_ENDED,
layerId,
dataId,
data,
meta,
requestToken,
});
//Clear any data-load errors when there is a succesful data return.
//Co this on end-data-load iso at start-data-load to avoid blipping the error status between true/false.
//This avoids jitter in the warning icon of the TOC when the requests continues to return errors.
dispatch(setLayerDataLoadErrorStatus(layerId, null));
dispatch(updateStyleMeta(layerId));
};
}
export function onDataLoadError(layerId, dataId, requestToken, errorMessage) {
return async (dispatch, getState) => {
dispatch(unregisterCancelCallback(requestToken));
const eventHandlers = getEventHandlers(getState());
if (eventHandlers && eventHandlers.onDataLoadError) {
eventHandlers.onDataLoadError({
layerId,
dataId,
errorMessage,
});
}
dispatch(cleanTooltipStateForLayer(layerId));
dispatch({
type: LAYER_DATA_LOAD_ERROR,
data: null,
layerId,
dataId,
requestToken,
});
dispatch(setLayerDataLoadErrorStatus(layerId, errorMessage));
};
}
export function updateSourceProp(layerId, propName, value, newLayerType) {
return async dispatch => {
dispatch({
type: UPDATE_SOURCE_PROP,
layerId,
propName,
value,
});
if (newLayerType) {
dispatch(updateLayerType(layerId, newLayerType));
}
await dispatch(clearMissingStyleProperties(layerId));
dispatch(syncDataForLayer(layerId));
};
}
function updateLayerType(layerId, newLayerType) {
return (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (!layer || layer.getType() === newLayerType) {
return;
}
dispatch(clearDataRequests(layer));
dispatch({
type: UPDATE_LAYER_PROP,
id: layerId,
propName: 'type',
newValue: newLayerType,
});
};
}
export function syncDataForLayer(layerId) {
return async (dispatch, getState) => {
const targetLayer = getLayerById(layerId, getState());
if (targetLayer) {
const dataFilters = getDataFilters(getState());
const loadingFunctions = getLayerLoadingCallbacks(dispatch, getState, layerId);
await targetLayer.syncData({
...loadingFunctions,
dataFilters,
});
}
};
}
export function updateLayerLabel(id, newLabel) {
return {
type: UPDATE_LAYER_PROP,
id,
propName: 'label',
newValue: newLabel,
};
}
export function updateLayerMinZoom(id, minZoom) {
return {
type: UPDATE_LAYER_PROP,
id,
propName: 'minZoom',
newValue: minZoom,
};
}
export function updateLayerMaxZoom(id, maxZoom) {
return {
type: UPDATE_LAYER_PROP,
id,
propName: 'maxZoom',
newValue: maxZoom,
};
}
export function updateLayerAlpha(id, alpha) {
return {
type: UPDATE_LAYER_PROP,
id,
propName: 'alpha',
newValue: alpha,
};
}
export function setLayerQuery(id, query) {
return dispatch => {
dispatch({
type: UPDATE_LAYER_PROP,
id,
propName: 'query',
newValue: query,
});
dispatch(syncDataForLayer(id));
};
}
export function removeSelectedLayer() {
return (dispatch, getState) => {
const state = getState();
const layerId = getSelectedLayerId(state);
dispatch(removeLayer(layerId));
};
}
export function removeLayer(layerId) {
return async (dispatch, getState) => {
const state = getState();
const selectedLayerId = getSelectedLayerId(state);
if (layerId === selectedLayerId) {
dispatch(updateFlyout(FLYOUT_STATE.NONE));
await dispatch(setSelectedLayer(null));
}
dispatch(removeLayerFromLayerList(layerId));
};
}
function removeLayerFromLayerList(layerId) {
return (dispatch, getState) => {
const layerGettingRemoved = getLayerById(layerId, getState());
if (!layerGettingRemoved) {
return;
}
layerGettingRemoved.getInFlightRequestTokens().forEach(requestToken => {
dispatch(cancelRequest(requestToken));
});
dispatch(cleanTooltipStateForLayer(layerId));
layerGettingRemoved.destroy();
dispatch({
type: REMOVE_LAYER,
id: layerId,
});
};
}
export function setQuery({ query, timeFilters, filters = [], refresh = false }) {
function generateQueryTimestamp() {
return new Date().toISOString();
}
return async (dispatch, getState) => {
const prevQuery = getQuery(getState());
const prevTriggeredAt =
prevQuery && prevQuery.queryLastTriggeredAt
? prevQuery.queryLastTriggeredAt
: generateQueryTimestamp();
dispatch({
type: SET_QUERY,
timeFilters,
query: {
...query,
// ensure query changes to trigger re-fetch when "Refresh" clicked
queryLastTriggeredAt: refresh ? generateQueryTimestamp() : prevTriggeredAt,
},
filters,
});
const dataFilters = getDataFilters(getState());
await syncDataForAllLayers(dispatch, getState, dataFilters);
};
}
export function setRefreshConfig({ isPaused, interval }) {
return {
type: SET_REFRESH_CONFIG,
isPaused,
interval,
};
}
export function triggerRefreshTimer() {
return async (dispatch, getState) => {
dispatch({
type: TRIGGER_REFRESH_TIMER,
});
const dataFilters = getDataFilters(getState());
await syncDataForAllLayers(dispatch, getState, dataFilters);
};
}
export function clearMissingStyleProperties(layerId) {
return async (dispatch, getState) => {
const targetLayer = getLayerById(layerId, getState());
if (!targetLayer) {
return;
}
const style = targetLayer.getCurrentStyle();
if (!style) {
return;
}
const nextFields = await targetLayer.getFields(); //take into account all fields, since labels can be driven by any field (source or join)
const { hasChanges, nextStyleDescriptor } = style.getDescriptorWithMissingStylePropsRemoved(
nextFields
);
if (hasChanges) {
dispatch(updateLayerStyle(layerId, nextStyleDescriptor));
}
};
}
export function updateLayerStyle(layerId, styleDescriptor) {
return dispatch => {
dispatch({
type: UPDATE_LAYER_STYLE,
layerId,
style: {
...styleDescriptor,
},
});
// Ensure updateStyleMeta is triggered
// syncDataForLayer may not trigger endDataLoad if no re-fetch is required
dispatch(updateStyleMeta(layerId));
// Style update may require re-fetch, for example ES search may need to retrieve field used for dynamic styling
dispatch(syncDataForLayer(layerId));
};
}
export function updateStyleMeta(layerId) {
return async (dispatch, getState) => {
const layer = getLayerById(layerId, getState());
if (!layer) {
return;
}
const sourceDataRequest = layer.getSourceDataRequest();
const style = layer.getCurrentStyle();
if (!style || !sourceDataRequest) {
return;
}
const styleMeta = await style.pluckStyleMetaFromSourceDataRequest(sourceDataRequest);
dispatch({
type: SET_LAYER_STYLE_META,
layerId,
styleMeta,
});
};
}
export function updateLayerStyleForSelectedLayer(styleDescriptor) {
return (dispatch, getState) => {
const selectedLayerId = getSelectedLayerId(getState());
if (!selectedLayerId) {
return;
}
dispatch(updateLayerStyle(selectedLayerId, styleDescriptor));
};
}
export function setJoinsForLayer(layer, joins) {
return async dispatch => {
await dispatch({
type: SET_JOINS,
layer: layer,
joins: joins,
});
await dispatch(clearMissingStyleProperties(layer.getId()));
dispatch(syncDataForLayer(layer.getId()));
};
}
export function updateDrawState(drawState) {
return dispatch => {
if (drawState !== null) {
dispatch({ type: SET_OPEN_TOOLTIPS, openTooltips: [] }); // tooltips just get in the way
}
dispatch({
type: UPDATE_DRAW_STATE,
drawState: drawState,
});
};
}
export function disableInteractive() {
return { type: SET_INTERACTIVE, disableInteractive: true };
}
export function disableTooltipControl() {
return { type: DISABLE_TOOLTIP_CONTROL, disableTooltipControl: true };
}
export function hideToolbarOverlay() {
return { type: HIDE_TOOLBAR_OVERLAY, hideToolbarOverlay: true };
}
export function hideLayerControl() {
return { type: HIDE_LAYER_CONTROL, hideLayerControl: true };
}
export function hideViewControl() {
return { type: HIDE_VIEW_CONTROL, hideViewControl: true };
}
export function setHiddenLayers(hiddenLayerIds) {
return (dispatch, getState) => {
const isMapReady = getMapReady(getState());
if (!isMapReady) {
dispatch({ type: SET_WAITING_FOR_READY_HIDDEN_LAYERS, hiddenLayerIds });
} else {
getLayerListRaw(getState()).forEach(layer =>
dispatch(setLayerVisibility(layer.id, !hiddenLayerIds.includes(layer.id)))
);
}
};
}

View file

@ -5,7 +5,7 @@
*/
jest.mock('../selectors/map_selectors', () => ({}));
jest.mock('../../../../../plugins/maps/public/kibana_services', () => ({}));
jest.mock('../kibana_services', () => ({}));
import { mapExtentChanged, setMouseCoordinates } from './map_actions';

View file

@ -6,6 +6,17 @@
import { AnyAction } from 'redux';
export const UPDATE_FLYOUT: string;
export const CLOSE_SET_VIEW: string;
export const OPEN_SET_VIEW: string;
export const SET_IS_LAYER_TOC_OPEN: string;
export const SET_FULL_SCREEN: string;
export const SET_READ_ONLY: string;
export const SET_OPEN_TOC_DETAILS: string;
export const SHOW_TOC_DETAILS: string;
export const HIDE_TOC_DETAILS: string;
export const UPDATE_INDEXING_STAGE: string;
export function setOpenTOCDetails(layerIds?: string[]): AnyAction;
export function setIsLayerTOCOpen(open: boolean): AnyAction;

View file

@ -14,3 +14,73 @@ export const SET_OPEN_TOC_DETAILS = 'SET_OPEN_TOC_DETAILS';
export const SHOW_TOC_DETAILS = 'SHOW_TOC_DETAILS';
export const HIDE_TOC_DETAILS = 'HIDE_TOC_DETAILS';
export const UPDATE_INDEXING_STAGE = 'UPDATE_INDEXING_STAGE';
export function exitFullScreen() {
return {
type: SET_FULL_SCREEN,
isFullScreen: false,
};
}
export function updateFlyout(display) {
return {
type: UPDATE_FLYOUT,
display,
};
}
export function closeSetView() {
return {
type: CLOSE_SET_VIEW,
};
}
export function openSetView() {
return {
type: OPEN_SET_VIEW,
};
}
export function setIsLayerTOCOpen(isLayerTOCOpen) {
return {
type: SET_IS_LAYER_TOC_OPEN,
isLayerTOCOpen,
};
}
export function enableFullScreen() {
return {
type: SET_FULL_SCREEN,
isFullScreen: true,
};
}
export function setReadOnly(isReadOnly) {
return {
type: SET_READ_ONLY,
isReadOnly,
};
}
export function setOpenTOCDetails(layerIds) {
return {
type: SET_OPEN_TOC_DETAILS,
layerIds,
};
}
export function showTOCDetails(layerId) {
return {
type: SHOW_TOC_DETAILS,
layerId,
};
}
export function hideTOCDetails(layerId) {
return {
type: HIDE_TOC_DETAILS,
layerId,
};
}
export function updateIndexingStage(stage) {
return {
type: UPDATE_INDEXING_STAGE,
stage,
};
}

View file

@ -0,0 +1,53 @@
/*
* 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 _ from 'lodash';
// Import each layer type, even those not used, to init in registry
import '../layers/sources/wms_source';
import '../layers/sources/ems_file_source';
import '../layers/sources/es_search_source';
import '../layers/sources/es_pew_pew_source/es_pew_pew_source';
import '../layers/sources/kibana_regionmap_source';
import '../layers/sources/es_geo_grid_source';
import '../layers/sources/xyz_tms_source';
import { KibanaTilemapSource } from '../layers/sources/kibana_tilemap_source';
import { EMSTMSSource } from '../layers/sources/ems_tms_source';
import { getInjectedVarFunc } from '../kibana_services';
import { getKibanaTileMap } from '../meta';
export function getInitialLayers(layerListJSON, initialLayers = []) {
if (layerListJSON) {
return JSON.parse(layerListJSON);
}
const tilemapSourceFromKibana = getKibanaTileMap();
if (_.get(tilemapSourceFromKibana, 'url')) {
const sourceDescriptor = KibanaTilemapSource.createDescriptor();
const source = new KibanaTilemapSource(sourceDescriptor);
const layer = source.createDefaultLayer();
return [layer.toLayerDescriptor(), ...initialLayers];
}
const isEmsEnabled = getInjectedVarFunc()('isEmsEnabled', true);
if (isEmsEnabled) {
const descriptor = EMSTMSSource.createDescriptor({ isAutoSelect: true });
const source = new EMSTMSSource(descriptor);
const layer = source.createDefaultLayer();
return [layer.toLayerDescriptor(), ...initialLayers];
}
return initialLayers;
}

View file

@ -4,10 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
jest.mock('../../../../../plugins/maps/public/meta', () => {
jest.mock('../meta', () => {
return {};
});
jest.mock('../../../../../plugins/maps/public/kibana_services');
jest.mock('../kibana_services');
import { getInitialLayers } from './get_initial_layers';
@ -15,8 +15,7 @@ const layerListNotProvided = undefined;
describe('Saved object has layer list', () => {
beforeEach(() => {
require('../../../../../plugins/maps/public/kibana_services').getInjectedVarFunc = () =>
jest.fn();
require('../kibana_services').getInjectedVarFunc = () => jest.fn();
});
it('Should get initial layers from saved object', () => {
@ -33,7 +32,7 @@ describe('Saved object has layer list', () => {
describe('kibana.yml configured with map.tilemap.url', () => {
beforeAll(() => {
require('../../../../../plugins/maps/public/meta').getKibanaTileMap = () => {
require('../meta').getKibanaTileMap = () => {
return {
url: 'myTileUrl',
};
@ -63,10 +62,10 @@ describe('kibana.yml configured with map.tilemap.url', () => {
describe('EMS is enabled', () => {
beforeAll(() => {
require('../../../../../plugins/maps/public/meta').getKibanaTileMap = () => {
require('../meta').getKibanaTileMap = () => {
return null;
};
require('../../../../../plugins/maps/public/kibana_services').getInjectedVarFunc = () => key => {
require('../kibana_services').getInjectedVarFunc = () => key => {
switch (key) {
case 'emsTileLayerId':
return {
@ -107,11 +106,11 @@ describe('EMS is enabled', () => {
describe('EMS is not enabled', () => {
beforeAll(() => {
require('../../../../../plugins/maps/public/meta').getKibanaTileMap = () => {
require('../meta').getKibanaTileMap = () => {
return null;
};
require('../../../../../plugins/maps/public/kibana_services').getInjectedVarFunc = () => key => {
require('../kibana_services').getInjectedVarFunc = () => key => {
switch (key) {
case 'isEmsEnabled':
return false;

View file

@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getUiSettings } from '../../../../../plugins/maps/public/kibana_services';
import { getUiSettings } from '../kibana_services';
export function getInitialQuery({ mapStateJSON, appState = {}, userQueryLanguage }) {
const settings = getUiSettings();

View file

@ -3,8 +3,8 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getUiSettings } from '../../../../../plugins/maps/public/kibana_services';
import { getUiSettings } from '../kibana_services';
export function getInitialRefreshConfig({ mapStateJSON, globalState = {} }) {
const uiSettings = getUiSettings();

View file

@ -3,8 +3,8 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getUiSettings } from '../../../../../plugins/maps/public/kibana_services';
import { getUiSettings } from '../kibana_services';
export function getInitialTimeFilters({ mapStateJSON, globalState = {} }) {
if (mapStateJSON) {

View file

@ -6,15 +6,14 @@
import _ from 'lodash';
import { createSavedGisMapClass } from './saved_gis_map';
import { SavedObjectLoader } from '../../../../../../../src/plugins/saved_objects/public';
import { SavedObjectLoader } from '../../../../../../src/plugins/saved_objects/public';
import {
getCoreChrome,
getSavedObjectsClient,
getIndexPatternService,
getCoreOverlays,
getData,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../../plugins/maps/public/kibana_services';
} from '../../kibana_services';
export const getMapsSavedObjectLoader = _.once(function() {
const services = {

View file

@ -5,7 +5,7 @@
*/
import _ from 'lodash';
import { createSavedObjectClass } from '../../../../../../../src/plugins/saved_objects/public';
import { createSavedObjectClass } from '../../../../../../src/plugins/saved_objects/public';
import {
getTimeFilters,
getMapZoom,
@ -17,10 +17,10 @@ import {
getFilters,
} from '../../selectors/map_selectors';
import { getIsLayerTOCOpen, getOpenTOCDetails } from '../../selectors/ui_selectors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { convertMapExtentToPolygon } from '../../../../../../plugins/maps/public/elasticsearch_geo_utils';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { copyPersistentState } from '../../../../../../plugins/maps/public/reducers/util';
import { convertMapExtentToPolygon } from '../../elasticsearch_geo_utils';
import { copyPersistentState } from '../../reducers/util';
import { extractReferences, injectReferences } from '../../../common/migrations/references';
import { MAP_SAVED_OBJECT_TYPE } from '../../../common/constants';

View file

@ -0,0 +1,3 @@
@import 'metric_editors';
@import './geometry_filter';
@import 'tooltip_selector';

View file

@ -7,8 +7,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import _ from 'lodash';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getToasts } from '../../../../../plugins/maps/public/kibana_services';
import { getToasts } from '../kibana_services';
import {
EuiTitle,
EuiFieldSearch,

View file

@ -0,0 +1,6 @@
@import 'gis_map/gis_map';
@import 'layer_addpanel/source_select/index';
@import 'layer_panel/index';
@import 'widget_overlay/index';
@import 'toolbar_overlay/index';
@import 'map/features_tooltip/index';

View file

@ -6,8 +6,8 @@
import React from 'react';
import { Filter } from 'src/plugins/data/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { RenderToolTipContent } from '../../../../../../plugins/maps/public/layers/tooltips/tooltip_property';
import { RenderToolTipContent } from '../../layers/tooltips/tooltip_property';
export const GisMap: React.ComponentType<{
addFilters: ((filters: Filter[]) => void) | null;

View file

@ -6,8 +6,8 @@
import { connect } from 'react-redux';
import { GisMap } from './view';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { FLYOUT_STATE } from '../../../../../../plugins/maps/public/reducers/ui';
import { FLYOUT_STATE } from '../../reducers/ui';
import { exitFullScreen } from '../../actions/ui_actions';
import { getFlyoutDisplay, getIsFullScreen } from '../../selectors/ui_selectors';
import { triggerRefreshTimer, cancelAllInFlightRequests } from '../../actions/map_actions';
@ -18,8 +18,8 @@ import {
getQueryableUniqueIndexPatternIds,
isToolbarOverlayHidden,
} from '../../selectors/map_selectors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getCoreChrome } from '../../../../../../plugins/maps/public/kibana_services';
import { getCoreChrome } from '../../kibana_services';
function mapStateToProps(state = {}) {
const flyoutDisplay = getFlyoutDisplay(state);

View file

@ -7,17 +7,16 @@
import _ from 'lodash';
import React, { Component } from 'react';
import { MBMapContainer } from '../map/mb';
import { WidgetOverlay } from '../widget_overlay/index';
import { ToolbarOverlay } from '../toolbar_overlay/index';
import { LayerPanel } from '../layer_panel/index';
import { AddLayerPanel } from '../layer_addpanel/index';
import { WidgetOverlay } from '../widget_overlay';
import { ToolbarOverlay } from '../toolbar_overlay';
import { LayerPanel } from '../layer_panel';
import { AddLayerPanel } from '../layer_addpanel';
import { EuiFlexGroup, EuiFlexItem, EuiCallOut } from '@elastic/eui';
import { ExitFullScreenButton } from '../../../../../../../src/plugins/kibana_react/public';
import { ExitFullScreenButton } from '../../../../../../src/plugins/kibana_react/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getIndexPatternsFromIds } from '../../../../../../plugins/maps/public/index_pattern_util';
import { getIndexPatternsFromIds } from '../../index_pattern_util';
import { ES_GEO_FIELD_TYPE } from '../../../common/constants';
import { indexPatterns as indexPatternsUtils } from '../../../../../../../src/plugins/data/public';
import { indexPatterns as indexPatternsUtils } from '../../../../../../src/plugins/data/public';
import { i18n } from '@kbn/i18n';
import uuid from 'uuid/v4';

View file

@ -6,10 +6,10 @@
import { connect } from 'react-redux';
import { ImportEditor } from './view';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInspectorAdapters } from '../../../../../../../plugins/maps/public/reducers/non_serializable_instances';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { INDEXING_STAGE } from '../../../../../../../plugins/maps/public/reducers/ui';
import { getInspectorAdapters } from '../../../reducers/non_serializable_instances';
import { INDEXING_STAGE } from '../../../reducers/ui';
import { updateIndexingStage } from '../../../actions/ui_actions';
import { getIndexingStage } from '../../../selectors/ui_selectors';

View file

@ -7,8 +7,8 @@
import React, { Fragment } from 'react';
import { EuiSpacer, EuiPanel, EuiButtonEmpty } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { uploadLayerWizardConfig } from '../../../../../../../plugins/maps/public/layers/sources/client_file_source';
import { uploadLayerWizardConfig } from '../../../layers/sources/client_file_source';
export const ImportEditor = ({ clearSource, isIndexingTriggered, ...props }) => {
const editorProperties = getEditorProperties({ isIndexingTriggered, ...props });

View file

@ -6,13 +6,13 @@
import { connect } from 'react-redux';
import { AddLayerPanel } from './view';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { FLYOUT_STATE, INDEXING_STAGE } from '../../../../../../plugins/maps/public/reducers/ui';
import { FLYOUT_STATE, INDEXING_STAGE } from '../../reducers/ui';
import { updateFlyout, updateIndexingStage } from '../../actions/ui_actions';
import { getFlyoutDisplay, getIndexingStage } from '../../selectors/ui_selectors';
import { getMapColors } from '../../selectors/map_selectors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInspectorAdapters } from '../../../../../../plugins/maps/public/reducers/non_serializable_instances';
import { getInspectorAdapters } from '../../reducers/non_serializable_instances';
import {
setTransientLayer,
addLayer,

View file

@ -6,8 +6,8 @@
import { connect } from 'react-redux';
import { SourceEditor } from './view';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInspectorAdapters } from '../../../../../../../plugins/maps/public/reducers/non_serializable_instances';
import { getInspectorAdapters } from '../../../reducers/non_serializable_instances';
function mapStateToProps(state = {}) {
return {

View file

@ -0,0 +1 @@
@import 'source_select';

View file

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

View file

@ -0,0 +1,4 @@
@import 'layer_panel';
@import 'filter_editor/filter_editor';
@import 'join_editor/resources/join';
@import 'style_settings/style_settings';

Some files were not shown because too many files have changed in this diff Show more