[Stack management apps] Deprecate "enabled" Kibana setting (#114768)
This commit is contained in:
parent
5974fcfdb5
commit
f6a9afea61
|
@ -129,3 +129,12 @@ image::dev-tools/console/images/console-settings.png["Console Settings", width=6
|
||||||
|
|
||||||
For a list of available keyboard
|
For a list of available keyboard
|
||||||
shortcuts, click *Help*.
|
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.
|
|
@ -20,6 +20,11 @@ configuration using `${MY_ENV_VAR}` syntax.
|
||||||
[cols="2*<"]
|
[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:`
|
| `csp.rules:`
|
||||||
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
|
| 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
|
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
|
| 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`*
|
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.`
|
|[[settings-explore-data-in-context]] `xpack.discoverEnhanced.actions.`
|
||||||
`exploreDataInContextMenu.enabled`
|
`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`*
|
| 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`
|
`exploreDataInChart.enabled`
|
||||||
| Enables you to view the underlying documents in a data series from a dashboard panel. *Default: `false`*
|
| 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 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}
|
| `i18n.locale` {ess-icon}
|
||||||
| Set this value to change the {kib} interface language.
|
| Set this value to change the {kib} interface language.
|
||||||
Valid locales are: `en`, `zh-CN`, `ja-JP`. *Default: `en`*
|
Valid locales are: `en`, `zh-CN`, `ja-JP`. *Default: `en`*
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
import { PluginInitializerContext } from 'src/core/public';
|
||||||
|
|
||||||
import { ConsoleUIPlugin } from './plugin';
|
import { ConsoleUIPlugin } from './plugin';
|
||||||
|
|
||||||
export type { ConsoleUILocatorParams } from './plugin';
|
export type { ConsoleUILocatorParams, ConsolePluginSetup } from './types';
|
||||||
|
|
||||||
export { ConsoleUIPlugin as Plugin };
|
export { ConsoleUIPlugin as Plugin };
|
||||||
|
|
||||||
export function plugin() {
|
export function plugin(ctx: PluginInitializerContext) {
|
||||||
return new ConsoleUIPlugin();
|
return new ConsoleUIPlugin(ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,77 +7,87 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { SerializableRecord } from '@kbn/utility-types';
|
import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/public';
|
||||||
import { Plugin, CoreSetup } from 'src/core/public';
|
|
||||||
|
|
||||||
import { FeatureCatalogueCategory } from '../../home/public';
|
import { FeatureCatalogueCategory } from '../../home/public';
|
||||||
import { AppSetupUIPluginDependencies } from './types';
|
import {
|
||||||
|
AppSetupUIPluginDependencies,
|
||||||
export interface ConsoleUILocatorParams extends SerializableRecord {
|
ClientConfigType,
|
||||||
loadFrom?: string;
|
ConsolePluginSetup,
|
||||||
}
|
ConsoleUILocatorParams,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
export class ConsoleUIPlugin implements Plugin<void, void, AppSetupUIPluginDependencies> {
|
export class ConsoleUIPlugin implements Plugin<void, void, AppSetupUIPluginDependencies> {
|
||||||
|
constructor(private ctx: PluginInitializerContext) {}
|
||||||
|
|
||||||
public setup(
|
public setup(
|
||||||
{ notifications, getStartServices, http }: CoreSetup,
|
{ notifications, getStartServices, http }: CoreSetup,
|
||||||
{ devTools, home, share, usageCollection }: AppSetupUIPluginDependencies
|
{ devTools, home, share, usageCollection }: AppSetupUIPluginDependencies
|
||||||
) {
|
): ConsolePluginSetup {
|
||||||
if (home) {
|
const {
|
||||||
home.featureCatalogue.register({
|
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',
|
id: 'console',
|
||||||
title: i18n.translate('console.devToolsTitle', {
|
order: 1,
|
||||||
defaultMessage: 'Interact with the Elasticsearch API',
|
title: i18n.translate('console.consoleDisplayName', {
|
||||||
|
defaultMessage: 'Console',
|
||||||
}),
|
}),
|
||||||
description: i18n.translate('console.devToolsDescription', {
|
enableRouting: false,
|
||||||
defaultMessage: 'Skip cURL and use a JSON interface to work with your data in Console.',
|
mount: async ({ element }) => {
|
||||||
}),
|
const [core] = await getStartServices();
|
||||||
icon: 'consoleApp',
|
|
||||||
path: '/app/dev_tools#/console',
|
const {
|
||||||
showOnHomePage: false,
|
i18n: { Context: I18nContext },
|
||||||
category: FeatureCatalogueCategory.ADMIN,
|
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({
|
return {};
|
||||||
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 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public start() {}
|
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 './token';
|
||||||
export * from './tokens_provider';
|
export * from './tokens_provider';
|
||||||
export * from './common';
|
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 { HomePublicPluginSetup } from '../../../home/public';
|
||||||
import { DevToolsSetup } from '../../../dev_tools/public';
|
import { DevToolsSetup } from '../../../dev_tools/public';
|
||||||
import { UsageCollectionSetup } from '../../../usage_collection/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 {
|
export interface AppSetupUIPluginDependencies {
|
||||||
home?: HomePublicPluginSetup;
|
home?: HomePublicPluginSetup;
|
||||||
|
@ -17,3 +19,7 @@ export interface AppSetupUIPluginDependencies {
|
||||||
share: SharePluginSetup;
|
share: SharePluginSetup;
|
||||||
usageCollection?: UsageCollectionSetup;
|
usageCollection?: UsageCollectionSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ConsolePluginSetup {
|
||||||
|
locator?: LocatorPublic<ConsoleUILocatorParams>;
|
||||||
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SemVer } from 'semver';
|
import { SemVer } from 'semver';
|
||||||
|
import { i18n } from '@kbn/i18n';
|
||||||
|
import { get } from 'lodash';
|
||||||
import { schema, TypeOf } from '@kbn/config-schema';
|
import { schema, TypeOf } from '@kbn/config-schema';
|
||||||
import { PluginConfigDescriptor } from 'kibana/server';
|
import { PluginConfigDescriptor } from 'kibana/server';
|
||||||
|
|
||||||
|
@ -14,62 +16,171 @@ import { MAJOR_VERSION } from '../common/constants';
|
||||||
|
|
||||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||||
|
|
||||||
const baseSettings = {
|
// -------------------------------
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
// >= 8.x
|
||||||
ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}),
|
// -------------------------------
|
||||||
};
|
const schemaLatest = schema.object(
|
||||||
|
{
|
||||||
// Settings only available in 7.x
|
ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}),
|
||||||
const deprecatedSettings = {
|
ui: schema.object({
|
||||||
proxyFilter: schema.arrayOf(schema.string(), { defaultValue: ['.*'] }),
|
enabled: schema.boolean({ defaultValue: true }),
|
||||||
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 }
|
||||||
|
);
|
||||||
|
|
||||||
|
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 }
|
{ defaultValue: undefined }
|
||||||
);
|
);
|
||||||
|
|
||||||
const configSchema7x = schema.object(
|
export type ConsoleConfig7x = TypeOf<typeof schema7x>;
|
||||||
{
|
|
||||||
...baseSettings,
|
const config7x: PluginConfigDescriptor<ConsoleConfig7x> = {
|
||||||
...deprecatedSettings,
|
exposeToBrowser: {
|
||||||
|
ui: true,
|
||||||
},
|
},
|
||||||
{ defaultValue: undefined }
|
schema: schema7x,
|
||||||
);
|
|
||||||
|
|
||||||
export type ConfigType = TypeOf<typeof configSchema>;
|
|
||||||
export type ConfigType7x = TypeOf<typeof configSchema7x>;
|
|
||||||
|
|
||||||
export const config: PluginConfigDescriptor<ConfigType | ConfigType7x> = {
|
|
||||||
schema: kibanaVersion.major < 8 ? configSchema7x : configSchema,
|
|
||||||
deprecations: ({ deprecate, unused }) => [
|
deprecations: ({ deprecate, unused }) => [
|
||||||
deprecate('enabled', '8.0.0'),
|
|
||||||
deprecate('proxyFilter', '8.0.0'),
|
|
||||||
deprecate('proxyConfig', '8.0.0'),
|
|
||||||
unused('ssl'),
|
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';
|
import { ConsoleServerPlugin } from './plugin';
|
||||||
|
|
||||||
export { ConsoleSetup, ConsoleStart } from './types';
|
export { ConsoleSetup, ConsoleStart } from './types';
|
||||||
|
|
||||||
export { config } from './config';
|
export { config } from './config';
|
||||||
|
|
||||||
export const plugin = (ctx: PluginInitializerContext) => new ConsoleServerPlugin(ctx);
|
export const plugin = (ctx: PluginInitializerContext) => new ConsoleServerPlugin(ctx);
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { SemVer } from 'semver';
|
||||||
|
|
||||||
import { ProxyConfigCollection } from './lib';
|
import { ProxyConfigCollection } from './lib';
|
||||||
import { SpecDefinitionsService, EsLegacyConfigService } from './services';
|
import { SpecDefinitionsService, EsLegacyConfigService } from './services';
|
||||||
import { ConfigType, ConfigType7x } from './config';
|
import { ConsoleConfig, ConsoleConfig7x } from './config';
|
||||||
|
|
||||||
import { registerRoutes } from './routes';
|
import { registerRoutes } from './routes';
|
||||||
|
|
||||||
|
@ -24,11 +24,11 @@ export class ConsoleServerPlugin implements Plugin<ConsoleSetup, ConsoleStart> {
|
||||||
|
|
||||||
esLegacyConfigService = new EsLegacyConfigService();
|
esLegacyConfigService = new EsLegacyConfigService();
|
||||||
|
|
||||||
constructor(private readonly ctx: PluginInitializerContext<ConfigType | ConfigType7x>) {
|
constructor(private readonly ctx: PluginInitializerContext<ConsoleConfig | ConsoleConfig7x>) {
|
||||||
this.log = this.ctx.logger.get();
|
this.log = this.ctx.logger.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
setup({ http, capabilities, getStartServices, elasticsearch }: CoreSetup) {
|
setup({ http, capabilities, elasticsearch }: CoreSetup) {
|
||||||
capabilities.registerProvider(() => ({
|
capabilities.registerProvider(() => ({
|
||||||
dev_tools: {
|
dev_tools: {
|
||||||
show: true,
|
show: true,
|
||||||
|
@ -43,8 +43,8 @@ export class ConsoleServerPlugin implements Plugin<ConsoleSetup, ConsoleStart> {
|
||||||
let proxyConfigCollection: ProxyConfigCollection | undefined;
|
let proxyConfigCollection: ProxyConfigCollection | undefined;
|
||||||
if (kibanaVersion.major < 8) {
|
if (kibanaVersion.major < 8) {
|
||||||
// "pathFilters" and "proxyConfig" are only used in 7.x
|
// "pathFilters" and "proxyConfig" are only used in 7.x
|
||||||
pathFilters = (config as ConfigType7x).proxyFilter.map((str: string) => new RegExp(str));
|
pathFilters = (config as ConsoleConfig7x).proxyFilter.map((str: string) => new RegExp(str));
|
||||||
proxyConfigCollection = new ProxyConfigCollection((config as ConfigType7x).proxyConfig);
|
proxyConfigCollection = new ProxyConfigCollection((config as ConsoleConfig7x).proxyConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.esLegacyConfigService.setup(elasticsearch.legacy.config$);
|
this.esLegacyConfigService.setup(elasticsearch.legacy.config$);
|
||||||
|
|
|
@ -61,7 +61,8 @@ export const ManageData: FC<Props> = ({ addBasePath, application, features }) =>
|
||||||
{isDevToolsEnabled || isManagementEnabled ? (
|
{isDevToolsEnabled || isManagementEnabled ? (
|
||||||
<EuiFlexItem className="homDataManage__actions" grow={false}>
|
<EuiFlexItem className="homDataManage__actions" grow={false}>
|
||||||
<EuiFlexGroup alignItems="center" responsive={false} wrap>
|
<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}>
|
<EuiFlexItem grow={false}>
|
||||||
<RedirectAppLinks application={application}>
|
<RedirectAppLinks application={application}>
|
||||||
<EuiButtonEmpty
|
<EuiButtonEmpty
|
||||||
|
|
|
@ -39,15 +39,17 @@ export const RequestCodeViewer = ({ indexPattern, json }: RequestCodeViewerProps
|
||||||
const { services } = useKibana<InspectorPluginStartDeps>();
|
const { services } = useKibana<InspectorPluginStartDeps>();
|
||||||
|
|
||||||
const navigateToUrl = services.application?.navigateToUrl;
|
const navigateToUrl = services.application?.navigateToUrl;
|
||||||
const canShowDevTools = services.application?.capabilities?.dev_tools.show;
|
|
||||||
const devToolsDataUri = compressToEncodedURIComponent(`GET ${indexPattern}/_search\n${json}`);
|
const devToolsDataUri = compressToEncodedURIComponent(`GET ${indexPattern}/_search\n${json}`);
|
||||||
const devToolsHref = services.share.url.locators
|
const consoleHref = services.share.url.locators
|
||||||
.get('CONSOLE_APP_LOCATOR')
|
.get('CONSOLE_APP_LOCATOR')
|
||||||
?.useUrl({ loadFrom: `data:text/plain,${devToolsDataUri}` });
|
?.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 shouldShowDevToolsLink = !!(indexPattern && canShowDevTools);
|
||||||
const handleDevToolsLinkClick = useCallback(
|
const handleDevToolsLinkClick = useCallback(
|
||||||
() => devToolsHref && navigateToUrl && navigateToUrl(devToolsHref),
|
() => consoleHref && navigateToUrl && navigateToUrl(consoleHref),
|
||||||
[devToolsHref, navigateToUrl]
|
[consoleHref, navigateToUrl]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -79,7 +81,7 @@ export const RequestCodeViewer = ({ indexPattern, json }: RequestCodeViewerProps
|
||||||
size="xs"
|
size="xs"
|
||||||
flush="right"
|
flush="right"
|
||||||
iconType="wrench"
|
iconType="wrench"
|
||||||
href={devToolsHref}
|
href={consoleHref}
|
||||||
onClick={handleDevToolsLinkClick}
|
onClick={handleDevToolsLinkClick}
|
||||||
data-test-subj="inspectorRequestOpenInConsoleButton"
|
data-test-subj="inspectorRequestOpenInConsoleButton"
|
||||||
>
|
>
|
||||||
|
|
|
@ -19,6 +19,8 @@ export const PLUGIN = {
|
||||||
minimumLicenseType: platinumLicense,
|
minimumLicenseType: platinumLicense,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const MAJOR_VERSION = '8.0.0';
|
||||||
|
|
||||||
export const APPS = {
|
export const APPS = {
|
||||||
CCR_APP: 'ccr',
|
CCR_APP: 'ccr',
|
||||||
REMOTE_CLUSTER_APP: 'remote_cluster',
|
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; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
import { SemVer } from 'semver';
|
||||||
|
import { i18n } from '@kbn/i18n';
|
||||||
|
import { get } from 'lodash';
|
||||||
import { schema, TypeOf } from '@kbn/config-schema';
|
import { schema, TypeOf } from '@kbn/config-schema';
|
||||||
|
import { PluginConfigDescriptor } from 'src/core/server';
|
||||||
|
|
||||||
export const configSchema = schema.object({
|
import { MAJOR_VERSION } from '../common/constants';
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
|
||||||
ui: schema.object({
|
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 }),
|
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.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server';
|
import { PluginInitializerContext } from 'src/core/server';
|
||||||
import { CrossClusterReplicationServerPlugin } from './plugin';
|
import { CrossClusterReplicationServerPlugin } from './plugin';
|
||||||
import { configSchema, CrossClusterReplicationConfig } from './config';
|
|
||||||
|
export { config } from './config';
|
||||||
|
|
||||||
export const plugin = (pluginInitializerContext: PluginInitializerContext) =>
|
export const plugin = (pluginInitializerContext: PluginInitializerContext) =>
|
||||||
new CrossClusterReplicationServerPlugin(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 = '8.0.0';
|
||||||
|
|
||||||
export const API_BASE_PATH = '/api/index_lifecycle_management';
|
export const API_BASE_PATH = '/api/index_lifecycle_management';
|
||||||
|
|
||||||
export { MIN_SEARCHABLE_SNAPSHOT_LICENSE, MIN_PLUGIN_LICENSE };
|
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; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
import { SemVer } from 'semver';
|
||||||
|
import { i18n } from '@kbn/i18n';
|
||||||
|
import { get } from 'lodash';
|
||||||
import { schema, TypeOf } from '@kbn/config-schema';
|
import { schema, TypeOf } from '@kbn/config-schema';
|
||||||
|
import { PluginConfigDescriptor } from 'src/core/server';
|
||||||
|
|
||||||
export const configSchema = schema.object({
|
import { MAJOR_VERSION } from '../common/constants';
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
|
||||||
ui: schema.object({
|
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 }),
|
enabled: schema.boolean({ defaultValue: true }),
|
||||||
}),
|
ui: schema.object({
|
||||||
// Cloud requires the ability to hide internal node attributes from users.
|
enabled: schema.boolean({ defaultValue: true }),
|
||||||
filteredNodeAttributes: schema.arrayOf(schema.string(), { defaultValue: [] }),
|
}),
|
||||||
});
|
// 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.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PluginInitializerContext, PluginConfigDescriptor } from 'kibana/server';
|
import { PluginInitializerContext } from 'kibana/server';
|
||||||
import { IndexLifecycleManagementServerPlugin } from './plugin';
|
import { IndexLifecycleManagementServerPlugin } from './plugin';
|
||||||
import { configSchema, IndexLifecycleManagementConfig } from './config';
|
|
||||||
|
export { config } from './config';
|
||||||
|
|
||||||
export const plugin = (ctx: PluginInitializerContext) =>
|
export const plugin = (ctx: PluginInitializerContext) =>
|
||||||
new IndexLifecycleManagementServerPlugin(ctx);
|
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 { 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
|
// avoid import from index files in plugin.ts, use specific import paths
|
||||||
import { PLUGIN } from '../common/constants/plugin';
|
import { PLUGIN } from '../common/constants/plugin';
|
||||||
|
@ -31,25 +36,30 @@ export class IndexMgmtUIPlugin {
|
||||||
coreSetup: CoreSetup<StartDependencies>,
|
coreSetup: CoreSetup<StartDependencies>,
|
||||||
plugins: SetupDependencies
|
plugins: SetupDependencies
|
||||||
): IndexManagementPluginSetup {
|
): IndexManagementPluginSetup {
|
||||||
const { fleet, usageCollection, management } = plugins;
|
const {
|
||||||
const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version);
|
ui: { enabled: isIndexManagementUiEnabled },
|
||||||
|
} = this.ctx.config.get<ClientConfigType>();
|
||||||
|
|
||||||
management.sections.section.data.registerApp({
|
if (isIndexManagementUiEnabled) {
|
||||||
id: PLUGIN.id,
|
const { fleet, usageCollection, management } = plugins;
|
||||||
title: i18n.translate('xpack.idxMgmt.appTitle', { defaultMessage: 'Index Management' }),
|
const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version);
|
||||||
order: 0,
|
management.sections.section.data.registerApp({
|
||||||
mount: async (params) => {
|
id: PLUGIN.id,
|
||||||
const { mountManagementSection } = await import('./application/mount_management_section');
|
title: i18n.translate('xpack.idxMgmt.appTitle', { defaultMessage: 'Index Management' }),
|
||||||
return mountManagementSection(
|
order: 0,
|
||||||
coreSetup,
|
mount: async (params) => {
|
||||||
usageCollection,
|
const { mountManagementSection } = await import('./application/mount_management_section');
|
||||||
params,
|
return mountManagementSection(
|
||||||
this.extensionsService,
|
coreSetup,
|
||||||
Boolean(fleet),
|
usageCollection,
|
||||||
kibanaVersion
|
params,
|
||||||
);
|
this.extensionsService,
|
||||||
},
|
Boolean(fleet),
|
||||||
});
|
kibanaVersion
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
extensionsService: this.extensionsService.setup(),
|
extensionsService: this.extensionsService.setup(),
|
||||||
|
|
|
@ -23,3 +23,9 @@ export interface SetupDependencies {
|
||||||
export interface StartDependencies {
|
export interface StartDependencies {
|
||||||
share: SharePluginStart;
|
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; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
import { SemVer } from 'semver';
|
||||||
|
import { i18n } from '@kbn/i18n';
|
||||||
|
import { get } from 'lodash';
|
||||||
import { schema, TypeOf } from '@kbn/config-schema';
|
import { schema, TypeOf } from '@kbn/config-schema';
|
||||||
|
import { PluginConfigDescriptor } from 'src/core/server';
|
||||||
|
|
||||||
export const configSchema = schema.object({
|
import { MAJOR_VERSION } from '../common/constants';
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
|
||||||
});
|
|
||||||
|
|
||||||
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.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server';
|
import { PluginInitializerContext } from 'src/core/server';
|
||||||
|
|
||||||
import { IndexMgmtServerPlugin } from './plugin';
|
import { IndexMgmtServerPlugin } from './plugin';
|
||||||
import { configSchema } from './config';
|
|
||||||
|
export { config } from './config';
|
||||||
|
|
||||||
export const plugin = (context: PluginInitializerContext) => new IndexMgmtServerPlugin(context);
|
export const plugin = (context: PluginInitializerContext) => new IndexMgmtServerPlugin(context);
|
||||||
|
|
||||||
export const config: PluginConfigDescriptor = {
|
|
||||||
schema: configSchema,
|
|
||||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @public */
|
/** @public */
|
||||||
export { Dependencies } from './types';
|
export { Dependencies } from './types';
|
||||||
export { IndexManagementPluginSetup } from './plugin';
|
export { IndexManagementPluginSetup } from './plugin';
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export { PLUGIN } from './plugin';
|
export { PLUGIN, MAJOR_VERSION } from './plugin';
|
||||||
export { API_BASE_PATH } from './base_path';
|
export { API_BASE_PATH } from './base_path';
|
||||||
export { EXTERNAL_LINKS } from './external_links';
|
export { EXTERNAL_LINKS } from './external_links';
|
||||||
export { APP_PERMISSION } from './permissions';
|
export { APP_PERMISSION } from './permissions';
|
||||||
|
|
|
@ -13,3 +13,5 @@ export const PLUGIN = {
|
||||||
}),
|
}),
|
||||||
id: 'license_management',
|
id: 'license_management',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const MAJOR_VERSION = '8.0.0';
|
||||||
|
|
|
@ -4,14 +4,90 @@
|
||||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
import { SemVer } from 'semver';
|
||||||
|
import { i18n } from '@kbn/i18n';
|
||||||
|
import { get } from 'lodash';
|
||||||
import { schema, TypeOf } from '@kbn/config-schema';
|
import { schema, TypeOf } from '@kbn/config-schema';
|
||||||
|
import { PluginConfigDescriptor } from 'src/core/server';
|
||||||
|
|
||||||
export const configSchema = schema.object({
|
import { MAJOR_VERSION } from '../common/constants';
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
|
||||||
ui: schema.object({
|
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 }),
|
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.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server';
|
import { PluginInitializerContext } from 'src/core/server';
|
||||||
|
|
||||||
import { LicenseManagementServerPlugin } from './plugin';
|
import { LicenseManagementServerPlugin } from './plugin';
|
||||||
import { configSchema, LicenseManagementConfig } from './config';
|
|
||||||
|
export { config } from './config';
|
||||||
|
|
||||||
export const plugin = (ctx: PluginInitializerContext) => new LicenseManagementServerPlugin();
|
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 = '8.0.0';
|
||||||
|
|
||||||
export const API_BASE_PATH = '/api/remote_clusters';
|
export const API_BASE_PATH = '/api/remote_clusters';
|
||||||
|
|
||||||
export const SNIFF_MODE = 'sniff';
|
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; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
import { SemVer } from 'semver';
|
||||||
|
import { i18n } from '@kbn/i18n';
|
||||||
|
import { get } from 'lodash';
|
||||||
import { schema, TypeOf } from '@kbn/config-schema';
|
import { schema, TypeOf } from '@kbn/config-schema';
|
||||||
import { PluginConfigDescriptor } from 'kibana/server';
|
import { PluginConfigDescriptor } from 'src/core/server';
|
||||||
|
|
||||||
export const configSchema = schema.object({
|
import { MAJOR_VERSION } from '../common/constants';
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
|
||||||
ui: schema.object({
|
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
export type ConfigType = TypeOf<typeof configSchema>;
|
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||||
|
|
||||||
export const config: PluginConfigDescriptor<ConfigType> = {
|
// -------------------------------
|
||||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
// >= 8.x
|
||||||
schema: configSchema,
|
// -------------------------------
|
||||||
|
const schemaLatest = schema.object(
|
||||||
|
{
|
||||||
|
ui: schema.object({
|
||||||
|
enabled: schema.boolean({ defaultValue: true }),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{ defaultValue: undefined }
|
||||||
|
);
|
||||||
|
|
||||||
|
const configLatest: PluginConfigDescriptor<RemoteClustersConfig> = {
|
||||||
exposeToBrowser: {
|
exposeToBrowser: {
|
||||||
ui: true,
|
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 { PLUGIN } from '../common/constants';
|
||||||
import { Dependencies, LicenseStatus, RouteDependencies } from './types';
|
import { Dependencies, LicenseStatus, RouteDependencies } from './types';
|
||||||
import { ConfigType } from './config';
|
import { RemoteClustersConfig, RemoteClustersConfig7x } from './config';
|
||||||
import {
|
import {
|
||||||
registerGetRoute,
|
registerGetRoute,
|
||||||
registerAddRoute,
|
registerAddRoute,
|
||||||
|
@ -30,7 +30,7 @@ export class RemoteClustersServerPlugin
|
||||||
{
|
{
|
||||||
licenseStatus: LicenseStatus;
|
licenseStatus: LicenseStatus;
|
||||||
log: Logger;
|
log: Logger;
|
||||||
config: ConfigType;
|
config: RemoteClustersConfig | RemoteClustersConfig7x;
|
||||||
|
|
||||||
constructor({ logger, config }: PluginInitializerContext) {
|
constructor({ logger, config }: PluginInitializerContext) {
|
||||||
this.log = logger.get();
|
this.log = logger.get();
|
||||||
|
|
|
@ -14,6 +14,8 @@ export const PLUGIN = {
|
||||||
minimumLicenseType: basicLicense,
|
minimumLicenseType: basicLicense,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const MAJOR_VERSION = '8.0.0';
|
||||||
|
|
||||||
export const CONFIG_ROLLUPS = 'rollups:enableIndexPatterns';
|
export const CONFIG_ROLLUPS = 'rollups:enableIndexPatterns';
|
||||||
|
|
||||||
export const API_BASE_PATH = '/api/rollup';
|
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; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
import { PluginInitializerContext } from 'src/core/public';
|
||||||
|
|
||||||
import { RollupPlugin } from './plugin';
|
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 { 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';
|
import { rollupBadgeExtension, rollupToggleExtension } from './extend_index_management';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { RollupIndexPatternCreationConfig } from './index_pattern_creation/rollup_index_pattern_creation_config';
|
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 { setHttp, init as initDocumentation } from './crud_app/services/index';
|
||||||
import { setNotifications, setFatalErrors, setUiStatsReporter } from './kibana_services';
|
import { setNotifications, setFatalErrors, setUiStatsReporter } from './kibana_services';
|
||||||
import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/public';
|
import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/public';
|
||||||
|
import { ClientConfigType } from './types';
|
||||||
|
|
||||||
export interface RollupPluginSetupDependencies {
|
export interface RollupPluginSetupDependencies {
|
||||||
home?: HomePublicPluginSetup;
|
home?: HomePublicPluginSetup;
|
||||||
|
@ -32,10 +33,16 @@ export interface RollupPluginSetupDependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RollupPlugin implements Plugin {
|
export class RollupPlugin implements Plugin {
|
||||||
|
constructor(private ctx: PluginInitializerContext) {}
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
core: CoreSetup,
|
core: CoreSetup,
|
||||||
{ home, management, indexManagement, usageCollection }: RollupPluginSetupDependencies
|
{ home, management, indexManagement, usageCollection }: RollupPluginSetupDependencies
|
||||||
) {
|
) {
|
||||||
|
const {
|
||||||
|
ui: { enabled: isRollupUiEnabled },
|
||||||
|
} = this.ctx.config.get<ClientConfigType>();
|
||||||
|
|
||||||
setFatalErrors(core.fatalErrors);
|
setFatalErrors(core.fatalErrors);
|
||||||
if (usageCollection) {
|
if (usageCollection) {
|
||||||
setUiStatsReporter(usageCollection.reportUiCounter.bind(usageCollection, UIM_APP_NAME));
|
setUiStatsReporter(usageCollection.reportUiCounter.bind(usageCollection, UIM_APP_NAME));
|
||||||
|
@ -46,7 +53,7 @@ export class RollupPlugin implements Plugin {
|
||||||
indexManagement.extensionsService.addToggle(rollupToggleExtension);
|
indexManagement.extensionsService.addToggle(rollupToggleExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (home) {
|
if (home && isRollupUiEnabled) {
|
||||||
home.featureCatalogue.register({
|
home.featureCatalogue.register({
|
||||||
id: 'rollup_jobs',
|
id: 'rollup_jobs',
|
||||||
title: 'Rollups',
|
title: 'Rollups',
|
||||||
|
@ -61,33 +68,35 @@ export class RollupPlugin implements Plugin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const pluginName = i18n.translate('xpack.rollupJobs.appTitle', {
|
if (isRollupUiEnabled) {
|
||||||
defaultMessage: 'Rollup Jobs',
|
const pluginName = i18n.translate('xpack.rollupJobs.appTitle', {
|
||||||
});
|
defaultMessage: 'Rollup Jobs',
|
||||||
|
});
|
||||||
|
|
||||||
management.sections.section.data.registerApp({
|
management.sections.section.data.registerApp({
|
||||||
id: 'rollup_jobs',
|
id: 'rollup_jobs',
|
||||||
title: pluginName,
|
title: pluginName,
|
||||||
order: 4,
|
order: 4,
|
||||||
async mount(params) {
|
async mount(params) {
|
||||||
const [coreStart] = await core.getStartServices();
|
const [coreStart] = await core.getStartServices();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
chrome: { docTitle },
|
chrome: { docTitle },
|
||||||
} = coreStart;
|
} = coreStart;
|
||||||
|
|
||||||
docTitle.change(pluginName);
|
docTitle.change(pluginName);
|
||||||
params.setBreadcrumbs([{ text: pluginName }]);
|
params.setBreadcrumbs([{ text: pluginName }]);
|
||||||
|
|
||||||
const { renderApp } = await import('./application');
|
const { renderApp } = await import('./application');
|
||||||
const unmountAppCallback = await renderApp(core, params);
|
const unmountAppCallback = await renderApp(core, params);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
docTitle.reset();
|
docTitle.reset();
|
||||||
unmountAppCallback();
|
unmountAppCallback();
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
start(core: CoreStart) {
|
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; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
import { SemVer } from 'semver';
|
||||||
|
import { i18n } from '@kbn/i18n';
|
||||||
|
import { get } from 'lodash';
|
||||||
import { schema, TypeOf } from '@kbn/config-schema';
|
import { schema, TypeOf } from '@kbn/config-schema';
|
||||||
|
import { PluginConfigDescriptor } from 'src/core/server';
|
||||||
|
|
||||||
export const configSchema = schema.object({
|
import { MAJOR_VERSION } from '../common';
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
|
||||||
});
|
|
||||||
|
|
||||||
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.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server';
|
import { PluginInitializerContext } from 'src/core/server';
|
||||||
import { RollupPlugin } from './plugin';
|
import { RollupPlugin } from './plugin';
|
||||||
import { configSchema, RollupConfig } from './config';
|
|
||||||
|
export { config } from './config';
|
||||||
|
|
||||||
export const plugin = (pluginInitializerContext: PluginInitializerContext) =>
|
export const plugin = (pluginInitializerContext: PluginInitializerContext) =>
|
||||||
new RollupPlugin(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 = '8.0.0';
|
||||||
|
|
||||||
export const API_BASE_PATH = '/api/snapshot_restore/';
|
export const API_BASE_PATH = '/api/snapshot_restore/';
|
||||||
|
|
||||||
export enum REPOSITORY_TYPES {
|
export enum REPOSITORY_TYPES {
|
||||||
|
|
|
@ -42,52 +42,58 @@ export class SnapshotRestoreUIPlugin {
|
||||||
|
|
||||||
public setup(coreSetup: CoreSetup, plugins: PluginsDependencies): void {
|
public setup(coreSetup: CoreSetup, plugins: PluginsDependencies): void {
|
||||||
const config = this.initializerContext.config.get<ClientConfigType>();
|
const config = this.initializerContext.config.get<ClientConfigType>();
|
||||||
const { http } = coreSetup;
|
const {
|
||||||
const { home, management, usageCollection } = plugins;
|
ui: { enabled: isSnapshotRestoreUiEnabled },
|
||||||
|
} = config;
|
||||||
|
|
||||||
// Initialize services
|
if (isSnapshotRestoreUiEnabled) {
|
||||||
this.uiMetricService.setup(usageCollection);
|
const { http } = coreSetup;
|
||||||
textService.setup(i18n);
|
const { home, management, usageCollection } = plugins;
|
||||||
httpService.setup(http);
|
|
||||||
|
|
||||||
management.sections.section.data.registerApp({
|
// Initialize services
|
||||||
id: PLUGIN.id,
|
this.uiMetricService.setup(usageCollection);
|
||||||
title: i18n.translate('xpack.snapshotRestore.appTitle', {
|
textService.setup(i18n);
|
||||||
defaultMessage: 'Snapshot and Restore',
|
httpService.setup(http);
|
||||||
}),
|
|
||||||
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);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (home) {
|
management.sections.section.data.registerApp({
|
||||||
home.featureCatalogue.register({
|
|
||||||
id: PLUGIN.id,
|
id: PLUGIN.id,
|
||||||
title: i18n.translate('xpack.snapshotRestore.featureCatalogueTitle', {
|
title: i18n.translate('xpack.snapshotRestore.appTitle', {
|
||||||
defaultMessage: 'Back up and restore',
|
defaultMessage: 'Snapshot and Restore',
|
||||||
}),
|
}),
|
||||||
description: i18n.translate('xpack.snapshotRestore.featureCatalogueDescription', {
|
order: 3,
|
||||||
defaultMessage:
|
mount: async (params) => {
|
||||||
'Save snapshots to a backup repository, and restore to recover index and cluster state.',
|
const { mountManagementSection } = await import('./application/mount_management_section');
|
||||||
}),
|
const services = {
|
||||||
icon: 'storage',
|
uiMetricService: this.uiMetricService,
|
||||||
path: '/app/management/data/snapshot_restore',
|
};
|
||||||
showOnHomePage: true,
|
return await mountManagementSection(coreSetup, services, config, params);
|
||||||
category: FeatureCatalogueCategory.ADMIN,
|
},
|
||||||
order: 630,
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
plugins.share.url.locators.create(
|
if (home) {
|
||||||
new SnapshotRestoreLocatorDefinition({
|
home.featureCatalogue.register({
|
||||||
managementAppLocator: plugins.management.locator,
|
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() {}
|
public start() {}
|
||||||
|
|
|
@ -7,4 +7,5 @@
|
||||||
|
|
||||||
export interface ClientConfigType {
|
export interface ClientConfigType {
|
||||||
slm_ui: { enabled: boolean };
|
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; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
import { SemVer } from 'semver';
|
||||||
|
import { i18n } from '@kbn/i18n';
|
||||||
|
import { get } from 'lodash';
|
||||||
import { schema, TypeOf } from '@kbn/config-schema';
|
import { schema, TypeOf } from '@kbn/config-schema';
|
||||||
|
import { PluginConfigDescriptor } from 'src/core/server';
|
||||||
|
|
||||||
export const configSchema = schema.object({
|
import { MAJOR_VERSION } from '../common/constants';
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
|
||||||
slm_ui: schema.object({
|
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 }),
|
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.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PluginInitializerContext, PluginConfigDescriptor } from 'kibana/server';
|
import { PluginInitializerContext } from 'kibana/server';
|
||||||
import { SnapshotRestoreServerPlugin } from './plugin';
|
import { SnapshotRestoreServerPlugin } from './plugin';
|
||||||
import { configSchema, SnapshotRestoreConfig } from './config';
|
|
||||||
|
export { config } from './config';
|
||||||
|
|
||||||
export const plugin = (ctx: PluginInitializerContext) => new SnapshotRestoreServerPlugin(ctx);
|
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();
|
this.license = new License();
|
||||||
}
|
}
|
||||||
|
|
||||||
public setup(
|
public setup({ http }: CoreSetup, { licensing, features, security, cloud }: Dependencies): void {
|
||||||
{ http, getStartServices }: CoreSetup,
|
|
||||||
{ licensing, features, security, cloud }: Dependencies
|
|
||||||
): void {
|
|
||||||
const pluginConfig = this.context.config.get<SnapshotRestoreConfig>();
|
const pluginConfig = this.context.config.get<SnapshotRestoreConfig>();
|
||||||
|
|
||||||
if (!pluginConfig.enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const router = http.createRouter();
|
const router = http.createRouter();
|
||||||
|
|
||||||
this.license.setup(
|
this.license.setup(
|
||||||
|
|
|
@ -9,4 +9,4 @@ export { setup as setupOverviewPage, OverviewTestBed } from './overview.helpers'
|
||||||
export { setup as setupElasticsearchPage, ElasticsearchTestBed } from './elasticsearch.helpers';
|
export { setup as setupElasticsearchPage, ElasticsearchTestBed } from './elasticsearch.helpers';
|
||||||
export { setup as setupKibanaPage, KibanaTestBed } from './kibana.helpers';
|
export { setup as setupKibanaPage, KibanaTestBed } from './kibana.helpers';
|
||||||
|
|
||||||
export { setupEnvironment } from './setup_environment';
|
export { setupEnvironment, kibanaVersion } from './setup_environment';
|
||||||
|
|
|
@ -9,7 +9,7 @@ import React from 'react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import axiosXhrAdapter from 'axios/lib/adapters/xhr';
|
import axiosXhrAdapter from 'axios/lib/adapters/xhr';
|
||||||
|
import SemVer from 'semver/classes/semver';
|
||||||
import {
|
import {
|
||||||
deprecationsServiceMock,
|
deprecationsServiceMock,
|
||||||
docLinksServiceMock,
|
docLinksServiceMock,
|
||||||
|
@ -19,7 +19,7 @@ import {
|
||||||
import { HttpSetup } from 'src/core/public';
|
import { HttpSetup } from 'src/core/public';
|
||||||
|
|
||||||
import { KibanaContextProvider } from '../../../public/shared_imports';
|
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 { AppContextProvider } from '../../../public/application/app_context';
|
||||||
import { apiService } from '../../../public/application/lib/api';
|
import { apiService } from '../../../public/application/lib/api';
|
||||||
import { breadcrumbService } from '../../../public/application/lib/breadcrumbs';
|
import { breadcrumbService } from '../../../public/application/lib/breadcrumbs';
|
||||||
|
@ -31,6 +31,8 @@ const { GlobalFlyoutProvider } = GlobalFlyout;
|
||||||
|
|
||||||
const mockHttpClient = axios.create({ adapter: axiosXhrAdapter });
|
const mockHttpClient = axios.create({ adapter: axiosXhrAdapter });
|
||||||
|
|
||||||
|
export const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||||
|
|
||||||
export const WithAppDependencies =
|
export const WithAppDependencies =
|
||||||
(Comp: any, overrides: Record<string, unknown> = {}) =>
|
(Comp: any, overrides: Record<string, unknown> = {}) =>
|
||||||
(props: Record<string, unknown>) => {
|
(props: Record<string, unknown>) => {
|
||||||
|
@ -41,9 +43,9 @@ export const WithAppDependencies =
|
||||||
http: mockHttpClient as unknown as HttpSetup,
|
http: mockHttpClient as unknown as HttpSetup,
|
||||||
docLinks: docLinksServiceMock.createStartContract(),
|
docLinks: docLinksServiceMock.createStartContract(),
|
||||||
kibanaVersionInfo: {
|
kibanaVersionInfo: {
|
||||||
currentMajor: mockKibanaSemverVersion.major,
|
currentMajor: kibanaVersion.major,
|
||||||
prevMajor: mockKibanaSemverVersion.major - 1,
|
prevMajor: kibanaVersion.major - 1,
|
||||||
nextMajor: mockKibanaSemverVersion.major + 1,
|
nextMajor: kibanaVersion.major + 1,
|
||||||
},
|
},
|
||||||
notifications: notificationServiceMock.createStartContract(),
|
notifications: notificationServiceMock.createStartContract(),
|
||||||
isReadOnlyMode: false,
|
isReadOnlyMode: false,
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { mockKibanaSemverVersion } from '../../../common/constants';
|
import { OverviewTestBed, setupOverviewPage, setupEnvironment, kibanaVersion } from '../helpers';
|
||||||
import { OverviewTestBed, setupOverviewPage, setupEnvironment } from '../helpers';
|
|
||||||
|
|
||||||
describe('Overview Page', () => {
|
describe('Overview Page', () => {
|
||||||
let testBed: OverviewTestBed;
|
let testBed: OverviewTestBed;
|
||||||
|
@ -24,7 +23,7 @@ describe('Overview Page', () => {
|
||||||
describe('Documentation links', () => {
|
describe('Documentation links', () => {
|
||||||
test('Has a whatsNew link and it references nextMajor version', () => {
|
test('Has a whatsNew link and it references nextMajor version', () => {
|
||||||
const { exists, find } = testBed;
|
const { exists, find } = testBed;
|
||||||
const nextMajor = mockKibanaSemverVersion.major + 1;
|
const nextMajor = kibanaVersion.major + 1;
|
||||||
|
|
||||||
expect(exists('whatsNewLink')).toBe(true);
|
expect(exists('whatsNewLink')).toBe(true);
|
||||||
expect(find('whatsNewLink').text()).toContain(`${nextMajor}.0`);
|
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: true }),
|
|
||||||
});
|
|
||||||
|
|
||||||
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; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 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)
|
* 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)
|
* The release branch should match the release version (e.g., 7.x --> 7.0.0)
|
||||||
*/
|
*/
|
||||||
export const mockKibanaVersion = '8.0.0';
|
export const MAJOR_VERSION = '8.0.0';
|
||||||
export const mockKibanaSemverVersion = new SemVer(mockKibanaVersion);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map of 7.0 --> 8.0 index setting deprecation log messages and associated settings
|
* Map of 7.0 --> 8.0 index setting deprecation log messages and associated settings
|
||||||
|
|
|
@ -8,12 +8,20 @@
|
||||||
import { I18nProvider } from '@kbn/i18n/react';
|
import { I18nProvider } from '@kbn/i18n/react';
|
||||||
import { mount, shallow } from 'enzyme';
|
import { mount, shallow } from 'enzyme';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import SemVer from 'semver/classes/semver';
|
||||||
|
|
||||||
import { ReindexWarning } from '../../../../../../../common/types';
|
import { ReindexWarning } from '../../../../../../../common/types';
|
||||||
import { mockKibanaSemverVersion } from '../../../../../../../common/constants';
|
import { MAJOR_VERSION } from '../../../../../../../common/constants';
|
||||||
|
|
||||||
import { idForWarning, WarningsFlyoutStep } from './warnings_step';
|
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', () => {
|
jest.mock('../../../../../app_context', () => {
|
||||||
const { docLinksServiceMock } = jest.requireActual(
|
const { docLinksServiceMock } = jest.requireActual(
|
||||||
'../../../../../../../../../../src/core/public/doc_links/doc_links_service.mock'
|
'../../../../../../../../../../src/core/public/doc_links/doc_links_service.mock'
|
||||||
|
@ -23,11 +31,7 @@ jest.mock('../../../../../app_context', () => {
|
||||||
useAppContext: () => {
|
useAppContext: () => {
|
||||||
return {
|
return {
|
||||||
docLinks: docLinksServiceMock.createStartContract(),
|
docLinks: docLinksServiceMock.createStartContract(),
|
||||||
kibanaVersionInfo: {
|
kibanaVersionInfo: mockKibanaVersionInfo,
|
||||||
currentMajor: mockKibanaSemverVersion.major,
|
|
||||||
prevMajor: mockKibanaSemverVersion.major - 1,
|
|
||||||
nextMajor: mockKibanaSemverVersion.major + 1,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -45,7 +49,7 @@ describe('WarningsFlyoutStep', () => {
|
||||||
expect(shallow(<WarningsFlyoutStep {...defaultProps} />)).toMatchSnapshot();
|
expect(shallow(<WarningsFlyoutStep {...defaultProps} />)).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mockKibanaSemverVersion.major === 7) {
|
if (kibanaVersion.major === 7) {
|
||||||
it('does not allow proceeding until all are checked', () => {
|
it('does not allow proceeding until all are checked', () => {
|
||||||
const defaultPropsWithWarnings = {
|
const defaultPropsWithWarnings = {
|
||||||
...defaultProps,
|
...defaultProps,
|
||||||
|
|
|
@ -9,59 +9,69 @@ import SemVer from 'semver/classes/semver';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/public';
|
import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/public';
|
||||||
|
|
||||||
import { SetupDependencies, StartDependencies, AppServicesContext } from './types';
|
import {
|
||||||
import { Config } from '../common/config';
|
SetupDependencies,
|
||||||
|
StartDependencies,
|
||||||
|
AppServicesContext,
|
||||||
|
ClientConfigType,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
export class UpgradeAssistantUIPlugin
|
export class UpgradeAssistantUIPlugin
|
||||||
implements Plugin<void, void, SetupDependencies, StartDependencies>
|
implements Plugin<void, void, SetupDependencies, StartDependencies>
|
||||||
{
|
{
|
||||||
constructor(private ctx: PluginInitializerContext) {}
|
constructor(private ctx: PluginInitializerContext) {}
|
||||||
|
|
||||||
setup(coreSetup: CoreSetup<StartDependencies>, { management, cloud }: SetupDependencies) {
|
setup(coreSetup: CoreSetup<StartDependencies>, { management, cloud }: SetupDependencies) {
|
||||||
const { readonly } = this.ctx.config.get<Config>();
|
const {
|
||||||
|
readonly,
|
||||||
|
ui: { enabled: isUpgradeAssistantUiEnabled },
|
||||||
|
} = this.ctx.config.get<ClientConfigType>();
|
||||||
|
|
||||||
const appRegistrar = management.sections.section.stack;
|
if (isUpgradeAssistantUiEnabled) {
|
||||||
const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version);
|
const appRegistrar = management.sections.section.stack;
|
||||||
|
const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version);
|
||||||
|
|
||||||
const kibanaVersionInfo = {
|
const kibanaVersionInfo = {
|
||||||
currentMajor: kibanaVersion.major,
|
currentMajor: kibanaVersion.major,
|
||||||
prevMajor: kibanaVersion.major - 1,
|
prevMajor: kibanaVersion.major - 1,
|
||||||
nextMajor: kibanaVersion.major + 1,
|
nextMajor: kibanaVersion.major + 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
const pluginName = i18n.translate('xpack.upgradeAssistant.appTitle', {
|
const pluginName = i18n.translate('xpack.upgradeAssistant.appTitle', {
|
||||||
defaultMessage: '{version} Upgrade Assistant',
|
defaultMessage: '{version} Upgrade Assistant',
|
||||||
values: { version: `${kibanaVersionInfo.nextMajor}.0` },
|
values: { version: `${kibanaVersionInfo.nextMajor}.0` },
|
||||||
});
|
});
|
||||||
|
|
||||||
appRegistrar.registerApp({
|
appRegistrar.registerApp({
|
||||||
id: 'upgrade_assistant',
|
id: 'upgrade_assistant',
|
||||||
title: pluginName,
|
title: pluginName,
|
||||||
order: 1,
|
order: 1,
|
||||||
async mount(params) {
|
async mount(params) {
|
||||||
const [coreStart, { discover, data }] = await coreSetup.getStartServices();
|
const [coreStart, { discover, data }] = await coreSetup.getStartServices();
|
||||||
const services: AppServicesContext = { discover, data, cloud };
|
const services: AppServicesContext = { discover, data, cloud };
|
||||||
|
|
||||||
const {
|
const {
|
||||||
chrome: { docTitle },
|
chrome: { docTitle },
|
||||||
} = coreStart;
|
} = coreStart;
|
||||||
|
|
||||||
docTitle.change(pluginName);
|
docTitle.change(pluginName);
|
||||||
|
|
||||||
const { mountManagementSection } = await import('./application/mount_management_section');
|
const { mountManagementSection } = await import('./application/mount_management_section');
|
||||||
const unmountAppCallback = await mountManagementSection(
|
const unmountAppCallback = await mountManagementSection(
|
||||||
coreSetup,
|
coreSetup,
|
||||||
params,
|
params,
|
||||||
kibanaVersionInfo,
|
kibanaVersionInfo,
|
||||||
readonly,
|
readonly,
|
||||||
services
|
services
|
||||||
);
|
);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
docTitle.reset();
|
docTitle.reset();
|
||||||
unmountAppCallback();
|
unmountAppCallback();
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {}
|
start() {}
|
||||||
|
|
|
@ -26,3 +26,10 @@ export interface StartDependencies {
|
||||||
discover: DiscoverStart;
|
discover: DiscoverStart;
|
||||||
data: DataPublicPluginStart;
|
data: DataPublicPluginStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ClientConfigType {
|
||||||
|
readonly: boolean;
|
||||||
|
ui: {
|
||||||
|
enabled: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
107
x-pack/plugins/upgrade_assistant/server/config.ts
Normal file
107
x-pack/plugins/upgrade_assistant/server/config.ts
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
/*
|
||||||
|
* 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 }),
|
||||||
|
},
|
||||||
|
{ defaultValue: undefined }
|
||||||
|
);
|
||||||
|
|
||||||
|
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: true }),
|
||||||
|
},
|
||||||
|
{ defaultValue: undefined }
|
||||||
|
);
|
||||||
|
|
||||||
|
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.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server';
|
import { PluginInitializerContext } from 'src/core/server';
|
||||||
import { UpgradeAssistantServerPlugin } from './plugin';
|
import { UpgradeAssistantServerPlugin } from './plugin';
|
||||||
import { configSchema, Config } from '../common/config';
|
|
||||||
|
export { config } from './config';
|
||||||
|
|
||||||
export const plugin = (ctx: PluginInitializerContext) => {
|
export const plugin = (ctx: PluginInitializerContext) => {
|
||||||
return new UpgradeAssistantServerPlugin(ctx);
|
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; you may not use this file except in compliance with the Elastic License
|
||||||
* 2.0.
|
* 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 = () => {
|
export const getMockVersionInfo = () => {
|
||||||
const currentMajor = mockKibanaSemverVersion.major;
|
const currentMajor = kibanaVersion.major;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentVersion: mockKibanaSemverVersion,
|
currentVersion: kibanaVersion,
|
||||||
currentMajor,
|
currentMajor,
|
||||||
prevMajor: currentMajor - 1,
|
prevMajor: currentMajor - 1,
|
||||||
nextMajor: currentMajor + 1,
|
nextMajor: currentMajor + 1,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { SemVer } from 'semver';
|
||||||
import { IScopedClusterClient, kibanaResponseFactory } from 'src/core/server';
|
import { IScopedClusterClient, kibanaResponseFactory } from 'src/core/server';
|
||||||
import { coreMock } from 'src/core/server/mocks';
|
import { coreMock } from 'src/core/server/mocks';
|
||||||
import { licensingMock } from '../../../../plugins/licensing/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 { getMockVersionInfo } from './__fixtures__/version';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -98,7 +98,7 @@ describe('verifyAllMatchKibanaVersion', () => {
|
||||||
|
|
||||||
describe('EsVersionPrecheck', () => {
|
describe('EsVersionPrecheck', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
versionService.setup(mockKibanaVersion);
|
versionService.setup(MAJOR_VERSION);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns a 403 when callCluster fails with a 403', async () => {
|
it('returns a 403 when callCluster fails with a 403', async () => {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { mockKibanaSemverVersion, mockKibanaVersion } from '../../../common/constants';
|
import { MAJOR_VERSION } from '../../../common/constants';
|
||||||
import { versionService } from '../version';
|
import { versionService } from '../version';
|
||||||
import { getMockVersionInfo } from '../__fixtures__/version';
|
import { getMockVersionInfo } from '../__fixtures__/version';
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ describe('transformFlatSettings', () => {
|
||||||
|
|
||||||
describe('sourceNameForIndex', () => {
|
describe('sourceNameForIndex', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
versionService.setup(mockKibanaVersion);
|
versionService.setup(MAJOR_VERSION);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('parses internal indices', () => {
|
it('parses internal indices', () => {
|
||||||
|
@ -152,7 +152,7 @@ describe('transformFlatSettings', () => {
|
||||||
|
|
||||||
describe('generateNewIndexName', () => {
|
describe('generateNewIndexName', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
versionService.setup(mockKibanaVersion);
|
versionService.setup(MAJOR_VERSION);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('parses internal indices', () => {
|
it('parses internal indices', () => {
|
||||||
|
@ -186,7 +186,7 @@ describe('transformFlatSettings', () => {
|
||||||
).toEqual([]);
|
).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mockKibanaSemverVersion.major === 7) {
|
if (currentMajor === 7) {
|
||||||
describe('[7.x] customTypeName warning', () => {
|
describe('[7.x] customTypeName warning', () => {
|
||||||
it('returns customTypeName warning for non-_doc mapping types', () => {
|
it('returns customTypeName warning for non-_doc mapping types', () => {
|
||||||
expect(
|
expect(
|
||||||
|
|
|
@ -19,7 +19,7 @@ import {
|
||||||
ReindexStatus,
|
ReindexStatus,
|
||||||
ReindexStep,
|
ReindexStep,
|
||||||
} from '../../../common/types';
|
} from '../../../common/types';
|
||||||
import { mockKibanaVersion } from '../../../common/constants';
|
import { MAJOR_VERSION } from '../../../common/constants';
|
||||||
import { versionService } from '../version';
|
import { versionService } from '../version';
|
||||||
import { LOCK_WINDOW, ReindexActions, reindexActionsFactory } from './reindex_actions';
|
import { LOCK_WINDOW, ReindexActions, reindexActionsFactory } from './reindex_actions';
|
||||||
import { getMockVersionInfo } from '../__fixtures__/version';
|
import { getMockVersionInfo } from '../__fixtures__/version';
|
||||||
|
@ -54,7 +54,7 @@ describe('ReindexActions', () => {
|
||||||
|
|
||||||
describe('createReindexOp', () => {
|
describe('createReindexOp', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
versionService.setup(mockKibanaVersion);
|
versionService.setup(MAJOR_VERSION);
|
||||||
client.create.mockResolvedValue();
|
client.create.mockResolvedValue();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {
|
||||||
ReindexStatus,
|
ReindexStatus,
|
||||||
ReindexStep,
|
ReindexStep,
|
||||||
} from '../../../common/types';
|
} from '../../../common/types';
|
||||||
import { mockKibanaVersion } from '../../../common/constants';
|
import { MAJOR_VERSION } from '../../../common/constants';
|
||||||
import { licensingMock } from '../../../../licensing/server/mocks';
|
import { licensingMock } from '../../../../licensing/server/mocks';
|
||||||
import { LicensingPluginSetup } from '../../../../licensing/server';
|
import { LicensingPluginSetup } from '../../../../licensing/server';
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ describe('reindexService', () => {
|
||||||
licensingPluginSetup
|
licensingPluginSetup
|
||||||
);
|
);
|
||||||
|
|
||||||
versionService.setup(mockKibanaVersion);
|
versionService.setup(MAJOR_VERSION);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('hasRequiredPrivileges', () => {
|
describe('hasRequiredPrivileges', () => {
|
||||||
|
|
Loading…
Reference in a new issue