mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[7.x] Move VALUE_CLICK_TRIGGER and APPLY_FILTER_TRIGGER to ui_… (#60215)
* move triggers * move triggers * fix import path * fix import path Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Matthew Kime <matt@mattki.me> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
1a77fa3667
commit
a6f2b2e4f2
13 changed files with 93 additions and 50 deletions
|
@ -20,7 +20,10 @@ import _ from 'lodash';
|
|||
import * as Rx from 'rxjs';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiActionsStart } from 'src/plugins/ui_actions/public';
|
||||
import {
|
||||
UiActionsStart,
|
||||
APPLY_FILTER_TRIGGER,
|
||||
} from '../../../../../../..//plugins/ui_actions/public';
|
||||
import { RequestAdapter, Adapters } from '../../../../../../../plugins/inspector/public';
|
||||
import {
|
||||
esFilters,
|
||||
|
@ -31,11 +34,7 @@ import {
|
|||
Query,
|
||||
IFieldType,
|
||||
} from '../../../../../../../plugins/data/public';
|
||||
import {
|
||||
APPLY_FILTER_TRIGGER,
|
||||
Container,
|
||||
Embeddable,
|
||||
} from '../../../../../embeddable_api/public/np_ready/public';
|
||||
import { Container, Embeddable } from '../../../../../embeddable_api/public/np_ready/public';
|
||||
import * as columnActions from '../angular/doc_table/actions/columns';
|
||||
import searchTemplate from './search_template.html';
|
||||
import { ISearchEmbeddable, SearchInput, SearchOutput } from './types';
|
||||
|
|
|
@ -34,10 +34,12 @@ import {
|
|||
EmbeddableOutput,
|
||||
Embeddable,
|
||||
Container,
|
||||
valueClickTrigger,
|
||||
EmbeddableVisTriggerContext,
|
||||
} from '../../../../../../../plugins/embeddable/public';
|
||||
import { selectRangeTrigger } from '../../../../../../../plugins/ui_actions/public';
|
||||
import {
|
||||
selectRangeTrigger,
|
||||
valueClickTrigger,
|
||||
} from '../../../../../../../plugins/ui_actions/public';
|
||||
import { dispatchRenderComplete } from '../../../../../../../plugins/kibana_utils/public';
|
||||
import {
|
||||
IExpressionLoaderParams,
|
||||
|
|
|
@ -49,8 +49,11 @@ import {
|
|||
} from './services';
|
||||
import { createSearchBar } from './ui/search_bar/create_search_bar';
|
||||
import { esaggs } from './search/expressions';
|
||||
import { APPLY_FILTER_TRIGGER, VALUE_CLICK_TRIGGER } from '../../embeddable/public';
|
||||
import { SELECT_RANGE_TRIGGER } from '../../ui_actions/public';
|
||||
import {
|
||||
SELECT_RANGE_TRIGGER,
|
||||
VALUE_CLICK_TRIGGER,
|
||||
APPLY_FILTER_TRIGGER,
|
||||
} from '../../ui_actions/public';
|
||||
import { ACTION_GLOBAL_APPLY_FILTER, createFilterAction, createFiltersFromEvent } from './actions';
|
||||
import { ApplyGlobalFilterActionContext } from './actions/apply_filter_action';
|
||||
import {
|
||||
|
|
|
@ -17,18 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
import { UiActionsSetup } from '../../ui_actions/public';
|
||||
import { Filter } from '../../data/public';
|
||||
import {
|
||||
applyFilterTrigger,
|
||||
contextMenuTrigger,
|
||||
createFilterAction,
|
||||
panelBadgeTrigger,
|
||||
valueClickTrigger,
|
||||
EmbeddableVisTriggerContext,
|
||||
IEmbeddable,
|
||||
EmbeddableContext,
|
||||
APPLY_FILTER_TRIGGER,
|
||||
VALUE_CLICK_TRIGGER,
|
||||
CONTEXT_MENU_TRIGGER,
|
||||
PANEL_BADGE_TRIGGER,
|
||||
ACTION_ADD_PANEL,
|
||||
|
@ -42,11 +35,6 @@ import {
|
|||
|
||||
declare module '../../ui_actions/public' {
|
||||
export interface TriggerContextMapping {
|
||||
[VALUE_CLICK_TRIGGER]: EmbeddableVisTriggerContext;
|
||||
[APPLY_FILTER_TRIGGER]: {
|
||||
embeddable: IEmbeddable;
|
||||
filters: Filter[];
|
||||
};
|
||||
[CONTEXT_MENU_TRIGGER]: EmbeddableContext;
|
||||
[PANEL_BADGE_TRIGGER]: EmbeddableContext;
|
||||
}
|
||||
|
@ -67,9 +55,7 @@ declare module '../../ui_actions/public' {
|
|||
*/
|
||||
export const bootstrap = (uiActions: UiActionsSetup) => {
|
||||
uiActions.registerTrigger(contextMenuTrigger);
|
||||
uiActions.registerTrigger(applyFilterTrigger);
|
||||
uiActions.registerTrigger(panelBadgeTrigger);
|
||||
uiActions.registerTrigger(valueClickTrigger);
|
||||
|
||||
const actionApplyFilter = createFilterAction();
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@ export {
|
|||
ACTION_ADD_PANEL,
|
||||
AddPanelAction,
|
||||
ACTION_APPLY_FILTER,
|
||||
APPLY_FILTER_TRIGGER,
|
||||
applyFilterTrigger,
|
||||
Container,
|
||||
ContainerInput,
|
||||
ContainerOutput,
|
||||
|
@ -62,8 +60,6 @@ export {
|
|||
PanelNotFoundError,
|
||||
PanelState,
|
||||
PropertySpec,
|
||||
VALUE_CLICK_TRIGGER,
|
||||
valueClickTrigger,
|
||||
ViewMode,
|
||||
withEmbeddableSubscription,
|
||||
} from './lib';
|
||||
|
|
|
@ -33,13 +33,6 @@ export interface EmbeddableVisTriggerContext {
|
|||
};
|
||||
}
|
||||
|
||||
export const VALUE_CLICK_TRIGGER = 'VALUE_CLICK_TRIGGER';
|
||||
export const valueClickTrigger: Trigger<'VALUE_CLICK_TRIGGER'> = {
|
||||
id: VALUE_CLICK_TRIGGER,
|
||||
title: 'Value clicked',
|
||||
description: 'Value was clicked',
|
||||
};
|
||||
|
||||
export const CONTEXT_MENU_TRIGGER = 'CONTEXT_MENU_TRIGGER';
|
||||
export const contextMenuTrigger: Trigger<'CONTEXT_MENU_TRIGGER'> = {
|
||||
id: CONTEXT_MENU_TRIGGER,
|
||||
|
@ -47,13 +40,6 @@ export const contextMenuTrigger: Trigger<'CONTEXT_MENU_TRIGGER'> = {
|
|||
description: 'Triggered on top-right corner context-menu select.',
|
||||
};
|
||||
|
||||
export const APPLY_FILTER_TRIGGER = 'FILTER_TRIGGER';
|
||||
export const applyFilterTrigger: Trigger<'FILTER_TRIGGER'> = {
|
||||
id: APPLY_FILTER_TRIGGER,
|
||||
title: 'Filter click',
|
||||
description: 'Triggered when user applies filter to an embeddable.',
|
||||
};
|
||||
|
||||
export const PANEL_BADGE_TRIGGER = 'PANEL_BADGE_TRIGGER';
|
||||
export const panelBadgeTrigger: Trigger<'PANEL_BADGE_TRIGGER'> = {
|
||||
id: PANEL_BADGE_TRIGGER,
|
||||
|
|
|
@ -28,6 +28,15 @@ export { UiActionsSetup, UiActionsStart } from './plugin';
|
|||
export { UiActionsServiceParams, UiActionsService } from './service';
|
||||
export { Action, createAction, IncompatibleActionError } from './actions';
|
||||
export { buildContextMenuForActions } from './context_menu';
|
||||
export { Trigger, TriggerContext, SELECT_RANGE_TRIGGER, selectRangeTrigger } from './triggers';
|
||||
export {
|
||||
Trigger,
|
||||
TriggerContext,
|
||||
SELECT_RANGE_TRIGGER,
|
||||
selectRangeTrigger,
|
||||
VALUE_CLICK_TRIGGER,
|
||||
valueClickTrigger,
|
||||
APPLY_FILTER_TRIGGER,
|
||||
applyFilterTrigger,
|
||||
} from './triggers';
|
||||
export { TriggerContextMapping, TriggerId, ActionContextMapping, ActionType } from './types';
|
||||
export { ActionByType } from './actions';
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { CoreStart, CoreSetup, Plugin, PluginInitializerContext } from 'src/core/public';
|
||||
import { UiActionsService } from './service';
|
||||
import { selectRangeTrigger } from './triggers';
|
||||
import { selectRangeTrigger, valueClickTrigger, applyFilterTrigger } from './triggers';
|
||||
|
||||
export type UiActionsSetup = Pick<
|
||||
UiActionsService,
|
||||
|
@ -35,6 +35,8 @@ export class UiActionsPlugin implements Plugin<UiActionsSetup, UiActionsStart> {
|
|||
|
||||
public setup(core: CoreSetup): UiActionsSetup {
|
||||
this.service.registerTrigger(selectRangeTrigger);
|
||||
this.service.registerTrigger(valueClickTrigger);
|
||||
this.service.registerTrigger(applyFilterTrigger);
|
||||
return this.service;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 APPLY_FILTER_TRIGGER = 'FILTER_TRIGGER';
|
||||
export const applyFilterTrigger: Trigger<'FILTER_TRIGGER'> = {
|
||||
id: APPLY_FILTER_TRIGGER,
|
||||
title: 'Filter click',
|
||||
description: 'Triggered when user applies filter to an embeddable.',
|
||||
};
|
|
@ -21,3 +21,5 @@ export * from './trigger';
|
|||
export * from './trigger_contract';
|
||||
export * from './trigger_internal';
|
||||
export * from './select_range_trigger';
|
||||
export * from './value_click_trigger';
|
||||
export * from './apply_filter_trigger';
|
||||
|
|
|
@ -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 VALUE_CLICK_TRIGGER = 'VALUE_CLICK_TRIGGER';
|
||||
export const valueClickTrigger: Trigger<'VALUE_CLICK_TRIGGER'> = {
|
||||
id: VALUE_CLICK_TRIGGER,
|
||||
title: 'Value clicked',
|
||||
description: 'Value was clicked',
|
||||
};
|
|
@ -19,8 +19,9 @@
|
|||
|
||||
import { ActionByType } from './actions/action';
|
||||
import { TriggerInternal } from './triggers/trigger_internal';
|
||||
import { EmbeddableVisTriggerContext } from '../../embeddable/public';
|
||||
import { SELECT_RANGE_TRIGGER } from './triggers';
|
||||
import { EmbeddableVisTriggerContext, IEmbeddable } from '../../embeddable/public';
|
||||
import { Filter } from '../../data/public';
|
||||
import { SELECT_RANGE_TRIGGER, VALUE_CLICK_TRIGGER, APPLY_FILTER_TRIGGER } from './triggers';
|
||||
|
||||
export type TriggerRegistry = Map<TriggerId, TriggerInternal<any>>;
|
||||
export type ActionRegistry = Map<string, ActionByType<any>>;
|
||||
|
@ -36,6 +37,11 @@ export type TriggerContext = BaseContext;
|
|||
export interface TriggerContextMapping {
|
||||
[DEFAULT_TRIGGER]: TriggerContext;
|
||||
[SELECT_RANGE_TRIGGER]: EmbeddableVisTriggerContext;
|
||||
[VALUE_CLICK_TRIGGER]: EmbeddableVisTriggerContext;
|
||||
[APPLY_FILTER_TRIGGER]: {
|
||||
embeddable: IEmbeddable;
|
||||
filters: Filter[];
|
||||
};
|
||||
}
|
||||
|
||||
const DEFAULT_ACTION = '';
|
||||
|
|
|
@ -10,10 +10,8 @@ import { Provider } from 'react-redux';
|
|||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import 'mapbox-gl/dist/mapbox-gl.css';
|
||||
|
||||
import {
|
||||
Embeddable,
|
||||
APPLY_FILTER_TRIGGER,
|
||||
} from '../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public';
|
||||
import { Embeddable } from '../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public';
|
||||
import { APPLY_FILTER_TRIGGER } from '../../../../../../src/plugins/ui_actions/public';
|
||||
import { esFilters } from '../../../../../../src/plugins/data/public';
|
||||
|
||||
import { I18nContext } from 'ui/i18n';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue