mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
* [Stack management apps] Deprecate "enabled" Kibana setting (#114768) # Conflicts: # docs/dev-tools/console/console.asciidoc # docs/setup/settings.asciidoc # x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts # x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx # x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.test.tsx # x-pack/plugins/upgrade_assistant/common/config.ts # x-pack/plugins/upgrade_assistant/common/constants.ts # x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx # x-pack/plugins/upgrade_assistant/public/plugin.ts # x-pack/plugins/upgrade_assistant/public/types.ts * Fix doc issue * [CCR] Update "MAJOR_VERSION" constant * [ILM] Update "MAJOR_VERSION" constant * [License Management] Update "MAJOR_VERSION" constant * [Remote Clusters] Update "MAJOR_VERSION" constant * [Rollup] Update "MAJOR_VERSION" constant * [S&R] Update "MAJOR_VERSION" constant * [UA] Update "MAJOR_VERSION" constant * Fix default value for "readonly" in 7.16.0
This commit is contained in:
parent
e250fc5a9b
commit
12113d4579
58 changed files with 1286 additions and 442 deletions
|
@ -134,8 +134,13 @@ shortcuts, click *Help*.
|
|||
[[console-settings]]
|
||||
=== Disable Console
|
||||
|
||||
deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
|
||||
If you don’t want to use *Console*, you can disable it by setting `console.enabled`
|
||||
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.
|
||||
|
||||
=== Disable Console (before 8.0)
|
||||
|
||||
deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
|
||||
If you don’t want to use *Console*, you can disable it by setting `console.enabled`
|
||||
to `false` in your `kibana.yml` configuration file.
|
|
@ -21,7 +21,10 @@ configuration using `${MY_ENV_VAR}` syntax.
|
|||
|===
|
||||
|
||||
| `console.enabled:`
|
||||
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
|
||||
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported. Use `console.ui.enabled` instead."]
|
||||
Set to `false` to disable Console. *Default: `true`*
|
||||
|
||||
| `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`*
|
||||
|
@ -786,6 +789,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`*
|
||||
|
@ -794,15 +801,41 @@ 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.enabled`
|
||||
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
|
||||
Set this value to false to disable the License 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.enabled:`
|
||||
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
|
||||
Set this value to false to disable the Rollup UI. *Default: true*
|
||||
|
||||
| `xpack.rollup.ui.enabled:`
|
||||
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*
|
||||
|
||||
| `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`*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<void, void, AppSetupUIPluginDependencies> {
|
||||
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<ClientConfigType>();
|
||||
|
||||
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',
|
||||
order: 1,
|
||||
title: i18n.translate('console.consoleDisplayName', {
|
||||
defaultMessage: 'Console',
|
||||
}),
|
||||
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,
|
||||
enableRouting: false,
|
||||
mount: async ({ element }) => {
|
||||
const [core] = await getStartServices();
|
||||
|
||||
const {
|
||||
i18n: { Context: I18nContext },
|
||||
docLinks: { DOC_LINK_VERSION },
|
||||
} = core;
|
||||
|
||||
const { renderApp } = await import('./application');
|
||||
|
||||
return renderApp({
|
||||
http,
|
||||
docLinkVersion: DOC_LINK_VERSION,
|
||||
I18nContext,
|
||||
notifications,
|
||||
usageCollection,
|
||||
element,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const locator = share.url.locators.create<ConsoleUILocatorParams>({
|
||||
id: 'CONSOLE_APP_LOCATOR',
|
||||
getLocation: async ({ loadFrom }) => {
|
||||
return {
|
||||
app: 'dev_tools',
|
||||
path: `#/console${loadFrom ? `?load_from=${loadFrom}` : ''}`,
|
||||
state: { loadFrom },
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
return { locator };
|
||||
}
|
||||
|
||||
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 { renderApp } = await import('./application');
|
||||
|
||||
return renderApp({
|
||||
http,
|
||||
docLinkVersion: DOC_LINK_VERSION,
|
||||
I18nContext,
|
||||
notifications,
|
||||
usageCollection,
|
||||
element,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const locator = share.url.locators.create<ConsoleUILocatorParams>({
|
||||
id: 'CONSOLE_APP_LOCATOR',
|
||||
getLocation: async ({ loadFrom }) => {
|
||||
return {
|
||||
app: 'dev_tools',
|
||||
path: `#/console${loadFrom ? `?load_from=${loadFrom}` : ''}`,
|
||||
state: { loadFrom },
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
return { locator };
|
||||
return {};
|
||||
}
|
||||
|
||||
public start() {}
|
||||
|
|
13
src/plugins/console/public/types/config.ts
Normal file
13
src/plugins/console/public/types/config.ts
Normal file
|
@ -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;
|
||||
};
|
||||
}
|
|
@ -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';
|
||||
|
|
12
src/plugins/console/public/types/locator.ts
Normal file
12
src/plugins/console/public/types/locator.ts
Normal file
|
@ -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;
|
||||
}
|
|
@ -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<ConsoleUILocatorParams>;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
*/
|
||||
|
||||
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';
|
||||
|
||||
|
@ -14,62 +16,171 @@ 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 }) }, {}),
|
||||
};
|
||||
|
||||
// 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 }
|
||||
),
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object(
|
||||
{
|
||||
ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}),
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
{ defaultValue: [] }
|
||||
),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
const configLatest: PluginConfigDescriptor<ConsoleConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
const configSchema = schema.object(
|
||||
export type ConsoleConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object(
|
||||
{
|
||||
...baseSettings,
|
||||
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: [] }
|
||||
),
|
||||
ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}),
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
const configSchema7x = schema.object(
|
||||
{
|
||||
...baseSettings,
|
||||
...deprecatedSettings,
|
||||
export type ConsoleConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<ConsoleConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
export type ConfigType = TypeOf<typeof configSchema>;
|
||||
export type ConfigType7x = TypeOf<typeof configSchema7x>;
|
||||
|
||||
export const config: PluginConfigDescriptor<ConfigType | ConfigType7x> = {
|
||||
schema: kibanaVersion.major < 8 ? configSchema7x : configSchema,
|
||||
schema: schema7x,
|
||||
deprecations: ({ deprecate, unused }) => [
|
||||
deprecate('enabled', '8.0.0'),
|
||||
deprecate('proxyFilter', '8.0.0'),
|
||||
deprecate('proxyConfig', '8.0.0'),
|
||||
unused('ssl'),
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'console.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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:
|
||||
'To disallow users from accessing the Console UI, 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;
|
||||
},
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'console.proxyConfig') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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.',
|
||||
}),
|
||||
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',
|
||||
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.',
|
||||
}),
|
||||
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;
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const config: PluginConfigDescriptor<ConsoleConfig | ConsoleConfig7x> =
|
||||
kibanaVersion.major < 8 ? config7x : configLatest;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<ConsoleSetup, ConsoleStart> {
|
|||
|
||||
esLegacyConfigService = new EsLegacyConfigService();
|
||||
|
||||
constructor(private readonly ctx: PluginInitializerContext<ConfigType | ConfigType7x>) {
|
||||
constructor(private readonly ctx: PluginInitializerContext<ConsoleConfig | ConsoleConfig7x>) {
|
||||
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<ConsoleSetup, ConsoleStart> {
|
|||
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$);
|
||||
|
|
|
@ -61,7 +61,8 @@ export const ManageData: FC<Props> = ({ addBasePath, application, features }) =>
|
|||
{isDevToolsEnabled || isManagementEnabled ? (
|
||||
<EuiFlexItem className="homDataManage__actions" grow={false}>
|
||||
<EuiFlexGroup alignItems="center" responsive={false} wrap>
|
||||
{isDevToolsEnabled ? (
|
||||
{/* Check if both the Dev Tools UI and the Console UI are enabled. */}
|
||||
{isDevToolsEnabled && consoleHref !== undefined ? (
|
||||
<EuiFlexItem grow={false}>
|
||||
<RedirectAppLinks application={application}>
|
||||
<EuiButtonEmpty
|
||||
|
|
|
@ -39,15 +39,17 @@ export const RequestCodeViewer = ({ indexPattern, json }: RequestCodeViewerProps
|
|||
const { services } = useKibana<InspectorPluginStartDeps>();
|
||||
|
||||
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
|
||||
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 && consoleHref !== undefined;
|
||||
const shouldShowDevToolsLink = !!(indexPattern && canShowDevTools);
|
||||
const handleDevToolsLinkClick = useCallback(
|
||||
() => devToolsHref && navigateToUrl && navigateToUrl(devToolsHref),
|
||||
[devToolsHref, navigateToUrl]
|
||||
() => consoleHref && navigateToUrl && navigateToUrl(consoleHref),
|
||||
[consoleHref, navigateToUrl]
|
||||
);
|
||||
|
||||
return (
|
||||
|
@ -79,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"
|
||||
>
|
||||
|
|
|
@ -19,6 +19,8 @@ export const PLUGIN = {
|
|||
minimumLicenseType: platinumLicense,
|
||||
};
|
||||
|
||||
export const MAJOR_VERSION = '7.16.0';
|
||||
|
||||
export const APPS = {
|
||||
CCR_APP: 'ccr',
|
||||
REMOTE_CLUSTER_APP: 'remote_cluster',
|
||||
|
|
|
@ -4,14 +4,96 @@
|
|||
* 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 'src/core/server';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
ui: schema.object({
|
||||
import { MAJOR_VERSION } from '../common/constants';
|
||||
|
||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object(
|
||||
{
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
const configLatest: PluginConfigDescriptor<CrossClusterReplicationConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
export type CrossClusterReplicationConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object(
|
||||
{
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
});
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
export type CrossClusterReplicationConfig = TypeOf<typeof configSchema>;
|
||||
export type CrossClusterReplicationConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<CrossClusterReplicationConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schema7x,
|
||||
deprecations: () => [
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'xpack.ccr.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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:
|
||||
'To disallow users from accessing the Cross-Cluster Replication UI, 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 const config: PluginConfigDescriptor<
|
||||
CrossClusterReplicationConfig | CrossClusterReplicationConfig7x
|
||||
> = kibanaVersion.major < 8 ? config7x : configLatest;
|
||||
|
|
|
@ -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<CrossClusterReplicationConfig> = {
|
||||
schema: configSchema,
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
||||
};
|
||||
|
|
|
@ -19,6 +19,8 @@ export const PLUGIN = {
|
|||
}),
|
||||
};
|
||||
|
||||
export const MAJOR_VERSION = '7.16.0';
|
||||
|
||||
export const API_BASE_PATH = '/api/index_lifecycle_management';
|
||||
|
||||
export { MIN_SEARCHABLE_SNAPSHOT_LICENSE, MIN_PLUGIN_LICENSE };
|
||||
|
|
|
@ -4,16 +4,94 @@
|
|||
* 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 'src/core/server';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
ui: schema.object({
|
||||
import { MAJOR_VERSION } from '../common/constants';
|
||||
|
||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object(
|
||||
{
|
||||
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 }
|
||||
);
|
||||
|
||||
const configLatest: PluginConfigDescriptor<IndexLifecycleManagementConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
export type IndexLifecycleManagementConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object(
|
||||
{
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
// Cloud requires the ability to hide internal node attributes from users.
|
||||
filteredNodeAttributes: schema.arrayOf(schema.string(), { defaultValue: [] }),
|
||||
});
|
||||
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 }
|
||||
);
|
||||
|
||||
export type IndexLifecycleManagementConfig = TypeOf<typeof configSchema>;
|
||||
export type IndexLifecycleManagementConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<IndexLifecycleManagementConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schema7x,
|
||||
deprecations: () => [
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'xpack.ilm.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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:
|
||||
'To disallow users from accessing the Index Lifecycle Policies UI, 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 const config: PluginConfigDescriptor<
|
||||
IndexLifecycleManagementConfig | IndexLifecycleManagementConfig7x
|
||||
> = kibanaVersion.major < 8 ? config7x : configLatest;
|
||||
|
|
|
@ -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<IndexLifecycleManagementConfig> = {
|
||||
schema: configSchema,
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
||||
};
|
||||
|
|
|
@ -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<StartDependencies>,
|
||||
plugins: SetupDependencies
|
||||
): IndexManagementPluginSetup {
|
||||
const { fleet, usageCollection, management } = plugins;
|
||||
const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version);
|
||||
const {
|
||||
ui: { enabled: isIndexManagementUiEnabled },
|
||||
} = this.ctx.config.get<ClientConfigType>();
|
||||
|
||||
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
|
||||
);
|
||||
},
|
||||
});
|
||||
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(),
|
||||
|
|
|
@ -23,3 +23,9 @@ export interface SetupDependencies {
|
|||
export interface StartDependencies {
|
||||
share: SharePluginStart;
|
||||
}
|
||||
|
||||
export interface ClientConfigType {
|
||||
ui: {
|
||||
enabled: boolean;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,11 +4,90 @@
|
|||
* 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 'src/core/server';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
});
|
||||
import { MAJOR_VERSION } from '../common/constants';
|
||||
|
||||
export type IndexManagementConfig = TypeOf<typeof configSchema>;
|
||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object(
|
||||
{
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
const configLatest: PluginConfigDescriptor<IndexManagementConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
export type IndexManagementConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object(
|
||||
{
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
export type IndexManagementConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<IndexManagementConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schema7x,
|
||||
deprecations: () => [
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'xpack.index_management.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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:
|
||||
'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: [
|
||||
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<IndexManagementConfig | IndexManagementConfig7x> =
|
||||
kibanaVersion.major < 8 ? config7x : configLatest;
|
||||
|
|
|
@ -5,18 +5,14 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server';
|
||||
import { PluginInitializerContext } from 'src/core/server';
|
||||
|
||||
import { IndexMgmtServerPlugin } from './plugin';
|
||||
import { configSchema } from './config';
|
||||
|
||||
export { config } from './config';
|
||||
|
||||
export const plugin = (context: PluginInitializerContext) => new IndexMgmtServerPlugin(context);
|
||||
|
||||
export const config: PluginConfigDescriptor = {
|
||||
schema: configSchema,
|
||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export { Dependencies } from './types';
|
||||
export { IndexManagementPluginSetup } from './plugin';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -13,3 +13,5 @@ export const PLUGIN = {
|
|||
}),
|
||||
id: 'license_management',
|
||||
};
|
||||
|
||||
export const MAJOR_VERSION = '7.16.0';
|
||||
|
|
|
@ -4,14 +4,90 @@
|
|||
* 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 'src/core/server';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
ui: schema.object({
|
||||
import { MAJOR_VERSION } from '../common/constants';
|
||||
|
||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object(
|
||||
{
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
const configLatest: PluginConfigDescriptor<LicenseManagementConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
export type LicenseManagementConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object(
|
||||
{
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
});
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
export type LicenseManagementConfig = TypeOf<typeof configSchema>;
|
||||
export type LicenseManagementConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<LicenseManagementConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schema7x,
|
||||
deprecations: () => [
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'xpack.license_management.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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:
|
||||
'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: [
|
||||
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<LicenseManagementConfig | LicenseManagementConfig7x> =
|
||||
kibanaVersion.major < 8 ? config7x : configLatest;
|
||||
|
|
|
@ -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 { config } from './config';
|
||||
|
||||
export const plugin = (ctx: PluginInitializerContext) => new LicenseManagementServerPlugin();
|
||||
|
||||
export const config: PluginConfigDescriptor<LicenseManagementConfig> = {
|
||||
schema: configSchema,
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
||||
};
|
||||
|
|
|
@ -20,6 +20,8 @@ export const PLUGIN = {
|
|||
},
|
||||
};
|
||||
|
||||
export const MAJOR_VERSION = '7.16.0';
|
||||
|
||||
export const API_BASE_PATH = '/api/remote_clusters';
|
||||
|
||||
export const SNIFF_MODE = 'sniff';
|
||||
|
|
|
@ -4,23 +4,90 @@
|
|||
* 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 } from 'src/core/server';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
});
|
||||
import { MAJOR_VERSION } from '../common/constants';
|
||||
|
||||
export type ConfigType = TypeOf<typeof configSchema>;
|
||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
export const config: PluginConfigDescriptor<ConfigType> = {
|
||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
||||
schema: configSchema,
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object(
|
||||
{
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
const configLatest: PluginConfigDescriptor<RemoteClustersConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
export type RemoteClustersConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object(
|
||||
{
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
export type RemoteClustersConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<RemoteClustersConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schema7x,
|
||||
deprecations: () => [
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'xpack.remote_clusters.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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:
|
||||
'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: [
|
||||
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<RemoteClustersConfig | RemoteClustersConfig7x> =
|
||||
kibanaVersion.major < 8 ? config7x : configLatest;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -14,6 +14,8 @@ export const PLUGIN = {
|
|||
minimumLicenseType: basicLicense,
|
||||
};
|
||||
|
||||
export const MAJOR_VERSION = '7.16.0';
|
||||
|
||||
export const CONFIG_ROLLUPS = 'rollups:enableIndexPatterns';
|
||||
|
||||
export const API_BASE_PATH = '/api/rollup';
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<ClientConfigType>();
|
||||
|
||||
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) {
|
||||
|
|
12
x-pack/plugins/rollup/public/types.ts
Normal file
12
x-pack/plugins/rollup/public/types.ts
Normal file
|
@ -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;
|
||||
};
|
||||
}
|
|
@ -4,11 +4,90 @@
|
|||
* 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 'src/core/server';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
});
|
||||
import { MAJOR_VERSION } from '../common';
|
||||
|
||||
export type RollupConfig = TypeOf<typeof configSchema>;
|
||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object(
|
||||
{
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
const configLatest: PluginConfigDescriptor<RollupConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
export type RollupConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object(
|
||||
{
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
export type RollupConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<RollupConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schema7x,
|
||||
deprecations: () => [
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'xpack.rollup.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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:
|
||||
'To disallow users from accessing the Rollup Jobs UI, 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<RollupConfig | RollupConfig7x> =
|
||||
kibanaVersion.major < 8 ? config7x : configLatest;
|
||||
|
|
|
@ -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<RollupConfig> = {
|
||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
||||
schema: configSchema,
|
||||
};
|
||||
|
|
|
@ -20,6 +20,8 @@ export const PLUGIN = {
|
|||
},
|
||||
};
|
||||
|
||||
export const MAJOR_VERSION = '7.16.0';
|
||||
|
||||
export const API_BASE_PATH = '/api/snapshot_restore/';
|
||||
|
||||
export enum REPOSITORY_TYPES {
|
||||
|
|
|
@ -42,52 +42,58 @@ export class SnapshotRestoreUIPlugin {
|
|||
|
||||
public setup(coreSetup: CoreSetup, plugins: PluginsDependencies): void {
|
||||
const config = this.initializerContext.config.get<ClientConfigType>();
|
||||
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() {}
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
export interface ClientConfigType {
|
||||
slm_ui: { enabled: boolean };
|
||||
ui: { enabled: boolean };
|
||||
}
|
||||
|
|
|
@ -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 } from 'src/core/server';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
slm_ui: schema.object({
|
||||
import { MAJOR_VERSION } from '../common/constants';
|
||||
|
||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object(
|
||||
{
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
slm_ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
const configLatest: PluginConfigDescriptor<SnapshotRestoreConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
slm_ui: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
export type SnapshotRestoreConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object(
|
||||
{
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
});
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
slm_ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
export type SnapshotRestoreConfig = TypeOf<typeof configSchema>;
|
||||
export type SnapshotRestoreConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<SnapshotRestoreConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
slm_ui: true,
|
||||
},
|
||||
schema: schema7x,
|
||||
deprecations: () => [
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'xpack.snapshot_restore.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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:
|
||||
'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: [
|
||||
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<SnapshotRestoreConfig | SnapshotRestoreConfig7x> =
|
||||
kibanaVersion.major < 8 ? config7x : configLatest;
|
||||
|
|
|
@ -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 { config } from './config';
|
||||
|
||||
export const plugin = (ctx: PluginInitializerContext) => new SnapshotRestoreServerPlugin(ctx);
|
||||
|
||||
export const config: PluginConfigDescriptor<SnapshotRestoreConfig> = {
|
||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
||||
schema: configSchema,
|
||||
exposeToBrowser: {
|
||||
slm_ui: true,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -28,16 +28,9 @@ export class SnapshotRestoreServerPlugin implements Plugin<void, void, any, any>
|
|||
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<SnapshotRestoreConfig>();
|
||||
|
||||
if (!pluginConfig.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const router = http.createRouter();
|
||||
|
||||
this.license.setup(
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import SemVer from 'semver/classes/semver';
|
||||
import {
|
||||
deprecationsServiceMock,
|
||||
docLinksServiceMock,
|
||||
|
@ -16,7 +17,6 @@ import {
|
|||
} from 'src/core/public/mocks';
|
||||
import { sharePluginMock } from 'src/plugins/share/public/mocks';
|
||||
|
||||
import { mockKibanaSemverVersion } from '../../../common/constants';
|
||||
import { apiService } from '../../../public/application/lib/api';
|
||||
import { breadcrumbService } from '../../../public/application/lib/breadcrumbs';
|
||||
import { dataPluginMock } from '../../../../../../src/plugins/data/public/mocks';
|
||||
|
@ -53,12 +53,12 @@ shareMock.url.locators.get = (id: IdKey) => ({
|
|||
`${idToUrlMap[id]}?${stringifySearchParams(params)}`,
|
||||
});
|
||||
|
||||
export const getAppContextMock = () => ({
|
||||
export const getAppContextMock = (kibanaVersion: SemVer) => ({
|
||||
isReadOnlyMode: false,
|
||||
kibanaVersionInfo: {
|
||||
currentMajor: mockKibanaSemverVersion.major,
|
||||
prevMajor: mockKibanaSemverVersion.major - 1,
|
||||
nextMajor: mockKibanaSemverVersion.major + 1,
|
||||
currentMajor: kibanaVersion.major,
|
||||
prevMajor: kibanaVersion.major - 1,
|
||||
nextMajor: kibanaVersion.major + 1,
|
||||
},
|
||||
services: {
|
||||
...servicesMock,
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export { setupEnvironment, WithAppDependencies } from './setup_environment';
|
||||
export { setupEnvironment, WithAppDependencies, kibanaVersion } from './setup_environment';
|
||||
export { advanceTime } from './time_manipulation';
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
|
||||
import React from 'react';
|
||||
import axios from 'axios';
|
||||
import SemVer from 'semver/classes/semver';
|
||||
import { merge } from 'lodash';
|
||||
// @ts-ignore
|
||||
import axiosXhrAdapter from 'axios/lib/adapters/xhr';
|
||||
|
||||
import { HttpSetup } from 'src/core/public';
|
||||
|
||||
import { MAJOR_VERSION } from '../../../common/constants';
|
||||
import { AuthorizationContext, Authorization, Privileges } from '../../../public/shared_imports';
|
||||
import { AppContextProvider } from '../../../public/application/app_context';
|
||||
import { apiService } from '../../../public/application/lib/api';
|
||||
|
@ -33,13 +35,15 @@ const createAuthorizationContextValue = (privileges: Privileges) => {
|
|||
} as Authorization;
|
||||
};
|
||||
|
||||
export const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
export const WithAppDependencies =
|
||||
(Comp: any, { privileges, ...overrides }: Record<string, unknown> = {}) =>
|
||||
(props: Record<string, unknown>) => {
|
||||
apiService.setup(mockHttpClient as unknown as HttpSetup);
|
||||
breadcrumbService.setup(() => '');
|
||||
|
||||
const appContextMock = getAppContextMock() as unknown as AppDependencies;
|
||||
const appContextMock = getAppContextMock(kibanaVersion) as unknown as AppDependencies;
|
||||
|
||||
return (
|
||||
<AuthorizationContext.Provider
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { mockKibanaSemverVersion } from '../../../common/constants';
|
||||
import { setupEnvironment } from '../helpers';
|
||||
import { setupEnvironment, kibanaVersion } from '../helpers';
|
||||
import { OverviewTestBed, setupOverviewPage } from './overview.helpers';
|
||||
|
||||
describe('Overview Page', () => {
|
||||
|
@ -25,7 +24,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`);
|
||||
|
|
|
@ -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: false }),
|
||||
});
|
||||
|
||||
export type Config = TypeOf<typeof configSchema>;
|
|
@ -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 = '7.0.0';
|
||||
export const mockKibanaSemverVersion = new SemVer(mockKibanaVersion);
|
||||
export const MAJOR_VERSION = '7.16.0';
|
||||
|
||||
/*
|
||||
* Map of 7.0 --> 8.0 index setting deprecation log messages and associated settings
|
||||
|
|
|
@ -8,12 +8,15 @@
|
|||
import { I18nProvider } from '@kbn/i18n/react';
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
import SemVer from 'semver/classes/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'
|
||||
|
@ -44,7 +47,7 @@ describe('WarningsFlyoutStep', () => {
|
|||
expect(shallow(<WarningsFlyoutStep {...defaultProps} />)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
if (mockKibanaSemverVersion.major === 7) {
|
||||
if (kibanaVersion.major === 7) {
|
||||
it('does not allow proceeding until all are checked', () => {
|
||||
const defaultPropsWithWarnings = {
|
||||
...defaultProps,
|
||||
|
|
|
@ -12,9 +12,7 @@ import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/public';
|
|||
import { apiService } from './application/lib/api';
|
||||
import { breadcrumbService } from './application/lib/breadcrumbs';
|
||||
import { uiMetricService } from './application/lib/ui_metric';
|
||||
import { SetupDependencies, StartDependencies, AppDependencies } from './types';
|
||||
import { Config } from '../common/config';
|
||||
|
||||
import { SetupDependencies, StartDependencies, AppDependencies, ClientConfigType } from './types';
|
||||
export class UpgradeAssistantUIPlugin
|
||||
implements Plugin<void, void, SetupDependencies, StartDependencies>
|
||||
{
|
||||
|
@ -23,67 +21,72 @@ export class UpgradeAssistantUIPlugin
|
|||
coreSetup: CoreSetup<StartDependencies>,
|
||||
{ management, cloud, share, usageCollection }: SetupDependencies
|
||||
) {
|
||||
const { readonly } = this.ctx.config.get<Config>();
|
||||
const {
|
||||
readonly,
|
||||
ui: { enabled: isUpgradeAssistantUiEnabled },
|
||||
} = this.ctx.config.get<ClientConfigType>();
|
||||
|
||||
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: 'Upgrade Assistant',
|
||||
});
|
||||
const pluginName = i18n.translate('xpack.upgradeAssistant.appTitle', {
|
||||
defaultMessage: 'Upgrade Assistant',
|
||||
});
|
||||
|
||||
if (usageCollection) {
|
||||
uiMetricService.setup(usageCollection);
|
||||
if (usageCollection) {
|
||||
uiMetricService.setup(usageCollection);
|
||||
}
|
||||
|
||||
appRegistrar.registerApp({
|
||||
id: 'upgrade_assistant',
|
||||
title: pluginName,
|
||||
order: 1,
|
||||
async mount(params) {
|
||||
const [coreStart, { data, ...plugins }] = await coreSetup.getStartServices();
|
||||
|
||||
const {
|
||||
chrome: { docTitle },
|
||||
} = coreStart;
|
||||
|
||||
docTitle.change(pluginName);
|
||||
|
||||
const appDependencies: AppDependencies = {
|
||||
kibanaVersionInfo,
|
||||
isReadOnlyMode: readonly,
|
||||
plugins: {
|
||||
cloud,
|
||||
share,
|
||||
// Infra plugin doesnt export anything as a public interface. So the only
|
||||
// way we have at this stage for checking if the plugin is available or not
|
||||
// is by checking if the startServices has the `infra` key.
|
||||
infra: plugins.hasOwnProperty('infra') ? {} : undefined,
|
||||
},
|
||||
services: {
|
||||
core: coreStart,
|
||||
data,
|
||||
history: params.history,
|
||||
api: apiService,
|
||||
breadcrumbs: breadcrumbService,
|
||||
},
|
||||
};
|
||||
|
||||
const { mountManagementSection } = await import('./application/mount_management_section');
|
||||
const unmountAppCallback = mountManagementSection(params, appDependencies);
|
||||
|
||||
return () => {
|
||||
docTitle.reset();
|
||||
unmountAppCallback();
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
appRegistrar.registerApp({
|
||||
id: 'upgrade_assistant',
|
||||
title: pluginName,
|
||||
order: 1,
|
||||
async mount(params) {
|
||||
const [coreStart, { data, ...plugins }] = await coreSetup.getStartServices();
|
||||
|
||||
const {
|
||||
chrome: { docTitle },
|
||||
} = coreStart;
|
||||
|
||||
docTitle.change(pluginName);
|
||||
|
||||
const appDependencies: AppDependencies = {
|
||||
kibanaVersionInfo,
|
||||
isReadOnlyMode: readonly,
|
||||
plugins: {
|
||||
cloud,
|
||||
share,
|
||||
// Infra plugin doesnt export anything as a public interface. So the only
|
||||
// way we have at this stage for checking if the plugin is available or not
|
||||
// is by checking if the startServices has the `infra` key.
|
||||
infra: plugins.hasOwnProperty('infra') ? {} : undefined,
|
||||
},
|
||||
services: {
|
||||
core: coreStart,
|
||||
data,
|
||||
history: params.history,
|
||||
api: apiService,
|
||||
breadcrumbs: breadcrumbService,
|
||||
},
|
||||
};
|
||||
|
||||
const { mountManagementSection } = await import('./application/mount_management_section');
|
||||
const unmountAppCallback = mountManagementSection(params, appDependencies);
|
||||
|
||||
return () => {
|
||||
docTitle.reset();
|
||||
unmountAppCallback();
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
start() {}
|
||||
|
|
|
@ -50,3 +50,10 @@ export interface AppDependencies {
|
|||
api: ApiService;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ClientConfigType {
|
||||
readonly: boolean;
|
||||
ui: {
|
||||
enabled: boolean;
|
||||
};
|
||||
}
|
||||
|
|
101
x-pack/plugins/upgrade_assistant/server/config.ts
Normal file
101
x-pack/plugins/upgrade_assistant/server/config.ts
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* 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 } from 'src/core/server';
|
||||
|
||||
import { MAJOR_VERSION } from '../common/constants';
|
||||
|
||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object({
|
||||
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 }),
|
||||
});
|
||||
|
||||
const configLatest: PluginConfigDescriptor<UpgradeAssistantConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
readonly: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
export type UpgradeAssistantConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object({
|
||||
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: false }),
|
||||
});
|
||||
|
||||
export type UpgradeAssistantConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<UpgradeAssistantConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
readonly: true,
|
||||
},
|
||||
schema: schema7x,
|
||||
deprecations: () => [
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'xpack.upgrade_assistant.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
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:
|
||||
'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: [
|
||||
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<UpgradeAssistantConfig | UpgradeAssistantConfig7x> =
|
||||
kibanaVersion.major < 8 ? config7x : configLatest;
|
|
@ -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<Config> = {
|
||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
||||
schema: configSchema,
|
||||
exposeToBrowser: {
|
||||
readonly: true,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -18,7 +18,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';
|
||||
|
@ -53,7 +53,7 @@ describe('ReindexActions', () => {
|
|||
|
||||
describe('createReindexOp', () => {
|
||||
beforeEach(() => {
|
||||
versionService.setup(mockKibanaVersion);
|
||||
versionService.setup(MAJOR_VERSION);
|
||||
client.create.mockResolvedValue();
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,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';
|
||||
|
||||
|
@ -80,7 +80,7 @@ describe('reindexService', () => {
|
|||
licensingPluginSetup
|
||||
);
|
||||
|
||||
versionService.setup(mockKibanaVersion);
|
||||
versionService.setup(MAJOR_VERSION);
|
||||
});
|
||||
|
||||
describe('hasRequiredPrivileges', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue