mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Stack management apps] Deprecate "enabled" Kibana setting (#114768)
This commit is contained in:
parent
5974fcfdb5
commit
f6a9afea61
57 changed files with 1284 additions and 423 deletions
|
@ -20,6 +20,8 @@ export const PLUGIN = {
|
|||
},
|
||||
};
|
||||
|
||||
export const MAJOR_VERSION = '8.0.0';
|
||||
|
||||
export const API_BASE_PATH = '/api/remote_clusters';
|
||||
|
||||
export const SNIFF_MODE = 'sniff';
|
||||
|
|
|
@ -4,23 +4,90 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SemVer } from 'semver';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { get } from 'lodash';
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import { PluginConfigDescriptor } from 'kibana/server';
|
||||
import { PluginConfigDescriptor } from 'src/core/server';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
});
|
||||
import { MAJOR_VERSION } from '../common/constants';
|
||||
|
||||
export type ConfigType = TypeOf<typeof configSchema>;
|
||||
const kibanaVersion = new SemVer(MAJOR_VERSION);
|
||||
|
||||
export const config: PluginConfigDescriptor<ConfigType> = {
|
||||
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
|
||||
schema: configSchema,
|
||||
// -------------------------------
|
||||
// >= 8.x
|
||||
// -------------------------------
|
||||
const schemaLatest = schema.object(
|
||||
{
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
const configLatest: PluginConfigDescriptor<RemoteClustersConfig> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schemaLatest,
|
||||
deprecations: () => [],
|
||||
};
|
||||
|
||||
export type RemoteClustersConfig = TypeOf<typeof schemaLatest>;
|
||||
|
||||
// -------------------------------
|
||||
// 7.x
|
||||
// -------------------------------
|
||||
const schema7x = schema.object(
|
||||
{
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
ui: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
},
|
||||
{ defaultValue: undefined }
|
||||
);
|
||||
|
||||
export type RemoteClustersConfig7x = TypeOf<typeof schema7x>;
|
||||
|
||||
const config7x: PluginConfigDescriptor<RemoteClustersConfig7x> = {
|
||||
exposeToBrowser: {
|
||||
ui: true,
|
||||
},
|
||||
schema: schema7x,
|
||||
deprecations: () => [
|
||||
(completeConfig, rootPath, addDeprecation) => {
|
||||
if (get(completeConfig, 'xpack.remote_clusters.enabled') === undefined) {
|
||||
return completeConfig;
|
||||
}
|
||||
|
||||
addDeprecation({
|
||||
configPath: 'xpack.remote_clusters.enabled',
|
||||
level: 'critical',
|
||||
title: i18n.translate('xpack.remoteClusters.deprecations.enabledTitle', {
|
||||
defaultMessage: 'Setting "xpack.remote_clusters.enabled" is deprecated',
|
||||
}),
|
||||
message: i18n.translate('xpack.remoteClusters.deprecations.enabledMessage', {
|
||||
defaultMessage:
|
||||
'To disallow users from accessing the Remote Clusters UI, use the "xpack.remote_clusters.ui.enabled" setting instead of "xpack.remote_clusters.enabled".',
|
||||
}),
|
||||
correctiveActions: {
|
||||
manualSteps: [
|
||||
i18n.translate('xpack.remoteClusters.deprecations.enabled.manualStepOneMessage', {
|
||||
defaultMessage: 'Open the kibana.yml config file.',
|
||||
}),
|
||||
i18n.translate('xpack.remoteClusters.deprecations.enabled.manualStepTwoMessage', {
|
||||
defaultMessage:
|
||||
'Change the "xpack.remote_clusters.enabled" setting to "xpack.remote_clusters.ui.enabled".',
|
||||
}),
|
||||
],
|
||||
},
|
||||
});
|
||||
return completeConfig;
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const config: PluginConfigDescriptor<RemoteClustersConfig | RemoteClustersConfig7x> =
|
||||
kibanaVersion.major < 8 ? config7x : configLatest;
|
||||
|
|
|
@ -11,7 +11,7 @@ import { CoreSetup, Logger, Plugin, PluginInitializerContext } from 'src/core/se
|
|||
|
||||
import { PLUGIN } from '../common/constants';
|
||||
import { Dependencies, LicenseStatus, RouteDependencies } from './types';
|
||||
import { ConfigType } from './config';
|
||||
import { RemoteClustersConfig, RemoteClustersConfig7x } from './config';
|
||||
import {
|
||||
registerGetRoute,
|
||||
registerAddRoute,
|
||||
|
@ -30,7 +30,7 @@ export class RemoteClustersServerPlugin
|
|||
{
|
||||
licenseStatus: LicenseStatus;
|
||||
log: Logger;
|
||||
config: ConfigType;
|
||||
config: RemoteClustersConfig | RemoteClustersConfig7x;
|
||||
|
||||
constructor({ logger, config }: PluginInitializerContext) {
|
||||
this.log = logger.get();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue