Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stacey-gammon committed Mar 26, 2020
1 parent ce5cb68 commit fb69ea3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export interface VisualizeInput extends EmbeddableInput {
colors?: { [key: string]: string };
};
visObject: SerializedVis;
visType: string;
}

export interface VisualizeOutput extends EmbeddableOutput {
Expand All @@ -80,7 +79,7 @@ function getOutput(
input: VisualizeInput,
{ savedVisualizations, editable }: VisualizeEmbeddableConfiguration
): VisualizeOutput {
const vis = new Vis(input.visType, input.visObject);
const vis = new Vis(input.visObject.type, input.visObject);
const indexPattern = vis.data.indexPattern;
const indexPatterns = indexPattern ? [indexPattern] : [];
const editUrl = input.visObject.id
Expand Down Expand Up @@ -117,7 +116,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
parent?: IContainer
) {
super(input, getOutput(input, config), parent);
this.vis = new Vis(input.visType, input.visObject);
this.vis = new Vis(input.visObject.type, input.visObject);
this.timefilter = timefilter;
this.vis.uiState.on('change', this.uiStateChangeHandler);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export class VisualizeEmbeddableFactory
const embeddable = await this.create(
{
...input,
visType: savedObject.visState.type,
visObject: await convertToSerializedVis(savedObject),
},
parent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import React from 'react';
import { Filter } from 'src/plugins/data/public';
import { RenderTooltipContentParams } from '../../embeddable/types';
import { RenderTooltipContentParams, RenderToolTipContent } from '../../embeddable/types';

export const GisMap: React.ComponentType<{
addFilters: ((filters: Filter[]) => void) | null;
renderTooltipContent?: (params: RenderTooltipContentParams) => React.ComponentType;
renderTooltipContent?: RenderToolTipContent;
}>;
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {
} from '../../../../../plugins/maps/public/reducers/non_serializable_instances';
import { getMapCenter, getMapZoom, getHiddenLayerIds } from '../selectors/map_selectors';
import { MAP_SAVED_OBJECT_TYPE } from '../../common/constants';
import { RenderTooltipContentParams } from './types';
import { RenderToolTipContent } from './types';

interface MapConfig {
editUrl?: string;
Expand Down Expand Up @@ -92,7 +92,7 @@ export interface MapOutput extends EmbeddableOutput {
export class MapEmbeddable extends Embeddable<MapEmbeddableInput, MapOutput> {
type = MAP_SAVED_OBJECT_TYPE;

private _renderTooltipContent?: (params: RenderTooltipContentParams) => React.ComponentType;
private _renderTooltipContent?: RenderToolTipContent;
private _eventHandlers?: unknown;
private _layerList: unknown[];
private _store: MapStore;
Expand All @@ -108,7 +108,7 @@ export class MapEmbeddable extends Embeddable<MapEmbeddableInput, MapOutput> {
config: MapConfig,
initialInput: MapEmbeddableInput,
parent?: IContainer,
renderTooltipContent?: (params: unknown) => React.ComponentType,
renderTooltipContent?: RenderToolTipContent,
eventHandlers?: unknown
) {
super(
Expand All @@ -130,7 +130,7 @@ export class MapEmbeddable extends Embeddable<MapEmbeddableInput, MapOutput> {
this._subscription = this.getInput$().subscribe(input => this.onContainerStateChanged(input));
}

setRenderTooltipContent = (renderTooltipContent: (params: unknown) => React.ComponentType) => {
setRenderTooltipContent = (renderTooltipContent: RenderToolTipContent) => {
this._renderTooltipContent = renderTooltipContent;
};

Expand Down
2 changes: 2 additions & 0 deletions x-pack/legacy/plugins/maps/public/embeddable/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ export interface RenderTooltipContentParams {
loadFeatureProperties({ layerId, featureId }: LoadFeatureProps): Promise<FeatureProperty[]>;
loadFeatureGeometry({ layerId, featureId }: LoadFeatureProps): FeatureGeometry;
}

export type RenderToolTipContent = (params: RenderTooltipContentParams) => JSX.Element;
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ import uuid from 'uuid';
import React from 'react';
import { OutPortal, PortalNode } from 'react-reverse-portal';
import minimatch from 'minimatch';
import { ViewMode } from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public';
import { IndexPatternMapping, SetQuery } from './types';
import { getLayerList } from './map_config';
import { MAP_SAVED_OBJECT_TYPE } from '../../../../../../plugins/maps/public';
import { MapEmbeddable, RenderTooltipContentParams } from '../../../../maps/public';
import {
MapEmbeddable,
RenderTooltipContentParams,
MapEmbeddableInput,
} from '../../../../maps/public';
import * as i18n from './translations';
import { Query, Filter } from '../../../../../../../src/plugins/data/public';
import {
Expand Down

0 comments on commit fb69ea3

Please sign in to comment.