Skip to content

Commit 02ee4b1

Browse files
authored
Move select range trigger to uiActions (#60168)
* move select range trigger to uiActions
1 parent 5fb747e commit 02ee4b1

File tree

10 files changed

+37
-20
lines changed

10 files changed

+37
-20
lines changed

src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/visualize_embeddable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ import {
3434
EmbeddableOutput,
3535
Embeddable,
3636
Container,
37-
selectRangeTrigger,
3837
valueClickTrigger,
3938
EmbeddableVisTriggerContext,
4039
} from '../../../../../../../plugins/embeddable/public';
40+
import { selectRangeTrigger } from '../../../../../../../plugins/ui_actions/public';
4141
import { dispatchRenderComplete } from '../../../../../../../plugins/kibana_utils/public';
4242
import {
4343
IExpressionLoaderParams,

src/plugins/data/public/plugin.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,8 @@ import {
4949
} from './services';
5050
import { createSearchBar } from './ui/search_bar/create_search_bar';
5151
import { esaggs } from './search/expressions';
52-
import {
53-
APPLY_FILTER_TRIGGER,
54-
SELECT_RANGE_TRIGGER,
55-
VALUE_CLICK_TRIGGER,
56-
} from '../../embeddable/public';
52+
import { APPLY_FILTER_TRIGGER, VALUE_CLICK_TRIGGER } from '../../embeddable/public';
53+
import { SELECT_RANGE_TRIGGER } from '../../ui_actions/public';
5754
import { ACTION_GLOBAL_APPLY_FILTER, createFilterAction, createFiltersFromEvent } from './actions';
5855
import { ApplyGlobalFilterActionContext } from './actions/apply_filter_action';
5956
import {

src/plugins/embeddable/public/bootstrap.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ import {
2323
contextMenuTrigger,
2424
createFilterAction,
2525
panelBadgeTrigger,
26-
selectRangeTrigger,
2726
valueClickTrigger,
2827
EmbeddableVisTriggerContext,
2928
IEmbeddable,
3029
EmbeddableContext,
3130
APPLY_FILTER_TRIGGER,
3231
VALUE_CLICK_TRIGGER,
33-
SELECT_RANGE_TRIGGER,
3432
CONTEXT_MENU_TRIGGER,
3533
PANEL_BADGE_TRIGGER,
3634
ACTION_ADD_PANEL,
@@ -44,7 +42,6 @@ import {
4442

4543
declare module '../../ui_actions/public' {
4644
export interface TriggerContextMapping {
47-
[SELECT_RANGE_TRIGGER]: EmbeddableVisTriggerContext;
4845
[VALUE_CLICK_TRIGGER]: EmbeddableVisTriggerContext;
4946
[APPLY_FILTER_TRIGGER]: {
5047
embeddable: IEmbeddable;
@@ -72,7 +69,6 @@ export const bootstrap = (uiActions: UiActionsSetup) => {
7269
uiActions.registerTrigger(contextMenuTrigger);
7370
uiActions.registerTrigger(applyFilterTrigger);
7471
uiActions.registerTrigger(panelBadgeTrigger);
75-
uiActions.registerTrigger(selectRangeTrigger);
7672
uiActions.registerTrigger(valueClickTrigger);
7773

7874
const actionApplyFilter = createFilterAction();

src/plugins/embeddable/public/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ export {
6262
PanelNotFoundError,
6363
PanelState,
6464
PropertySpec,
65-
SELECT_RANGE_TRIGGER,
66-
selectRangeTrigger,
6765
VALUE_CLICK_TRIGGER,
6866
valueClickTrigger,
6967
ViewMode,

src/plugins/embeddable/public/lib/triggers/triggers.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ export interface EmbeddableVisTriggerContext {
3333
};
3434
}
3535

36-
export const SELECT_RANGE_TRIGGER = 'SELECT_RANGE_TRIGGER';
37-
export const selectRangeTrigger: Trigger<'SELECT_RANGE_TRIGGER'> = {
38-
id: SELECT_RANGE_TRIGGER,
39-
title: 'Select range',
40-
description: 'Applies a range filter',
41-
};
42-
4336
export const VALUE_CLICK_TRIGGER = 'VALUE_CLICK_TRIGGER';
4437
export const valueClickTrigger: Trigger<'VALUE_CLICK_TRIGGER'> = {
4538
id: VALUE_CLICK_TRIGGER,

src/plugins/ui_actions/public/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export { UiActionsSetup, UiActionsStart } from './plugin';
2828
export { UiActionsServiceParams, UiActionsService } from './service';
2929
export { Action, createAction, IncompatibleActionError } from './actions';
3030
export { buildContextMenuForActions } from './context_menu';
31-
export { Trigger, TriggerContext } from './triggers';
31+
export { Trigger, TriggerContext, SELECT_RANGE_TRIGGER, selectRangeTrigger } from './triggers';
3232
export { TriggerContextMapping, TriggerId, ActionContextMapping, ActionType } from './types';
3333
export { ActionByType } from './actions';

src/plugins/ui_actions/public/plugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import { CoreStart, CoreSetup, Plugin, PluginInitializerContext } from 'src/core/public';
2121
import { UiActionsService } from './service';
22+
import { selectRangeTrigger } from './triggers';
2223

2324
export type UiActionsSetup = Pick<
2425
UiActionsService,
@@ -33,6 +34,7 @@ export class UiActionsPlugin implements Plugin<UiActionsSetup, UiActionsStart> {
3334
constructor(initializerContext: PluginInitializerContext) {}
3435

3536
public setup(core: CoreSetup): UiActionsSetup {
37+
this.service.registerTrigger(selectRangeTrigger);
3638
return this.service;
3739
}
3840

src/plugins/ui_actions/public/triggers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
export * from './trigger';
2121
export * from './trigger_contract';
2222
export * from './trigger_internal';
23+
export * from './select_range_trigger';
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Trigger } from '.';
21+
22+
export const SELECT_RANGE_TRIGGER = 'SELECT_RANGE_TRIGGER';
23+
export const selectRangeTrigger: Trigger<'SELECT_RANGE_TRIGGER'> = {
24+
id: SELECT_RANGE_TRIGGER,
25+
title: 'Select range',
26+
description: 'Applies a range filter',
27+
};

src/plugins/ui_actions/public/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import { ActionByType } from './actions/action';
2121
import { TriggerInternal } from './triggers/trigger_internal';
22+
import { EmbeddableVisTriggerContext } from '../../embeddable/public';
23+
import { SELECT_RANGE_TRIGGER } from './triggers';
2224

2325
export type TriggerRegistry = Map<TriggerId, TriggerInternal<any>>;
2426
export type ActionRegistry = Map<string, ActionByType<any>>;
@@ -33,6 +35,7 @@ export type TriggerContext = BaseContext;
3335

3436
export interface TriggerContextMapping {
3537
[DEFAULT_TRIGGER]: TriggerContext;
38+
[SELECT_RANGE_TRIGGER]: EmbeddableVisTriggerContext;
3639
}
3740

3841
const DEFAULT_ACTION = '';

0 commit comments

Comments
 (0)