Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Dev/explore underlying data in maps poc #73067

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ export class ExploreDataChartAction extends AbstractExploreDataAction<ExploreDat

public readonly order = 200;

public async isCompatible(context: ExploreDataChartActionContext): Promise<boolean> {
if (context.embeddable?.type === 'map') return false; // TODO: https://github.com/elastic/kibana/issues/73043
return super.isCompatible(context);
}

protected readonly getUrl = async (
context: ExploreDataChartActionContext
): Promise<KibanaURL> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,12 @@ export class MBMap extends React.Component {
let drawControl;
let tooltipControl;
if (this.state.mbMap) {
drawControl = <DrawControl mbMap={this.state.mbMap} addFilters={this.props.addFilters} />;
drawControl = (
<DrawControl
mbMap={this.state.mbMap}
addFilters={(filters) => this.props.addFilters(filters, { skipTrigger: true })}
/>
);
tooltipControl = !this.props.disableTooltipControl ? (
<TooltipControl
mbMap={this.state.mbMap}
Expand Down
27 changes: 21 additions & 6 deletions x-pack/plugins/maps/public/embeddable/map_embeddable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { Provider } from 'react-redux';
import { render, unmountComponentAtNode } from 'react-dom';
import { Subscription } from 'rxjs';
import { Unsubscribe } from 'redux';
import { Embeddable, IContainer } from '../../../../../src/plugins/embeddable/public';
import {
ACTION_APPLY_FILTER,
Embeddable,
IContainer,
} from '../../../../../src/plugins/embeddable/public';
import { APPLY_FILTER_TRIGGER } from '../../../../../src/plugins/ui_actions/public';
import {
esFilters,
Expand Down Expand Up @@ -241,11 +245,22 @@ export class MapEmbeddable extends Embeddable<MapEmbeddableInput, MapEmbeddableO
return await this._store.dispatch<any>(replaceLayerList(this._layerList));
}

addFilters = (filters: Filter[]) => {
getUiActions().executeTriggerActions(APPLY_FILTER_TRIGGER, {
embeddable: this,
filters,
});
addFilters = (
filters: Filter[],
{ skipTrigger = false }: { skipTrigger?: boolean } = { skipTrigger: false }
) => {
if (!skipTrigger) {
getUiActions().executeTriggerActions(APPLY_FILTER_TRIGGER, {
embeddable: this,
filters,
});
} else {
// Applies filters immediately, without intermediate context menu with multiple possible actions
getUiActions().getAction(ACTION_APPLY_FILTER).execute({
Copy link
Contributor Author

@Dosant Dosant Jul 27, 2020

Choose a reason for hiding this comment

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

@ppisljar, we discussed that we could give this a try and check if it works.
ACTION_APPLY_FILTER is coming from embeddable plugin and not directly dependant on global filter manager. So seems this approach is OK? What do you think?

embeddable: this,
filters,
});
}
};

destroy() {
Expand Down