mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
84 lines
2.9 KiB
TypeScript
84 lines
2.9 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 { AppMountParameters, CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
|
import { i18n } from '@kbn/i18n';
|
|
import { appIds } from '@kbn/management-cards-navigation';
|
|
import { createServerlessSearchSideNavComponent as createComponent } from './layout/nav';
|
|
import { docLinks } from '../common/doc_links';
|
|
import {
|
|
ServerlessSearchPluginSetup,
|
|
ServerlessSearchPluginSetupDependencies,
|
|
ServerlessSearchPluginStart,
|
|
ServerlessSearchPluginStartDependencies,
|
|
} from './types';
|
|
|
|
export class ServerlessSearchPlugin
|
|
implements
|
|
Plugin<
|
|
ServerlessSearchPluginSetup,
|
|
ServerlessSearchPluginStart,
|
|
ServerlessSearchPluginSetupDependencies,
|
|
ServerlessSearchPluginStartDependencies
|
|
>
|
|
{
|
|
public setup(
|
|
core: CoreSetup<ServerlessSearchPluginStartDependencies, ServerlessSearchPluginStart>,
|
|
_setupDeps: ServerlessSearchPluginSetupDependencies
|
|
): ServerlessSearchPluginSetup {
|
|
core.application.register({
|
|
id: 'serverlessElasticsearch',
|
|
title: i18n.translate('xpack.serverlessSearch.app.elasticsearch.title', {
|
|
defaultMessage: 'Elasticsearch',
|
|
}),
|
|
appRoute: '/app/elasticsearch',
|
|
async mount({ element }: AppMountParameters) {
|
|
const { renderApp } = await import('./application/elasticsearch');
|
|
const [coreStart, services] = await core.getStartServices();
|
|
const { security } = services;
|
|
docLinks.setDocLinks(coreStart.docLinks.links);
|
|
|
|
const userProfile = await security.userProfiles.getCurrent();
|
|
|
|
return await renderApp(element, coreStart, { userProfile, ...services });
|
|
},
|
|
});
|
|
core.application.register({
|
|
id: 'serverlessIndexingApi',
|
|
title: i18n.translate('xpack.serverlessSearch.app.indexingApi.title', {
|
|
defaultMessage: 'Indexing API',
|
|
}),
|
|
appRoute: '/app/indexing_api',
|
|
async mount({ element }: AppMountParameters) {
|
|
const { renderApp } = await import('./application/indexing_api');
|
|
const [coreStart, services] = await core.getStartServices();
|
|
const { security } = services;
|
|
docLinks.setDocLinks(coreStart.docLinks.links);
|
|
|
|
const userProfile = await security.userProfiles.getCurrent();
|
|
|
|
return await renderApp(element, coreStart, { userProfile, ...services });
|
|
},
|
|
});
|
|
return {};
|
|
}
|
|
|
|
public start(
|
|
core: CoreStart,
|
|
{ serverless, management }: ServerlessSearchPluginStartDependencies
|
|
): ServerlessSearchPluginStart {
|
|
serverless.setProjectHome('/app/elasticsearch');
|
|
serverless.setSideNavComponent(createComponent(core, { serverless }));
|
|
management.setupCardsNavigation({
|
|
enabled: true,
|
|
hideLinksTo: [appIds.MAINTENANCE_WINDOWS],
|
|
});
|
|
return {};
|
|
}
|
|
|
|
public stop() {}
|
|
}
|