From ed37fec5c15db0ca23d8088495d6a5cc790d4b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loix?= Date: Mon, 30 Jan 2023 14:26:23 +0000 Subject: [PATCH] [Content management] Setup plugin (#149813) --- docs/developer/plugin-list.asciidoc | 4 +++ packages/kbn-optimizer/limits.yml | 1 + src/plugins/content_management/README.md | 3 ++ .../content_management/common/constants.ts | 11 ++++++++ .../content_management/common/index.ts | 9 ++++++ src/plugins/content_management/jest.config.js | 18 ++++++++++++ src/plugins/content_management/kibana.json | 14 ++++++++++ .../content_management/public/index.ts | 15 ++++++++++ .../content_management/public/plugin.ts | 26 +++++++++++++++++ .../content_management/public/types.ts | 16 +++++++++++ .../content_management/server/index.ts | 16 +++++++++++ .../content_management/server/plugin.ts | 28 +++++++++++++++++++ .../content_management/server/types.ts | 16 +++++++++++ src/plugins/content_management/tsconfig.json | 13 +++++++++ tsconfig.base.json | 2 ++ 15 files changed, 192 insertions(+) create mode 100644 src/plugins/content_management/README.md create mode 100644 src/plugins/content_management/common/constants.ts create mode 100644 src/plugins/content_management/common/index.ts create mode 100644 src/plugins/content_management/jest.config.js create mode 100644 src/plugins/content_management/kibana.json create mode 100644 src/plugins/content_management/public/index.ts create mode 100644 src/plugins/content_management/public/plugin.ts create mode 100644 src/plugins/content_management/public/types.ts create mode 100644 src/plugins/content_management/server/index.ts create mode 100755 src/plugins/content_management/server/plugin.ts create mode 100644 src/plugins/content_management/server/types.ts create mode 100644 src/plugins/content_management/tsconfig.json diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 4d0e8e1999749..2408866ced99a 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -40,6 +40,10 @@ as uiSettings within the code. |Console provides the user with tools for storing and executing requests against Elasticsearch. +|{kib-repo}blob/{branch}/src/plugins/content_management/README.md[contentManagement] +|The content management plugin provides functionality to manage content in Kibana. + + |{kib-repo}blob/{branch}/src/plugins/controls/README.mdx[controls] |The Controls plugin contains Embeddables which can be used to add user-friendly interactivity to apps. diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 2afd79ff64a94..b7439d781675b 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -19,6 +19,7 @@ pageLoadAssetSize: cloudLinks: 17629 cloudSecurityPosture: 19109 console: 46091 + contentManagement: 16254 controls: 40000 core: 435325 crossClusterReplication: 65408 diff --git a/src/plugins/content_management/README.md b/src/plugins/content_management/README.md new file mode 100644 index 0000000000000..08bbe41c4f787 --- /dev/null +++ b/src/plugins/content_management/README.md @@ -0,0 +1,3 @@ +# Content management + +The content management plugin provides functionality to manage content in Kibana. diff --git a/src/plugins/content_management/common/constants.ts b/src/plugins/content_management/common/constants.ts new file mode 100644 index 0000000000000..5c35a41577b82 --- /dev/null +++ b/src/plugins/content_management/common/constants.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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export const PLUGIN_ID = 'contentManagement'; + +export const API_ENDPOINT = '/api/content_management'; diff --git a/src/plugins/content_management/common/index.ts b/src/plugins/content_management/common/index.ts new file mode 100644 index 0000000000000..bc5dde9968d6d --- /dev/null +++ b/src/plugins/content_management/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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { PLUGIN_ID, API_ENDPOINT } from './constants'; diff --git a/src/plugins/content_management/jest.config.js b/src/plugins/content_management/jest.config.js new file mode 100644 index 0000000000000..130f1acfae958 --- /dev/null +++ b/src/plugins/content_management/jest.config.js @@ -0,0 +1,18 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/src/plugins/content_management'], + coverageDirectory: '/target/kibana-coverage/jest/src/plugins/content_management', + coverageReporters: ['text', 'html'], + collectCoverageFrom: [ + '/src/plugins/content_management/{common,public,server}/**/*.{js,ts,tsx}', + ], +}; diff --git a/src/plugins/content_management/kibana.json b/src/plugins/content_management/kibana.json new file mode 100644 index 0000000000000..8be769a8553c8 --- /dev/null +++ b/src/plugins/content_management/kibana.json @@ -0,0 +1,14 @@ +{ + "id": "contentManagement", + "version": "kibana", + "server": true, + "ui": true, + "requiredPlugins": [], + "requiredBundles": [], + "optionalPlugins": [], + "owner": { + "name": "@elastic/kibana-global-experience", + "githubTeam": "@elastic/kibana-global-experience" + }, + "description": "Content management app" +} diff --git a/src/plugins/content_management/public/index.ts b/src/plugins/content_management/public/index.ts new file mode 100644 index 0000000000000..786c4f212481f --- /dev/null +++ b/src/plugins/content_management/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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ContentManagementPlugin } from './plugin'; + +export function plugin() { + return new ContentManagementPlugin(); +} + +export type { ContentManagementPublicStart } from './types'; diff --git a/src/plugins/content_management/public/plugin.ts b/src/plugins/content_management/public/plugin.ts new file mode 100644 index 0000000000000..1650d95955d44 --- /dev/null +++ b/src/plugins/content_management/public/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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { CoreSetup, Plugin } from '@kbn/core/public'; +import { + ContentManagementPublicStart, + ContentManagementPublicSetup, + SetupDependencies, +} from './types'; + +export class ContentManagementPlugin + implements Plugin +{ + public setup(core: CoreSetup, deps: SetupDependencies) { + return {}; + } + + public start() { + return {}; + } +} diff --git a/src/plugins/content_management/public/types.ts b/src/plugins/content_management/public/types.ts new file mode 100644 index 0000000000000..e06d6e48bba40 --- /dev/null +++ b/src/plugins/content_management/public/types.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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SetupDependencies {} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ContentManagementPublicSetup {} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ContentManagementPublicStart {} diff --git a/src/plugins/content_management/server/index.ts b/src/plugins/content_management/server/index.ts new file mode 100644 index 0000000000000..e56a3b845fa93 --- /dev/null +++ b/src/plugins/content_management/server/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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import type { PluginInitializerContext } from '@kbn/core/server'; + +import { ContentManagementPlugin } from './plugin'; + +export function plugin(initializerContext: PluginInitializerContext) { + return new ContentManagementPlugin(initializerContext); +} + +export type { ContentManagementServerSetup, ContentManagementServerStart } from './types'; diff --git a/src/plugins/content_management/server/plugin.ts b/src/plugins/content_management/server/plugin.ts new file mode 100755 index 0000000000000..54ed5ba7a7c2d --- /dev/null +++ b/src/plugins/content_management/server/plugin.ts @@ -0,0 +1,28 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/server'; +import { + ContentManagementServerSetup, + ContentManagementServerStart, + SetupDependencies, +} from './types'; + +export class ContentManagementPlugin + implements Plugin +{ + constructor(initializerContext: PluginInitializerContext) {} + + public setup(core: CoreSetup) { + return {}; + } + + public start(core: CoreStart) { + return {}; + } +} diff --git a/src/plugins/content_management/server/types.ts b/src/plugins/content_management/server/types.ts new file mode 100644 index 0000000000000..0f4cc3138b5e9 --- /dev/null +++ b/src/plugins/content_management/server/types.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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SetupDependencies {} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ContentManagementServerSetup {} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ContentManagementServerStart {} diff --git a/src/plugins/content_management/tsconfig.json b/src/plugins/content_management/tsconfig.json new file mode 100644 index 0000000000000..d0ad9f31d30c0 --- /dev/null +++ b/src/plugins/content_management/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + }, + "include": ["common/**/*", "public/**/*", "server/**/*", ".storybook/**/*"], + "kbn_references": [ + "@kbn/core", + ], + "exclude": [ + "target/**/*", + ] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index fd9ea4a507cc5..526af85558a9e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -140,6 +140,8 @@ "@kbn/console-plugin/*": ["src/plugins/console/*"], "@kbn/content-management-content-editor": ["packages/content-management/content_editor"], "@kbn/content-management-content-editor/*": ["packages/content-management/content_editor/*"], + "@kbn/content-management-plugin": ["src/plugins/content_management"], + "@kbn/content-management-plugin/*": ["src/plugins/content_management/*"], "@kbn/content-management-table-list": ["packages/content-management/table_list"], "@kbn/content-management-table-list/*": ["packages/content-management/table_list/*"], "@kbn/controls-example-plugin": ["examples/controls_example"],