[Reporting] Add deprecation titles (#113387)

* added i18n and titles to config deprecations

* Updated jest test

* Add newline at end of file

* remove unneeded space
This commit is contained in:
Jean-Louis Leysens 2021-09-30 10:44:20 +02:00 committed by GitHub
parent a33ae63025
commit 9a530b2496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 12 deletions

View file

@ -37,7 +37,7 @@ describe('deprecations', () => {
const { messages } = applyReportingDeprecations({ index, roles: { enabled: false } });
expect(messages).toMatchInlineSnapshot(`
Array [
"\\"xpack.reporting.index\\" is deprecated. Multitenancy by changing \\"kibana.index\\" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details",
"Multitenancy by changing \\"kibana.index\\" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details",
]
`);
});
@ -47,7 +47,7 @@ describe('deprecations', () => {
const { messages } = applyReportingDeprecations({ roles: { enabled: true } });
expect(messages).toMatchInlineSnapshot(`
Array [
"\\"xpack.reporting.roles\\" is deprecated. Granting reporting privilege through a \\"reporting_user\\" role will not be supported starting in 8.0. Please set \\"xpack.reporting.roles.enabled\\" to \\"false\\" and grant reporting privileges to users using Kibana application privileges **Management > Security > Roles**.",
"Granting reporting privilege through a \\"reporting_user\\" role will not be supported starting in 8.0. Please set \\"xpack.reporting.roles.enabled\\" to \\"false\\" and grant reporting privileges to users using Kibana application privileges **Management > Security > Roles**.",
]
`);
});

View file

@ -5,6 +5,7 @@
* 2.0.
*/
import { i18n } from '@kbn/i18n';
import { PluginConfigDescriptor } from 'kibana/server';
import { get } from 'lodash';
import { ConfigSchema, ReportingConfigType } from './schema';
@ -27,11 +28,21 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
const reporting = get(settings, fromPath);
if (reporting?.index) {
addDeprecation({
message: `"${fromPath}.index" is deprecated. Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details`,
title: i18n.translate('xpack.reporting.deprecations.reportingIndex.title', {
defaultMessage: 'Setting "{fromPath}.index" is deprecated',
values: { fromPath },
}),
message: i18n.translate('xpack.reporting.deprecations.reportingIndex.description', {
defaultMessage: `Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details`,
}),
correctiveActions: {
manualSteps: [
`If you rely on this setting to achieve multitenancy you should use Spaces, cross-cluster replication, or cross-cluster search instead.`,
`To migrate to Spaces, we encourage using saved object management to export your saved objects from a tenant into the default tenant in a space.`,
i18n.translate('xpack.reporting.deprecations.reportingIndex.manualStepOne', {
defaultMessage: `If you rely on this setting to achieve multitenancy you should use Spaces, cross-cluster replication, or cross-cluster search instead.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingIndex.manualStepTwo', {
defaultMessage: `To migrate to Spaces, we encourage using saved object management to export your saved objects from a tenant into the default tenant in a space.`,
}),
],
},
});
@ -39,15 +50,26 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
if (reporting?.roles?.enabled !== false) {
addDeprecation({
message:
`"${fromPath}.roles" is deprecated. Granting reporting privilege through a "reporting_user" role will not be supported ` +
`starting in 8.0. Please set "xpack.reporting.roles.enabled" to "false" and grant reporting privileges to users ` +
`using Kibana application privileges **Management > Security > Roles**.`,
title: i18n.translate('xpack.reporting.deprecations.reportingRoles.title', {
defaultMessage: 'Setting "{fromPath}.roles" is deprecated',
values: { fromPath },
}),
message: i18n.translate('xpack.reporting.deprecations.reportingRoles.description', {
defaultMessage:
`Granting reporting privilege through a "reporting_user" role will not be supported` +
` starting in 8.0. Please set "xpack.reporting.roles.enabled" to "false" and grant reporting privileges to users` +
` using Kibana application privileges **Management > Security > Roles**.`,
}),
correctiveActions: {
manualSteps: [
`Set 'xpack.reporting.roles.enabled' to 'false' in your kibana configs.`,
`Grant reporting privileges to users using Kibana application privileges` +
`under **Management > Security > Roles**.`,
i18n.translate('xpack.reporting.deprecations.reportingRoles.manualStepOne', {
defaultMessage: `Set 'xpack.reporting.roles.enabled' to 'false' in your kibana configs.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoles.manualStepTwo', {
defaultMessage:
`Grant reporting privileges to users using Kibana application privileges` +
` under **Management > Security > Roles**.`,
}),
],
},
});