kibana/examples/ui_action_examples/public/plugin.ts
Nathan Reese 33077eaa99
Add overview section to actions and triggers example (#175152)
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>
2024-01-22 09:05:13 -07:00

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() {}
}