Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Screenshot mode] Move the example app to developer examples #101464

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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