From 4ec0c8b62d459df98d0368376906d7308149c1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Wed, 13 Oct 2021 10:25:09 +0100 Subject: [PATCH 01/26] [Index management] Add ui.enabled kibana setting --- .../plugins/index_management/public/plugin.ts | 50 ++++++---- .../plugins/index_management/public/types.ts | 6 ++ .../plugins/index_management/server/config.ts | 95 ++++++++++++++++++- .../plugins/index_management/server/index.ts | 10 +- 4 files changed, 130 insertions(+), 31 deletions(-) diff --git a/x-pack/plugins/index_management/public/plugin.ts b/x-pack/plugins/index_management/public/plugin.ts index b7e810b15dbf9..f897189845672 100644 --- a/x-pack/plugins/index_management/public/plugin.ts +++ b/x-pack/plugins/index_management/public/plugin.ts @@ -13,7 +13,12 @@ import { setExtensionsService } from './application/store/selectors/extension_se import { ExtensionsService } from './services'; -import { IndexManagementPluginSetup, SetupDependencies, StartDependencies } from './types'; +import { + IndexManagementPluginSetup, + SetupDependencies, + StartDependencies, + ClientConfigType, +} from './types'; // avoid import from index files in plugin.ts, use specific import paths import { PLUGIN } from '../common/constants/plugin'; @@ -31,25 +36,30 @@ export class IndexMgmtUIPlugin { coreSetup: CoreSetup, plugins: SetupDependencies ): IndexManagementPluginSetup { - const { fleet, usageCollection, management } = plugins; - const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version); - - management.sections.section.data.registerApp({ - id: PLUGIN.id, - title: i18n.translate('xpack.idxMgmt.appTitle', { defaultMessage: 'Index Management' }), - order: 0, - mount: async (params) => { - const { mountManagementSection } = await import('./application/mount_management_section'); - return mountManagementSection( - coreSetup, - usageCollection, - params, - this.extensionsService, - Boolean(fleet), - kibanaVersion - ); - }, - }); + const { + ui: { enabled: isIndexManagementUiEnabled }, + } = this.ctx.config.get(); + + if (isIndexManagementUiEnabled) { + const { fleet, usageCollection, management } = plugins; + const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version); + management.sections.section.data.registerApp({ + id: PLUGIN.id, + title: i18n.translate('xpack.idxMgmt.appTitle', { defaultMessage: 'Index Management' }), + order: 0, + mount: async (params) => { + const { mountManagementSection } = await import('./application/mount_management_section'); + return mountManagementSection( + coreSetup, + usageCollection, + params, + this.extensionsService, + Boolean(fleet), + kibanaVersion + ); + }, + }); + } return { extensionsService: this.extensionsService.setup(), diff --git a/x-pack/plugins/index_management/public/types.ts b/x-pack/plugins/index_management/public/types.ts index 05c486e299c7a..e0af6b160cf11 100644 --- a/x-pack/plugins/index_management/public/types.ts +++ b/x-pack/plugins/index_management/public/types.ts @@ -23,3 +23,9 @@ export interface SetupDependencies { export interface StartDependencies { share: SharePluginStart; } + +export interface ClientConfigType { + ui: { + enabled: boolean; + }; +} diff --git a/x-pack/plugins/index_management/server/config.ts b/x-pack/plugins/index_management/server/config.ts index 0a314c7654b16..dd62557bd33b5 100644 --- a/x-pack/plugins/index_management/server/config.ts +++ b/x-pack/plugins/index_management/server/config.ts @@ -4,11 +4,98 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { SemVer } from 'semver'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; +import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; -export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), -}); +import { MAJOR_VERSION } from '../common/constants'; + +const kibanaVersion = new SemVer(MAJOR_VERSION); + +const baseConfig = { + exposeToBrowser: { + ui: true, + }, +}; + +const baseSchema = { + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), +}; + +// >= 8.x +const configSchema = schema.object( + { + ...baseSchema, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in the next major +const deprecations: PluginConfigDescriptor['deprecations'] = () => []; + +// Config in latest major +const configLatest: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema, + deprecations, +}; export type IndexManagementConfig = TypeOf; + +// 7.x +const settings7x = { + enabled: schema.boolean({ defaultValue: true }), +}; + +const configSchema7x = schema.object( + { + ...baseSchema, + ...settings7x, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in 8.0 +const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ + (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { + if (get(completeConfig, 'xpack.index_management.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('xpack.index_management.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.index_management.enabled" is deprecated', + }), + message: i18n.translate('xpack.index_management.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.index_management.ui.enabled" setting instead of "xpack.index_management.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.index_management.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.index_management.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.index_management.enabled" setting to "xpack.index_management.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, +]; +export type IndexManagementConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema7x, + deprecations: deprecations7x, +}; + +export const config: PluginConfigDescriptor = + kibanaVersion.major < 8 ? config7x : configLatest; diff --git a/x-pack/plugins/index_management/server/index.ts b/x-pack/plugins/index_management/server/index.ts index 14b67e2ffd581..29291116e44fc 100644 --- a/x-pack/plugins/index_management/server/index.ts +++ b/x-pack/plugins/index_management/server/index.ts @@ -5,17 +5,13 @@ * 2.0. */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server'; +import { PluginInitializerContext } from 'src/core/server'; import { IndexMgmtServerPlugin } from './plugin'; -import { configSchema } from './config'; -export const plugin = (context: PluginInitializerContext) => new IndexMgmtServerPlugin(context); +export { config } from './config'; -export const config: PluginConfigDescriptor = { - schema: configSchema, - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], -}; +export const plugin = (context: PluginInitializerContext) => new IndexMgmtServerPlugin(context); /** @public */ export { Dependencies } from './types'; From 8cfa25ebd8e200e33bc1670c6cb7a0a4b08bb54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Wed, 13 Oct 2021 12:04:32 +0100 Subject: [PATCH 02/26] [Rolllup Add ui.enabled kibana setting --- x-pack/plugins/rollup/common/index.ts | 2 + x-pack/plugins/rollup/public/index.ts | 3 +- x-pack/plugins/rollup/public/plugin.ts | 57 +++++++++------- x-pack/plugins/rollup/public/types.ts | 12 ++++ x-pack/plugins/rollup/server/config.ts | 95 ++++++++++++++++++++++++-- x-pack/plugins/rollup/server/index.ts | 10 +-- 6 files changed, 143 insertions(+), 36 deletions(-) create mode 100644 x-pack/plugins/rollup/public/types.ts diff --git a/x-pack/plugins/rollup/common/index.ts b/x-pack/plugins/rollup/common/index.ts index dffbfbd182092..c912a905d061d 100644 --- a/x-pack/plugins/rollup/common/index.ts +++ b/x-pack/plugins/rollup/common/index.ts @@ -14,6 +14,8 @@ export const PLUGIN = { minimumLicenseType: basicLicense, }; +export const MAJOR_VERSION = '8.0.0'; + export const CONFIG_ROLLUPS = 'rollups:enableIndexPatterns'; export const API_BASE_PATH = '/api/rollup'; diff --git a/x-pack/plugins/rollup/public/index.ts b/x-pack/plugins/rollup/public/index.ts index b70ce86493382..f740971b4bcb0 100644 --- a/x-pack/plugins/rollup/public/index.ts +++ b/x-pack/plugins/rollup/public/index.ts @@ -4,7 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { PluginInitializerContext } from 'src/core/public'; import { RollupPlugin } from './plugin'; -export const plugin = () => new RollupPlugin(); +export const plugin = (ctx: PluginInitializerContext) => new RollupPlugin(ctx); diff --git a/x-pack/plugins/rollup/public/plugin.ts b/x-pack/plugins/rollup/public/plugin.ts index 0d345e326193c..e458a13ee0e0e 100644 --- a/x-pack/plugins/rollup/public/plugin.ts +++ b/x-pack/plugins/rollup/public/plugin.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { CoreSetup, CoreStart, Plugin } from 'kibana/public'; +import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'kibana/public'; import { rollupBadgeExtension, rollupToggleExtension } from './extend_index_management'; // @ts-ignore import { RollupIndexPatternCreationConfig } from './index_pattern_creation/rollup_index_pattern_creation_config'; @@ -23,6 +23,7 @@ import { IndexManagementPluginSetup } from '../../index_management/public'; import { setHttp, init as initDocumentation } from './crud_app/services/index'; import { setNotifications, setFatalErrors, setUiStatsReporter } from './kibana_services'; import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/public'; +import { ClientConfigType } from './types'; export interface RollupPluginSetupDependencies { home?: HomePublicPluginSetup; @@ -32,10 +33,16 @@ export interface RollupPluginSetupDependencies { } export class RollupPlugin implements Plugin { + constructor(private ctx: PluginInitializerContext) {} + setup( core: CoreSetup, { home, management, indexManagement, usageCollection }: RollupPluginSetupDependencies ) { + const { + ui: { enabled: isRollupUiEnabled }, + } = this.ctx.config.get(); + setFatalErrors(core.fatalErrors); if (usageCollection) { setUiStatsReporter(usageCollection.reportUiCounter.bind(usageCollection, UIM_APP_NAME)); @@ -46,7 +53,7 @@ export class RollupPlugin implements Plugin { indexManagement.extensionsService.addToggle(rollupToggleExtension); } - if (home) { + if (home && isRollupUiEnabled) { home.featureCatalogue.register({ id: 'rollup_jobs', title: 'Rollups', @@ -61,33 +68,35 @@ export class RollupPlugin implements Plugin { }); } - const pluginName = i18n.translate('xpack.rollupJobs.appTitle', { - defaultMessage: 'Rollup Jobs', - }); + if (isRollupUiEnabled) { + const pluginName = i18n.translate('xpack.rollupJobs.appTitle', { + defaultMessage: 'Rollup Jobs', + }); - management.sections.section.data.registerApp({ - id: 'rollup_jobs', - title: pluginName, - order: 4, - async mount(params) { - const [coreStart] = await core.getStartServices(); + management.sections.section.data.registerApp({ + id: 'rollup_jobs', + title: pluginName, + order: 4, + async mount(params) { + const [coreStart] = await core.getStartServices(); - const { - chrome: { docTitle }, - } = coreStart; + const { + chrome: { docTitle }, + } = coreStart; - docTitle.change(pluginName); - params.setBreadcrumbs([{ text: pluginName }]); + docTitle.change(pluginName); + params.setBreadcrumbs([{ text: pluginName }]); - const { renderApp } = await import('./application'); - const unmountAppCallback = await renderApp(core, params); + const { renderApp } = await import('./application'); + const unmountAppCallback = await renderApp(core, params); - return () => { - docTitle.reset(); - unmountAppCallback(); - }; - }, - }); + return () => { + docTitle.reset(); + unmountAppCallback(); + }; + }, + }); + } } start(core: CoreStart) { diff --git a/x-pack/plugins/rollup/public/types.ts b/x-pack/plugins/rollup/public/types.ts new file mode 100644 index 0000000000000..dc5e55e9268f8 --- /dev/null +++ b/x-pack/plugins/rollup/public/types.ts @@ -0,0 +1,12 @@ +/* + * 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 interface ClientConfigType { + ui: { + enabled: boolean; + }; +} diff --git a/x-pack/plugins/rollup/server/config.ts b/x-pack/plugins/rollup/server/config.ts index d20b317422107..7913f09bed231 100644 --- a/x-pack/plugins/rollup/server/config.ts +++ b/x-pack/plugins/rollup/server/config.ts @@ -4,11 +4,98 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { SemVer } from 'semver'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; +import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; -export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), -}); +import { MAJOR_VERSION } from '../common'; + +const kibanaVersion = new SemVer(MAJOR_VERSION); + +const baseConfig = { + exposeToBrowser: { + ui: true, + }, +}; + +const baseSchema = { + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), +}; + +// >= 8.x +const configSchema = schema.object( + { + ...baseSchema, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in the next major +const deprecations: PluginConfigDescriptor['deprecations'] = () => []; + +// Config in latest major +const configLatest: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema, + deprecations, +}; export type RollupConfig = TypeOf; + +// 7.x +const settings7x = { + enabled: schema.boolean({ defaultValue: true }), +}; + +const configSchema7x = schema.object( + { + ...baseSchema, + ...settings7x, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in 8.0 +const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ + (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { + if (get(completeConfig, 'xpack.rollup.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('xpack.rollup.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.rollup.enabled" is deprecated', + }), + message: i18n.translate('xpack.rollup.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.rollup.ui.enabled" setting instead of "xpack.rollup.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.rollup.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.rollup.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.rollup.enabled" setting to "xpack.rollup.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, +]; +export type RollupConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema7x, + deprecations: deprecations7x, +}; + +export const config: PluginConfigDescriptor = + kibanaVersion.major < 8 ? config7x : configLatest; diff --git a/x-pack/plugins/rollup/server/index.ts b/x-pack/plugins/rollup/server/index.ts index e77e0e6f15d72..6ae1d9f24b8b9 100644 --- a/x-pack/plugins/rollup/server/index.ts +++ b/x-pack/plugins/rollup/server/index.ts @@ -5,14 +5,10 @@ * 2.0. */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server'; +import { PluginInitializerContext } from 'src/core/server'; import { RollupPlugin } from './plugin'; -import { configSchema, RollupConfig } from './config'; + +export { config } from './config'; export const plugin = (pluginInitializerContext: PluginInitializerContext) => new RollupPlugin(pluginInitializerContext); - -export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], - schema: configSchema, -}; From d58fd9c8ee6403f6d34586a43bb7d5f7c4ef34ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Wed, 13 Oct 2021 12:30:09 +0100 Subject: [PATCH 03/26] [Snapshot and restore] Add ui.enabled kibana setting --- .../snapshot_restore/common/constants.ts | 2 + .../plugins/snapshot_restore/public/plugin.ts | 84 ++++++++-------- .../plugins/snapshot_restore/public/types.ts | 1 + .../plugins/snapshot_restore/server/config.ts | 96 ++++++++++++++++++- .../plugins/snapshot_restore/server/index.ts | 13 +-- 5 files changed, 143 insertions(+), 53 deletions(-) diff --git a/x-pack/plugins/snapshot_restore/common/constants.ts b/x-pack/plugins/snapshot_restore/common/constants.ts index a7c83ecf702e0..06139f7356ca7 100644 --- a/x-pack/plugins/snapshot_restore/common/constants.ts +++ b/x-pack/plugins/snapshot_restore/common/constants.ts @@ -20,6 +20,8 @@ export const PLUGIN = { }, }; +export const MAJOR_VERSION = '8.0.0'; + export const API_BASE_PATH = '/api/snapshot_restore/'; export enum REPOSITORY_TYPES { diff --git a/x-pack/plugins/snapshot_restore/public/plugin.ts b/x-pack/plugins/snapshot_restore/public/plugin.ts index bb091a1fd1831..0351716fad5b5 100644 --- a/x-pack/plugins/snapshot_restore/public/plugin.ts +++ b/x-pack/plugins/snapshot_restore/public/plugin.ts @@ -42,52 +42,58 @@ export class SnapshotRestoreUIPlugin { public setup(coreSetup: CoreSetup, plugins: PluginsDependencies): void { const config = this.initializerContext.config.get(); - const { http } = coreSetup; - const { home, management, usageCollection } = plugins; + const { + ui: { enabled: isSnapshotRestoreUiEnabled }, + } = config; - // Initialize services - this.uiMetricService.setup(usageCollection); - textService.setup(i18n); - httpService.setup(http); + if (isSnapshotRestoreUiEnabled) { + const { http } = coreSetup; + const { home, management, usageCollection } = plugins; - management.sections.section.data.registerApp({ - id: PLUGIN.id, - title: i18n.translate('xpack.snapshotRestore.appTitle', { - defaultMessage: 'Snapshot and Restore', - }), - order: 3, - mount: async (params) => { - const { mountManagementSection } = await import('./application/mount_management_section'); - const services = { - uiMetricService: this.uiMetricService, - }; - return await mountManagementSection(coreSetup, services, config, params); - }, - }); + // Initialize services + this.uiMetricService.setup(usageCollection); + textService.setup(i18n); + httpService.setup(http); - if (home) { - home.featureCatalogue.register({ + management.sections.section.data.registerApp({ id: PLUGIN.id, - title: i18n.translate('xpack.snapshotRestore.featureCatalogueTitle', { - defaultMessage: 'Back up and restore', + title: i18n.translate('xpack.snapshotRestore.appTitle', { + defaultMessage: 'Snapshot and Restore', }), - description: i18n.translate('xpack.snapshotRestore.featureCatalogueDescription', { - defaultMessage: - 'Save snapshots to a backup repository, and restore to recover index and cluster state.', - }), - icon: 'storage', - path: '/app/management/data/snapshot_restore', - showOnHomePage: true, - category: FeatureCatalogueCategory.ADMIN, - order: 630, + order: 3, + mount: async (params) => { + const { mountManagementSection } = await import('./application/mount_management_section'); + const services = { + uiMetricService: this.uiMetricService, + }; + return await mountManagementSection(coreSetup, services, config, params); + }, }); - } - plugins.share.url.locators.create( - new SnapshotRestoreLocatorDefinition({ - managementAppLocator: plugins.management.locator, - }) - ); + if (home) { + home.featureCatalogue.register({ + id: PLUGIN.id, + title: i18n.translate('xpack.snapshotRestore.featureCatalogueTitle', { + defaultMessage: 'Back up and restore', + }), + description: i18n.translate('xpack.snapshotRestore.featureCatalogueDescription', { + defaultMessage: + 'Save snapshots to a backup repository, and restore to recover index and cluster state.', + }), + icon: 'storage', + path: '/app/management/data/snapshot_restore', + showOnHomePage: true, + category: FeatureCatalogueCategory.ADMIN, + order: 630, + }); + } + + plugins.share.url.locators.create( + new SnapshotRestoreLocatorDefinition({ + managementAppLocator: plugins.management.locator, + }) + ); + } } public start() {} diff --git a/x-pack/plugins/snapshot_restore/public/types.ts b/x-pack/plugins/snapshot_restore/public/types.ts index b73170ad9d578..c58c942b4bc16 100644 --- a/x-pack/plugins/snapshot_restore/public/types.ts +++ b/x-pack/plugins/snapshot_restore/public/types.ts @@ -7,4 +7,5 @@ export interface ClientConfigType { slm_ui: { enabled: boolean }; + ui: { enabled: boolean }; } diff --git a/x-pack/plugins/snapshot_restore/server/config.ts b/x-pack/plugins/snapshot_restore/server/config.ts index f0ca416ef2032..6775802c8e7aa 100644 --- a/x-pack/plugins/snapshot_restore/server/config.ts +++ b/x-pack/plugins/snapshot_restore/server/config.ts @@ -4,14 +4,102 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { SemVer } from 'semver'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; +import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; -export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), +import { MAJOR_VERSION } from '../common/constants'; + +const kibanaVersion = new SemVer(MAJOR_VERSION); + +const baseConfig = { + exposeToBrowser: { + ui: true, + slm_ui: true, + }, +}; + +const baseSchema = { + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), slm_ui: schema.object({ enabled: schema.boolean({ defaultValue: true }), }), -}); +}; + +// >= 8.x +const configSchema = schema.object( + { + ...baseSchema, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in the next major +const deprecations: PluginConfigDescriptor['deprecations'] = () => []; + +// Config in latest major +const configLatest: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema, + deprecations, +}; export type SnapshotRestoreConfig = TypeOf; + +// 7.x +const settings7x = { + enabled: schema.boolean({ defaultValue: true }), +}; + +const configSchema7x = schema.object( + { + ...baseSchema, + ...settings7x, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in 8.0 +const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ + (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { + if (get(completeConfig, 'xpack.snapshot_restore.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('xpack.snapshot_restore.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.snapshot_restore.enabled" is deprecated', + }), + message: i18n.translate('xpack.snapshot_restore.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.snapshot_restore.ui.enabled" setting instead of "xpack.snapshot_restore.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.snapshot_restore.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.snapshot_restore.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.snapshot_restore.enabled" setting to "xpack.snapshot_restore.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, +]; +export type SnapshotRestoreConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema7x, + deprecations: deprecations7x, +}; + +export const config: PluginConfigDescriptor = + kibanaVersion.major < 8 ? config7x : configLatest; diff --git a/x-pack/plugins/snapshot_restore/server/index.ts b/x-pack/plugins/snapshot_restore/server/index.ts index e10bffd6073d2..1e9d2b55aa20b 100644 --- a/x-pack/plugins/snapshot_restore/server/index.ts +++ b/x-pack/plugins/snapshot_restore/server/index.ts @@ -5,16 +5,9 @@ * 2.0. */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'kibana/server'; +import { PluginInitializerContext } from 'kibana/server'; import { SnapshotRestoreServerPlugin } from './plugin'; -import { configSchema, SnapshotRestoreConfig } from './config'; -export const plugin = (ctx: PluginInitializerContext) => new SnapshotRestoreServerPlugin(ctx); +export { config } from './config'; -export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], - schema: configSchema, - exposeToBrowser: { - slm_ui: true, - }, -}; +export const plugin = (ctx: PluginInitializerContext) => new SnapshotRestoreServerPlugin(ctx); From d93ca8c452ba7f5a273e2b73c645b53c4932523a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Wed, 13 Oct 2021 12:57:55 +0100 Subject: [PATCH 04/26] [UA] Align with other apps and use the "MAJOR_VERSION" constant --- .../__jest__/client_integration/helpers/index.ts | 2 +- .../helpers/setup_environment.tsx | 12 +++++++----- .../client_integration/overview/overview.test.tsx | 5 ++--- .../plugins/upgrade_assistant/common/constants.ts | 6 +----- .../reindex/flyout/warning_step.test.tsx | 13 ++++++++----- .../server/lib/__fixtures__/version.ts | 8 +++++--- .../server/lib/es_version_precheck.test.ts | 4 ++-- .../server/lib/reindexing/index_settings.test.ts | 8 ++++---- .../server/lib/reindexing/reindex_service.test.ts | 4 ++-- 9 files changed, 32 insertions(+), 30 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts index b19c8b3d0f082..b2a1c4e80ec7d 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts @@ -9,4 +9,4 @@ export { setup as setupOverviewPage, OverviewTestBed } from './overview.helpers' export { setup as setupElasticsearchPage, ElasticsearchTestBed } from './elasticsearch.helpers'; export { setup as setupKibanaPage, KibanaTestBed } from './kibana.helpers'; -export { setupEnvironment } from './setup_environment'; +export { setupEnvironment, kibanaVersion } from './setup_environment'; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx index a1cdfaa3446cb..aa35d90f4f785 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx @@ -9,7 +9,7 @@ import React from 'react'; import axios from 'axios'; // @ts-ignore import axiosXhrAdapter from 'axios/lib/adapters/xhr'; - +import { SemVer } from 'semver'; import { deprecationsServiceMock, docLinksServiceMock, @@ -19,7 +19,7 @@ import { import { HttpSetup } from 'src/core/public'; import { KibanaContextProvider } from '../../../public/shared_imports'; -import { mockKibanaSemverVersion } from '../../../common/constants'; +import { MAJOR_VERSION } from '../../../common/constants'; import { AppContextProvider } from '../../../public/application/app_context'; import { apiService } from '../../../public/application/lib/api'; import { breadcrumbService } from '../../../public/application/lib/breadcrumbs'; @@ -31,6 +31,8 @@ const { GlobalFlyoutProvider } = GlobalFlyout; const mockHttpClient = axios.create({ adapter: axiosXhrAdapter }); +export const kibanaVersion = new SemVer(MAJOR_VERSION); + export const WithAppDependencies = (Comp: any, overrides: Record = {}) => (props: Record) => { @@ -41,9 +43,9 @@ export const WithAppDependencies = http: mockHttpClient as unknown as HttpSetup, docLinks: docLinksServiceMock.createStartContract(), kibanaVersionInfo: { - currentMajor: mockKibanaSemverVersion.major, - prevMajor: mockKibanaSemverVersion.major - 1, - nextMajor: mockKibanaSemverVersion.major + 1, + currentMajor: kibanaVersion.major, + prevMajor: kibanaVersion.major - 1, + nextMajor: kibanaVersion.major + 1, }, notifications: notificationServiceMock.createStartContract(), isReadOnlyMode: false, diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.test.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.test.tsx index 0acf5ae65c6cc..7831ab0110e4f 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.test.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.test.tsx @@ -5,8 +5,7 @@ * 2.0. */ -import { mockKibanaSemverVersion } from '../../../common/constants'; -import { OverviewTestBed, setupOverviewPage, setupEnvironment } from '../helpers'; +import { OverviewTestBed, setupOverviewPage, setupEnvironment, kibanaVersion } from '../helpers'; describe('Overview Page', () => { let testBed: OverviewTestBed; @@ -24,7 +23,7 @@ describe('Overview Page', () => { describe('Documentation links', () => { test('Has a whatsNew link and it references nextMajor version', () => { const { exists, find } = testBed; - const nextMajor = mockKibanaSemverVersion.major + 1; + const nextMajor = kibanaVersion.major + 1; expect(exists('whatsNewLink')).toBe(true); expect(find('whatsNewLink').text()).toContain(`${nextMajor}.0`); diff --git a/x-pack/plugins/upgrade_assistant/common/constants.ts b/x-pack/plugins/upgrade_assistant/common/constants.ts index 893d61d329534..68a6b9e9cdb83 100644 --- a/x-pack/plugins/upgrade_assistant/common/constants.ts +++ b/x-pack/plugins/upgrade_assistant/common/constants.ts @@ -4,15 +4,11 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import SemVer from 'semver/classes/semver'; - /* - * These constants are used only in tests to add conditional logic based on Kibana version * On master, the version should represent the next major version (e.g., master --> 8.0.0) * The release branch should match the release version (e.g., 7.x --> 7.0.0) */ -export const mockKibanaVersion = '8.0.0'; -export const mockKibanaSemverVersion = new SemVer(mockKibanaVersion); +export const MAJOR_VERSION = '8.0.0'; /* * Map of 7.0 --> 8.0 index setting deprecation log messages and associated settings diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx index ff11b9f1a8450..b762aa30d9fb2 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx @@ -8,12 +8,15 @@ import { I18nProvider } from '@kbn/i18n/react'; import { mount, shallow } from 'enzyme'; import React from 'react'; +import { SemVer } from 'semver'; import { ReindexWarning } from '../../../../../../../common/types'; -import { mockKibanaSemverVersion } from '../../../../../../../common/constants'; +import { MAJOR_VERSION } from '../../../../../../../common/constants'; import { idForWarning, WarningsFlyoutStep } from './warnings_step'; +const kibanaVersion = new SemVer(MAJOR_VERSION); + jest.mock('../../../../../app_context', () => { const { docLinksServiceMock } = jest.requireActual( '../../../../../../../../../../src/core/public/doc_links/doc_links_service.mock' @@ -24,9 +27,9 @@ jest.mock('../../../../../app_context', () => { return { docLinks: docLinksServiceMock.createStartContract(), kibanaVersionInfo: { - currentMajor: mockKibanaSemverVersion.major, - prevMajor: mockKibanaSemverVersion.major - 1, - nextMajor: mockKibanaSemverVersion.major + 1, + currentMajor: kibanaVersion.major, + prevMajor: kibanaVersion.major - 1, + nextMajor: kibanaVersion.major + 1, }, }; }, @@ -45,7 +48,7 @@ describe('WarningsFlyoutStep', () => { expect(shallow()).toMatchSnapshot(); }); - if (mockKibanaSemverVersion.major === 7) { + if (kibanaVersion.major === 7) { it('does not allow proceeding until all are checked', () => { const defaultPropsWithWarnings = { ...defaultProps, diff --git a/x-pack/plugins/upgrade_assistant/server/lib/__fixtures__/version.ts b/x-pack/plugins/upgrade_assistant/server/lib/__fixtures__/version.ts index d93fe7920f1d7..5f39e902c75d9 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/__fixtures__/version.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/__fixtures__/version.ts @@ -4,14 +4,16 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { SemVer } from 'semver'; +import { MAJOR_VERSION } from '../../../common/constants'; -import { mockKibanaSemverVersion } from '../../../common/constants'; +const kibanaVersion = new SemVer(MAJOR_VERSION); export const getMockVersionInfo = () => { - const currentMajor = mockKibanaSemverVersion.major; + const currentMajor = kibanaVersion.major; return { - currentVersion: mockKibanaSemverVersion, + currentVersion: kibanaVersion, currentMajor, prevMajor: currentMajor - 1, nextMajor: currentMajor + 1, diff --git a/x-pack/plugins/upgrade_assistant/server/lib/es_version_precheck.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/es_version_precheck.test.ts index e1817ef63927d..1785491e5da45 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/es_version_precheck.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/es_version_precheck.test.ts @@ -9,7 +9,7 @@ import { SemVer } from 'semver'; import { IScopedClusterClient, kibanaResponseFactory } from 'src/core/server'; import { coreMock } from 'src/core/server/mocks'; import { licensingMock } from '../../../../plugins/licensing/server/mocks'; -import { mockKibanaVersion } from '../../common/constants'; +import { MAJOR_VERSION } from '../../common/constants'; import { getMockVersionInfo } from './__fixtures__/version'; import { @@ -98,7 +98,7 @@ describe('verifyAllMatchKibanaVersion', () => { describe('EsVersionPrecheck', () => { beforeEach(() => { - versionService.setup(mockKibanaVersion); + versionService.setup(MAJOR_VERSION); }); it('returns a 403 when callCluster fails with a 403', async () => { diff --git a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/index_settings.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/index_settings.test.ts index 30093a9fb6e50..957198cde8da9 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/index_settings.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/index_settings.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { mockKibanaSemverVersion, mockKibanaVersion } from '../../../common/constants'; +import { MAJOR_VERSION } from '../../../common/constants'; import { versionService } from '../version'; import { getMockVersionInfo } from '../__fixtures__/version'; @@ -131,7 +131,7 @@ describe('transformFlatSettings', () => { describe('sourceNameForIndex', () => { beforeEach(() => { - versionService.setup(mockKibanaVersion); + versionService.setup(MAJOR_VERSION); }); it('parses internal indices', () => { @@ -152,7 +152,7 @@ describe('transformFlatSettings', () => { describe('generateNewIndexName', () => { beforeEach(() => { - versionService.setup(mockKibanaVersion); + versionService.setup(MAJOR_VERSION); }); it('parses internal indices', () => { @@ -186,7 +186,7 @@ describe('transformFlatSettings', () => { ).toEqual([]); }); - if (mockKibanaSemverVersion.major === 7) { + if (currentMajor === 7) { describe('[7.x] customTypeName warning', () => { it('returns customTypeName warning for non-_doc mapping types', () => { expect( diff --git a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts index 7a5bf1c187698..6017691a9328d 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts @@ -20,7 +20,7 @@ import { ReindexStatus, ReindexStep, } from '../../../common/types'; -import { mockKibanaVersion } from '../../../common/constants'; +import { MAJOR_VERSION } from '../../../common/constants'; import { licensingMock } from '../../../../licensing/server/mocks'; import { LicensingPluginSetup } from '../../../../licensing/server'; @@ -89,7 +89,7 @@ describe('reindexService', () => { licensingPluginSetup ); - versionService.setup(mockKibanaVersion); + versionService.setup(MAJOR_VERSION); }); describe('hasRequiredPrivileges', () => { From 25bc5666db3c74854bbd80272c6bcb34be680e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Wed, 13 Oct 2021 12:59:01 +0100 Subject: [PATCH 05/26] [UA] Align with other apps and use the "MAJOR_VERSION" constant (2) --- .../server/lib/reindexing/reindex_actions.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_actions.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_actions.test.ts index 3cfdb1fdd3167..ce1e8e11eb2d1 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_actions.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_actions.test.ts @@ -19,7 +19,7 @@ import { ReindexStatus, ReindexStep, } from '../../../common/types'; -import { mockKibanaVersion } from '../../../common/constants'; +import { MAJOR_VERSION } from '../../../common/constants'; import { versionService } from '../version'; import { LOCK_WINDOW, ReindexActions, reindexActionsFactory } from './reindex_actions'; import { getMockVersionInfo } from '../__fixtures__/version'; @@ -54,7 +54,7 @@ describe('ReindexActions', () => { describe('createReindexOp', () => { beforeEach(() => { - versionService.setup(mockKibanaVersion); + versionService.setup(MAJOR_VERSION); client.create.mockResolvedValue(); }); From c7ac361f8b71d5ba8617a2b3164d1216a485eec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Wed, 13 Oct 2021 13:11:51 +0100 Subject: [PATCH 06/26] [UA] Add ui.enabled kibana setting --- .../upgrade_assistant/common/config.ts | 20 ---- .../upgrade_assistant/public/plugin.ts | 88 +++++++------- .../plugins/upgrade_assistant/public/types.ts | 7 ++ .../upgrade_assistant/server/config.ts | 108 ++++++++++++++++++ .../plugins/upgrade_assistant/server/index.ts | 13 +-- 5 files changed, 167 insertions(+), 69 deletions(-) delete mode 100644 x-pack/plugins/upgrade_assistant/common/config.ts create mode 100644 x-pack/plugins/upgrade_assistant/server/config.ts diff --git a/x-pack/plugins/upgrade_assistant/common/config.ts b/x-pack/plugins/upgrade_assistant/common/config.ts deleted file mode 100644 index e74fe5cc1bf16..0000000000000 --- a/x-pack/plugins/upgrade_assistant/common/config.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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'; - -export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), - /* - * This will default to true up until the last minor before the next major. - * In readonly mode, the user will not be able to perform any actions in the UI - * and will be presented with a message indicating as such. - */ - readonly: schema.boolean({ defaultValue: true }), -}); - -export type Config = TypeOf; diff --git a/x-pack/plugins/upgrade_assistant/public/plugin.ts b/x-pack/plugins/upgrade_assistant/public/plugin.ts index 5edb638e1bc5b..32e825fbdc20d 100644 --- a/x-pack/plugins/upgrade_assistant/public/plugin.ts +++ b/x-pack/plugins/upgrade_assistant/public/plugin.ts @@ -9,59 +9,69 @@ import SemVer from 'semver/classes/semver'; import { i18n } from '@kbn/i18n'; import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/public'; -import { SetupDependencies, StartDependencies, AppServicesContext } from './types'; -import { Config } from '../common/config'; +import { + SetupDependencies, + StartDependencies, + AppServicesContext, + ClientConfigType, +} from './types'; export class UpgradeAssistantUIPlugin implements Plugin { constructor(private ctx: PluginInitializerContext) {} + setup(coreSetup: CoreSetup, { management, cloud }: SetupDependencies) { - const { readonly } = this.ctx.config.get(); + const { + readonly, + ui: { enabled: isUpgradeAssistantUiEnabled }, + } = this.ctx.config.get(); - const appRegistrar = management.sections.section.stack; - const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version); + if (isUpgradeAssistantUiEnabled) { + const appRegistrar = management.sections.section.stack; + const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version); - const kibanaVersionInfo = { - currentMajor: kibanaVersion.major, - prevMajor: kibanaVersion.major - 1, - nextMajor: kibanaVersion.major + 1, - }; + const kibanaVersionInfo = { + currentMajor: kibanaVersion.major, + prevMajor: kibanaVersion.major - 1, + nextMajor: kibanaVersion.major + 1, + }; - const pluginName = i18n.translate('xpack.upgradeAssistant.appTitle', { - defaultMessage: '{version} Upgrade Assistant', - values: { version: `${kibanaVersionInfo.nextMajor}.0` }, - }); + const pluginName = i18n.translate('xpack.upgradeAssistant.appTitle', { + defaultMessage: '{version} Upgrade Assistant', + values: { version: `${kibanaVersionInfo.nextMajor}.0` }, + }); - appRegistrar.registerApp({ - id: 'upgrade_assistant', - title: pluginName, - order: 1, - async mount(params) { - const [coreStart, { discover, data }] = await coreSetup.getStartServices(); - const services: AppServicesContext = { discover, data, cloud }; + appRegistrar.registerApp({ + id: 'upgrade_assistant', + title: pluginName, + order: 1, + async mount(params) { + const [coreStart, { discover, data }] = await coreSetup.getStartServices(); + const services: AppServicesContext = { discover, data, cloud }; - const { - chrome: { docTitle }, - } = coreStart; + const { + chrome: { docTitle }, + } = coreStart; - docTitle.change(pluginName); + docTitle.change(pluginName); - const { mountManagementSection } = await import('./application/mount_management_section'); - const unmountAppCallback = await mountManagementSection( - coreSetup, - params, - kibanaVersionInfo, - readonly, - services - ); + const { mountManagementSection } = await import('./application/mount_management_section'); + const unmountAppCallback = await mountManagementSection( + coreSetup, + params, + kibanaVersionInfo, + readonly, + services + ); - return () => { - docTitle.reset(); - unmountAppCallback(); - }; - }, - }); + return () => { + docTitle.reset(); + unmountAppCallback(); + }; + }, + }); + } } start() {} diff --git a/x-pack/plugins/upgrade_assistant/public/types.ts b/x-pack/plugins/upgrade_assistant/public/types.ts index a2b49305c32d4..cbeaf22bb095b 100644 --- a/x-pack/plugins/upgrade_assistant/public/types.ts +++ b/x-pack/plugins/upgrade_assistant/public/types.ts @@ -26,3 +26,10 @@ export interface StartDependencies { discover: DiscoverStart; data: DataPublicPluginStart; } + +export interface ClientConfigType { + readonly: boolean; + ui: { + enabled: boolean; + }; +} diff --git a/x-pack/plugins/upgrade_assistant/server/config.ts b/x-pack/plugins/upgrade_assistant/server/config.ts new file mode 100644 index 0000000000000..634921495d4a4 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/server/config.ts @@ -0,0 +1,108 @@ +/* + * 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 { SemVer } from 'semver'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; +import { schema, TypeOf } from '@kbn/config-schema'; +import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; + +import { MAJOR_VERSION } from '../common/constants'; + +const kibanaVersion = new SemVer(MAJOR_VERSION); + +const baseConfig = { + exposeToBrowser: { + ui: true, + readonly: true, + }, +}; + +const baseSchema = { + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), + /* + * This will default to true up until the last minor before the next major. + * In readonly mode, the user will not be able to perform any actions in the UI + * and will be presented with a message indicating as such. + */ + readonly: schema.boolean({ defaultValue: true }), +}; + +// >= 8.x +const configSchema = schema.object( + { + ...baseSchema, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in the next major +const deprecations: PluginConfigDescriptor['deprecations'] = () => []; + +// Config in latest major +const configLatest: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema, + deprecations, +}; + +export type UpgradeAssistantConfig = TypeOf; + +// 7.x +const settings7x = { + enabled: schema.boolean({ defaultValue: true }), +}; + +const configSchema7x = schema.object( + { + ...baseSchema, + ...settings7x, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in 8.0 +const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ + (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { + if (get(completeConfig, 'xpack.upgrade_assistant.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('xpack.upgrade_assistant.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.upgrade_assistant.enabled" is deprecated', + }), + message: i18n.translate('xpack.upgrade_assistant.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.upgrade_assistant.ui.enabled" setting instead of "xpack.upgrade_assistant.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.upgrade_assistant.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.upgrade_assistant.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.upgrade_assistant.enabled" setting to "xpack.upgrade_assistant.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, +]; +export type UpgradeAssistantConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema7x, + deprecations: deprecations7x, +}; + +export const config: PluginConfigDescriptor = + kibanaVersion.major < 8 ? config7x : configLatest; diff --git a/x-pack/plugins/upgrade_assistant/server/index.ts b/x-pack/plugins/upgrade_assistant/server/index.ts index 5591276b2fa34..660aa107292e8 100644 --- a/x-pack/plugins/upgrade_assistant/server/index.ts +++ b/x-pack/plugins/upgrade_assistant/server/index.ts @@ -5,18 +5,11 @@ * 2.0. */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server'; +import { PluginInitializerContext } from 'src/core/server'; import { UpgradeAssistantServerPlugin } from './plugin'; -import { configSchema, Config } from '../common/config'; + +export { config } from './config'; export const plugin = (ctx: PluginInitializerContext) => { return new UpgradeAssistantServerPlugin(ctx); }; - -export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], - schema: configSchema, - exposeToBrowser: { - readonly: true, - }, -}; From ed4200931d694d7bffc3e943f013576457c5765c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 08:18:53 +0100 Subject: [PATCH 07/26] [Console] Add ui.enabled kibana setting --- src/plugins/console/public/index.ts | 7 +- src/plugins/console/public/plugin.ts | 122 ++++++++------- src/plugins/console/public/types/config.ts | 13 ++ src/plugins/console/public/types/index.ts | 2 + src/plugins/console/public/types/locator.ts | 12 ++ .../public/types/plugin_dependencies.ts | 8 +- src/plugins/console/server/config.ts | 139 ++++++++++++------ src/plugins/console/server/index.ts | 1 + src/plugins/console/server/plugin.ts | 10 +- .../components/manage_data/manage_data.tsx | 2 +- .../components/details/req_code_viewer.tsx | 3 +- 11 files changed, 209 insertions(+), 110 deletions(-) create mode 100644 src/plugins/console/public/types/config.ts create mode 100644 src/plugins/console/public/types/locator.ts diff --git a/src/plugins/console/public/index.ts b/src/plugins/console/public/index.ts index 8c4a107108565..9a9c5896cd26d 100644 --- a/src/plugins/console/public/index.ts +++ b/src/plugins/console/public/index.ts @@ -7,13 +7,14 @@ */ import './index.scss'; +import { PluginInitializerContext } from 'src/core/public'; import { ConsoleUIPlugin } from './plugin'; -export type { ConsoleUILocatorParams } from './plugin'; +export type { ConsoleUILocatorParams, ConsolePluginSetup } from './types'; export { ConsoleUIPlugin as Plugin }; -export function plugin() { - return new ConsoleUIPlugin(); +export function plugin(ctx: PluginInitializerContext) { + return new ConsoleUIPlugin(ctx); } diff --git a/src/plugins/console/public/plugin.ts b/src/plugins/console/public/plugin.ts index e3791df6a2db6..d61769c23dfe0 100644 --- a/src/plugins/console/public/plugin.ts +++ b/src/plugins/console/public/plugin.ts @@ -7,77 +7,87 @@ */ import { i18n } from '@kbn/i18n'; -import { SerializableRecord } from '@kbn/utility-types'; -import { Plugin, CoreSetup } from 'src/core/public'; +import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/public'; import { FeatureCatalogueCategory } from '../../home/public'; -import { AppSetupUIPluginDependencies } from './types'; - -export interface ConsoleUILocatorParams extends SerializableRecord { - loadFrom?: string; -} +import { + AppSetupUIPluginDependencies, + ClientConfigType, + ConsolePluginSetup, + ConsoleUILocatorParams, +} from './types'; export class ConsoleUIPlugin implements Plugin { + constructor(private ctx: PluginInitializerContext) {} + public setup( { notifications, getStartServices, http }: CoreSetup, { devTools, home, share, usageCollection }: AppSetupUIPluginDependencies - ) { - if (home) { - home.featureCatalogue.register({ + ): ConsolePluginSetup { + const { + ui: { enabled: isConsoleUiEnabled }, + } = this.ctx.config.get(); + + if (isConsoleUiEnabled) { + if (home) { + home.featureCatalogue.register({ + id: 'console', + title: i18n.translate('console.devToolsTitle', { + defaultMessage: 'Interact with the Elasticsearch API', + }), + description: i18n.translate('console.devToolsDescription', { + defaultMessage: 'Skip cURL and use a JSON interface to work with your data in Console.', + }), + icon: 'consoleApp', + path: '/app/dev_tools#/console', + showOnHomePage: false, + category: FeatureCatalogueCategory.ADMIN, + }); + } + + devTools.register({ id: 'console', - title: i18n.translate('console.devToolsTitle', { - defaultMessage: 'Interact with the Elasticsearch API', - }), - description: i18n.translate('console.devToolsDescription', { - defaultMessage: 'Skip cURL and use a JSON interface to work with your data in Console.', + order: 1, + title: i18n.translate('console.consoleDisplayName', { + defaultMessage: 'Console', }), - icon: 'consoleApp', - path: '/app/dev_tools#/console', - showOnHomePage: false, - category: FeatureCatalogueCategory.ADMIN, - }); - } + enableRouting: false, + mount: async ({ element }) => { + const [core] = await getStartServices(); - devTools.register({ - id: 'console', - order: 1, - title: i18n.translate('console.consoleDisplayName', { - defaultMessage: 'Console', - }), - enableRouting: false, - mount: async ({ element }) => { - const [core] = await getStartServices(); + const { + i18n: { Context: I18nContext }, + docLinks: { DOC_LINK_VERSION }, + } = core; - const { - i18n: { Context: I18nContext }, - docLinks: { DOC_LINK_VERSION }, - } = core; + const { renderApp } = await import('./application'); - const { renderApp } = await import('./application'); + return renderApp({ + http, + docLinkVersion: DOC_LINK_VERSION, + I18nContext, + notifications, + usageCollection, + element, + }); + }, + }); - return renderApp({ - http, - docLinkVersion: DOC_LINK_VERSION, - I18nContext, - notifications, - usageCollection, - element, - }); - }, - }); + const locator = share.url.locators.create({ + id: 'CONSOLE_APP_LOCATOR', + getLocation: async ({ loadFrom }) => { + return { + app: 'dev_tools', + path: `#/console${loadFrom ? `?load_from=${loadFrom}` : ''}`, + state: { loadFrom }, + }; + }, + }); - const locator = share.url.locators.create({ - id: 'CONSOLE_APP_LOCATOR', - getLocation: async ({ loadFrom }) => { - return { - app: 'dev_tools', - path: `#/console${loadFrom ? `?load_from=${loadFrom}` : ''}`, - state: { loadFrom }, - }; - }, - }); + return { locator }; + } - return { locator }; + return {}; } public start() {} diff --git a/src/plugins/console/public/types/config.ts b/src/plugins/console/public/types/config.ts new file mode 100644 index 0000000000000..da41eef6f5484 --- /dev/null +++ b/src/plugins/console/public/types/config.ts @@ -0,0 +1,13 @@ +/* + * 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 interface ClientConfigType { + ui: { + enabled: boolean; + }; +} diff --git a/src/plugins/console/public/types/index.ts b/src/plugins/console/public/types/index.ts index b98adbf5610cd..d8b6aaf7b12c4 100644 --- a/src/plugins/console/public/types/index.ts +++ b/src/plugins/console/public/types/index.ts @@ -11,3 +11,5 @@ export * from './core_editor'; export * from './token'; export * from './tokens_provider'; export * from './common'; +export { ClientConfigType } from './config'; +export { ConsoleUILocatorParams } from './locator'; diff --git a/src/plugins/console/public/types/locator.ts b/src/plugins/console/public/types/locator.ts new file mode 100644 index 0000000000000..f3a42338aaadc --- /dev/null +++ b/src/plugins/console/public/types/locator.ts @@ -0,0 +1,12 @@ +/* + * 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 { SerializableRecord } from '@kbn/utility-types'; + +export interface ConsoleUILocatorParams extends SerializableRecord { + loadFrom?: string; +} diff --git a/src/plugins/console/public/types/plugin_dependencies.ts b/src/plugins/console/public/types/plugin_dependencies.ts index 444776f47ea13..afc49f9a5a986 100644 --- a/src/plugins/console/public/types/plugin_dependencies.ts +++ b/src/plugins/console/public/types/plugin_dependencies.ts @@ -9,7 +9,9 @@ import { HomePublicPluginSetup } from '../../../home/public'; import { DevToolsSetup } from '../../../dev_tools/public'; import { UsageCollectionSetup } from '../../../usage_collection/public'; -import { SharePluginSetup } from '../../../share/public'; +import { SharePluginSetup, LocatorPublic } from '../../../share/public'; + +import { ConsoleUILocatorParams } from './locator'; export interface AppSetupUIPluginDependencies { home?: HomePublicPluginSetup; @@ -17,3 +19,7 @@ export interface AppSetupUIPluginDependencies { share: SharePluginSetup; usageCollection?: UsageCollectionSetup; } + +export interface ConsolePluginSetup { + locator?: LocatorPublic; +} diff --git a/src/plugins/console/server/config.ts b/src/plugins/console/server/config.ts index 6d667fed081e8..94e7da451701d 100644 --- a/src/plugins/console/server/config.ts +++ b/src/plugins/console/server/config.ts @@ -7,69 +7,122 @@ */ import { SemVer } from 'semver'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor } from 'kibana/server'; +import { PluginConfigDescriptor, AddConfigDeprecation } from 'kibana/server'; import { MAJOR_VERSION } from '../common/constants'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseSettings = { - enabled: schema.boolean({ defaultValue: true }), - ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}), +const baseConfig = { + exposeToBrowser: { + ui: true, + }, }; -// Settings only available in 7.x -const deprecatedSettings = { - proxyFilter: schema.arrayOf(schema.string(), { defaultValue: ['.*'] }), - proxyConfig: schema.arrayOf( - schema.object({ - match: schema.object({ - protocol: schema.string({ defaultValue: '*' }), - host: schema.string({ defaultValue: '*' }), - port: schema.string({ defaultValue: '*' }), - path: schema.string({ defaultValue: '*' }), - }), - - timeout: schema.number(), - ssl: schema.object( - { - verify: schema.boolean(), - ca: schema.arrayOf(schema.string()), - cert: schema.string(), - key: schema.string(), - }, - { defaultValue: undefined } - ), - }), - { defaultValue: [] } - ), +const baseSchema = { + ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }; +// >= 8.x const configSchema = schema.object( { - ...baseSettings, + ...baseSchema, }, { defaultValue: undefined } ); +// Settings that will be deprecated in the next major +const deprecations: PluginConfigDescriptor['deprecations'] = () => []; + +// Config in latest major +const configLatest: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema, + deprecations, +}; + +export type ConsoleConfig = TypeOf; + +// 7.x const configSchema7x = schema.object( { - ...baseSettings, - ...deprecatedSettings, + ...baseSchema, + enabled: schema.boolean({ defaultValue: true }), + proxyFilter: schema.arrayOf(schema.string(), { defaultValue: ['.*'] }), + proxyConfig: schema.arrayOf( + schema.object({ + match: schema.object({ + protocol: schema.string({ defaultValue: '*' }), + host: schema.string({ defaultValue: '*' }), + port: schema.string({ defaultValue: '*' }), + path: schema.string({ defaultValue: '*' }), + }), + + timeout: schema.number(), + ssl: schema.object( + { + verify: schema.boolean(), + ca: schema.arrayOf(schema.string()), + cert: schema.string(), + key: schema.string(), + }, + { defaultValue: undefined } + ), + }), + { defaultValue: [] } + ), }, { defaultValue: undefined } ); -export type ConfigType = TypeOf; -export type ConfigType7x = TypeOf; - -export const config: PluginConfigDescriptor = { - schema: kibanaVersion.major < 8 ? configSchema7x : configSchema, - deprecations: ({ deprecate, unused }) => [ - deprecate('enabled', '8.0.0'), - deprecate('proxyFilter', '8.0.0'), - deprecate('proxyConfig', '8.0.0'), - unused('ssl'), - ], +// Settings that will be deprecated in 8.0 +const deprecations7x: PluginConfigDescriptor['deprecations'] = ({ + deprecate, + unused, +}) => [ + deprecate('proxyFilter', '8.0.0'), + deprecate('proxyConfig', '8.0.0'), + unused('ssl'), + (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { + if (get(completeConfig, 'console.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('console.deprecations.enabledTitle', { + defaultMessage: 'Setting "console.enabled" is deprecated', + }), + message: i18n.translate('console.deprecations.enabledMessage', { + defaultMessage: 'Use the "console.ui.enabled" setting instead of "console.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('console.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('console.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: 'Change the "console.enabled" setting to "console.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, +]; + +export type ConsoleConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema7x, + deprecations: deprecations7x, }; + +export const config: PluginConfigDescriptor = + kibanaVersion.major < 8 ? config7x : configLatest; diff --git a/src/plugins/console/server/index.ts b/src/plugins/console/server/index.ts index 6ae518f5dc796..b270b89a3d45a 100644 --- a/src/plugins/console/server/index.ts +++ b/src/plugins/console/server/index.ts @@ -11,6 +11,7 @@ import { PluginInitializerContext } from 'kibana/server'; import { ConsoleServerPlugin } from './plugin'; export { ConsoleSetup, ConsoleStart } from './types'; + export { config } from './config'; export const plugin = (ctx: PluginInitializerContext) => new ConsoleServerPlugin(ctx); diff --git a/src/plugins/console/server/plugin.ts b/src/plugins/console/server/plugin.ts index 613337b286fbf..5543c40d03cb0 100644 --- a/src/plugins/console/server/plugin.ts +++ b/src/plugins/console/server/plugin.ts @@ -11,7 +11,7 @@ import { SemVer } from 'semver'; import { ProxyConfigCollection } from './lib'; import { SpecDefinitionsService, EsLegacyConfigService } from './services'; -import { ConfigType, ConfigType7x } from './config'; +import { ConsoleConfig, ConsoleConfig7x } from './config'; import { registerRoutes } from './routes'; @@ -24,11 +24,11 @@ export class ConsoleServerPlugin implements Plugin { esLegacyConfigService = new EsLegacyConfigService(); - constructor(private readonly ctx: PluginInitializerContext) { + constructor(private readonly ctx: PluginInitializerContext) { this.log = this.ctx.logger.get(); } - setup({ http, capabilities, getStartServices, elasticsearch }: CoreSetup) { + setup({ http, capabilities, elasticsearch }: CoreSetup) { capabilities.registerProvider(() => ({ dev_tools: { show: true, @@ -43,8 +43,8 @@ export class ConsoleServerPlugin implements Plugin { let proxyConfigCollection: ProxyConfigCollection | undefined; if (kibanaVersion.major < 8) { // "pathFilters" and "proxyConfig" are only used in 7.x - pathFilters = (config as ConfigType7x).proxyFilter.map((str: string) => new RegExp(str)); - proxyConfigCollection = new ProxyConfigCollection((config as ConfigType7x).proxyConfig); + pathFilters = (config as ConsoleConfig7x).proxyFilter.map((str: string) => new RegExp(str)); + proxyConfigCollection = new ProxyConfigCollection((config as ConsoleConfig7x).proxyConfig); } this.esLegacyConfigService.setup(elasticsearch.legacy.config$); diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.tsx index b374bdd2e1612..8da23d88568cd 100644 --- a/src/plugins/home/public/application/components/manage_data/manage_data.tsx +++ b/src/plugins/home/public/application/components/manage_data/manage_data.tsx @@ -61,7 +61,7 @@ export const ManageData: FC = ({ addBasePath, application, features }) => {isDevToolsEnabled || isManagementEnabled ? ( - {isDevToolsEnabled ? ( + {isDevToolsEnabled && consoleHref !== undefined ? ( (); const navigateToUrl = services.application?.navigateToUrl; - const canShowDevTools = services.application?.capabilities?.dev_tools.show; const devToolsDataUri = compressToEncodedURIComponent(`GET ${indexPattern}/_search\n${json}`); const devToolsHref = services.share.url.locators .get('CONSOLE_APP_LOCATOR') ?.useUrl({ loadFrom: `data:text/plain,${devToolsDataUri}` }); + const canShowDevTools = + services.application?.capabilities?.dev_tools.show && devToolsHref !== undefined; const shouldShowDevToolsLink = !!(indexPattern && canShowDevTools); const handleDevToolsLinkClick = useCallback( () => devToolsHref && navigateToUrl && navigateToUrl(devToolsHref), From 020bbd732c1129a818b022975ee36dc56e1edba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 08:32:54 +0100 Subject: [PATCH 08/26] Fix TS and i18n issues --- x-pack/plugins/index_management/server/config.ts | 8 ++++---- x-pack/plugins/snapshot_restore/server/plugin.ts | 9 +-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/index_management/server/config.ts b/x-pack/plugins/index_management/server/config.ts index dd62557bd33b5..bde7e3e63d4d8 100644 --- a/x-pack/plugins/index_management/server/config.ts +++ b/x-pack/plugins/index_management/server/config.ts @@ -67,19 +67,19 @@ const deprecations7x: PluginConfigDescriptor['deprecati } addDeprecation({ - title: i18n.translate('xpack.index_management.deprecations.enabledTitle', { + title: i18n.translate('xpack.idxMgmt.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.index_management.enabled" is deprecated', }), - message: i18n.translate('xpack.index_management.deprecations.enabledMessage', { + message: i18n.translate('xpack.idxMgmt.deprecations.enabledMessage', { defaultMessage: 'Use the "xpack.index_management.ui.enabled" setting instead of "xpack.index_management.enabled".', }), correctiveActions: { manualSteps: [ - i18n.translate('xpack.index_management.deprecations.enabled.manualStepOneMessage', { + i18n.translate('xpack.idxMgmt.deprecations.enabled.manualStepOneMessage', { defaultMessage: 'Open the kibana.yml config file.', }), - i18n.translate('xpack.index_management.deprecations.enabled.manualStepTwoMessage', { + i18n.translate('xpack.idxMgmt.deprecations.enabled.manualStepTwoMessage', { defaultMessage: 'Change the "xpack.index_management.enabled" setting to "xpack.index_management.ui.enabled".', }), diff --git a/x-pack/plugins/snapshot_restore/server/plugin.ts b/x-pack/plugins/snapshot_restore/server/plugin.ts index 4414e3735959b..d737807ec8dad 100644 --- a/x-pack/plugins/snapshot_restore/server/plugin.ts +++ b/x-pack/plugins/snapshot_restore/server/plugin.ts @@ -28,16 +28,9 @@ export class SnapshotRestoreServerPlugin implements Plugin this.license = new License(); } - public setup( - { http, getStartServices }: CoreSetup, - { licensing, features, security, cloud }: Dependencies - ): void { + public setup({ http }: CoreSetup, { licensing, features, security, cloud }: Dependencies): void { const pluginConfig = this.context.config.get(); - if (!pluginConfig.enabled) { - return; - } - const router = http.createRouter(); this.license.setup( From cc60f007e021a9358c1d04bf4d1ef8aa1b731a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 08:49:08 +0100 Subject: [PATCH 09/26] [CCR] Add ui.enabled kibana setting --- .../common/constants/index.ts | 2 + .../server/config.ts | 102 +++++++++++++++++- .../cross_cluster_replication/server/index.ts | 13 +-- 3 files changed, 103 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/common/constants/index.ts b/x-pack/plugins/cross_cluster_replication/common/constants/index.ts index f1b327aed6389..a800afcf77ae4 100644 --- a/x-pack/plugins/cross_cluster_replication/common/constants/index.ts +++ b/x-pack/plugins/cross_cluster_replication/common/constants/index.ts @@ -19,6 +19,8 @@ export const PLUGIN = { minimumLicenseType: platinumLicense, }; +export const MAJOR_VERSION = '8.0.0'; + export const APPS = { CCR_APP: 'ccr', REMOTE_CLUSTER_APP: 'remote_cluster', diff --git a/x-pack/plugins/cross_cluster_replication/server/config.ts b/x-pack/plugins/cross_cluster_replication/server/config.ts index 50cca903f8a2b..126ace3734711 100644 --- a/x-pack/plugins/cross_cluster_replication/server/config.ts +++ b/x-pack/plugins/cross_cluster_replication/server/config.ts @@ -4,14 +4,108 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { SemVer } from 'semver'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; +import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; -export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), +import { MAJOR_VERSION } from '../common/constants'; + +const kibanaVersion = new SemVer(MAJOR_VERSION); + +const baseConfig = { + exposeToBrowser: { + ui: true, + }, +}; + +const baseSchema = { ui: schema.object({ enabled: schema.boolean({ defaultValue: true }), }), -}); +}; + +// >= 8.x +const configSchema = schema.object( + { + ...baseSchema, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in the next major +const deprecations: PluginConfigDescriptor['deprecations'] = () => []; + +// Config in latest major +const configLatest: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema, + deprecations, +}; export type CrossClusterReplicationConfig = TypeOf; + +// 7.x +const settings7x = { + enabled: schema.boolean({ defaultValue: true }), +}; + +const configSchema7x = schema.object( + { + ...baseSchema, + ...settings7x, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in 8.0 +const deprecations7x: PluginConfigDescriptor['deprecations'] = + () => [ + ( + completeConfig: Record, + rootPath: string, + addDeprecation: AddConfigDeprecation + ) => { + if (get(completeConfig, 'xpack.ccr.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('xpack.crossClusterReplication.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.ccr.enabled" is deprecated', + }), + message: i18n.translate('xpack.crossClusterReplication.deprecations.enabledMessage', { + defaultMessage: 'Use the "xpack.ccr.ui.enabled" setting instead of "xpack.ccr.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate( + 'xpack.crossClusterReplication.deprecations.enabled.manualStepOneMessage', + { + defaultMessage: 'Open the kibana.yml config file.', + } + ), + i18n.translate( + 'xpack.crossClusterReplication.deprecations.enabled.manualStepTwoMessage', + { + defaultMessage: 'Change the "xpack.ccr.enabled" setting to "xpack.ccr.ui.enabled".', + } + ), + ], + }, + }); + return completeConfig; + }, + ]; +export type CrossClusterReplicationConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema7x, + deprecations: deprecations7x, +}; + +export const config: PluginConfigDescriptor< + CrossClusterReplicationConfig | CrossClusterReplicationConfig7x +> = kibanaVersion.major < 8 ? config7x : configLatest; diff --git a/x-pack/plugins/cross_cluster_replication/server/index.ts b/x-pack/plugins/cross_cluster_replication/server/index.ts index a6a3ec0fe5753..7a0984a6117bf 100644 --- a/x-pack/plugins/cross_cluster_replication/server/index.ts +++ b/x-pack/plugins/cross_cluster_replication/server/index.ts @@ -5,17 +5,10 @@ * 2.0. */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server'; +import { PluginInitializerContext } from 'src/core/server'; import { CrossClusterReplicationServerPlugin } from './plugin'; -import { configSchema, CrossClusterReplicationConfig } from './config'; + +export { config } from './config'; export const plugin = (pluginInitializerContext: PluginInitializerContext) => new CrossClusterReplicationServerPlugin(pluginInitializerContext); - -export const config: PluginConfigDescriptor = { - schema: configSchema, - exposeToBrowser: { - ui: true, - }, - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], -}; From 5fe771339be7849a0014d353d6c064a1ab3bc0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 08:57:28 +0100 Subject: [PATCH 10/26] [ILM] Add deprecation for "enabled" setting --- .../common/constants/index.ts | 2 + .../server/config.ts | 96 ++++++++++++++++++- .../server/index.ts | 13 +-- 3 files changed, 97 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/index_lifecycle_management/common/constants/index.ts b/x-pack/plugins/index_lifecycle_management/common/constants/index.ts index 7107489f4e2ba..329f479e128e2 100644 --- a/x-pack/plugins/index_lifecycle_management/common/constants/index.ts +++ b/x-pack/plugins/index_lifecycle_management/common/constants/index.ts @@ -19,6 +19,8 @@ export const PLUGIN = { }), }; +export const MAJOR_VERSION = '8.0.0'; + export const API_BASE_PATH = '/api/index_lifecycle_management'; export { MIN_SEARCHABLE_SNAPSHOT_LICENSE, MIN_PLUGIN_LICENSE }; diff --git a/x-pack/plugins/index_lifecycle_management/server/config.ts b/x-pack/plugins/index_lifecycle_management/server/config.ts index f3fdf59cec55b..23c93005858ea 100644 --- a/x-pack/plugins/index_lifecycle_management/server/config.ts +++ b/x-pack/plugins/index_lifecycle_management/server/config.ts @@ -4,16 +4,104 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { SemVer } from 'semver'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; +import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; -export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), +import { MAJOR_VERSION } from '../common/constants'; + +const kibanaVersion = new SemVer(MAJOR_VERSION); + +const baseConfig = { + exposeToBrowser: { + ui: true, + }, +}; + +const baseSchema = { ui: schema.object({ enabled: schema.boolean({ defaultValue: true }), }), // Cloud requires the ability to hide internal node attributes from users. filteredNodeAttributes: schema.arrayOf(schema.string(), { defaultValue: [] }), -}); +}; + +// >= 8.x +const configSchema = schema.object( + { + ...baseSchema, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in the next major +const deprecations: PluginConfigDescriptor['deprecations'] = () => []; + +// Config in latest major +const configLatest: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema, + deprecations, +}; export type IndexLifecycleManagementConfig = TypeOf; + +// 7.x +const settings7x = { + enabled: schema.boolean({ defaultValue: true }), +}; + +const configSchema7x = schema.object( + { + ...baseSchema, + ...settings7x, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in 8.0 +const deprecations7x: PluginConfigDescriptor['deprecations'] = + () => [ + ( + completeConfig: Record, + rootPath: string, + addDeprecation: AddConfigDeprecation + ) => { + if (get(completeConfig, 'xpack.ilm.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('xpack.indexLifecycleMgmt.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.ilm.enabled" is deprecated', + }), + message: i18n.translate('xpack.indexLifecycleMgmt.deprecations.enabledMessage', { + defaultMessage: 'Use the "xpack.ilm.ui.enabled" setting instead of "xpack.ilm.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.indexLifecycleMgmt.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.indexLifecycleMgmt.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: 'Change the "xpack.ilm.enabled" setting to "xpack.ilm.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, + ]; +export type IndexLifecycleManagementConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema7x, + deprecations: deprecations7x, +}; + +export const config: PluginConfigDescriptor< + IndexLifecycleManagementConfig | IndexLifecycleManagementConfig7x +> = kibanaVersion.major < 8 ? config7x : configLatest; diff --git a/x-pack/plugins/index_lifecycle_management/server/index.ts b/x-pack/plugins/index_lifecycle_management/server/index.ts index 1f8b01913fd3e..6a74b4c80b2d3 100644 --- a/x-pack/plugins/index_lifecycle_management/server/index.ts +++ b/x-pack/plugins/index_lifecycle_management/server/index.ts @@ -5,17 +5,10 @@ * 2.0. */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'kibana/server'; +import { PluginInitializerContext } from 'kibana/server'; import { IndexLifecycleManagementServerPlugin } from './plugin'; -import { configSchema, IndexLifecycleManagementConfig } from './config'; + +export { config } from './config'; export const plugin = (ctx: PluginInitializerContext) => new IndexLifecycleManagementServerPlugin(ctx); - -export const config: PluginConfigDescriptor = { - schema: configSchema, - exposeToBrowser: { - ui: true, - }, - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], -}; From cf466499cf509eecfcb6e86e7bc36305a4983116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 13:44:14 +0100 Subject: [PATCH 11/26] [License management] Add deprecation for "enabled" setting --- .../common/constants/index.ts | 2 +- .../common/constants/plugin.ts | 2 + .../license_management/server/config.ts | 92 ++++++++++++++++++- .../license_management/server/index.ts | 13 +-- 4 files changed, 94 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/license_management/common/constants/index.ts b/x-pack/plugins/license_management/common/constants/index.ts index 0567b0008f0c8..9735eabeb1e40 100644 --- a/x-pack/plugins/license_management/common/constants/index.ts +++ b/x-pack/plugins/license_management/common/constants/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -export { PLUGIN } from './plugin'; +export { PLUGIN, MAJOR_VERSION } from './plugin'; export { API_BASE_PATH } from './base_path'; export { EXTERNAL_LINKS } from './external_links'; export { APP_PERMISSION } from './permissions'; diff --git a/x-pack/plugins/license_management/common/constants/plugin.ts b/x-pack/plugins/license_management/common/constants/plugin.ts index ae7fd0f6e8a2e..76f4d94a0188a 100644 --- a/x-pack/plugins/license_management/common/constants/plugin.ts +++ b/x-pack/plugins/license_management/common/constants/plugin.ts @@ -13,3 +13,5 @@ export const PLUGIN = { }), id: 'license_management', }; + +export const MAJOR_VERSION = '8.0.0'; diff --git a/x-pack/plugins/license_management/server/config.ts b/x-pack/plugins/license_management/server/config.ts index 0e4de29b718be..393253e44098c 100644 --- a/x-pack/plugins/license_management/server/config.ts +++ b/x-pack/plugins/license_management/server/config.ts @@ -4,14 +4,98 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { SemVer } from 'semver'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; +import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; -export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), +import { MAJOR_VERSION } from '../common/constants'; + +const kibanaVersion = new SemVer(MAJOR_VERSION); + +const baseConfig = { + exposeToBrowser: { + ui: true, + }, +}; + +const baseSchema = { ui: schema.object({ enabled: schema.boolean({ defaultValue: true }), }), -}); +}; + +// >= 8.x +const configSchema = schema.object( + { + ...baseSchema, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in the next major +const deprecations: PluginConfigDescriptor['deprecations'] = () => []; + +// Config in latest major +const configLatest: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema, + deprecations, +}; export type LicenseManagementConfig = TypeOf; + +// 7.x +const settings7x = { + enabled: schema.boolean({ defaultValue: true }), +}; + +const configSchema7x = schema.object( + { + ...baseSchema, + ...settings7x, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in 8.0 +const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ + (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { + if (get(completeConfig, 'xpack.license_management.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('xpack.licenseMgmt.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.license_management.enabled" is deprecated', + }), + message: i18n.translate('xpack.licenseMgmt.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.license_management.ui.enabled" setting instead of "xpack.license_management.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.licenseMgmt.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.licenseMgmt.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.license_management.enabled" setting to "xpack.license_management.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, +]; +export type LicenseManagementConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema7x, + deprecations: deprecations7x, +}; + +export const config: PluginConfigDescriptor = + kibanaVersion.major < 8 ? config7x : configLatest; diff --git a/x-pack/plugins/license_management/server/index.ts b/x-pack/plugins/license_management/server/index.ts index e78ffe07b50c0..7aa6bfb06d54d 100644 --- a/x-pack/plugins/license_management/server/index.ts +++ b/x-pack/plugins/license_management/server/index.ts @@ -5,17 +5,10 @@ * 2.0. */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server'; +import { PluginInitializerContext } from 'src/core/server'; import { LicenseManagementServerPlugin } from './plugin'; -import { configSchema, LicenseManagementConfig } from './config'; -export const plugin = (ctx: PluginInitializerContext) => new LicenseManagementServerPlugin(); +export { config } from './config'; -export const config: PluginConfigDescriptor = { - schema: configSchema, - exposeToBrowser: { - ui: true, - }, - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], -}; +export const plugin = (ctx: PluginInitializerContext) => new LicenseManagementServerPlugin(); From 8f936a6200d23cf07e516ffaf1ed0d5a04bdef0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 13:46:46 +0100 Subject: [PATCH 12/26] Fix i18n issue --- x-pack/plugins/rollup/server/config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/rollup/server/config.ts b/x-pack/plugins/rollup/server/config.ts index 7913f09bed231..dd6be1f1404f7 100644 --- a/x-pack/plugins/rollup/server/config.ts +++ b/x-pack/plugins/rollup/server/config.ts @@ -67,19 +67,19 @@ const deprecations7x: PluginConfigDescriptor['deprecations'] = ( } addDeprecation({ - title: i18n.translate('xpack.rollup.deprecations.enabledTitle', { + title: i18n.translate('xpack.rollupJobs.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.rollup.enabled" is deprecated', }), - message: i18n.translate('xpack.rollup.deprecations.enabledMessage', { + message: i18n.translate('xpack.rollupJobs.deprecations.enabledMessage', { defaultMessage: 'Use the "xpack.rollup.ui.enabled" setting instead of "xpack.rollup.enabled".', }), correctiveActions: { manualSteps: [ - i18n.translate('xpack.rollup.deprecations.enabled.manualStepOneMessage', { + i18n.translate('xpack.rollupJobs.deprecations.enabled.manualStepOneMessage', { defaultMessage: 'Open the kibana.yml config file.', }), - i18n.translate('xpack.rollup.deprecations.enabled.manualStepTwoMessage', { + i18n.translate('xpack.rollupJobs.deprecations.enabled.manualStepTwoMessage', { defaultMessage: 'Change the "xpack.rollup.enabled" setting to "xpack.rollup.ui.enabled".', }), From d8b6909f182a113d2b4e5974f41204e7ad26d567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 13:50:20 +0100 Subject: [PATCH 13/26] Fix jest test --- .../reindex/flyout/warning_step.test.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx index b762aa30d9fb2..419e4b941586a 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx @@ -16,6 +16,11 @@ import { MAJOR_VERSION } from '../../../../../../../common/constants'; import { idForWarning, WarningsFlyoutStep } from './warnings_step'; const kibanaVersion = new SemVer(MAJOR_VERSION); +const mockKibanaVersionInfo = { + currentMajor: kibanaVersion.major, + prevMajor: kibanaVersion.major - 1, + nextMajor: kibanaVersion.major + 1, +}; jest.mock('../../../../../app_context', () => { const { docLinksServiceMock } = jest.requireActual( @@ -26,11 +31,7 @@ jest.mock('../../../../../app_context', () => { useAppContext: () => { return { docLinks: docLinksServiceMock.createStartContract(), - kibanaVersionInfo: { - currentMajor: kibanaVersion.major, - prevMajor: kibanaVersion.major - 1, - nextMajor: kibanaVersion.major + 1, - }, + kibanaVersionInfo: mockKibanaVersionInfo, }; }, }; From 63df99c8841b04e9291dc084abafa644e6de21d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 13:58:56 +0100 Subject: [PATCH 14/26] [Remote clusters] Add deprecation for "enabled" setting --- .../remote_clusters/common/constants.ts | 2 + .../plugins/remote_clusters/server/config.ts | 96 +++++++++++++++++-- 2 files changed, 88 insertions(+), 10 deletions(-) diff --git a/x-pack/plugins/remote_clusters/common/constants.ts b/x-pack/plugins/remote_clusters/common/constants.ts index b11292141672d..5a36924b26433 100644 --- a/x-pack/plugins/remote_clusters/common/constants.ts +++ b/x-pack/plugins/remote_clusters/common/constants.ts @@ -20,6 +20,8 @@ export const PLUGIN = { }, }; +export const MAJOR_VERSION = '8.0.0'; + export const API_BASE_PATH = '/api/remote_clusters'; export const SNIFF_MODE = 'sniff'; diff --git a/x-pack/plugins/remote_clusters/server/config.ts b/x-pack/plugins/remote_clusters/server/config.ts index 8f379ec5613c8..43b5ebfe3517b 100644 --- a/x-pack/plugins/remote_clusters/server/config.ts +++ b/x-pack/plugins/remote_clusters/server/config.ts @@ -4,23 +4,99 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { SemVer } from 'semver'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor } from 'kibana/server'; +import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; -export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), +import { MAJOR_VERSION } from '../common/constants'; + +const kibanaVersion = new SemVer(MAJOR_VERSION); + +const baseConfig = { + exposeToBrowser: { + ui: true, + }, +}; + +const baseSchema = { ui: schema.object({ enabled: schema.boolean({ defaultValue: true }), }), -}); +}; -export type ConfigType = TypeOf; +// >= 8.x +const configSchema = schema.object( + { + ...baseSchema, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in the next major +const deprecations: PluginConfigDescriptor['deprecations'] = () => []; -export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], +// Config in latest major +const configLatest: PluginConfigDescriptor = { + ...baseConfig, schema: configSchema, - exposeToBrowser: { - ui: true, + deprecations, +}; + +// export type ConfigType = TypeOf; +export type RemoteClustersConfig = TypeOf; + +// 7.x +const settings7x = { + enabled: schema.boolean({ defaultValue: true }), +}; + +const configSchema7x = schema.object( + { + ...baseSchema, + ...settings7x, + }, + { defaultValue: undefined } +); + +// Settings that will be deprecated in 8.0 +const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ + (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { + if (get(completeConfig, 'xpack.remote_clusters.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('xpack.remoteClusters.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.remote_clusters.enabled" is deprecated', + }), + message: i18n.translate('xpack.remoteClusters.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.remote_clusters.ui.enabled" setting instead of "xpack.remote_clusters.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.remoteClusters.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.remoteClusters.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.remote_clusters.enabled" setting to "xpack.remote_clusters.ui.enabled".', + }), + ], + }, + }); + return completeConfig; }, +]; +export type RemoteClustersConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + ...baseConfig, + schema: configSchema7x, + deprecations: deprecations7x, }; + +export const config: PluginConfigDescriptor = + kibanaVersion.major < 8 ? config7x : configLatest; From 338488ab0d913f04094304b8ed98d4ed4c6fdb9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 14:12:50 +0100 Subject: [PATCH 15/26] Fix i18n issue --- x-pack/plugins/snapshot_restore/server/config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/snapshot_restore/server/config.ts b/x-pack/plugins/snapshot_restore/server/config.ts index 6775802c8e7aa..43feabd74822b 100644 --- a/x-pack/plugins/snapshot_restore/server/config.ts +++ b/x-pack/plugins/snapshot_restore/server/config.ts @@ -71,19 +71,19 @@ const deprecations7x: PluginConfigDescriptor['deprecati } addDeprecation({ - title: i18n.translate('xpack.snapshot_restore.deprecations.enabledTitle', { + title: i18n.translate('xpack.snapshotRestore.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.snapshot_restore.enabled" is deprecated', }), - message: i18n.translate('xpack.snapshot_restore.deprecations.enabledMessage', { + message: i18n.translate('xpack.snapshotRestore.deprecations.enabledMessage', { defaultMessage: 'Use the "xpack.snapshot_restore.ui.enabled" setting instead of "xpack.snapshot_restore.enabled".', }), correctiveActions: { manualSteps: [ - i18n.translate('xpack.snapshot_restore.deprecations.enabled.manualStepOneMessage', { + i18n.translate('xpack.snapshotRestore.deprecations.enabled.manualStepOneMessage', { defaultMessage: 'Open the kibana.yml config file.', }), - i18n.translate('xpack.snapshot_restore.deprecations.enabled.manualStepTwoMessage', { + i18n.translate('xpack.snapshotRestore.deprecations.enabled.manualStepTwoMessage', { defaultMessage: 'Change the "xpack.snapshot_restore.enabled" setting to "xpack.snapshot_restore.ui.enabled".', }), From 8b932f4ca19369164d848a804bff81b21e29d8ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 14:24:25 +0100 Subject: [PATCH 16/26] Fix i18n issue --- x-pack/plugins/upgrade_assistant/server/config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/server/config.ts b/x-pack/plugins/upgrade_assistant/server/config.ts index 634921495d4a4..b0e77b6a04e66 100644 --- a/x-pack/plugins/upgrade_assistant/server/config.ts +++ b/x-pack/plugins/upgrade_assistant/server/config.ts @@ -74,19 +74,19 @@ const deprecations7x: PluginConfigDescriptor['deprecat } addDeprecation({ - title: i18n.translate('xpack.upgrade_assistant.deprecations.enabledTitle', { + title: i18n.translate('xpack.upgradeAssistant.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.upgrade_assistant.enabled" is deprecated', }), - message: i18n.translate('xpack.upgrade_assistant.deprecations.enabledMessage', { + message: i18n.translate('xpack.upgradeAssistant.deprecations.enabledMessage', { defaultMessage: 'Use the "xpack.upgrade_assistant.ui.enabled" setting instead of "xpack.upgrade_assistant.enabled".', }), correctiveActions: { manualSteps: [ - i18n.translate('xpack.upgrade_assistant.deprecations.enabled.manualStepOneMessage', { + i18n.translate('xpack.upgradeAssistant.deprecations.enabled.manualStepOneMessage', { defaultMessage: 'Open the kibana.yml config file.', }), - i18n.translate('xpack.upgrade_assistant.deprecations.enabled.manualStepTwoMessage', { + i18n.translate('xpack.upgradeAssistant.deprecations.enabled.manualStepTwoMessage', { defaultMessage: 'Change the "xpack.upgrade_assistant.enabled" setting to "xpack.upgrade_assistant.ui.enabled".', }), From 2fddef64241649ac3eaff6bfe9dcbd770c623d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Thu, 14 Oct 2021 16:00:17 +0100 Subject: [PATCH 17/26] Fix TS issue --- x-pack/plugins/remote_clusters/server/plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/remote_clusters/server/plugin.ts b/x-pack/plugins/remote_clusters/server/plugin.ts index b13773c27034a..fde71677b8448 100644 --- a/x-pack/plugins/remote_clusters/server/plugin.ts +++ b/x-pack/plugins/remote_clusters/server/plugin.ts @@ -11,7 +11,7 @@ import { CoreSetup, Logger, Plugin, PluginInitializerContext } from 'src/core/se import { PLUGIN } from '../common/constants'; import { Dependencies, LicenseStatus, RouteDependencies } from './types'; -import { ConfigType } from './config'; +import { RemoteClustersConfig, RemoteClustersConfig7x } from './config'; import { registerGetRoute, registerAddRoute, @@ -30,7 +30,7 @@ export class RemoteClustersServerPlugin { licenseStatus: LicenseStatus; log: Logger; - config: ConfigType; + config: RemoteClustersConfig | RemoteClustersConfig7x; constructor({ logger, config }: PluginInitializerContext) { this.log = logger.get(); From 972934ea3a73c9595a6d94fe8dac9125c9ae99f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Mon, 18 Oct 2021 07:50:06 +0100 Subject: [PATCH 18/26] Refactor to not extend schema and config objects --- src/plugins/console/server/config.ts | 121 +++++++--------- .../server/config.ts | 75 ++++------ .../server/config.ts | 81 +++++------ .../plugins/index_management/server/config.ts | 116 +++++++-------- .../license_management/server/config.ts | 116 +++++++-------- .../plugins/remote_clusters/server/config.ts | 117 +++++++-------- x-pack/plugins/rollup/server/config.ts | 116 +++++++-------- .../plugins/snapshot_restore/server/config.ts | 128 ++++++++-------- .../upgrade_assistant/server/config.ts | 137 +++++++++--------- 9 files changed, 460 insertions(+), 547 deletions(-) diff --git a/src/plugins/console/server/config.ts b/src/plugins/console/server/config.ts index 94e7da451701d..1e09f7581c6e2 100644 --- a/src/plugins/console/server/config.ts +++ b/src/plugins/console/server/config.ts @@ -10,49 +10,40 @@ import { SemVer } from 'semver'; import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor, AddConfigDeprecation } from 'kibana/server'; +import { PluginConfigDescriptor } from 'kibana/server'; import { MAJOR_VERSION } from '../common/constants'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseConfig = { - exposeToBrowser: { - ui: true, - }, -}; - -const baseSchema = { - ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}), - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), -}; - +// ------------------------------- // >= 8.x -const configSchema = schema.object( +// ------------------------------- +const schemaLatest = schema.object( { - ...baseSchema, + ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in the next major -const deprecations: PluginConfigDescriptor['deprecations'] = () => []; - -// Config in latest major const configLatest: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema, - deprecations, + exposeToBrowser: { + ui: true, + }, + schema: schemaLatest, + deprecations: () => [], }; -export type ConsoleConfig = TypeOf; +export type ConsoleConfig = TypeOf; +// ------------------------------- // 7.x -const configSchema7x = schema.object( +// ------------------------------- +const schema7x = schema.object( { - ...baseSchema, enabled: schema.boolean({ defaultValue: true }), proxyFilter: schema.arrayOf(schema.string(), { defaultValue: ['.*'] }), proxyConfig: schema.arrayOf( @@ -77,51 +68,51 @@ const configSchema7x = schema.object( }), { defaultValue: [] } ), + ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in 8.0 -const deprecations7x: PluginConfigDescriptor['deprecations'] = ({ - deprecate, - unused, -}) => [ - deprecate('proxyFilter', '8.0.0'), - deprecate('proxyConfig', '8.0.0'), - unused('ssl'), - (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { - if (get(completeConfig, 'console.enabled') === undefined) { - return completeConfig; - } - - addDeprecation({ - title: i18n.translate('console.deprecations.enabledTitle', { - defaultMessage: 'Setting "console.enabled" is deprecated', - }), - message: i18n.translate('console.deprecations.enabledMessage', { - defaultMessage: 'Use the "console.ui.enabled" setting instead of "console.enabled".', - }), - correctiveActions: { - manualSteps: [ - i18n.translate('console.deprecations.enabled.manualStepOneMessage', { - defaultMessage: 'Open the kibana.yml config file.', - }), - i18n.translate('console.deprecations.enabled.manualStepTwoMessage', { - defaultMessage: 'Change the "console.enabled" setting to "console.ui.enabled".', - }), - ], - }, - }); - return completeConfig; - }, -]; - -export type ConsoleConfig7x = TypeOf; +export type ConsoleConfig7x = TypeOf; const config7x: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema7x, - deprecations: deprecations7x, + exposeToBrowser: { + ui: true, + }, + schema: schema7x, + deprecations: ({ deprecate, unused }) => [ + deprecate('proxyFilter', '8.0.0'), + deprecate('proxyConfig', '8.0.0'), + unused('ssl'), + (completeConfig, rootPath, addDeprecation) => { + if (get(completeConfig, 'console.enabled') === undefined) { + return completeConfig; + } + + addDeprecation({ + title: i18n.translate('console.deprecations.enabledTitle', { + defaultMessage: 'Setting "console.enabled" is deprecated', + }), + message: i18n.translate('console.deprecations.enabledMessage', { + defaultMessage: 'Use the "console.ui.enabled" setting instead of "console.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('console.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('console.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: 'Change the "console.enabled" setting to "console.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, + ], }; export const config: PluginConfigDescriptor = diff --git a/x-pack/plugins/cross_cluster_replication/server/config.ts b/x-pack/plugins/cross_cluster_replication/server/config.ts index 126ace3734711..ff108a75be1cf 100644 --- a/x-pack/plugins/cross_cluster_replication/server/config.ts +++ b/x-pack/plugins/cross_cluster_replication/server/config.ts @@ -8,65 +8,56 @@ import { SemVer } from 'semver'; import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; +import { PluginConfigDescriptor } from 'src/core/server'; import { MAJOR_VERSION } from '../common/constants'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseConfig = { - exposeToBrowser: { - ui: true, - }, -}; - -const baseSchema = { - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), -}; - +// ------------------------------- // >= 8.x -const configSchema = schema.object( +// ------------------------------- +const schemaLatest = schema.object( { - ...baseSchema, + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in the next major -const deprecations: PluginConfigDescriptor['deprecations'] = () => []; - -// Config in latest major const configLatest: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema, - deprecations, + exposeToBrowser: { + ui: true, + }, + schema: schemaLatest, + deprecations: () => [], }; -export type CrossClusterReplicationConfig = TypeOf; +export type CrossClusterReplicationConfig = TypeOf; +// ------------------------------- // 7.x -const settings7x = { - enabled: schema.boolean({ defaultValue: true }), -}; - -const configSchema7x = schema.object( +// ------------------------------- +const schema7x = schema.object( { - ...baseSchema, - ...settings7x, + enabled: schema.boolean({ defaultValue: true }), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in 8.0 -const deprecations7x: PluginConfigDescriptor['deprecations'] = - () => [ - ( - completeConfig: Record, - rootPath: string, - addDeprecation: AddConfigDeprecation - ) => { +export type CrossClusterReplicationConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + exposeToBrowser: { + ui: true, + }, + schema: schema7x, + deprecations: () => [ + (completeConfig, rootPath, addDeprecation) => { if (get(completeConfig, 'xpack.ccr.enabled') === undefined) { return completeConfig; } @@ -97,13 +88,7 @@ const deprecations7x: PluginConfigDescriptor['dep }); return completeConfig; }, - ]; -export type CrossClusterReplicationConfig7x = TypeOf; - -const config7x: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema7x, - deprecations: deprecations7x, + ], }; export const config: PluginConfigDescriptor< diff --git a/x-pack/plugins/index_lifecycle_management/server/config.ts b/x-pack/plugins/index_lifecycle_management/server/config.ts index 23c93005858ea..1d2cdacc1891f 100644 --- a/x-pack/plugins/index_lifecycle_management/server/config.ts +++ b/x-pack/plugins/index_lifecycle_management/server/config.ts @@ -8,67 +8,60 @@ import { SemVer } from 'semver'; import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; +import { PluginConfigDescriptor } from 'src/core/server'; import { MAJOR_VERSION } from '../common/constants'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseConfig = { - exposeToBrowser: { - ui: true, - }, -}; - -const baseSchema = { - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), - // Cloud requires the ability to hide internal node attributes from users. - filteredNodeAttributes: schema.arrayOf(schema.string(), { defaultValue: [] }), -}; - +// ------------------------------- // >= 8.x -const configSchema = schema.object( +// ------------------------------- +const schemaLatest = schema.object( { - ...baseSchema, + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), + // Cloud requires the ability to hide internal node attributes from users. + filteredNodeAttributes: schema.arrayOf(schema.string(), { defaultValue: [] }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in the next major -const deprecations: PluginConfigDescriptor['deprecations'] = () => []; - -// Config in latest major const configLatest: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema, - deprecations, + exposeToBrowser: { + ui: true, + }, + schema: schemaLatest, + deprecations: () => [], }; -export type IndexLifecycleManagementConfig = TypeOf; +export type IndexLifecycleManagementConfig = TypeOf; +// ------------------------------- // 7.x -const settings7x = { - enabled: schema.boolean({ defaultValue: true }), -}; - -const configSchema7x = schema.object( +// ------------------------------- +const schema7x = schema.object( { - ...baseSchema, - ...settings7x, + enabled: schema.boolean({ defaultValue: true }), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), + // Cloud requires the ability to hide internal node attributes from users. + filteredNodeAttributes: schema.arrayOf(schema.string(), { defaultValue: [] }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in 8.0 -const deprecations7x: PluginConfigDescriptor['deprecations'] = - () => [ - ( - completeConfig: Record, - rootPath: string, - addDeprecation: AddConfigDeprecation - ) => { +export type IndexLifecycleManagementConfig7x = TypeOf; + +const config7x: PluginConfigDescriptor = { + exposeToBrowser: { + ui: true, + }, + schema: schema7x, + deprecations: () => [ + (completeConfig, rootPath, addDeprecation) => { if (get(completeConfig, 'xpack.ilm.enabled') === undefined) { return completeConfig; } @@ -93,13 +86,7 @@ const deprecations7x: PluginConfigDescriptor[' }); return completeConfig; }, - ]; -export type IndexLifecycleManagementConfig7x = TypeOf; - -const config7x: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema7x, - deprecations: deprecations7x, + ], }; export const config: PluginConfigDescriptor< diff --git a/x-pack/plugins/index_management/server/config.ts b/x-pack/plugins/index_management/server/config.ts index bde7e3e63d4d8..5ef35a5a2466d 100644 --- a/x-pack/plugins/index_management/server/config.ts +++ b/x-pack/plugins/index_management/server/config.ts @@ -8,93 +8,83 @@ import { SemVer } from 'semver'; import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; +import { PluginConfigDescriptor } from 'src/core/server'; import { MAJOR_VERSION } from '../common/constants'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseConfig = { - exposeToBrowser: { - ui: true, - }, -}; - -const baseSchema = { - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), -}; - +// ------------------------------- // >= 8.x -const configSchema = schema.object( +// ------------------------------- +const schemaLatest = schema.object( { - ...baseSchema, + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in the next major -const deprecations: PluginConfigDescriptor['deprecations'] = () => []; - -// Config in latest major const configLatest: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema, - deprecations, + exposeToBrowser: { + ui: true, + }, + schema: schemaLatest, + deprecations: () => [], }; -export type IndexManagementConfig = TypeOf; +export type IndexManagementConfig = TypeOf; +// ------------------------------- // 7.x -const settings7x = { - enabled: schema.boolean({ defaultValue: true }), -}; - -const configSchema7x = schema.object( +// ------------------------------- +const schema7x = schema.object( { - ...baseSchema, - ...settings7x, + enabled: schema.boolean({ defaultValue: true }), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in 8.0 -const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ - (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { - if (get(completeConfig, 'xpack.index_management.enabled') === undefined) { - return completeConfig; - } +export type IndexManagementConfig7x = TypeOf; - addDeprecation({ - title: i18n.translate('xpack.idxMgmt.deprecations.enabledTitle', { - defaultMessage: 'Setting "xpack.index_management.enabled" is deprecated', - }), - message: i18n.translate('xpack.idxMgmt.deprecations.enabledMessage', { - defaultMessage: - 'Use the "xpack.index_management.ui.enabled" setting instead of "xpack.index_management.enabled".', - }), - correctiveActions: { - manualSteps: [ - i18n.translate('xpack.idxMgmt.deprecations.enabled.manualStepOneMessage', { - defaultMessage: 'Open the kibana.yml config file.', - }), - i18n.translate('xpack.idxMgmt.deprecations.enabled.manualStepTwoMessage', { - defaultMessage: - 'Change the "xpack.index_management.enabled" setting to "xpack.index_management.ui.enabled".', - }), - ], - }, - }); - return completeConfig; +const config7x: PluginConfigDescriptor = { + exposeToBrowser: { + ui: true, }, -]; -export type IndexManagementConfig7x = TypeOf; + schema: schema7x, + deprecations: () => [ + (completeConfig, rootPath, addDeprecation) => { + if (get(completeConfig, 'xpack.index_management.enabled') === undefined) { + return completeConfig; + } -const config7x: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema7x, - deprecations: deprecations7x, + addDeprecation({ + title: i18n.translate('xpack.idxMgmt.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.index_management.enabled" is deprecated', + }), + message: i18n.translate('xpack.idxMgmt.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.index_management.ui.enabled" setting instead of "xpack.index_management.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.idxMgmt.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.idxMgmt.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.index_management.enabled" setting to "xpack.index_management.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, + ], }; export const config: PluginConfigDescriptor = diff --git a/x-pack/plugins/license_management/server/config.ts b/x-pack/plugins/license_management/server/config.ts index 393253e44098c..268f4f323912f 100644 --- a/x-pack/plugins/license_management/server/config.ts +++ b/x-pack/plugins/license_management/server/config.ts @@ -8,93 +8,83 @@ import { SemVer } from 'semver'; import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; +import { PluginConfigDescriptor } from 'src/core/server'; import { MAJOR_VERSION } from '../common/constants'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseConfig = { - exposeToBrowser: { - ui: true, - }, -}; - -const baseSchema = { - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), -}; - +// ------------------------------- // >= 8.x -const configSchema = schema.object( +// ------------------------------- +const schemaLatest = schema.object( { - ...baseSchema, + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in the next major -const deprecations: PluginConfigDescriptor['deprecations'] = () => []; - -// Config in latest major const configLatest: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema, - deprecations, + exposeToBrowser: { + ui: true, + }, + schema: schemaLatest, + deprecations: () => [], }; -export type LicenseManagementConfig = TypeOf; +export type LicenseManagementConfig = TypeOf; +// ------------------------------- // 7.x -const settings7x = { - enabled: schema.boolean({ defaultValue: true }), -}; - -const configSchema7x = schema.object( +// ------------------------------- +const schema7x = schema.object( { - ...baseSchema, - ...settings7x, + enabled: schema.boolean({ defaultValue: true }), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in 8.0 -const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ - (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { - if (get(completeConfig, 'xpack.license_management.enabled') === undefined) { - return completeConfig; - } +export type LicenseManagementConfig7x = TypeOf; - addDeprecation({ - title: i18n.translate('xpack.licenseMgmt.deprecations.enabledTitle', { - defaultMessage: 'Setting "xpack.license_management.enabled" is deprecated', - }), - message: i18n.translate('xpack.licenseMgmt.deprecations.enabledMessage', { - defaultMessage: - 'Use the "xpack.license_management.ui.enabled" setting instead of "xpack.license_management.enabled".', - }), - correctiveActions: { - manualSteps: [ - i18n.translate('xpack.licenseMgmt.deprecations.enabled.manualStepOneMessage', { - defaultMessage: 'Open the kibana.yml config file.', - }), - i18n.translate('xpack.licenseMgmt.deprecations.enabled.manualStepTwoMessage', { - defaultMessage: - 'Change the "xpack.license_management.enabled" setting to "xpack.license_management.ui.enabled".', - }), - ], - }, - }); - return completeConfig; +const config7x: PluginConfigDescriptor = { + exposeToBrowser: { + ui: true, }, -]; -export type LicenseManagementConfig7x = TypeOf; + schema: schema7x, + deprecations: () => [ + (completeConfig, rootPath, addDeprecation) => { + if (get(completeConfig, 'xpack.license_management.enabled') === undefined) { + return completeConfig; + } -const config7x: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema7x, - deprecations: deprecations7x, + addDeprecation({ + title: i18n.translate('xpack.licenseMgmt.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.license_management.enabled" is deprecated', + }), + message: i18n.translate('xpack.licenseMgmt.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.license_management.ui.enabled" setting instead of "xpack.license_management.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.licenseMgmt.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.licenseMgmt.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.license_management.enabled" setting to "xpack.license_management.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, + ], }; export const config: PluginConfigDescriptor = diff --git a/x-pack/plugins/remote_clusters/server/config.ts b/x-pack/plugins/remote_clusters/server/config.ts index 43b5ebfe3517b..65b246483b538 100644 --- a/x-pack/plugins/remote_clusters/server/config.ts +++ b/x-pack/plugins/remote_clusters/server/config.ts @@ -8,94 +8,83 @@ import { SemVer } from 'semver'; import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; +import { PluginConfigDescriptor } from 'src/core/server'; import { MAJOR_VERSION } from '../common/constants'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseConfig = { - exposeToBrowser: { - ui: true, - }, -}; - -const baseSchema = { - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), -}; - +// ------------------------------- // >= 8.x -const configSchema = schema.object( +// ------------------------------- +const schemaLatest = schema.object( { - ...baseSchema, + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in the next major -const deprecations: PluginConfigDescriptor['deprecations'] = () => []; - -// Config in latest major const configLatest: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema, - deprecations, + exposeToBrowser: { + ui: true, + }, + schema: schemaLatest, + deprecations: () => [], }; -// export type ConfigType = TypeOf; -export type RemoteClustersConfig = TypeOf; +export type RemoteClustersConfig = TypeOf; +// ------------------------------- // 7.x -const settings7x = { - enabled: schema.boolean({ defaultValue: true }), -}; - -const configSchema7x = schema.object( +// ------------------------------- +const schema7x = schema.object( { - ...baseSchema, - ...settings7x, + enabled: schema.boolean({ defaultValue: true }), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in 8.0 -const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ - (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { - if (get(completeConfig, 'xpack.remote_clusters.enabled') === undefined) { - return completeConfig; - } +export type RemoteClustersConfig7x = TypeOf; - addDeprecation({ - title: i18n.translate('xpack.remoteClusters.deprecations.enabledTitle', { - defaultMessage: 'Setting "xpack.remote_clusters.enabled" is deprecated', - }), - message: i18n.translate('xpack.remoteClusters.deprecations.enabledMessage', { - defaultMessage: - 'Use the "xpack.remote_clusters.ui.enabled" setting instead of "xpack.remote_clusters.enabled".', - }), - correctiveActions: { - manualSteps: [ - i18n.translate('xpack.remoteClusters.deprecations.enabled.manualStepOneMessage', { - defaultMessage: 'Open the kibana.yml config file.', - }), - i18n.translate('xpack.remoteClusters.deprecations.enabled.manualStepTwoMessage', { - defaultMessage: - 'Change the "xpack.remote_clusters.enabled" setting to "xpack.remote_clusters.ui.enabled".', - }), - ], - }, - }); - return completeConfig; +const config7x: PluginConfigDescriptor = { + exposeToBrowser: { + ui: true, }, -]; -export type RemoteClustersConfig7x = TypeOf; + schema: schema7x, + deprecations: () => [ + (completeConfig, rootPath, addDeprecation) => { + if (get(completeConfig, 'xpack.remote_clusters.enabled') === undefined) { + return completeConfig; + } -const config7x: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema7x, - deprecations: deprecations7x, + addDeprecation({ + title: i18n.translate('xpack.remoteClusters.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.remote_clusters.enabled" is deprecated', + }), + message: i18n.translate('xpack.remoteClusters.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.remote_clusters.ui.enabled" setting instead of "xpack.remote_clusters.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.remoteClusters.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.remoteClusters.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.remote_clusters.enabled" setting to "xpack.remote_clusters.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, + ], }; export const config: PluginConfigDescriptor = diff --git a/x-pack/plugins/rollup/server/config.ts b/x-pack/plugins/rollup/server/config.ts index dd6be1f1404f7..75134726b1d72 100644 --- a/x-pack/plugins/rollup/server/config.ts +++ b/x-pack/plugins/rollup/server/config.ts @@ -8,93 +8,83 @@ import { SemVer } from 'semver'; import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; +import { PluginConfigDescriptor } from 'src/core/server'; import { MAJOR_VERSION } from '../common'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseConfig = { - exposeToBrowser: { - ui: true, - }, -}; - -const baseSchema = { - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), -}; - +// ------------------------------- // >= 8.x -const configSchema = schema.object( +// ------------------------------- +const schemaLatest = schema.object( { - ...baseSchema, + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in the next major -const deprecations: PluginConfigDescriptor['deprecations'] = () => []; - -// Config in latest major const configLatest: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema, - deprecations, + exposeToBrowser: { + ui: true, + }, + schema: schemaLatest, + deprecations: () => [], }; -export type RollupConfig = TypeOf; +export type RollupConfig = TypeOf; +// ------------------------------- // 7.x -const settings7x = { - enabled: schema.boolean({ defaultValue: true }), -}; - -const configSchema7x = schema.object( +// ------------------------------- +const schema7x = schema.object( { - ...baseSchema, - ...settings7x, + enabled: schema.boolean({ defaultValue: true }), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in 8.0 -const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ - (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { - if (get(completeConfig, 'xpack.rollup.enabled') === undefined) { - return completeConfig; - } +export type RollupConfig7x = TypeOf; - addDeprecation({ - title: i18n.translate('xpack.rollupJobs.deprecations.enabledTitle', { - defaultMessage: 'Setting "xpack.rollup.enabled" is deprecated', - }), - message: i18n.translate('xpack.rollupJobs.deprecations.enabledMessage', { - defaultMessage: - 'Use the "xpack.rollup.ui.enabled" setting instead of "xpack.rollup.enabled".', - }), - correctiveActions: { - manualSteps: [ - i18n.translate('xpack.rollupJobs.deprecations.enabled.manualStepOneMessage', { - defaultMessage: 'Open the kibana.yml config file.', - }), - i18n.translate('xpack.rollupJobs.deprecations.enabled.manualStepTwoMessage', { - defaultMessage: - 'Change the "xpack.rollup.enabled" setting to "xpack.rollup.ui.enabled".', - }), - ], - }, - }); - return completeConfig; +const config7x: PluginConfigDescriptor = { + exposeToBrowser: { + ui: true, }, -]; -export type RollupConfig7x = TypeOf; + schema: schema7x, + deprecations: () => [ + (completeConfig, rootPath, addDeprecation) => { + if (get(completeConfig, 'xpack.rollup.enabled') === undefined) { + return completeConfig; + } -const config7x: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema7x, - deprecations: deprecations7x, + addDeprecation({ + title: i18n.translate('xpack.rollupJobs.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.rollup.enabled" is deprecated', + }), + message: i18n.translate('xpack.rollupJobs.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.rollup.ui.enabled" setting instead of "xpack.rollup.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.rollupJobs.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.rollupJobs.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.rollup.enabled" setting to "xpack.rollup.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, + ], }; export const config: PluginConfigDescriptor = diff --git a/x-pack/plugins/snapshot_restore/server/config.ts b/x-pack/plugins/snapshot_restore/server/config.ts index 43feabd74822b..6e7dd283a3549 100644 --- a/x-pack/plugins/snapshot_restore/server/config.ts +++ b/x-pack/plugins/snapshot_restore/server/config.ts @@ -8,97 +8,91 @@ import { SemVer } from 'semver'; import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; +import { PluginConfigDescriptor } from 'src/core/server'; import { MAJOR_VERSION } from '../common/constants'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseConfig = { - exposeToBrowser: { - ui: true, - slm_ui: true, - }, -}; - -const baseSchema = { - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), - slm_ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), -}; - +// ------------------------------- // >= 8.x -const configSchema = schema.object( +// ------------------------------- +const schemaLatest = schema.object( { - ...baseSchema, + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), + slm_ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in the next major -const deprecations: PluginConfigDescriptor['deprecations'] = () => []; - -// Config in latest major const configLatest: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema, - deprecations, + exposeToBrowser: { + ui: true, + slm_ui: true, + }, + schema: schemaLatest, + deprecations: () => [], }; -export type SnapshotRestoreConfig = TypeOf; +export type SnapshotRestoreConfig = TypeOf; +// ------------------------------- // 7.x -const settings7x = { - enabled: schema.boolean({ defaultValue: true }), -}; - -const configSchema7x = schema.object( +// ------------------------------- +const schema7x = schema.object( { - ...baseSchema, - ...settings7x, + enabled: schema.boolean({ defaultValue: true }), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), + slm_ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in 8.0 -const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ - (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { - if (get(completeConfig, 'xpack.snapshot_restore.enabled') === undefined) { - return completeConfig; - } +export type SnapshotRestoreConfig7x = TypeOf; - addDeprecation({ - title: i18n.translate('xpack.snapshotRestore.deprecations.enabledTitle', { - defaultMessage: 'Setting "xpack.snapshot_restore.enabled" is deprecated', - }), - message: i18n.translate('xpack.snapshotRestore.deprecations.enabledMessage', { - defaultMessage: - 'Use the "xpack.snapshot_restore.ui.enabled" setting instead of "xpack.snapshot_restore.enabled".', - }), - correctiveActions: { - manualSteps: [ - i18n.translate('xpack.snapshotRestore.deprecations.enabled.manualStepOneMessage', { - defaultMessage: 'Open the kibana.yml config file.', - }), - i18n.translate('xpack.snapshotRestore.deprecations.enabled.manualStepTwoMessage', { - defaultMessage: - 'Change the "xpack.snapshot_restore.enabled" setting to "xpack.snapshot_restore.ui.enabled".', - }), - ], - }, - }); - return completeConfig; +const config7x: PluginConfigDescriptor = { + exposeToBrowser: { + ui: true, + slm_ui: true, }, -]; -export type SnapshotRestoreConfig7x = TypeOf; + schema: schema7x, + deprecations: () => [ + (completeConfig, rootPath, addDeprecation) => { + if (get(completeConfig, 'xpack.snapshot_restore.enabled') === undefined) { + return completeConfig; + } -const config7x: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema7x, - deprecations: deprecations7x, + addDeprecation({ + title: i18n.translate('xpack.snapshotRestore.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.snapshot_restore.enabled" is deprecated', + }), + message: i18n.translate('xpack.snapshotRestore.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.snapshot_restore.ui.enabled" setting instead of "xpack.snapshot_restore.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.snapshotRestore.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.snapshotRestore.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.snapshot_restore.enabled" setting to "xpack.snapshot_restore.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, + ], }; export const config: PluginConfigDescriptor = diff --git a/x-pack/plugins/upgrade_assistant/server/config.ts b/x-pack/plugins/upgrade_assistant/server/config.ts index b0e77b6a04e66..5ef1192906021 100644 --- a/x-pack/plugins/upgrade_assistant/server/config.ts +++ b/x-pack/plugins/upgrade_assistant/server/config.ts @@ -8,100 +8,97 @@ import { SemVer } from 'semver'; import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginConfigDescriptor, AddConfigDeprecation } from 'src/core/server'; +import { PluginConfigDescriptor } from 'src/core/server'; import { MAJOR_VERSION } from '../common/constants'; const kibanaVersion = new SemVer(MAJOR_VERSION); -const baseConfig = { - exposeToBrowser: { - ui: true, - readonly: true, - }, -}; - -const baseSchema = { - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), - /* - * This will default to true up until the last minor before the next major. - * In readonly mode, the user will not be able to perform any actions in the UI - * and will be presented with a message indicating as such. - */ - readonly: schema.boolean({ defaultValue: true }), -}; - +// ------------------------------- // >= 8.x -const configSchema = schema.object( +// ------------------------------- +const schemaLatest = schema.object( { - ...baseSchema, + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), + /* + * This will default to true up until the last minor before the next major. + * In readonly mode, the user will not be able to perform any actions in the UI + * and will be presented with a message indicating as such. + */ + readonly: schema.boolean({ defaultValue: true }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in the next major -const deprecations: PluginConfigDescriptor['deprecations'] = () => []; - -// Config in latest major const configLatest: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema, - deprecations, + exposeToBrowser: { + ui: true, + readonly: true, + }, + schema: schemaLatest, + deprecations: () => [], }; -export type UpgradeAssistantConfig = TypeOf; +export type UpgradeAssistantConfig = TypeOf; +// ------------------------------- // 7.x -const settings7x = { - enabled: schema.boolean({ defaultValue: true }), -}; - -const configSchema7x = schema.object( +// ------------------------------- +const schema7x = schema.object( { - ...baseSchema, - ...settings7x, + enabled: schema.boolean({ defaultValue: true }), + ui: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), + /* + * This will default to true up until the last minor before the next major. + * In readonly mode, the user will not be able to perform any actions in the UI + * and will be presented with a message indicating as such. + */ + readonly: schema.boolean({ defaultValue: true }), }, { defaultValue: undefined } ); -// Settings that will be deprecated in 8.0 -const deprecations7x: PluginConfigDescriptor['deprecations'] = () => [ - (completeConfig: Record, rootPath: string, addDeprecation: AddConfigDeprecation) => { - if (get(completeConfig, 'xpack.upgrade_assistant.enabled') === undefined) { - return completeConfig; - } +export type UpgradeAssistantConfig7x = TypeOf; - addDeprecation({ - title: i18n.translate('xpack.upgradeAssistant.deprecations.enabledTitle', { - defaultMessage: 'Setting "xpack.upgrade_assistant.enabled" is deprecated', - }), - message: i18n.translate('xpack.upgradeAssistant.deprecations.enabledMessage', { - defaultMessage: - 'Use the "xpack.upgrade_assistant.ui.enabled" setting instead of "xpack.upgrade_assistant.enabled".', - }), - correctiveActions: { - manualSteps: [ - i18n.translate('xpack.upgradeAssistant.deprecations.enabled.manualStepOneMessage', { - defaultMessage: 'Open the kibana.yml config file.', - }), - i18n.translate('xpack.upgradeAssistant.deprecations.enabled.manualStepTwoMessage', { - defaultMessage: - 'Change the "xpack.upgrade_assistant.enabled" setting to "xpack.upgrade_assistant.ui.enabled".', - }), - ], - }, - }); - return completeConfig; +const config7x: PluginConfigDescriptor = { + exposeToBrowser: { + ui: true, + readonly: true, }, -]; -export type UpgradeAssistantConfig7x = TypeOf; + schema: schema7x, + deprecations: () => [ + (completeConfig, rootPath, addDeprecation) => { + if (get(completeConfig, 'xpack.upgrade_assistant.enabled') === undefined) { + return completeConfig; + } -const config7x: PluginConfigDescriptor = { - ...baseConfig, - schema: configSchema7x, - deprecations: deprecations7x, + addDeprecation({ + title: i18n.translate('xpack.upgradeAssistant.deprecations.enabledTitle', { + defaultMessage: 'Setting "xpack.upgrade_assistant.enabled" is deprecated', + }), + message: i18n.translate('xpack.upgradeAssistant.deprecations.enabledMessage', { + defaultMessage: + 'Use the "xpack.upgrade_assistant.ui.enabled" setting instead of "xpack.upgrade_assistant.enabled".', + }), + correctiveActions: { + manualSteps: [ + i18n.translate('xpack.upgradeAssistant.deprecations.enabled.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('xpack.upgradeAssistant.deprecations.enabled.manualStepTwoMessage', { + defaultMessage: + 'Change the "xpack.upgrade_assistant.enabled" setting to "xpack.upgrade_assistant.ui.enabled".', + }), + ], + }, + }); + return completeConfig; + }, + ], }; export const config: PluginConfigDescriptor = From d7cb7e26d8dbd4ca3e99da5b50bcf9881eec0df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Mon, 18 Oct 2021 08:55:21 +0100 Subject: [PATCH 19/26] Fix TS issue --- src/plugins/console/server/config.ts | 1 + x-pack/plugins/cross_cluster_replication/server/config.ts | 1 + x-pack/plugins/index_lifecycle_management/server/config.ts | 1 + x-pack/plugins/index_management/server/config.ts | 1 + x-pack/plugins/license_management/server/config.ts | 1 + x-pack/plugins/remote_clusters/server/config.ts | 1 + x-pack/plugins/rollup/server/config.ts | 1 + x-pack/plugins/snapshot_restore/server/config.ts | 1 + x-pack/plugins/upgrade_assistant/server/config.ts | 1 + 9 files changed, 9 insertions(+) diff --git a/src/plugins/console/server/config.ts b/src/plugins/console/server/config.ts index 1e09f7581c6e2..c43e1488c97ad 100644 --- a/src/plugins/console/server/config.ts +++ b/src/plugins/console/server/config.ts @@ -93,6 +93,7 @@ const config7x: PluginConfigDescriptor = { } addDeprecation({ + configPath: 'console.enabled', title: i18n.translate('console.deprecations.enabledTitle', { defaultMessage: 'Setting "console.enabled" is deprecated', }), diff --git a/x-pack/plugins/cross_cluster_replication/server/config.ts b/x-pack/plugins/cross_cluster_replication/server/config.ts index ff108a75be1cf..f7e65da99db71 100644 --- a/x-pack/plugins/cross_cluster_replication/server/config.ts +++ b/x-pack/plugins/cross_cluster_replication/server/config.ts @@ -63,6 +63,7 @@ const config7x: PluginConfigDescriptor = { } addDeprecation({ + configPath: 'xpack.ccr.enabled', title: i18n.translate('xpack.crossClusterReplication.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.ccr.enabled" is deprecated', }), diff --git a/x-pack/plugins/index_lifecycle_management/server/config.ts b/x-pack/plugins/index_lifecycle_management/server/config.ts index 1d2cdacc1891f..8232f8f4b67e5 100644 --- a/x-pack/plugins/index_lifecycle_management/server/config.ts +++ b/x-pack/plugins/index_lifecycle_management/server/config.ts @@ -67,6 +67,7 @@ const config7x: PluginConfigDescriptor = { } addDeprecation({ + configPath: 'xpack.ilm.enabled', title: i18n.translate('xpack.indexLifecycleMgmt.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.ilm.enabled" is deprecated', }), diff --git a/x-pack/plugins/index_management/server/config.ts b/x-pack/plugins/index_management/server/config.ts index 5ef35a5a2466d..2f8a2c7fec404 100644 --- a/x-pack/plugins/index_management/server/config.ts +++ b/x-pack/plugins/index_management/server/config.ts @@ -63,6 +63,7 @@ const config7x: PluginConfigDescriptor = { } addDeprecation({ + configPath: 'xpack.index_management.enabled', title: i18n.translate('xpack.idxMgmt.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.index_management.enabled" is deprecated', }), diff --git a/x-pack/plugins/license_management/server/config.ts b/x-pack/plugins/license_management/server/config.ts index 268f4f323912f..953af7e2cab2f 100644 --- a/x-pack/plugins/license_management/server/config.ts +++ b/x-pack/plugins/license_management/server/config.ts @@ -63,6 +63,7 @@ const config7x: PluginConfigDescriptor = { } addDeprecation({ + configPath: 'xpack.license_management.enabled', title: i18n.translate('xpack.licenseMgmt.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.license_management.enabled" is deprecated', }), diff --git a/x-pack/plugins/remote_clusters/server/config.ts b/x-pack/plugins/remote_clusters/server/config.ts index 65b246483b538..21e961d83ecbd 100644 --- a/x-pack/plugins/remote_clusters/server/config.ts +++ b/x-pack/plugins/remote_clusters/server/config.ts @@ -63,6 +63,7 @@ const config7x: PluginConfigDescriptor = { } addDeprecation({ + configPath: 'xpack.remote_clusters.enabled', title: i18n.translate('xpack.remoteClusters.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.remote_clusters.enabled" is deprecated', }), diff --git a/x-pack/plugins/rollup/server/config.ts b/x-pack/plugins/rollup/server/config.ts index 75134726b1d72..e1bb5e421fef3 100644 --- a/x-pack/plugins/rollup/server/config.ts +++ b/x-pack/plugins/rollup/server/config.ts @@ -63,6 +63,7 @@ const config7x: PluginConfigDescriptor = { } addDeprecation({ + configPath: 'xpack.rollup.enabled', title: i18n.translate('xpack.rollupJobs.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.rollup.enabled" is deprecated', }), diff --git a/x-pack/plugins/snapshot_restore/server/config.ts b/x-pack/plugins/snapshot_restore/server/config.ts index 6e7dd283a3549..62809d498bfd8 100644 --- a/x-pack/plugins/snapshot_restore/server/config.ts +++ b/x-pack/plugins/snapshot_restore/server/config.ts @@ -71,6 +71,7 @@ const config7x: PluginConfigDescriptor = { } addDeprecation({ + configPath: 'xpack.snapshot_restore.enabled', title: i18n.translate('xpack.snapshotRestore.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.snapshot_restore.enabled" is deprecated', }), diff --git a/x-pack/plugins/upgrade_assistant/server/config.ts b/x-pack/plugins/upgrade_assistant/server/config.ts index 5ef1192906021..f57dc60a730ed 100644 --- a/x-pack/plugins/upgrade_assistant/server/config.ts +++ b/x-pack/plugins/upgrade_assistant/server/config.ts @@ -77,6 +77,7 @@ const config7x: PluginConfigDescriptor = { } addDeprecation({ + configPath: 'xpack.upgrade_assistant.enabled', title: i18n.translate('xpack.upgradeAssistant.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.upgrade_assistant.enabled" is deprecated', }), From 6813c6aff03e8ac7c5f9e440f10d416df7816a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Mon, 18 Oct 2021 14:22:09 +0100 Subject: [PATCH 20/26] Improve deprecation message for console.proxyConfig and console.proxyFilter (fixes #113810) --- src/plugins/console/server/config.ts | 66 +++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/plugins/console/server/config.ts b/src/plugins/console/server/config.ts index c43e1488c97ad..7147958ce1474 100644 --- a/src/plugins/console/server/config.ts +++ b/src/plugins/console/server/config.ts @@ -84,8 +84,6 @@ const config7x: PluginConfigDescriptor = { }, schema: schema7x, deprecations: ({ deprecate, unused }) => [ - deprecate('proxyFilter', '8.0.0'), - deprecate('proxyConfig', '8.0.0'), unused('ssl'), (completeConfig, rootPath, addDeprecation) => { if (get(completeConfig, 'console.enabled') === undefined) { @@ -113,6 +111,70 @@ const config7x: PluginConfigDescriptor = { }); return completeConfig; }, + (completeConfig, rootPath, addDeprecation) => { + if (get(completeConfig, 'console.proxyConfig') === undefined) { + return completeConfig; + } + + addDeprecation({ + configPath: 'console.proxyConfig', + title: i18n.translate('console.deprecations.proxyConfigTitle', { + defaultMessage: 'Setting "console.proxyConfig" is deprecated', + }), + message: i18n.translate('console.deprecations.proxyConfigMessage', { + defaultMessage: + 'Configuring "console.proxyConfig" is deprecated and will be removed in 8.0.0. To secure your connection between Kibana and Elasticsearch use the standard "server.ssl.*" settings instead.". See https://ela.st/encrypt-kibana-browser for more details', + }), + documentationUrl: 'https://ela.st/encrypt-kibana-browser', + correctiveActions: { + manualSteps: [ + i18n.translate('console.deprecations.proxyConfig.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('console.deprecations.proxyConfig.manualStepTwoMessage', { + defaultMessage: 'Remove the "console.proxyConfig" setting.', + }), + i18n.translate('console.deprecations.proxyConfig.manualStepThreeMessage', { + defaultMessage: + 'Configure the secure connection between Kibana and Elasticsearch using the "server.ssl.*" settings', + }), + ], + }, + }); + return completeConfig; + }, + (completeConfig, rootPath, addDeprecation) => { + if (get(completeConfig, 'console.proxyFilter') === undefined) { + return completeConfig; + } + + addDeprecation({ + configPath: 'console.proxyFilter', + title: i18n.translate('console.deprecations.proxyFilterTitle', { + defaultMessage: 'Setting "console.proxyFilter" is deprecated', + }), + message: i18n.translate('console.deprecations.proxyFilterMessage', { + defaultMessage: + 'Configuring "console.proxyFilter" is deprecated and will be removed in 8.0.0. To secure your connection between Kibana and Elasticsearch use the standard "server.ssl.*" settings instead.". See https://ela.st/encrypt-kibana-browser for more details', + }), + documentationUrl: 'https://ela.st/encrypt-kibana-browser', + correctiveActions: { + manualSteps: [ + i18n.translate('console.deprecations.proxyFilter.manualStepOneMessage', { + defaultMessage: 'Open the kibana.yml config file.', + }), + i18n.translate('console.deprecations.proxyFilter.manualStepTwoMessage', { + defaultMessage: 'Remove the "console.proxyFilter" setting.', + }), + i18n.translate('console.deprecations.proxyFilter.manualStepThreeMessage', { + defaultMessage: + 'Configure the secure connection between Kibana and Elasticsearch using the "server.ssl.*" settings', + }), + ], + }, + }); + return completeConfig; + }, ], }; From 52739f8f85d877c353acb4738f3d941fec19dc26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Mon, 18 Oct 2021 14:28:37 +0100 Subject: [PATCH 21/26] Fix TS issue --- .../__jest__/client_integration/helpers/setup_environment.tsx | 2 +- .../deprecation_types/reindex/flyout/warning_step.test.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx index aa35d90f4f785..fbbbc0e07853c 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx @@ -9,7 +9,7 @@ import React from 'react'; import axios from 'axios'; // @ts-ignore import axiosXhrAdapter from 'axios/lib/adapters/xhr'; -import { SemVer } from 'semver'; +import SemVer from 'semver/classes/semver'; import { deprecationsServiceMock, docLinksServiceMock, diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx index 419e4b941586a..d2cafd69e94eb 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx @@ -8,7 +8,7 @@ import { I18nProvider } from '@kbn/i18n/react'; import { mount, shallow } from 'enzyme'; import React from 'react'; -import { SemVer } from 'semver'; +import SemVer from 'semver/classes/semver'; import { ReindexWarning } from '../../../../../../../common/types'; import { MAJOR_VERSION } from '../../../../../../../common/constants'; From 83e0a7bac5e09637f3ec935b40d8fa97b46cd727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20Loix?= Date: Mon, 18 Oct 2021 14:57:51 +0100 Subject: [PATCH 22/26] Add doc for the ".ui.enabled" setting --- docs/dev-tools/console/console.asciidoc | 9 +++++++ docs/setup/settings.asciidoc | 34 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/docs/dev-tools/console/console.asciidoc b/docs/dev-tools/console/console.asciidoc index 48fe936dd2db5..21334c31011f4 100644 --- a/docs/dev-tools/console/console.asciidoc +++ b/docs/dev-tools/console/console.asciidoc @@ -129,3 +129,12 @@ image::dev-tools/console/images/console-settings.png["Console Settings", width=6 For a list of available keyboard shortcuts, click *Help*. + +[float] +[[console-settings]] +=== Disable Console + +If you don’t want to use *Console*, you can disable it by setting `console.ui.enabled` +to `false` in your `kibana.yml` configuration file. Changing this setting +causes the server to regenerate assets on the next startup, +which might cause a delay before pages start being served. \ No newline at end of file diff --git a/docs/setup/settings.asciidoc b/docs/setup/settings.asciidoc index 16fa8eb734204..61f569f78df68 100644 --- a/docs/setup/settings.asciidoc +++ b/docs/setup/settings.asciidoc @@ -20,6 +20,11 @@ configuration using `${MY_ENV_VAR}` syntax. [cols="2*<"] |=== +| `console.ui.enabled:` +Toggling this causes the server to regenerate assets on the next startup, +which may cause a delay before pages start being served. +Set to `false` to disable Console. *Default: `true`* + | `csp.rules:` | deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."] A https://w3c.github.io/webappsec-csp/[Content Security Policy] template @@ -681,6 +686,10 @@ out through *Advanced Settings*. *Default: `true`* | Set this value to true to allow Vega to use any URL to access external data sources and images. When false, Vega can only get data from {es}. *Default: `false`* +| `xpack.ccr.ui.enabled` +Set this value to false to disable the Cross-Cluster Replication UI. +*Default: `true`* + |[[settings-explore-data-in-context]] `xpack.discoverEnhanced.actions.` `exploreDataInContextMenu.enabled` | Enables the *Explore underlying data* option that allows you to open *Discover* from a dashboard panel and view the panel data. *Default: `false`* @@ -689,6 +698,31 @@ sources and images. When false, Vega can only get data from {es}. *Default: `fal `exploreDataInChart.enabled` | Enables you to view the underlying documents in a data series from a dashboard panel. *Default: `false`* +| `xpack.ilm.ui.enabled` +Set this value to false to disable the Index Lifecycle Policies UI. +*Default: `true`* + +| `xpack.index_management.ui.enabled` +Set this value to false to disable the Index Management UI. +*Default: `true`* + +| `xpack.license_management.ui.enabled` +Set this value to false to disable the License Management UI. +*Default: `true`* + +| `xpack.remote_clusters.ui.enabled` +Set this value to false to disable the Remote Clusters UI. +*Default: `true`* + +| `xpack.rollup.ui.enabled:` +Set this value to false to disable the Rollup UI. *Default: true* + +| `xpack.snapshot_restore.ui.enabled:` +Set this value to false to disable the Snapshot and Restore UI. *Default: true* + +| `xpack.upgrade_assistant.ui.enabled:` +Set this value to false to disable the Upgrade Assistant UI. *Default: true* + | `i18n.locale` {ess-icon} | Set this value to change the {kib} interface language. Valid locales are: `en`, `zh-CN`, `ja-JP`. *Default: `en`* From 183a1c3fd690f1930a32e46d5671dff268efbeb0 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Mon, 18 Oct 2021 13:24:56 -0700 Subject: [PATCH 23/26] Fix Console deprecations. * Fix copy * Configure level --- src/plugins/console/server/config.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/console/server/config.ts b/src/plugins/console/server/config.ts index 7147958ce1474..024777aa8d252 100644 --- a/src/plugins/console/server/config.ts +++ b/src/plugins/console/server/config.ts @@ -92,11 +92,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'console.enabled', + level: 'critical', title: i18n.translate('console.deprecations.enabledTitle', { defaultMessage: 'Setting "console.enabled" is deprecated', }), message: i18n.translate('console.deprecations.enabledMessage', { - defaultMessage: 'Use the "console.ui.enabled" setting instead of "console.enabled".', + defaultMessage: + 'To disallow users from accessing the Console UI, use the "console.ui.enabled" setting instead of "console.enabled".', }), correctiveActions: { manualSteps: [ @@ -118,12 +120,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'console.proxyConfig', + level: 'critical', title: i18n.translate('console.deprecations.proxyConfigTitle', { defaultMessage: 'Setting "console.proxyConfig" is deprecated', }), message: i18n.translate('console.deprecations.proxyConfigMessage', { defaultMessage: - 'Configuring "console.proxyConfig" is deprecated and will be removed in 8.0.0. To secure your connection between Kibana and Elasticsearch use the standard "server.ssl.*" settings instead.". See https://ela.st/encrypt-kibana-browser for more details', + 'Configuring "console.proxyConfig" is deprecated and will be removed in 8.0.0. To secure your connection between Kibana and Elasticsearch use the standard "server.ssl.*" settings instead.', }), documentationUrl: 'https://ela.st/encrypt-kibana-browser', correctiveActions: { @@ -136,7 +139,7 @@ const config7x: PluginConfigDescriptor = { }), i18n.translate('console.deprecations.proxyConfig.manualStepThreeMessage', { defaultMessage: - 'Configure the secure connection between Kibana and Elasticsearch using the "server.ssl.*" settings', + 'Configure the secure connection between Kibana and Elasticsearch using the "server.ssl.*" settings.', }), ], }, @@ -150,12 +153,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'console.proxyFilter', + level: 'critical', title: i18n.translate('console.deprecations.proxyFilterTitle', { defaultMessage: 'Setting "console.proxyFilter" is deprecated', }), message: i18n.translate('console.deprecations.proxyFilterMessage', { defaultMessage: - 'Configuring "console.proxyFilter" is deprecated and will be removed in 8.0.0. To secure your connection between Kibana and Elasticsearch use the standard "server.ssl.*" settings instead.". See https://ela.st/encrypt-kibana-browser for more details', + 'Configuring "console.proxyFilter" is deprecated and will be removed in 8.0.0. To secure your connection between Kibana and Elasticsearch use the standard "server.ssl.*" settings instead.', }), documentationUrl: 'https://ela.st/encrypt-kibana-browser', correctiveActions: { @@ -168,7 +172,7 @@ const config7x: PluginConfigDescriptor = { }), i18n.translate('console.deprecations.proxyFilter.manualStepThreeMessage', { defaultMessage: - 'Configure the secure connection between Kibana and Elasticsearch using the "server.ssl.*" settings', + 'Configure the secure connection between Kibana and Elasticsearch using the "server.ssl.*" settings.', }), ], }, From 2e326e54cdf57ddb4d99379810dc793732874b96 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Mon, 18 Oct 2021 13:33:39 -0700 Subject: [PATCH 24/26] Add inline comments where we check if Console UI is enabled. * Clarify distinction between Dev Tools and Console. --- .../components/manage_data/manage_data.tsx | 1 + .../requests/components/details/req_code_viewer.tsx | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.tsx index 8da23d88568cd..0f465dfcf965f 100644 --- a/src/plugins/home/public/application/components/manage_data/manage_data.tsx +++ b/src/plugins/home/public/application/components/manage_data/manage_data.tsx @@ -61,6 +61,7 @@ export const ManageData: FC = ({ addBasePath, application, features }) => {isDevToolsEnabled || isManagementEnabled ? ( + {/* Check if both the Dev Tools UI and the Console UI are enabled. */} {isDevToolsEnabled && consoleHref !== undefined ? ( diff --git a/src/plugins/inspector/public/views/requests/components/details/req_code_viewer.tsx b/src/plugins/inspector/public/views/requests/components/details/req_code_viewer.tsx index 8a60e29df4ac5..e46910c170103 100644 --- a/src/plugins/inspector/public/views/requests/components/details/req_code_viewer.tsx +++ b/src/plugins/inspector/public/views/requests/components/details/req_code_viewer.tsx @@ -40,15 +40,16 @@ export const RequestCodeViewer = ({ indexPattern, json }: RequestCodeViewerProps const navigateToUrl = services.application?.navigateToUrl; const devToolsDataUri = compressToEncodedURIComponent(`GET ${indexPattern}/_search\n${json}`); - const devToolsHref = services.share.url.locators + const consoleHref = services.share.url.locators .get('CONSOLE_APP_LOCATOR') ?.useUrl({ loadFrom: `data:text/plain,${devToolsDataUri}` }); + // Check if both the Dev Tools UI and the Console UI are enabled. const canShowDevTools = - services.application?.capabilities?.dev_tools.show && devToolsHref !== undefined; + services.application?.capabilities?.dev_tools.show && consoleHref !== undefined; const shouldShowDevToolsLink = !!(indexPattern && canShowDevTools); const handleDevToolsLinkClick = useCallback( - () => devToolsHref && navigateToUrl && navigateToUrl(devToolsHref), - [devToolsHref, navigateToUrl] + () => consoleHref && navigateToUrl && navigateToUrl(consoleHref), + [consoleHref, navigateToUrl] ); return ( @@ -80,7 +81,7 @@ export const RequestCodeViewer = ({ indexPattern, json }: RequestCodeViewerProps size="xs" flush="right" iconType="wrench" - href={devToolsHref} + href={consoleHref} onClick={handleDevToolsLinkClick} data-test-subj="inspectorRequestOpenInConsoleButton" > From 61b703e139510db09bbeb4331484617d82d237c7 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Mon, 18 Oct 2021 13:34:40 -0700 Subject: [PATCH 25/26] Fix typo in docs. --- docs/setup/settings.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/setup/settings.asciidoc b/docs/setup/settings.asciidoc index 61f569f78df68..d0d46391d36b6 100644 --- a/docs/setup/settings.asciidoc +++ b/docs/setup/settings.asciidoc @@ -715,7 +715,7 @@ Set this value to false to disable the Remote Clusters UI. *Default: `true`* | `xpack.rollup.ui.enabled:` -Set this value to false to disable the Rollup UI. *Default: true* +Set this value to false to disable the Rollup Jobs UI. *Default: true* | `xpack.snapshot_restore.ui.enabled:` Set this value to false to disable the Snapshot and Restore UI. *Default: true* From 596c6057d166f39ddda1f9c1144020691150e71c Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Mon, 18 Oct 2021 13:48:54 -0700 Subject: [PATCH 26/26] Configure level and refine copy for other deprecations. --- x-pack/plugins/cross_cluster_replication/server/config.ts | 4 +++- x-pack/plugins/index_lifecycle_management/server/config.ts | 4 +++- x-pack/plugins/index_management/server/config.ts | 3 ++- x-pack/plugins/license_management/server/config.ts | 3 ++- x-pack/plugins/remote_clusters/server/config.ts | 3 ++- x-pack/plugins/rollup/server/config.ts | 3 ++- x-pack/plugins/snapshot_restore/server/config.ts | 3 ++- x-pack/plugins/upgrade_assistant/server/config.ts | 3 ++- 8 files changed, 18 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/server/config.ts b/x-pack/plugins/cross_cluster_replication/server/config.ts index f7e65da99db71..732137e308a0d 100644 --- a/x-pack/plugins/cross_cluster_replication/server/config.ts +++ b/x-pack/plugins/cross_cluster_replication/server/config.ts @@ -64,11 +64,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'xpack.ccr.enabled', + level: 'critical', title: i18n.translate('xpack.crossClusterReplication.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.ccr.enabled" is deprecated', }), message: i18n.translate('xpack.crossClusterReplication.deprecations.enabledMessage', { - defaultMessage: 'Use the "xpack.ccr.ui.enabled" setting instead of "xpack.ccr.enabled".', + defaultMessage: + 'To disallow users from accessing the Cross-Cluster Replication UI, use the "xpack.ccr.ui.enabled" setting instead of "xpack.ccr.enabled".', }), correctiveActions: { manualSteps: [ diff --git a/x-pack/plugins/index_lifecycle_management/server/config.ts b/x-pack/plugins/index_lifecycle_management/server/config.ts index 8232f8f4b67e5..691cc06708bb5 100644 --- a/x-pack/plugins/index_lifecycle_management/server/config.ts +++ b/x-pack/plugins/index_lifecycle_management/server/config.ts @@ -68,11 +68,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'xpack.ilm.enabled', + level: 'critical', title: i18n.translate('xpack.indexLifecycleMgmt.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.ilm.enabled" is deprecated', }), message: i18n.translate('xpack.indexLifecycleMgmt.deprecations.enabledMessage', { - defaultMessage: 'Use the "xpack.ilm.ui.enabled" setting instead of "xpack.ilm.enabled".', + defaultMessage: + 'To disallow users from accessing the Index Lifecycle Policies UI, use the "xpack.ilm.ui.enabled" setting instead of "xpack.ilm.enabled".', }), correctiveActions: { manualSteps: [ diff --git a/x-pack/plugins/index_management/server/config.ts b/x-pack/plugins/index_management/server/config.ts index 2f8a2c7fec404..88a714db5edca 100644 --- a/x-pack/plugins/index_management/server/config.ts +++ b/x-pack/plugins/index_management/server/config.ts @@ -64,12 +64,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'xpack.index_management.enabled', + level: 'critical', title: i18n.translate('xpack.idxMgmt.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.index_management.enabled" is deprecated', }), message: i18n.translate('xpack.idxMgmt.deprecations.enabledMessage', { defaultMessage: - 'Use the "xpack.index_management.ui.enabled" setting instead of "xpack.index_management.enabled".', + 'To disallow users from accessing the Index Management UI, use the "xpack.index_management.ui.enabled" setting instead of "xpack.index_management.enabled".', }), correctiveActions: { manualSteps: [ diff --git a/x-pack/plugins/license_management/server/config.ts b/x-pack/plugins/license_management/server/config.ts index 953af7e2cab2f..e378a10191684 100644 --- a/x-pack/plugins/license_management/server/config.ts +++ b/x-pack/plugins/license_management/server/config.ts @@ -64,12 +64,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'xpack.license_management.enabled', + level: 'critical', title: i18n.translate('xpack.licenseMgmt.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.license_management.enabled" is deprecated', }), message: i18n.translate('xpack.licenseMgmt.deprecations.enabledMessage', { defaultMessage: - 'Use the "xpack.license_management.ui.enabled" setting instead of "xpack.license_management.enabled".', + 'To disallow users from accessing the License Management UI, use the "xpack.license_management.ui.enabled" setting instead of "xpack.license_management.enabled".', }), correctiveActions: { manualSteps: [ diff --git a/x-pack/plugins/remote_clusters/server/config.ts b/x-pack/plugins/remote_clusters/server/config.ts index 21e961d83ecbd..5b4972f0a5259 100644 --- a/x-pack/plugins/remote_clusters/server/config.ts +++ b/x-pack/plugins/remote_clusters/server/config.ts @@ -64,12 +64,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'xpack.remote_clusters.enabled', + level: 'critical', title: i18n.translate('xpack.remoteClusters.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.remote_clusters.enabled" is deprecated', }), message: i18n.translate('xpack.remoteClusters.deprecations.enabledMessage', { defaultMessage: - 'Use the "xpack.remote_clusters.ui.enabled" setting instead of "xpack.remote_clusters.enabled".', + 'To disallow users from accessing the Remote Clusters UI, use the "xpack.remote_clusters.ui.enabled" setting instead of "xpack.remote_clusters.enabled".', }), correctiveActions: { manualSteps: [ diff --git a/x-pack/plugins/rollup/server/config.ts b/x-pack/plugins/rollup/server/config.ts index e1bb5e421fef3..c0cca4bbb4d33 100644 --- a/x-pack/plugins/rollup/server/config.ts +++ b/x-pack/plugins/rollup/server/config.ts @@ -64,12 +64,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'xpack.rollup.enabled', + level: 'critical', title: i18n.translate('xpack.rollupJobs.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.rollup.enabled" is deprecated', }), message: i18n.translate('xpack.rollupJobs.deprecations.enabledMessage', { defaultMessage: - 'Use the "xpack.rollup.ui.enabled" setting instead of "xpack.rollup.enabled".', + 'To disallow users from accessing the Rollup Jobs UI, use the "xpack.rollup.ui.enabled" setting instead of "xpack.rollup.enabled".', }), correctiveActions: { manualSteps: [ diff --git a/x-pack/plugins/snapshot_restore/server/config.ts b/x-pack/plugins/snapshot_restore/server/config.ts index 62809d498bfd8..cc430f4756610 100644 --- a/x-pack/plugins/snapshot_restore/server/config.ts +++ b/x-pack/plugins/snapshot_restore/server/config.ts @@ -72,12 +72,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'xpack.snapshot_restore.enabled', + level: 'critical', title: i18n.translate('xpack.snapshotRestore.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.snapshot_restore.enabled" is deprecated', }), message: i18n.translate('xpack.snapshotRestore.deprecations.enabledMessage', { defaultMessage: - 'Use the "xpack.snapshot_restore.ui.enabled" setting instead of "xpack.snapshot_restore.enabled".', + 'To disallow users from accessing the Snapshot and Restore UI, use the "xpack.snapshot_restore.ui.enabled" setting instead of "xpack.snapshot_restore.enabled".', }), correctiveActions: { manualSteps: [ diff --git a/x-pack/plugins/upgrade_assistant/server/config.ts b/x-pack/plugins/upgrade_assistant/server/config.ts index f57dc60a730ed..4183ea337def1 100644 --- a/x-pack/plugins/upgrade_assistant/server/config.ts +++ b/x-pack/plugins/upgrade_assistant/server/config.ts @@ -78,12 +78,13 @@ const config7x: PluginConfigDescriptor = { addDeprecation({ configPath: 'xpack.upgrade_assistant.enabled', + level: 'critical', title: i18n.translate('xpack.upgradeAssistant.deprecations.enabledTitle', { defaultMessage: 'Setting "xpack.upgrade_assistant.enabled" is deprecated', }), message: i18n.translate('xpack.upgradeAssistant.deprecations.enabledMessage', { defaultMessage: - 'Use the "xpack.upgrade_assistant.ui.enabled" setting instead of "xpack.upgrade_assistant.enabled".', + 'To disallow users from accessing the Upgrade Assistant UI, use the "xpack.upgrade_assistant.ui.enabled" setting instead of "xpack.upgrade_assistant.enabled".', }), correctiveActions: { manualSteps: [