Skip to content

Commit

Permalink
fix backport
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Feb 25, 2021
1 parent 81512ed commit 6429e28
Show file tree
Hide file tree
Showing 26 changed files with 117 additions and 577 deletions.
6 changes: 0 additions & 6 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -21502,10 +21502,6 @@
"xpack.upgradeAssistant.checkupTab.deprecations.indexTable.indexColumnLabel": "インデックス",
"xpack.upgradeAssistant.checkupTab.deprecations.warningActionTooltip": "アップグレード前にこの問題を解決することをお勧めしますが、必須ではありません。",
"xpack.upgradeAssistant.checkupTab.deprecations.warningLabel": "警告",
"xpack.upgradeAssistant.checkupTab.fixMetricbeatIndexButton.failedLabel": "失敗",
"xpack.upgradeAssistant.checkupTab.fixMetricbeatIndexButton.fixedLabel": "修正済み",
"xpack.upgradeAssistant.checkupTab.fixMetricbeatIndexButton.fixingLabel": "修正中…",
"xpack.upgradeAssistant.checkupTab.fixMetricbeatIndexButton.reindexLabel": "修正",
"xpack.upgradeAssistant.checkupTab.indexLabel": "インデックス",
"xpack.upgradeAssistant.checkupTab.indicesBadgeLabel": "{numIndices, plural, other {インデックス}}",
"xpack.upgradeAssistant.checkupTab.indicesTabLabel": "インデックス",
Expand All @@ -21515,8 +21511,6 @@
"xpack.upgradeAssistant.checkupTab.noIssues.noIssuesLabel": "{strongCheckupLabel} の問題がありません。",
"xpack.upgradeAssistant.checkupTab.noIssues.noIssuesTitle": "完璧です!",
"xpack.upgradeAssistant.checkupTab.numDeprecationsShownLabel": "{total} 件中 {numShown} 件を表示中",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.apmIndexPatternCallout.apmSetupLinkLabel": "APMのセットアップ手順",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.apmIndexPatternCallout.calloutTitle": "APMインデックスの再インデックス後、{apmSetupLink}に戻ってKibanaオブジェクトを再度読み込んでください。これは1度だけ必要な作業です。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.cancelButtonLabel": "キャンセル",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.closeButtonLabel": "閉じる",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.continueButtonLabel": "再インデックスを続ける",
Expand Down
6 changes: 0 additions & 6 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -21552,10 +21552,6 @@
"xpack.upgradeAssistant.checkupTab.deprecations.indexTable.indexColumnLabel": "索引",
"xpack.upgradeAssistant.checkupTab.deprecations.warningActionTooltip": "建议在升级之前先解决此问题,但这不是必需的。",
"xpack.upgradeAssistant.checkupTab.deprecations.warningLabel": "警告",
"xpack.upgradeAssistant.checkupTab.fixMetricbeatIndexButton.failedLabel": "失败",
"xpack.upgradeAssistant.checkupTab.fixMetricbeatIndexButton.fixedLabel": "已修复",
"xpack.upgradeAssistant.checkupTab.fixMetricbeatIndexButton.fixingLabel": "正在修复……",
"xpack.upgradeAssistant.checkupTab.fixMetricbeatIndexButton.reindexLabel": "修复",
"xpack.upgradeAssistant.checkupTab.indexLabel": "索引",
"xpack.upgradeAssistant.checkupTab.indicesBadgeLabel": "{numIndices, plural, other { 个索引}}",
"xpack.upgradeAssistant.checkupTab.indicesTabLabel": "索引",
Expand All @@ -21565,8 +21561,6 @@
"xpack.upgradeAssistant.checkupTab.noIssues.noIssuesLabel": "您没有 {strongCheckupLabel} 问题。",
"xpack.upgradeAssistant.checkupTab.noIssues.noIssuesTitle": "全部清除!",
"xpack.upgradeAssistant.checkupTab.numDeprecationsShownLabel": "显示 {numShown} 个,共 {total} 个",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.apmIndexPatternCallout.apmSetupLinkLabel": "APM 设置说明",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.apmIndexPatternCallout.calloutTitle": "重新索引 APM 索引后,返回 {apmSetupLink} 以重新加载 Kibana 对象。您只需执行一次此操作。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.cancelButtonLabel": "取消",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.closeButtonLabel": "关闭",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.continueButtonLabel": "继续重新索引",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ import {
EuiFlexItem,
EuiFlyoutBody,
EuiFlyoutFooter,
EuiLink,
EuiSpacer,
EuiTitle,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { ReindexStatus, ReindexWarning } from '../../../../../../../../common/types';
import { ReindexStatus } from '../../../../../../../../common/types';
import { LoadingState } from '../../../../../types';
import { ReindexState } from '../polling_service';
import { ReindexProgress } from './progress';
Expand Down Expand Up @@ -78,7 +77,7 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{
cancelReindex: () => void;
http: HttpSetup;
}> = ({ closeFlyout, reindexState, startReindex, cancelReindex, http, renderGlobalCallouts }) => {
const { loadingState, status, hasRequiredPrivileges, reindexWarnings } = reindexState;
const { loadingState, status, hasRequiredPrivileges } = reindexState;
const loading = loadingState === LoadingState.Loading || status === ReindexStatus.inProgress;

return (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ describe('getUpgradeAssistantStatus', () => {
esClient.asCurrentUser.indices.resolveIndex.mockResolvedValue(asApiResponse(resolvedIndices));

it('calls /_migration/deprecations', async () => {
await getUpgradeAssistantStatus(esClient, false, []);
await getUpgradeAssistantStatus(esClient, false);
expect(esClient.asCurrentUser.migration.deprecations).toHaveBeenCalled();
});

it('returns the correct shape of data', async () => {
const resp = await getUpgradeAssistantStatus(esClient, false, []);
const resp = await getUpgradeAssistantStatus(esClient, false);
expect(resp).toMatchSnapshot();
});

Expand All @@ -56,7 +56,7 @@ describe('getUpgradeAssistantStatus', () => {
})
);

await expect(getUpgradeAssistantStatus(esClient, false, [])).resolves.toHaveProperty(
await expect(getUpgradeAssistantStatus(esClient, false)).resolves.toHaveProperty(
'readyForUpgrade',
false
);
Expand All @@ -72,7 +72,7 @@ describe('getUpgradeAssistantStatus', () => {
})
);

await expect(getUpgradeAssistantStatus(esClient, false, [])).resolves.toHaveProperty(
await expect(getUpgradeAssistantStatus(esClient, false)).resolves.toHaveProperty(
'readyForUpgrade',
true
);
Expand All @@ -94,7 +94,7 @@ describe('getUpgradeAssistantStatus', () => {
})
);

const result = await getUpgradeAssistantStatus(esClient, true, []);
const result = await getUpgradeAssistantStatus(esClient, true);

expect(result).toHaveProperty('readyForUpgrade', true);
expect(result).toHaveProperty('cluster', []);
Expand Down
49 changes: 17 additions & 32 deletions x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ import {
UpgradeAssistantStatus,
} from '../../common/types';

import { isSystemIndex } from './reindexing';

import { esIndicesStateCheck } from './es_indices_state_check';

export async function getUpgradeAssistantStatus(
dataClient: IScopedClusterClient,
isCloudEnabled: boolean,
isCloudEnabled: boolean
): Promise<UpgradeAssistantStatus> {
const [{ body: deprecations }] = await Promise.all([
dataClient.asCurrentUser.migration.deprecations<DeprecationAPIResponse>(),
]);
const {
body: deprecations,
} = await dataClient.asCurrentUser.migration.deprecations<DeprecationAPIResponse>();

const cluster = getClusterDeprecations(deprecations, isCloudEnabled);
const indices = getCombinedIndexInfos(deprecations);
Expand Down Expand Up @@ -50,32 +48,19 @@ export async function getUpgradeAssistantStatus(
}

// Reformats the index deprecations to an array of deprecation warnings extended with an index field.
const getCombinedIndexInfos = (
deprecations: DeprecationAPIResponse,
) => {

return (
Object.keys(deprecations.index_settings)
.reduce((indexDeprecations, indexName) => {
return indexDeprecations.concat(
deprecations.index_settings[indexName].map(
(d) =>
({
...d,
index: indexName,
reindex: /Index created before/.test(d.message),
needsDefaultFields: /Number of fields exceeds automatic field expansion limit/.test(
d.message
),
} as EnrichedDeprecationInfo)
)
);
}, [] as EnrichedDeprecationInfo[])
// Filter out warnings for system indices until we know more about what changes are required for the
// next upgrade in a future minor version.
.filter((deprecation) => !isSystemIndex(deprecation.index!))
);
};
const getCombinedIndexInfos = (deprecations: DeprecationAPIResponse) =>
Object.keys(deprecations.index_settings).reduce((indexDeprecations, indexName) => {
return indexDeprecations.concat(
deprecations.index_settings[indexName].map(
(d) =>
({
...d,
index: indexName,
reindex: /Index created before/.test(d.message),
} as EnrichedDeprecationInfo)
)
);
}, [] as EnrichedDeprecationInfo[]);

const getClusterDeprecations = (deprecations: DeprecationAPIResponse, isCloudEnabled: boolean) => {
const combined = deprecations.cluster_settings
Expand Down
Loading

0 comments on commit 6429e28

Please sign in to comment.