From 3853bf4b144958f92c4e063519dfea0d2f1ce6a5 Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Sun, 13 Mar 2022 20:13:15 -0400 Subject: [PATCH] [Upgrade Assistant] Update status API response (#126482) (#126620) --- .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - .../server/routes/status.test.ts | 9 ++--- .../upgrade_assistant/server/routes/status.ts | 40 +++++++++++++++++-- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 75017c6607d87..12d45f8ee5918 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -28453,7 +28453,6 @@ "xpack.upgradeAssistant.overview.whatsNewLink": "8.xの新機能", "xpack.upgradeAssistant.reindex.reindexPrivilegesErrorBatch": "「{indexName}」に再インデックスするための権限が不十分です。", "xpack.upgradeAssistant.status.allDeprecationsResolvedMessage": "すべての廃止予定の警告が解決されました。", - "xpack.upgradeAssistant.status.deprecationsUnresolvedMessage": "アップグレード前に移行が必要な{notMigratedSystemIndices}システム{notMigratedSystemIndices, plural, other {インデックス}}と、解決が必要な{esTotalCriticalDeps} Elasticsearch廃止予定{esTotalCriticalDeps, plural, other {問題}}および{kibanaTotalCriticalDeps} Kibana廃止予定{kibanaTotalCriticalDeps, plural, other {問題}}があります。", "xpack.upgradeAssistant.upgradedDescription": "すべての Elasticsearch ノードがアップグレードされました。Kibana をアップデートする準備ができました。", "xpack.upgradeAssistant.upgradedTitle": "クラスターがアップグレードされました", "xpack.upgradeAssistant.upgradingDescription": "1 つまたは複数の Elasticsearch ノードに、 Kibana よりも新しいバージョンの Elasticsearch があります。すべてのノードがアップグレードされた後で Kibana をアップグレードしてください。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index d26b3d471e20b..42b11521a98db 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -28486,7 +28486,6 @@ "xpack.upgradeAssistant.overview.whatsNewLink": "8.x 版新增功能", "xpack.upgradeAssistant.reindex.reindexPrivilegesErrorBatch": "您没有足够的权限重新索引“{indexName}”。", "xpack.upgradeAssistant.status.allDeprecationsResolvedMessage": "所有弃用警告均已解决。", - "xpack.upgradeAssistant.status.deprecationsUnresolvedMessage": "您具有 {notMigratedSystemIndices} 个必须迁移的系统{notMigratedSystemIndices, plural, other {索引}}以及 {esTotalCriticalDeps} 个 Elasticsearch 弃用{esTotalCriticalDeps, plural, other {问题}}和 {kibanaTotalCriticalDeps} 个 Kibana 弃用{kibanaTotalCriticalDeps, plural, other {问题}},必须解决它们才能进行升级。", "xpack.upgradeAssistant.upgradedDescription": "所有 Elasticsearch 节点已升级。可以现在升级 Kibana。", "xpack.upgradeAssistant.upgradedTitle": "您的集群已升级", "xpack.upgradeAssistant.upgradingDescription": "一个或多个 Elasticsearch 节点的 Elasticsearch 版本比 Kibana 版本新。所有节点升级后,请升级 Kibana。", diff --git a/x-pack/plugins/upgrade_assistant/server/routes/status.test.ts b/x-pack/plugins/upgrade_assistant/server/routes/status.test.ts index c5f7aebc208c9..2d19674d63a75 100644 --- a/x-pack/plugins/upgrade_assistant/server/routes/status.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/routes/status.test.ts @@ -121,8 +121,7 @@ describe('Status API', () => { expect(resp.payload).toEqual({ readyForUpgrade: false, details: - 'You have 0 system indices that must be migrated and ' + - '1 Elasticsearch deprecation issue and 1 Kibana deprecation issue that must be resolved before upgrading.', + 'The following issues must be resolved before upgrading: 1 Elasticsearch deprecation issue, 1 Kibana deprecation issue.', }); }); @@ -144,8 +143,7 @@ describe('Status API', () => { expect(resp.payload).toEqual({ readyForUpgrade: false, details: - 'You have 1 system index that must be migrated and ' + - '1 Elasticsearch deprecation issue and 1 Kibana deprecation issue that must be resolved before upgrading.', + 'The following issues must be resolved before upgrading: 1 unmigrated system index, 1 Elasticsearch deprecation issue, 1 Kibana deprecation issue.', }); }); @@ -167,8 +165,7 @@ describe('Status API', () => { expect(resp.payload).toEqual({ readyForUpgrade: false, details: - 'You have 1 system index that must be migrated and ' + - '0 Elasticsearch deprecation issues and 0 Kibana deprecation issues that must be resolved before upgrading.', + 'The following issues must be resolved before upgrading: 1 unmigrated system index.', }); }); diff --git a/x-pack/plugins/upgrade_assistant/server/routes/status.ts b/x-pack/plugins/upgrade_assistant/server/routes/status.ts index cfa5d6d14c85c..9e8d3f9b2734b 100644 --- a/x-pack/plugins/upgrade_assistant/server/routes/status.ts +++ b/x-pack/plugins/upgrade_assistant/server/routes/status.ts @@ -63,12 +63,44 @@ export function registerUpgradeStatusRoute({ router, lib: { handleEsError } }: R ); } + const upgradeIssues: string[] = []; + + if (notMigratedSystemIndices) { + upgradeIssues.push( + i18n.translate('xpack.upgradeAssistant.status.systemIndicesMessage', { + defaultMessage: + '{notMigratedSystemIndices} unmigrated system {notMigratedSystemIndices, plural, one {index} other {indices}}', + values: { notMigratedSystemIndices }, + }) + ); + } + + if (esTotalCriticalDeps) { + upgradeIssues.push( + i18n.translate('xpack.upgradeAssistant.status.esTotalCriticalDepsMessage', { + defaultMessage: + '{esTotalCriticalDeps} Elasticsearch deprecation {esTotalCriticalDeps, plural, one {issue} other {issues}}', + values: { esTotalCriticalDeps }, + }) + ); + } + + if (kibanaTotalCriticalDeps) { + upgradeIssues.push( + i18n.translate('xpack.upgradeAssistant.status.kibanaTotalCriticalDepsMessage', { + defaultMessage: + '{kibanaTotalCriticalDeps} Kibana deprecation {kibanaTotalCriticalDeps, plural, one {issue} other {issues}}', + values: { kibanaTotalCriticalDeps }, + }) + ); + } + return i18n.translate('xpack.upgradeAssistant.status.deprecationsUnresolvedMessage', { defaultMessage: - 'You have {notMigratedSystemIndices} system {notMigratedSystemIndices, plural, one {index} other {indices}} that must be migrated ' + - 'and {esTotalCriticalDeps} Elasticsearch deprecation {esTotalCriticalDeps, plural, one {issue} other {issues}} ' + - 'and {kibanaTotalCriticalDeps} Kibana deprecation {kibanaTotalCriticalDeps, plural, one {issue} other {issues}} that must be resolved before upgrading.', - values: { esTotalCriticalDeps, kibanaTotalCriticalDeps, notMigratedSystemIndices }, + 'The following issues must be resolved before upgrading: {upgradeIssues}.', + values: { + upgradeIssues: upgradeIssues.join(', '), + }, }); };