mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Adds locators for the playground app in the enterprise search and search playground plugins. These will be used by the file upload tool to link to Playground after a successful upload. https://github.com/elastic/kibana/pull/186956 These locators are not registered in the observability or security serverless projects, and so the file upload plugin will not render the link to Playground. Note to reviewers, I originally attempted to have one common locator class which would be used by both plugins, this turned out to be more trouble due to cross plugin import restrictions, plus I was concerned the increase to the enterprise search bundle would be larger than the size of the duplicated function. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
74 lines
2.2 KiB
TypeScript
74 lines
2.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; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import type {
|
|
CoreSetup,
|
|
Plugin,
|
|
CoreStart,
|
|
AppMountParameters,
|
|
PluginInitializerContext,
|
|
} from '@kbn/core/public';
|
|
import { PLUGIN_ID, PLUGIN_NAME } from '../common';
|
|
import { docLinks } from '../common/doc_links';
|
|
import { PlaygroundHeaderDocs } from './components/playground_header_docs';
|
|
import { Playground, getPlaygroundProvider } from './embeddable';
|
|
import type {
|
|
AppPluginSetupDependencies,
|
|
AppPluginStartDependencies,
|
|
SearchPlaygroundConfigType,
|
|
SearchPlaygroundPluginSetup,
|
|
SearchPlaygroundPluginStart,
|
|
} from './types';
|
|
import { registerLocators } from './locators';
|
|
|
|
export class SearchPlaygroundPlugin
|
|
implements Plugin<SearchPlaygroundPluginSetup, SearchPlaygroundPluginStart>
|
|
{
|
|
private config: SearchPlaygroundConfigType;
|
|
|
|
constructor(initializerContext: PluginInitializerContext) {
|
|
this.config = initializerContext.config.get<SearchPlaygroundConfigType>();
|
|
}
|
|
|
|
public setup(
|
|
core: CoreSetup<AppPluginStartDependencies, SearchPlaygroundPluginStart>,
|
|
deps: AppPluginSetupDependencies
|
|
): SearchPlaygroundPluginSetup {
|
|
if (!this.config.ui?.enabled) return {};
|
|
|
|
core.application.register({
|
|
id: PLUGIN_ID,
|
|
appRoute: '/app/search_playground',
|
|
title: PLUGIN_NAME,
|
|
async mount({ element, history }: AppMountParameters) {
|
|
const { renderApp } = await import('./application');
|
|
const [coreStart, depsStart] = await core.getStartServices();
|
|
const startDeps: AppPluginStartDependencies = {
|
|
...depsStart,
|
|
history,
|
|
};
|
|
|
|
return renderApp(coreStart, startDeps, element);
|
|
},
|
|
});
|
|
|
|
registerLocators(deps.share);
|
|
|
|
return {};
|
|
}
|
|
|
|
public start(core: CoreStart, deps: AppPluginStartDependencies): SearchPlaygroundPluginStart {
|
|
docLinks.setDocLinks(core.docLinks.links);
|
|
return {
|
|
PlaygroundProvider: getPlaygroundProvider(core, deps),
|
|
Playground,
|
|
PlaygroundHeaderDocs,
|
|
};
|
|
}
|
|
|
|
public stop() {}
|
|
}
|