mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[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>
This commit is contained in:
parent
f90a89a839
commit
e7746b24d5
30 changed files with 165 additions and 105 deletions
|
@ -7,7 +7,7 @@
|
|||
"githubTeam": "platform-onboarding"
|
||||
},
|
||||
"description": "Example plugin to consume guidedOnboarding",
|
||||
"server": false,
|
||||
"server": true,
|
||||
"ui": true,
|
||||
"requiredPlugins": ["navigation", "guidedOnboarding"],
|
||||
"optionalPlugins": []
|
||||
|
|
12
examples/guided_onboarding_example/server/index.ts
Normal file
12
examples/guided_onboarding_example/server/index.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* 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 { PluginInitializerContext } from '@kbn/core/server';
|
||||
import { GuidedOnboardingExamplePlugin } from './plugin';
|
||||
|
||||
export const plugin = (ctx: PluginInitializerContext) => new GuidedOnboardingExamplePlugin(ctx);
|
36
examples/guided_onboarding_example/server/plugin.ts
Normal file
36
examples/guided_onboarding_example/server/plugin.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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() {}
|
||||
}
|
13
examples/guided_onboarding_example/server/types.ts
Normal file
13
examples/guided_onboarding_example/server/types.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface GuidedOnboardingExamplePluginSetup {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface GuidedOnboardingExamplePluginStart {}
|
Loading…
Add table
Add a link
Reference in a new issue