Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Improve deprecation message for xpack.spaces.enabled #112242

Merged
merged 14 commits into from
Oct 6, 2021
8 changes: 4 additions & 4 deletions x-pack/plugins/spaces/server/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ describe('spaces config', () => {
const { messages, migrated } = applyConfigDeprecations({ ...originalConfig });

expect(messages).toMatchInlineSnapshot(`
Array [
"Disabling the Spaces plugin (xpack.spaces.enabled) will not be supported in the next major version (8.0)",
]
`);
Array [
"Disabling the Spaces plugin (xpack.spaces.enabled) will not be supported in the next major version (8.0).",
watson marked this conversation as resolved.
Show resolved Hide resolved
]
`);
expect(migrated).toEqual(originalConfig);
});

Expand Down
17 changes: 14 additions & 3 deletions x-pack/plugins/spaces/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { Observable } from 'rxjs';

import type { TypeOf } from '@kbn/config-schema';
import { schema } from '@kbn/config-schema';
import { i18n } from '@kbn/i18n';
import type {
ConfigDeprecation,
ConfigDeprecationProvider,
Expand All @@ -25,11 +26,21 @@ export function createConfig$(context: PluginInitializerContext) {
}

const disabledDeprecation: ConfigDeprecation = (config, fromPath, addDeprecation) => {
if (config.xpack?.spaces?.enabled === false) {
if ('enabled' in (settings?.xpack?.spaces || {}) {
addDeprecation({
message: `Disabling the Spaces plugin (xpack.spaces.enabled) will not be supported in the next major version (8.0)`,
title: i18n.translate('xpack.spaces.deprecations.enabledTitle', {
defaultMessage: 'Setting "xpack.spaces.enabled" is deprecated',
}),
message: i18n.translate('xpack.spaces.deprecations.enabledMessage', {
defaultMessage:
'Disabling the Spaces plugin (xpack.spaces.enabled) will not be supported in the next major version (8.0).',
watson marked this conversation as resolved.
Show resolved Hide resolved
}),
correctiveActions: {
manualSteps: [`Remove "xpack.spaces.enabled: false" from your Kibana configuration`],
manualSteps: [
i18n.translate('xpack.spaces.deprecations.enabled.manualStepOneMessage', {
defaultMessage: `Remove "xpack.spaces.enabled" from kibana.yml.`,
watson marked this conversation as resolved.
Show resolved Hide resolved
}),
],
},
});
}
Expand Down