Move select range trigger to uiActions (#60168) (#60180)

* move select range trigger to uiActions
This commit is contained in:
Matthew Kime 2020-03-13 21:00:54 -05:00 committed by GitHub
parent ff820cb273
commit 2435368b62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 37 additions and 20 deletions

View file

@ -34,10 +34,10 @@ import {
EmbeddableOutput,
Embeddable,
Container,
selectRangeTrigger,
valueClickTrigger,
EmbeddableVisTriggerContext,
} from '../../../../../../../plugins/embeddable/public';
import { selectRangeTrigger } from '../../../../../../../plugins/ui_actions/public';
import { dispatchRenderComplete } from '../../../../../../../plugins/kibana_utils/public';
import {
IExpressionLoaderParams,

View file

@ -49,11 +49,8 @@ import {
} from './services';
import { createSearchBar } from './ui/search_bar/create_search_bar';
import { esaggs } from './search/expressions';
import {
APPLY_FILTER_TRIGGER,
SELECT_RANGE_TRIGGER,
VALUE_CLICK_TRIGGER,
} from '../../embeddable/public';
import { APPLY_FILTER_TRIGGER, VALUE_CLICK_TRIGGER } from '../../embeddable/public';
import { SELECT_RANGE_TRIGGER } from '../../ui_actions/public';
import { ACTION_GLOBAL_APPLY_FILTER, createFilterAction, createFiltersFromEvent } from './actions';
import { ApplyGlobalFilterActionContext } from './actions/apply_filter_action';
import {

View file

@ -23,14 +23,12 @@ import {
contextMenuTrigger,
createFilterAction,
panelBadgeTrigger,
selectRangeTrigger,
valueClickTrigger,
EmbeddableVisTriggerContext,
IEmbeddable,
EmbeddableContext,
APPLY_FILTER_TRIGGER,
VALUE_CLICK_TRIGGER,
SELECT_RANGE_TRIGGER,
CONTEXT_MENU_TRIGGER,
PANEL_BADGE_TRIGGER,
ACTION_ADD_PANEL,
@ -44,7 +42,6 @@ import {
declare module '../../ui_actions/public' {
export interface TriggerContextMapping {
[SELECT_RANGE_TRIGGER]: EmbeddableVisTriggerContext;
[VALUE_CLICK_TRIGGER]: EmbeddableVisTriggerContext;
[APPLY_FILTER_TRIGGER]: {
embeddable: IEmbeddable;
@ -72,7 +69,6 @@ export const bootstrap = (uiActions: UiActionsSetup) => {
uiActions.registerTrigger(contextMenuTrigger);
uiActions.registerTrigger(applyFilterTrigger);
uiActions.registerTrigger(panelBadgeTrigger);
uiActions.registerTrigger(selectRangeTrigger);
uiActions.registerTrigger(valueClickTrigger);
const actionApplyFilter = createFilterAction();

View file

@ -62,8 +62,6 @@ export {
PanelNotFoundError,
PanelState,
PropertySpec,
SELECT_RANGE_TRIGGER,
selectRangeTrigger,
VALUE_CLICK_TRIGGER,
valueClickTrigger,
ViewMode,

View file

@ -33,13 +33,6 @@ export interface EmbeddableVisTriggerContext {
};
}
export const SELECT_RANGE_TRIGGER = 'SELECT_RANGE_TRIGGER';
export const selectRangeTrigger: Trigger<'SELECT_RANGE_TRIGGER'> = {
id: SELECT_RANGE_TRIGGER,
title: 'Select range',
description: 'Applies a range filter',
};
export const VALUE_CLICK_TRIGGER = 'VALUE_CLICK_TRIGGER';
export const valueClickTrigger: Trigger<'VALUE_CLICK_TRIGGER'> = {
id: VALUE_CLICK_TRIGGER,

View file

@ -28,6 +28,6 @@ export { UiActionsSetup, UiActionsStart } from './plugin';
export { UiActionsServiceParams, UiActionsService } from './service';
export { Action, createAction, IncompatibleActionError } from './actions';
export { buildContextMenuForActions } from './context_menu';
export { Trigger, TriggerContext } from './triggers';
export { Trigger, TriggerContext, SELECT_RANGE_TRIGGER, selectRangeTrigger } from './triggers';
export { TriggerContextMapping, TriggerId, ActionContextMapping, ActionType } from './types';
export { ActionByType } from './actions';

View file

@ -19,6 +19,7 @@
import { CoreStart, CoreSetup, Plugin, PluginInitializerContext } from 'src/core/public';
import { UiActionsService } from './service';
import { selectRangeTrigger } from './triggers';
export type UiActionsSetup = Pick<
UiActionsService,
@ -33,6 +34,7 @@ export class UiActionsPlugin implements Plugin<UiActionsSetup, UiActionsStart> {
constructor(initializerContext: PluginInitializerContext) {}
public setup(core: CoreSetup): UiActionsSetup {
this.service.registerTrigger(selectRangeTrigger);
return this.service;
}

View file

@ -20,3 +20,4 @@
export * from './trigger';
export * from './trigger_contract';
export * from './trigger_internal';
export * from './select_range_trigger';

View file

@ -0,0 +1,27 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Trigger } from '.';
export const SELECT_RANGE_TRIGGER = 'SELECT_RANGE_TRIGGER';
export const selectRangeTrigger: Trigger<'SELECT_RANGE_TRIGGER'> = {
id: SELECT_RANGE_TRIGGER,
title: 'Select range',
description: 'Applies a range filter',
};

View file

@ -19,6 +19,8 @@
import { ActionByType } from './actions/action';
import { TriggerInternal } from './triggers/trigger_internal';
import { EmbeddableVisTriggerContext } from '../../embeddable/public';
import { SELECT_RANGE_TRIGGER } from './triggers';
export type TriggerRegistry = Map<TriggerId, TriggerInternal<any>>;
export type ActionRegistry = Map<string, ActionByType<any>>;
@ -33,6 +35,7 @@ export type TriggerContext = BaseContext;
export interface TriggerContextMapping {
[DEFAULT_TRIGGER]: TriggerContext;
[SELECT_RANGE_TRIGGER]: EmbeddableVisTriggerContext;
}
const DEFAULT_ACTION = '';