diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index bde1a2bd0130a..2f51b5496d505 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -550,6 +550,7 @@ packages/kbn-server-http-tools @elastic/kibana-core packages/kbn-server-route-repository @elastic/apm-ui x-pack/plugins/serverless @elastic/appex-sharedux x-pack/plugins/serverless_observability @elastic/appex-sharedux +x-pack/plugins/serverless_search @elastic/appex-sharedux @elastic/enterprise-search-frontend x-pack/plugins/serverless_security @elastic/appex-sharedux test/plugin_functional/plugins/session_notifications @elastic/kibana-core x-pack/plugins/session_view @elastic/awp-viz diff --git a/config/serverless.es.yml b/config/serverless.es.yml index e69de29bb2d1d..73e90be302b27 100644 --- a/config/serverless.es.yml +++ b/config/serverless.es.yml @@ -0,0 +1,10 @@ +xpack.apm.enabled: false +xpack.canvas.enabled: false +xpack.reporting.enabled: false +xpack.uptime.enabled: false +xpack.watcher.enabled: false + +enterpriseSearch.enabled: true +xpack.serverless.search.enabled: true + +uiSettings.overrides.defaultRoute: /app/enterprise_search/content/search_indices diff --git a/package.json b/package.json index 7ed4bec311ce1..f87a556292ccd 100644 --- a/package.json +++ b/package.json @@ -552,6 +552,7 @@ "@kbn/server-route-repository": "link:packages/kbn-server-route-repository", "@kbn/serverless": "link:x-pack/plugins/serverless", "@kbn/serverless-observability": "link:x-pack/plugins/serverless_observability", + "@kbn/serverless-search": "link:x-pack/plugins/serverless_search", "@kbn/serverless-security": "link:x-pack/plugins/serverless_security", "@kbn/session-notifications-plugin": "link:test/plugin_functional/plugins/session_notifications", "@kbn/session-view-plugin": "link:x-pack/plugins/session_view", diff --git a/src/plugins/management/public/components/management_app/management_app.tsx b/src/plugins/management/public/components/management_app/management_app.tsx index bc0b88e7dffcb..f0a3eb57db139 100644 --- a/src/plugins/management/public/components/management_app/management_app.tsx +++ b/src/plugins/management/public/components/management_app/management_app.tsx @@ -34,6 +34,7 @@ export interface ManagementAppDependencies { sections: SectionsServiceStart; kibanaVersion: string; setBreadcrumbs: (newBreadcrumbs: ChromeBreadcrumb[]) => void; + getIsSidebarEnabled: () => boolean; } export const ManagementApp = ({ dependencies, history, theme$ }: ManagementAppProps) => { @@ -75,18 +76,21 @@ export const ManagementApp = ({ dependencies, history, theme$ }: ManagementAppPr return null; } - const solution: KibanaPageTemplateProps['solutionNav'] = { - name: i18n.translate('management.nav.label', { - defaultMessage: 'Management', - }), - icon: 'managementApp', - 'data-test-subj': 'mgtSideBarNav', - items: managementSidebarNav({ - selectedId, - sections, - history, - }), - }; + const solution: KibanaPageTemplateProps['solutionNav'] | undefined = + dependencies.getIsSidebarEnabled() + ? { + name: i18n.translate('management.nav.label', { + defaultMessage: 'Management', + }), + icon: 'managementApp', + 'data-test-subj': 'mgtSideBarNav', + items: managementSidebarNav({ + selectedId, + sections, + history, + }), + } + : undefined; return ( diff --git a/src/plugins/management/public/plugin.ts b/src/plugins/management/public/plugin.ts index 0cdb83d4b6793..39de850e2c72a 100644 --- a/src/plugins/management/public/plugin.ts +++ b/src/plugins/management/public/plugin.ts @@ -71,6 +71,8 @@ export class ManagementPlugin private hasAnyEnabledApps = true; + private isSidebarEnabled = true; + constructor(private initializerContext: PluginInitializerContext) {} public setup(core: CoreSetup, { home, share }: ManagementSetupDependencies) { @@ -93,6 +95,7 @@ export class ManagementPlugin visible: () => this.hasAnyEnabledApps, }); } + const managementPlugin = this; core.application.register({ id: MANAGEMENT_APP_ID, @@ -111,6 +114,7 @@ export class ManagementPlugin sections: getSectionsServiceStartPrivate(), kibanaVersion, setBreadcrumbs: coreStart.chrome.setBreadcrumbs, + getIsSidebarEnabled: () => managementPlugin.isSidebarEnabled, }); }, }); @@ -118,6 +122,9 @@ export class ManagementPlugin return { sections: this.managementSections.setup(), locator, + setIsSidebarEnabled: (enabled: boolean) => { + this.isSidebarEnabled = enabled; + }, }; } diff --git a/src/plugins/management/public/types.ts b/src/plugins/management/public/types.ts index 5d8d963ea981e..b9896a0e38b21 100644 --- a/src/plugins/management/public/types.ts +++ b/src/plugins/management/public/types.ts @@ -16,6 +16,7 @@ import type { ManagementAppLocatorParams } from '../common/locator'; export interface ManagementSetup { sections: SectionsServiceSetup; locator: LocatorPublic; + setIsSidebarEnabled: (enabled: boolean) => void; } export interface DefinedSections { diff --git a/tsconfig.base.json b/tsconfig.base.json index e4945d1b028b5..5485c5c3b09ac 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1094,6 +1094,8 @@ "@kbn/serverless/*": ["x-pack/plugins/serverless/*"], "@kbn/serverless-observability": ["x-pack/plugins/serverless_observability"], "@kbn/serverless-observability/*": ["x-pack/plugins/serverless_observability/*"], + "@kbn/serverless-search": ["x-pack/plugins/serverless_search"], + "@kbn/serverless-search/*": ["x-pack/plugins/serverless_search/*"], "@kbn/serverless-security": ["x-pack/plugins/serverless_security"], "@kbn/serverless-security/*": ["x-pack/plugins/serverless_security/*"], "@kbn/session-notifications-plugin": ["test/plugin_functional/plugins/session_notifications"], diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/header_actions/header_actions.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/header_actions/header_actions.tsx index f6cb956478fde..4d6ca941351f5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/header_actions/header_actions.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/header_actions/header_actions.tsx @@ -15,15 +15,22 @@ import { SearchEnginesPopover } from './search_engines_popover'; import { SyncsContextMenu } from './syncs_context_menu'; // Used to populate rightSideItems of an EuiPageTemplate, which is rendered right-to-left -export const getHeaderActions = (indexData?: ElasticsearchIndexWithIngestion) => { +export const getHeaderActions = ( + indexData?: ElasticsearchIndexWithIngestion, + hasAppSearchAccess?: boolean +) => { const ingestionMethod = getIngestionMethod(indexData); return [ ...(isCrawlerIndex(indexData) && indexData.connector ? [] : []), ...(isConnectorIndex(indexData) ? [] : []), - , + ...(hasAppSearchAccess || hasAppSearchAccess === undefined + ? [ + , + ] + : []), ]; }; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/search_index.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/search_index.tsx index 52ae6628f8081..ab85ee26ba12e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/search_index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/search_index.tsx @@ -75,7 +75,10 @@ export const SearchIndex: React.FC = () => { * This needs to be checked for any of the 3 registered search guideIds * Putting it here guarantees that if a user is viewing an index with data, it'll be marked as complete */ - const { guidedOnboarding } = useValues(KibanaLogic); + const { + guidedOnboarding, + productAccess: { hasAppSearchAccess }, + } = useValues(KibanaLogic); const isAppGuideActive = useObservable( guidedOnboarding.guidedOnboardingApi!.isGuideStepActive$('appSearch', 'add_data') ); @@ -222,7 +225,7 @@ export const SearchIndex: React.FC = () => { isLoading={isInitialLoading} pageHeader={{ pageTitle: indexName, - rightSideItems: getHeaderActions(index), + rightSideItems: getHeaderActions(index, hasAppSearchAccess), }} > {isCrawlerIndex(index) && !index.connector ? ( diff --git a/x-pack/plugins/enterprise_search/public/applications/index.tsx b/x-pack/plugins/enterprise_search/public/applications/index.tsx index 11250d05a845e..5b3b050d72238 100644 --- a/x-pack/plugins/enterprise_search/public/applications/index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/index.tsx @@ -36,7 +36,17 @@ import { mountLicensingLogic } from './shared/licensing'; export const renderApp = ( App: React.FC, - { params, core, plugins }: { params: AppMountParameters; core: CoreStart; plugins: PluginsStart }, + { + params, + core, + plugins, + isSidebarEnabled, + }: { + params: AppMountParameters; + core: CoreStart; + plugins: PluginsStart; + isSidebarEnabled: boolean; + }, { config, data }: { config: ClientConfigType; data: ClientData } ) => { const { publicUrl, errorConnectingMessage, ...initialData } = data; @@ -64,6 +74,7 @@ export const renderApp = ( charts: plugins.charts, cloud: plugins.cloud, uiSettings: core.uiSettings, + isSidebarEnabled, guidedOnboarding: plugins.guidedOnboarding, history: params.history, navigateToUrl: core.application.navigateToUrl, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts index 070c273884772..418baa7050732 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts @@ -33,6 +33,7 @@ interface KibanaLogicProps { application: ApplicationStart; config: { host?: string }; productAccess: ProductAccess; + isSidebarEnabled: boolean; // Kibana core capabilities: Capabilities; history: ScopedHistory; @@ -49,6 +50,7 @@ interface KibanaLogicProps { // Optional plugins cloud?: CloudSetup; } + export interface KibanaValues extends Omit { cloud: Partial; isCloud: boolean; @@ -65,6 +67,7 @@ export const KibanaLogic = kea>({ cloud: [props.cloud || {}, {}], guidedOnboarding: [props.guidedOnboarding, {}], history: [props.history, {}], + isSidebarEnabled: [props.isSidebarEnabled, {}], navigateToUrl: [ (url: string, options?: CreateHrefOptions) => { const deps = { history: props.history, http: HttpLogic.values.http }; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/layout/nav.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/layout/nav.tsx index 8c7025312e387..b08a9256c42ed 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/layout/nav.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/layout/nav.tsx @@ -30,8 +30,9 @@ import { KibanaLogic } from '../kibana'; import { generateNavLink } from './nav_link_helpers'; export const useEnterpriseSearchNav = () => { - const { productAccess } = useValues(KibanaLogic); + const { isSidebarEnabled, productAccess } = useValues(KibanaLogic); + if (!isSidebarEnabled) return undefined; const enginesSectionEnabled = productAccess.hasSearchEnginesAccess; const navItems: Array> = [ @@ -243,6 +244,7 @@ export const useEnterpriseSearchNav = () => { export const useEnterpriseSearchEngineNav = (engineName?: string, isEmptyState?: boolean) => { const navItems = useEnterpriseSearchNav(); + if (!navItems) return undefined; if (!engineName) return navItems; const searchItem = navItems.find((item) => item.id === 'enginesSearch'); if (!searchItem || !searchItem.items) return navItems; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/layout/page_template.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/layout/page_template.tsx index 4793d11b56c76..d234b8374d0ae 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/layout/page_template.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/layout/page_template.tsx @@ -73,7 +73,11 @@ export const EnterpriseSearchPageTemplateWrapper: React.FC = ), }} isEmptyState={isEmptyState && !isLoading} - solutionNav={solutionNav ? { icon: 'logoEnterpriseSearch', ...solutionNav } : undefined} + solutionNav={ + solutionNav && solutionNav.items + ? { icon: 'logoEnterpriseSearch', ...solutionNav } + : undefined + } > {setPageChrome} {readOnlyMode && ( diff --git a/x-pack/plugins/enterprise_search/public/index.ts b/x-pack/plugins/enterprise_search/public/index.ts index b24616fc4b3d8..8dc84c6934e42 100644 --- a/x-pack/plugins/enterprise_search/public/index.ts +++ b/x-pack/plugins/enterprise_search/public/index.ts @@ -12,3 +12,5 @@ import { EnterpriseSearchPlugin } from './plugin'; export const plugin = (initializerContext: PluginInitializerContext) => { return new EnterpriseSearchPlugin(initializerContext); }; + +export type { EnterpriseSearchPublicSetup, EnterpriseSearchPublicStart } from './plugin'; diff --git a/x-pack/plugins/enterprise_search/public/plugin.ts b/x-pack/plugins/enterprise_search/public/plugin.ts index add4d9f69b56b..9aded65b54eb5 100644 --- a/x-pack/plugins/enterprise_search/public/plugin.ts +++ b/x-pack/plugins/enterprise_search/public/plugin.ts @@ -45,6 +45,9 @@ export interface ClientData extends InitialAppData { errorConnectingMessage?: string; } +export type EnterpriseSearchPublicSetup = ReturnType; +export type EnterpriseSearchPublicStart = ReturnType; + interface PluginsSetup { cloud?: CloudSetup; home?: HomePublicPluginSetup; @@ -64,6 +67,7 @@ export class EnterpriseSearchPlugin implements Plugin { private config: ClientConfigType; private hasInitialized: boolean = false; private data: ClientData = {} as ClientData; + private isSidebarEnabled: boolean = true; constructor(initializerContext: PluginInitializerContext) { this.config = initializerContext.config.get(); @@ -288,6 +292,14 @@ export class EnterpriseSearchPlugin implements Plugin { showOnHomePage: false, }); } + + return { + navigation: { + setIsSidebarEnabled: (enabled: boolean) => { + this.isSidebarEnabled = enabled; + }, + }, + }; } public start(core: CoreStart) { @@ -312,7 +324,7 @@ export class EnterpriseSearchPlugin implements Plugin { : undefined; const plugins = { ...pluginsStart, cloud } as PluginsStart; - return { params, core: coreStart, plugins }; + return { params, core: coreStart, plugins, isSidebarEnabled: this.isSidebarEnabled }; } private getPluginData() { diff --git a/x-pack/plugins/serverless_search/.gitignore b/x-pack/plugins/serverless_search/.gitignore new file mode 100644 index 0000000000000..c3dca1b96fcc2 --- /dev/null +++ b/x-pack/plugins/serverless_search/.gitignore @@ -0,0 +1,2 @@ +/build +/target diff --git a/x-pack/plugins/serverless_search/.i18nrc.json b/x-pack/plugins/serverless_search/.i18nrc.json new file mode 100644 index 0000000000000..7b0dcef6895ed --- /dev/null +++ b/x-pack/plugins/serverless_search/.i18nrc.json @@ -0,0 +1,9 @@ +{ + "prefix": "serverlessSearch", + "paths": { + "serverlessSearch": "." + }, + "translations": [ + "translations/ja-JP.json" + ] +} diff --git a/x-pack/plugins/serverless_search/README.md b/x-pack/plugins/serverless_search/README.md new file mode 100755 index 0000000000000..9758a7616785d --- /dev/null +++ b/x-pack/plugins/serverless_search/README.md @@ -0,0 +1,3 @@ +# serverlessSearch + +A witty, fitting description to come. diff --git a/x-pack/plugins/serverless_search/common/index.ts b/x-pack/plugins/serverless_search/common/index.ts new file mode 100644 index 0000000000000..539748f2cea38 --- /dev/null +++ b/x-pack/plugins/serverless_search/common/index.ts @@ -0,0 +1,9 @@ +/* + * 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. + */ + +export const PLUGIN_ID = 'serverlessSearch'; +export const PLUGIN_NAME = 'serverlessSearch'; diff --git a/x-pack/plugins/serverless_search/kibana.jsonc b/x-pack/plugins/serverless_search/kibana.jsonc new file mode 100644 index 0000000000000..b548823567ce0 --- /dev/null +++ b/x-pack/plugins/serverless_search/kibana.jsonc @@ -0,0 +1,23 @@ +{ + "type": "plugin", + "id": "@kbn/serverless-search", + "owner": "@elastic/appex-sharedux", + "description": "Serverless customizations for search.", + "plugin": { + "id": "serverlessSearch", + "server": true, + "browser": true, + "configPath": [ + "xpack", + "serverless", + "search" + ], + "requiredPlugins": [ + "serverless", + "enterpriseSearch", + "management" + ], + "optionalPlugins": [], + "requiredBundles": [] + } +} diff --git a/x-pack/plugins/serverless_search/package.json b/x-pack/plugins/serverless_search/package.json new file mode 100644 index 0000000000000..b7820231076ee --- /dev/null +++ b/x-pack/plugins/serverless_search/package.json @@ -0,0 +1,11 @@ +{ + "name": "@kbn/serverless-search", + "version": "1.0.0", + "license": "Elastic License 2.0", + "private": true, + "scripts": { + "build": "yarn plugin-helpers build", + "plugin-helpers": "node ../../../scripts/plugin_helpers", + "kbn": "node ../../../scripts/kbn" + } +} diff --git a/x-pack/plugins/serverless_search/public/index.ts b/x-pack/plugins/serverless_search/public/index.ts new file mode 100644 index 0000000000000..5031ccc61d1ac --- /dev/null +++ b/x-pack/plugins/serverless_search/public/index.ts @@ -0,0 +1,16 @@ +/* + * 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 { ServerlessSearchPlugin } from './plugin'; + +// This exports static code and TypeScript types, +// as well as, Kibana Platform `plugin()` initializer. +export function plugin() { + return new ServerlessSearchPlugin(); +} + +export type { ServerlessSearchPluginSetup, ServerlessSearchPluginStart } from './types'; diff --git a/x-pack/plugins/serverless_search/public/layout/nav.tsx b/x-pack/plugins/serverless_search/public/layout/nav.tsx new file mode 100644 index 0000000000000..b4ebbf328da1a --- /dev/null +++ b/x-pack/plugins/serverless_search/public/layout/nav.tsx @@ -0,0 +1,54 @@ +/* + * 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 React from 'react'; +import { EuiCollapsibleNavGroup, EuiListGroup } from '@elastic/eui'; +import { ApplicationStart, HttpSetup } from '@kbn/core/public'; + +export interface ServerlessSearchCollapsibleNavigationProps { + http: HttpSetup; + navigateToUrl: ApplicationStart['navigateToUrl']; +} + +export const ServerlessSearchCollapsibleNavigation = ({ + http, + navigateToUrl, +}: ServerlessSearchCollapsibleNavigationProps) => { + const navigateTo = (url: string) => () => { + navigateToUrl(http.basePath.prepend(url)); + }; + const navItems = [ + { + label: 'Overview', + onClick: navigateTo('/app/enterprise_search/overview'), + }, + { + label: 'Indices', + onClick: navigateTo('/app/enterprise_search/content/search_indices'), + }, + { + label: 'Engines', + onClick: navigateTo('/app/enterprise_search/content/engines'), + }, + { + label: 'API keys', + onClick: navigateTo('/app/management/security/api_keys'), + }, + { + label: 'Ingest pipelines', + onClick: navigateTo('/app/management/ingest/ingest_pipelines'), + }, + ]; + + return ( + <> + + + + + ); +}; diff --git a/x-pack/plugins/serverless_search/public/plugin.tsx b/x-pack/plugins/serverless_search/public/plugin.tsx new file mode 100644 index 0000000000000..1b2a29452ca9d --- /dev/null +++ b/x-pack/plugins/serverless_search/public/plugin.tsx @@ -0,0 +1,45 @@ +/* + * 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 React from 'react'; +import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public'; +import { + ServerlessSearchPluginSetup, + ServerlessSearchPluginSetupDependencies, + ServerlessSearchPluginStart, + ServerlessSearchPluginStartDependencies, +} from './types'; + +import { ServerlessSearchCollapsibleNavigation } from './layout/nav'; + +export class ServerlessSearchPlugin + implements Plugin +{ + public setup( + _core: CoreSetup, + setupDeps: ServerlessSearchPluginSetupDependencies + ): ServerlessSearchPluginSetup { + setupDeps.enterpriseSearch.navigation.setIsSidebarEnabled(false); + setupDeps.management.setIsSidebarEnabled(false); + return {}; + } + + public start( + core: CoreStart, + { serverless }: ServerlessSearchPluginStartDependencies + ): ServerlessSearchPluginStart { + serverless.setServerlessNavigation( + + ); + return {}; + } + + public stop() {} +} diff --git a/x-pack/plugins/serverless_search/public/types.ts b/x-pack/plugins/serverless_search/public/types.ts new file mode 100644 index 0000000000000..ad66e6df85c74 --- /dev/null +++ b/x-pack/plugins/serverless_search/public/types.ts @@ -0,0 +1,31 @@ +/* + * 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 { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public'; +import { ManagementSetup, ManagementStart } from '@kbn/management-plugin/public'; +import { + EnterpriseSearchPublicSetup, + EnterpriseSearchPublicStart, +} from '@kbn/enterprise-search-plugin/public'; + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ServerlessSearchPluginSetup {} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ServerlessSearchPluginStart {} + +export interface ServerlessSearchPluginSetupDependencies { + enterpriseSearch: EnterpriseSearchPublicSetup; + management: ManagementSetup; + serverless: ServerlessPluginSetup; +} + +export interface ServerlessSearchPluginStartDependencies { + enterpriseSearch: EnterpriseSearchPublicStart; + management: ManagementStart; + serverless: ServerlessPluginStart; +} diff --git a/x-pack/plugins/serverless_search/server/config.ts b/x-pack/plugins/serverless_search/server/config.ts new file mode 100644 index 0000000000000..546c594aaabfb --- /dev/null +++ b/x-pack/plugins/serverless_search/server/config.ts @@ -0,0 +1,23 @@ +/* + * 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 { schema, TypeOf } from '@kbn/config-schema'; +import { PluginConfigDescriptor } from '@kbn/core/server'; + +export * from './types'; + +const configSchema = schema.object({ + enabled: schema.boolean({ defaultValue: false }), +}); + +type ConfigType = TypeOf; + +export const config: PluginConfigDescriptor = { + schema: configSchema, +}; + +export type ServerlessSearchConfig = TypeOf; diff --git a/x-pack/plugins/serverless_search/server/index.ts b/x-pack/plugins/serverless_search/server/index.ts new file mode 100644 index 0000000000000..90e0b170d4a71 --- /dev/null +++ b/x-pack/plugins/serverless_search/server/index.ts @@ -0,0 +1,20 @@ +/* + * 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 { PluginInitializerContext } from '@kbn/core/server'; + +import { ServerlessSearchPlugin } from './plugin'; +export { config } from './config'; + +// This exports static code and TypeScript types, +// as well as, Kibana Platform `plugin()` initializer. + +export function plugin(initializerContext: PluginInitializerContext) { + return new ServerlessSearchPlugin(initializerContext); +} + +export type { ServerlessSearchPluginSetup, ServerlessSearchPluginStart } from './types'; diff --git a/x-pack/plugins/serverless_search/server/plugin.ts b/x-pack/plugins/serverless_search/server/plugin.ts new file mode 100644 index 0000000000000..99d9bf01da0df --- /dev/null +++ b/x-pack/plugins/serverless_search/server/plugin.ts @@ -0,0 +1,26 @@ +/* + * 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 { PluginInitializerContext, Plugin } from '@kbn/core/server'; + +import { ServerlessSearchPluginSetup, ServerlessSearchPluginStart } from './types'; + +export class ServerlessSearchPlugin + implements Plugin +{ + constructor(_initializerContext: PluginInitializerContext) {} + + public setup() { + return {}; + } + + public start() { + return {}; + } + + public stop() {} +} diff --git a/x-pack/plugins/serverless_search/server/types.ts b/x-pack/plugins/serverless_search/server/types.ts new file mode 100644 index 0000000000000..6011e2eb60fa0 --- /dev/null +++ b/x-pack/plugins/serverless_search/server/types.ts @@ -0,0 +1,11 @@ +/* + * 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. + */ + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ServerlessSearchPluginSetup {} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ServerlessSearchPluginStart {} diff --git a/x-pack/plugins/serverless_search/tsconfig.json b/x-pack/plugins/serverless_search/tsconfig.json new file mode 100644 index 0000000000000..c8150e5a71926 --- /dev/null +++ b/x-pack/plugins/serverless_search/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types" + }, + "include": [ + "index.ts", + "common/**/*.ts", + "public/**/*.ts", + "public/**/*.tsx", + "server/**/*.ts", + "../../../typings/**/*" + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + "@kbn/core", + "@kbn/config-schema", + "@kbn/enterprise-search-plugin", + "@kbn/management-plugin", + "@kbn/serverless", + ] +} diff --git a/yarn.lock b/yarn.lock index 94adb6357e773..a120dc38f04bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4921,6 +4921,10 @@ version "0.0.0" uid "" +"@kbn/serverless-search@link:x-pack/plugins/serverless_search": + version "0.0.0" + uid "" + "@kbn/serverless-security@link:x-pack/plugins/serverless_security": version "0.0.0" uid ""