Skip to content

Commit

Permalink
[embeddable refactor] decouple MapEmbeddable from Security Solution p…
Browse files Browse the repository at this point in the history
…lugin (#182737)

Part of #182020

@elastic/kibana-presentation is refactoring the Embeddable framework.
Part of this effort is decoupling plugins from the legacy Embeddable
framework. The Maps plugin provides a react component from the plugins
start contract that can be used instead of natively using MapEmbeddable.

This PR swaps out the native MapEmbeddable implementation with the react
component exposed from the Maps plugin.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
nreese and kibanamachine committed May 13, 2024
1 parent 98329a8 commit 1c15e9a
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 425 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/maps/public/embeddable/map_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type { ILayer } from '../classes/layers/layer';

export type MapApi = HasType<'map'> & {
getLayerList: () => ILayer[];
reload: () => void;
} & PublishesDataViews &
PublishesPanelTitle &
PublishesUnifiedSearch &
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/maps/public/embeddable/map_component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { LayerDescriptor, MapCenterAndZoom, MapSettings } from '../../commo
import { MapEmbeddable } from './map_embeddable';
import { createBasemapLayerDescriptor } from '../classes/layers/create_basemap_layer_descriptor';
import { RenderToolTipContent } from '../classes/tooltips/tooltip_property';
import { MapApi } from './map_api';

export interface Props {
title?: string;
Expand All @@ -27,6 +28,7 @@ export interface Props {
mapCenter?: MapCenterAndZoom;
onInitialRenderComplete?: () => void;
getTooltipRenderer?: () => RenderToolTipContent;
onApiAvailable?: (api: MapApi) => void;
/*
* Set to false to exclude sharing attributes 'data-*'.
*/
Expand Down Expand Up @@ -70,6 +72,9 @@ export class MapComponent extends Component<Props> {
if (this.props.getTooltipRenderer) {
this._mapEmbeddable.setRenderTooltipContent(this.props.getTooltipRenderer());
}
if (this.props.onApiAvailable) {
this.props.onApiAvailable(this._mapEmbeddable as MapApi);
}

if (this.props.onInitialRenderComplete) {
this._mapEmbeddable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,36 +398,9 @@ const mockApmDataStreamClientServerLineLayer = {
label: 'traces-apm*,logs-apm*,metrics-apm*,apm-* | Line',
};

export const mockLayerList = [
{
sourceDescriptor: { type: 'EMS_TMS', isAutoSelect: true },
id: 'uuidv4()',
label: null,
minZoom: 0,
maxZoom: 24,
alpha: 1,
visible: true,
style: null,
type: LAYER_TYPE.EMS_VECTOR_TILE,
},
mockLineLayer,
mockDestinationLayer,
mockSourceLayer,
mockLayerGroup,
];
export const mockLayerList = [mockLineLayer, mockDestinationLayer, mockSourceLayer, mockLayerGroup];

export const mockLayerListDouble = [
{
sourceDescriptor: { type: 'EMS_TMS', isAutoSelect: true },
id: 'uuidv4()',
label: null,
minZoom: 0,
maxZoom: 24,
alpha: 1,
visible: true,
style: null,
type: LAYER_TYPE.EMS_VECTOR_TILE,
},
mockLineLayer,
mockDestinationLayer,
mockSourceLayer,
Expand All @@ -439,17 +412,6 @@ export const mockLayerListDouble = [
];

export const mockLayerListMixed = [
{
sourceDescriptor: { type: 'EMS_TMS', isAutoSelect: true },
id: 'uuidv4()',
label: null,
minZoom: 0,
maxZoom: 24,
alpha: 1,
visible: true,
style: null,
type: LAYER_TYPE.EMS_VECTOR_TILE,
},
mockLineLayer,
mockDestinationLayer,
mockSourceLayer,
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 1c15e9a

Please sign in to comment.