From d823150b43351018aacbac7e405785af1a770045 Mon Sep 17 00:00:00 2001 From: Rodney Norris Date: Mon, 19 Aug 2024 21:59:28 +0000 Subject: [PATCH] search_indices: scaffold empty plugin --- .github/CODEOWNERS | 1 + docs/developer/plugin-list.asciidoc | 4 ++ package.json | 1 + packages/kbn-optimizer/limits.yml | 1 + tsconfig.base.json | 2 + x-pack/.i18nrc.json | 1 + x-pack/plugins/search_indices/README.mdx | 3 ++ x-pack/plugins/search_indices/common/index.ts | 9 ++++ x-pack/plugins/search_indices/jest.config.js | 15 +++++++ x-pack/plugins/search_indices/kibana.jsonc | 23 ++++++++++ x-pack/plugins/search_indices/public/index.ts | 15 +++++++ .../plugins/search_indices/public/plugin.ts | 23 ++++++++++ x-pack/plugins/search_indices/public/types.ts | 17 +++++++ .../plugins/search_indices/server/config.ts | 19 ++++++++ x-pack/plugins/search_indices/server/index.ts | 17 +++++++ .../plugins/search_indices/server/plugin.ts | 45 +++++++++++++++++++ .../search_indices/server/routes/index.ts | 10 +++++ x-pack/plugins/search_indices/server/types.ts | 11 +++++ x-pack/plugins/search_indices/tsconfig.json | 21 +++++++++ x-pack/plugins/serverless_search/kibana.jsonc | 1 + yarn.lock | 4 ++ 21 files changed, 243 insertions(+) create mode 100644 x-pack/plugins/search_indices/README.mdx create mode 100644 x-pack/plugins/search_indices/common/index.ts create mode 100644 x-pack/plugins/search_indices/jest.config.js create mode 100644 x-pack/plugins/search_indices/kibana.jsonc create mode 100644 x-pack/plugins/search_indices/public/index.ts create mode 100644 x-pack/plugins/search_indices/public/plugin.ts create mode 100644 x-pack/plugins/search_indices/public/types.ts create mode 100644 x-pack/plugins/search_indices/server/config.ts create mode 100644 x-pack/plugins/search_indices/server/index.ts create mode 100644 x-pack/plugins/search_indices/server/plugin.ts create mode 100644 x-pack/plugins/search_indices/server/routes/index.ts create mode 100644 x-pack/plugins/search_indices/server/types.ts create mode 100644 x-pack/plugins/search_indices/tsconfig.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c3cab77ee6951..a7040cc54cf58 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -735,6 +735,7 @@ packages/kbn-search-errors @elastic/kibana-data-discovery examples/search_examples @elastic/kibana-data-discovery x-pack/plugins/search_homepage @elastic/search-kibana packages/kbn-search-index-documents @elastic/search-kibana +x-pack/plugins/search_indices @elastic/search-kibana x-pack/plugins/search_inference_endpoints @elastic/search-kibana x-pack/plugins/search_notebooks @elastic/search-kibana x-pack/plugins/search_playground @elastic/search-kibana diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 49b5755243076..f341379f515cb 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -803,6 +803,10 @@ It uses Chromium and Puppeteer underneath to run the browser in headless mode. |The Search Homepage is a shared homepage for elasticsearch users. +|{kib-repo}blob/{branch}/x-pack/plugins/search_indices/README.mdx[searchIndices] +|The Search Indices plugin is a shared set of pages for elasticsearch users across stack and serverless search solutions. + + |{kib-repo}blob/{branch}/x-pack/plugins/search_inference_endpoints/README.md[searchInferenceEndpoints] |The Inference Endpoints is a tool used to manage inference endpoints diff --git a/package.json b/package.json index 3a0c99e9940be..504213c09d64f 100644 --- a/package.json +++ b/package.json @@ -752,6 +752,7 @@ "@kbn/search-examples-plugin": "link:examples/search_examples", "@kbn/search-homepage": "link:x-pack/plugins/search_homepage", "@kbn/search-index-documents": "link:packages/kbn-search-index-documents", + "@kbn/search-indices": "link:x-pack/plugins/search_indices", "@kbn/search-inference-endpoints": "link:x-pack/plugins/search_inference_endpoints", "@kbn/search-notebooks": "link:x-pack/plugins/search_notebooks", "@kbn/search-playground": "link:x-pack/plugins/search_playground", diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index a33156e376972..d7a44cb37f42c 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -138,6 +138,7 @@ pageLoadAssetSize: screenshotting: 22870 searchConnectors: 30000 searchHomepage: 19831 + searchIndices: 20519 searchInferenceEndpoints: 20470 searchNotebooks: 18942 searchPlayground: 19325 diff --git a/tsconfig.base.json b/tsconfig.base.json index d063f6a880441..970911bb69a10 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1464,6 +1464,8 @@ "@kbn/search-homepage/*": ["x-pack/plugins/search_homepage/*"], "@kbn/search-index-documents": ["packages/kbn-search-index-documents"], "@kbn/search-index-documents/*": ["packages/kbn-search-index-documents/*"], + "@kbn/search-indices": ["x-pack/plugins/search_indices"], + "@kbn/search-indices/*": ["x-pack/plugins/search_indices/*"], "@kbn/search-inference-endpoints": ["x-pack/plugins/search_inference_endpoints"], "@kbn/search-inference-endpoints/*": ["x-pack/plugins/search_inference_endpoints/*"], "@kbn/search-notebooks": ["x-pack/plugins/search_notebooks"], diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 7ff0f3e3ef766..2862d8e23b78e 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -98,6 +98,7 @@ "xpack.runtimeFields": "plugins/runtime_fields", "xpack.screenshotting": "plugins/screenshotting", "xpack.searchHomepage": "plugins/search_homepage", + "xpack.searchIndices": "plugins/search_indices", "xpack.searchNotebooks": "plugins/search_notebooks", "xpack.searchPlayground": "plugins/search_playground", "xpack.searchInferenceEndpoints": "plugins/search_inference_endpoints", diff --git a/x-pack/plugins/search_indices/README.mdx b/x-pack/plugins/search_indices/README.mdx new file mode 100644 index 0000000000000..77ca7d86aa55c --- /dev/null +++ b/x-pack/plugins/search_indices/README.mdx @@ -0,0 +1,3 @@ +# Search Indices + +The Search Indices plugin is a shared set of pages for elasticsearch users across stack and serverless search solutions. diff --git a/x-pack/plugins/search_indices/common/index.ts b/x-pack/plugins/search_indices/common/index.ts new file mode 100644 index 0000000000000..a0e7d3fe35e68 --- /dev/null +++ b/x-pack/plugins/search_indices/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 = 'searchIndices'; +export const PLUGIN_NAME = 'searchIndices'; diff --git a/x-pack/plugins/search_indices/jest.config.js b/x-pack/plugins/search_indices/jest.config.js new file mode 100644 index 0000000000000..8f8cacaaeed62 --- /dev/null +++ b/x-pack/plugins/search_indices/jest.config.js @@ -0,0 +1,15 @@ +/* + * 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. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/x-pack/plugins/search_indices'], + coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/search_indices', + coverageReporters: ['text', 'html'], + collectCoverageFrom: ['/x-pack/plugins/search_indices/{public,server}/**/*.{ts,tsx}'], +}; diff --git a/x-pack/plugins/search_indices/kibana.jsonc b/x-pack/plugins/search_indices/kibana.jsonc new file mode 100644 index 0000000000000..287719e99b350 --- /dev/null +++ b/x-pack/plugins/search_indices/kibana.jsonc @@ -0,0 +1,23 @@ +{ + "type": "plugin", + "id": "@kbn/search-indices", + "owner": "@elastic/search-kibana", + "plugin": { + "id": "searchIndices", + "server": true, + "browser": true, + "configPath": [ + "xpack", + "searchIndices" + ], + "requiredPlugins": [ + "share", + ], + "optionalPlugins": [ + "cloud", + "console", + "usageCollection", + ], + "requiredBundles": [] + } +} diff --git a/x-pack/plugins/search_indices/public/index.ts b/x-pack/plugins/search_indices/public/index.ts new file mode 100644 index 0000000000000..b3ad3b1e834b7 --- /dev/null +++ b/x-pack/plugins/search_indices/public/index.ts @@ -0,0 +1,15 @@ +/* + * 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 { SearchIndicesPlugin } from './plugin'; + +// This exports static code and TypeScript types, +// as well as, Kibana Platform `plugin()` initializer. +export function plugin() { + return new SearchIndicesPlugin(); +} +export type { SearchIndicesPluginSetup, SearchIndicesPluginStart } from './types'; diff --git a/x-pack/plugins/search_indices/public/plugin.ts b/x-pack/plugins/search_indices/public/plugin.ts new file mode 100644 index 0000000000000..88df6c1e4c10e --- /dev/null +++ b/x-pack/plugins/search_indices/public/plugin.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 type { CoreSetup, CoreStart, Plugin } from '@kbn/core/public'; +import type { SearchIndicesPluginSetup, SearchIndicesPluginStart } from './types'; + +export class SearchIndicesPlugin + implements Plugin +{ + public setup(core: CoreSetup): SearchIndicesPluginSetup { + return {}; + } + + public start(core: CoreStart): SearchIndicesPluginStart { + return {}; + } + + public stop() {} +} diff --git a/x-pack/plugins/search_indices/public/types.ts b/x-pack/plugins/search_indices/public/types.ts new file mode 100644 index 0000000000000..b16086803be53 --- /dev/null +++ b/x-pack/plugins/search_indices/public/types.ts @@ -0,0 +1,17 @@ +/* + * 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 { NavigationPublicPluginStart } from '@kbn/navigation-plugin/public'; + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SearchIndicesPluginSetup {} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SearchIndicesPluginStart {} + +export interface AppPluginStartDependencies { + navigation: NavigationPublicPluginStart; +} diff --git a/x-pack/plugins/search_indices/server/config.ts b/x-pack/plugins/search_indices/server/config.ts new file mode 100644 index 0000000000000..408d45cf23e2e --- /dev/null +++ b/x-pack/plugins/search_indices/server/config.ts @@ -0,0 +1,19 @@ +/* + * 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'; + +const configSchema = schema.object({ + enabled: schema.boolean({ defaultValue: false }), +}); + +export type SearchIndicesConfig = TypeOf; + +export const config: PluginConfigDescriptor = { + schema: configSchema, +}; diff --git a/x-pack/plugins/search_indices/server/index.ts b/x-pack/plugins/search_indices/server/index.ts new file mode 100644 index 0000000000000..b9b062b7df181 --- /dev/null +++ b/x-pack/plugins/search_indices/server/index.ts @@ -0,0 +1,17 @@ +/* + * 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 { PluginInitializerContext } from '@kbn/core/server'; + +export { config } from './config'; + +export async function plugin(initializerContext: PluginInitializerContext) { + const { SearchIndicesPlugin } = await import('./plugin'); + return new SearchIndicesPlugin(initializerContext); +} + +export type { SearchIndicesPluginSetup, SearchIndicesPluginStart } from './types'; diff --git a/x-pack/plugins/search_indices/server/plugin.ts b/x-pack/plugins/search_indices/server/plugin.ts new file mode 100644 index 0000000000000..666e49016f551 --- /dev/null +++ b/x-pack/plugins/search_indices/server/plugin.ts @@ -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 type { + PluginInitializerContext, + CoreSetup, + CoreStart, + Plugin, + Logger, +} from '@kbn/core/server'; + +import type { SearchIndicesPluginSetup, SearchIndicesPluginStart } from './types'; +import { defineRoutes } from './routes'; + +export class SearchIndicesPlugin + implements Plugin +{ + private readonly logger: Logger; + + constructor(initializerContext: PluginInitializerContext) { + this.logger = initializerContext.logger.get(); + } + + public setup(core: CoreSetup) { + this.logger.debug('searchIndices: Setup'); + this.logger.info('searchIndices test'); + const router = core.http.createRouter(); + + // Register server side APIs + defineRoutes(router); + + return {}; + } + + public start(core: CoreStart) { + this.logger.debug('searchIndices: Started'); + return {}; + } + + public stop() {} +} diff --git a/x-pack/plugins/search_indices/server/routes/index.ts b/x-pack/plugins/search_indices/server/routes/index.ts new file mode 100644 index 0000000000000..c98be5b6a4490 --- /dev/null +++ b/x-pack/plugins/search_indices/server/routes/index.ts @@ -0,0 +1,10 @@ +/* + * 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 { IRouter } from '@kbn/core/server'; + +export function defineRoutes(router: IRouter) {} diff --git a/x-pack/plugins/search_indices/server/types.ts b/x-pack/plugins/search_indices/server/types.ts new file mode 100644 index 0000000000000..3586d18e6f253 --- /dev/null +++ b/x-pack/plugins/search_indices/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 SearchIndicesPluginSetup {} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SearchIndicesPluginStart {} diff --git a/x-pack/plugins/search_indices/tsconfig.json b/x-pack/plugins/search_indices/tsconfig.json new file mode 100644 index 0000000000000..48969cf7142bb --- /dev/null +++ b/x-pack/plugins/search_indices/tsconfig.json @@ -0,0 +1,21 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types" + }, + "include": [ + "__mocks__/**/*", + "common/**/*", + "public/**/*", + "server/**/*", + "../../../typings/**/*" + ], + "kbn_references": [ + "@kbn/core", + "@kbn/navigation-plugin", + "@kbn/config-schema", + ], + "exclude": [ + "target/**/*", + ] +} diff --git a/x-pack/plugins/serverless_search/kibana.jsonc b/x-pack/plugins/serverless_search/kibana.jsonc index 04002ee897cf4..a326956635d80 100644 --- a/x-pack/plugins/serverless_search/kibana.jsonc +++ b/x-pack/plugins/serverless_search/kibana.jsonc @@ -30,6 +30,7 @@ "indexManagement", "searchConnectors", "searchHomepage", + "searchIndices", "searchInferenceEndpoints", "usageCollection" ], diff --git a/yarn.lock b/yarn.lock index c5701f90e7584..806d5f768a504 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6219,6 +6219,10 @@ version "0.0.0" uid "" +"@kbn/search-indices@link:x-pack/plugins/search_indices": + version "0.0.0" + uid "" + "@kbn/search-inference-endpoints@link:x-pack/plugins/search_inference_endpoints": version "0.0.0" uid ""