Skip to content

Commit

Permalink
move the example app to be mounted in the developerExamples plugin in…
Browse files Browse the repository at this point in the history
…stead of visible in navbar (elastic#101464)

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
jloleysens and kibanamachine committed Jun 14, 2021
1 parent 45ef7ba commit 919d55f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/screenshot_mode_example/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["navigation", "screenshotMode", "usageCollection"],
"requiredPlugins": ["navigation", "screenshotMode", "usageCollection", "developerExamples"],
"optionalPlugins": []
}
18 changes: 16 additions & 2 deletions examples/screenshot_mode_example/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
* Side Public License, v 1.
*/

import { AppMountParameters, CoreSetup, CoreStart, Plugin } from '../../../src/core/public';
import {
AppMountParameters,
CoreSetup,
CoreStart,
Plugin,
AppNavLinkStatus,
} from '../../../src/core/public';
import { AppPluginSetupDependencies, AppPluginStartDependencies } from './types';
import { MetricsTracking } from './services';
import { PLUGIN_NAME } from '../common';
Expand All @@ -15,7 +21,7 @@ export class ScreenshotModeExamplePlugin implements Plugin<void, void> {
uiTracking = new MetricsTracking();

public setup(core: CoreSetup, depsSetup: AppPluginSetupDependencies): void {
const { screenshotMode, usageCollection } = depsSetup;
const { screenshotMode, usageCollection, developerExamples } = depsSetup;
const isScreenshotMode = screenshotMode.isScreenshotMode();

this.uiTracking.setup({
Expand All @@ -27,6 +33,7 @@ export class ScreenshotModeExamplePlugin implements Plugin<void, void> {
core.application.register({
id: 'screenshotModeExample',
title: PLUGIN_NAME,
navLinkStatus: AppNavLinkStatus.hidden,
async mount(params: AppMountParameters) {
// Load application bundle
const { renderApp } = await import('./application');
Expand All @@ -40,6 +47,13 @@ export class ScreenshotModeExamplePlugin implements Plugin<void, void> {
return renderApp(coreStart, depsSetup, depsStart as AppPluginStartDependencies, params);
},
});

developerExamples.register({
appId: 'screenshotModeExample',
title: 'Screenshot mode integration',
description:
'Demonstrate how a plugin can adapt appearance based on whether we are in screenshot mode',
});
}

public start(core: CoreStart): void {}
Expand Down
2 changes: 2 additions & 0 deletions examples/screenshot_mode_example/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public';
import { ScreenshotModePluginSetup } from '../../../src/plugins/screenshot_mode/public';
import { UsageCollectionSetup } from '../../../src/plugins/usage_collection/public';
import { DeveloperExamplesSetup } from '../../developer_examples/public';

export interface AppPluginSetupDependencies {
usageCollection: UsageCollectionSetup;
screenshotMode: ScreenshotModePluginSetup;
developerExamples: DeveloperExamplesSetup;
}

export interface AppPluginStartDependencies {
Expand Down

0 comments on commit 919d55f

Please sign in to comment.