mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
PR updates actions and triggers example with an "Overview" section better explaining the top level concepts. PR also re-works the hello world example to have a better explaination of what it does and simplify the example ### before <img width="800" alt="Screenshot 2024-01-18 at 12 08 44 PM" src="5969b35e
-a307-402a-aba4-a5b4ffa9920b"> ### after <img width="800" alt="Screenshot 2024-01-18 at 12 06 46 PM" src="e2eb416e
-c7a0-4a04-83e8-2383fbe12dae"> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
* Side Public License, v 1.
|
|
*/
|
|
|
|
import { Plugin, CoreSetup, CoreStart } from '@kbn/core/public';
|
|
import { UiActionsSetup, UiActionsStart } from '@kbn/ui-actions-plugin/public';
|
|
import { createHelloWorldActionDefinition } from './hello_world_action';
|
|
import { helloWorldTrigger } from './hello_world_trigger';
|
|
|
|
export interface UiActionExamplesSetupDependencies {
|
|
uiActions: UiActionsSetup;
|
|
}
|
|
|
|
export interface UiActionExamplesStartDependencies {
|
|
uiActions: UiActionsStart;
|
|
}
|
|
|
|
export class UiActionExamplesPlugin
|
|
implements
|
|
Plugin<void, void, UiActionExamplesSetupDependencies, UiActionExamplesStartDependencies>
|
|
{
|
|
public setup(
|
|
core: CoreSetup<UiActionExamplesStartDependencies>,
|
|
{ uiActions }: UiActionExamplesSetupDependencies
|
|
) {
|
|
uiActions.registerTrigger(helloWorldTrigger);
|
|
|
|
const helloWorldAction = createHelloWorldActionDefinition(async () => ({
|
|
openModal: (await core.getStartServices())[0].overlays.openModal,
|
|
}));
|
|
|
|
uiActions.addTriggerAction(helloWorldTrigger.id, helloWorldAction);
|
|
}
|
|
|
|
public start(core: CoreStart, plugins: UiActionExamplesStartDependencies) {}
|
|
|
|
public stop() {}
|
|
}
|