Skip to content

Commit

Permalink
only show context menu option in edit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed May 12, 2021
1 parent 1ce2938 commit 585a49a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
*/

import { i18n } from '@kbn/i18n';
import { Embeddable, EmbeddableInput } from 'src/plugins/embeddable/public';
import {
Embeddable,
EmbeddableInput,
ViewMode,
} from '../../../../../src/plugins/embeddable/public';
import { MAP_SAVED_OBJECT_TYPE } from '../../common/constants';
import { createAction } from '../../../../../src/plugins/ui_actions/public';

Expand Down Expand Up @@ -37,7 +41,9 @@ export const filterByMapExtentAction = createAction<FilterByMapExtentActionConte
return 'filter';
},
isCompatible: async ({ embeddable }: FilterByMapExtentActionContext) => {
return embeddable.type === MAP_SAVED_OBJECT_TYPE;
return (
embeddable.type === MAP_SAVED_OBJECT_TYPE && embeddable.getInput().viewMode === ViewMode.EDIT
);
},
execute: async ({ embeddable }: FilterByMapExtentActionContext) => {
embeddable.updateInput({
Expand Down

0 comments on commit 585a49a

Please sign in to comment.