Local actions (#57451)

* feat: 🎸 create UiActionsService

* feat: 🎸 add UiActionsServvice.fork() method

* feat: 🎸 instantiate UiActionsService in plugin

* feat: 🎸 add UiActionsService.registerTrigger(), remove old

* feat: 🎸 move attach/detachAction() methods to UiActionsService

* refactor: 💡 move remaining actions API to UiActionsService

* chore: 🤖 clean up /trigger folder

* test: 💍 move registry tests into UiActiosnService tests

* fix: 🐛 fix TypeScript typecheck errors

* test: 💍 add .fork() trigger tests

* feat: 🎸 remove actionIds from ui_actions Trigger interface

* fix: 🐛 remove usage of actionIds

* fix: 🐛 attach hello world action to trigger in plugin lifecycle

* feat: 🎸 fork also trigger to action attachments

* fix: 🐛 clear mapping registry in .clear(), improve type
This commit is contained in:
Vadim Dalecky 2020-02-17 14:59:47 +01:00 committed by GitHub
parent 9388ff7b43
commit ca5e25c139
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 764 additions and 734 deletions

View file

@ -18,11 +18,9 @@
*/
import { Trigger } from '../../../src/plugins/ui_actions/public';
import { HELLO_WORLD_ACTION_TYPE } from './hello_world_action';
export const HELLO_WORLD_TRIGGER_ID = 'HELLO_WORLD_TRIGGER_ID';
export const helloWorldTrigger: Trigger = {
id: HELLO_WORLD_TRIGGER_ID,
actionIds: [HELLO_WORLD_ACTION_TYPE],
};

View file

@ -19,7 +19,7 @@
import { Plugin, CoreSetup, CoreStart } from '../../../src/core/public';
import { UiActionsSetup, UiActionsStart } from '../../../src/plugins/ui_actions/public';
import { createHelloWorldAction } from './hello_world_action';
import { createHelloWorldAction, HELLO_WORLD_ACTION_TYPE } from './hello_world_action';
import { helloWorldTrigger } from './hello_world_trigger';
interface UiActionExamplesSetupDependencies {
@ -33,8 +33,9 @@ interface UiActionExamplesStartDependencies {
export class UiActionExamplesPlugin
implements
Plugin<void, void, UiActionExamplesSetupDependencies, UiActionExamplesStartDependencies> {
public setup(core: CoreSetup, deps: UiActionExamplesSetupDependencies) {
deps.uiActions.registerTrigger(helloWorldTrigger);
public setup(core: CoreSetup, { uiActions }: UiActionExamplesSetupDependencies) {
uiActions.registerTrigger(helloWorldTrigger);
uiActions.attachAction(helloWorldTrigger.id, HELLO_WORLD_ACTION_TYPE);
}
public start(coreStart: CoreStart, deps: UiActionExamplesStartDependencies) {