kibana/examples/guided_onboarding_example/server/plugin.ts
Yulia Čech e7746b24d5
[Guided onboarding] Register test guide in the example plugin (#147703)
This PR moves the test guide used for testing and dev work to the guided
onboarding package. It is now being registered when the guided
onboarding example plugin is being setup. For that a server side is
added to the example plugin.
Registering the test guide from the example plugin demonstrates how the
"register guide" function can be used for production guides. The test
config needs to be in the `kbn-guided-onboarding` package because
example plugins have some problems importing files from other plugins.
That way the test config is available to the example plugin and to the
guided onboarding plugin for unit and functional tests.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-20 03:29:25 -07:00

36 lines
1.2 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 { GuidedOnboardingPluginSetup } from '@kbn/guided-onboarding-plugin/server';
import { PluginInitializerContext, CoreSetup, Plugin, Logger } from '@kbn/core/server';
import { testGuideId, testGuideConfig } from '@kbn/guided-onboarding';
interface PluginsSetup {
guidedOnboarding: GuidedOnboardingPluginSetup;
}
export class GuidedOnboardingExamplePlugin implements Plugin {
private readonly logger: Logger;
constructor(initializerContext: PluginInitializerContext) {
this.logger = initializerContext.logger.get();
}
public setup(coreSetup: CoreSetup, { guidedOnboarding }: PluginsSetup) {
this.logger.debug('guidedOnboardingExample: Setup');
guidedOnboarding.registerGuideConfig(testGuideId, testGuideConfig);
return {};
}
public start() {
this.logger.debug('guidedOnboardingExample: Started');
return {};
}
public stop() {}
}