From 8f3c3028dd6227ec3890ea153180db601ffbb6b8 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 19 Oct 2021 17:59:07 +0100 Subject: [PATCH] [Upgrade Assistant] Rename upgrade_status to migration_status (#114755) --- .../migrate_system_indices.test.tsx | 10 +++++----- .../overview/migrate_system_indices/mocks.ts | 10 +++++----- .../migrate_system_indices/step_completion.test.ts | 8 ++++---- x-pack/plugins/upgrade_assistant/common/types.ts | 6 +++--- .../overview/migrate_system_indices/flyout.tsx | 10 +++++----- .../migrate_system_indices/migrate_system_indices.tsx | 8 ++++---- .../use_migrate_system_indices.ts | 2 +- .../server/lib/es_deprecations_status.test.ts | 4 ++-- .../server/lib/es_system_indices_migration.test.ts | 6 +++--- .../server/routes/system_indices_migration.test.ts | 4 ++-- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/migrate_system_indices.test.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/migrate_system_indices.test.tsx index c5f680319d0ab..f6c69c818b378 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/migrate_system_indices.test.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/migrate_system_indices.test.tsx @@ -45,7 +45,7 @@ describe('Overview - Migrate system indices', () => { component.update(); httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({ - upgrade_status: 'NO_UPGRADE_NEEDED', + migration_status: 'NO_MIGRATION_NEEDED', }); await actions.clickRetrySystemIndicesButton(); @@ -56,7 +56,7 @@ describe('Overview - Migrate system indices', () => { test('No migration needed', async () => { httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({ - upgrade_status: 'NO_UPGRADE_NEEDED', + migration_status: 'NO_MIGRATION_NEEDED', }); testBed = await setupOverviewPage(); @@ -72,7 +72,7 @@ describe('Overview - Migrate system indices', () => { test('Migration in progress', async () => { httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({ - upgrade_status: 'IN_PROGRESS', + migration_status: 'IN_PROGRESS', }); testBed = await setupOverviewPage(); @@ -91,7 +91,7 @@ describe('Overview - Migrate system indices', () => { describe('Migration needed', () => { test('Initial state', async () => { httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({ - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', }); testBed = await setupOverviewPage(); @@ -109,7 +109,7 @@ describe('Overview - Migrate system indices', () => { test('Handles errors when migrating', async () => { httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({ - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', }); httpRequestsMockHelpers.setSystemIndicesMigrationResponse(undefined, { statusCode: 400, diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/mocks.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/mocks.ts index 298f537819507..a810799c434e0 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/mocks.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/mocks.ts @@ -8,12 +8,12 @@ import { SystemIndicesMigrationStatus } from '../../../../common/types'; export const systemIndicesMigrationStatus: SystemIndicesMigrationStatus = { - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', features: [ { feature_name: 'security', minimum_index_version: '7.1.1', - upgrade_status: 'ERROR', + migration_status: 'ERROR', indices: [ { index: '.security-7', @@ -24,7 +24,7 @@ export const systemIndicesMigrationStatus: SystemIndicesMigrationStatus = { { feature_name: 'machine_learning', minimum_index_version: '7.1.2', - upgrade_status: 'IN_PROGRESS', + migration_status: 'IN_PROGRESS', indices: [ { index: '.ml-config', @@ -35,7 +35,7 @@ export const systemIndicesMigrationStatus: SystemIndicesMigrationStatus = { { feature_name: 'kibana', minimum_index_version: '7.1.3', - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', indices: [ { index: '.kibana', @@ -46,7 +46,7 @@ export const systemIndicesMigrationStatus: SystemIndicesMigrationStatus = { { feature_name: 'logstash', minimum_index_version: '7.1.4', - upgrade_status: 'NO_UPGRADE_NEEDED', + migration_status: 'NO_MIGRATION_NEEDED', indices: [ { index: '.logstash-config', diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/step_completion.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/step_completion.test.ts index c5173481d8dac..9eb0831c3c7a0 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/step_completion.test.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/migrate_system_indices/step_completion.test.ts @@ -21,7 +21,7 @@ describe('Overview - Migrate system indices - Step completion', () => { test(`It's complete when no upgrade is needed`, async () => { httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({ - upgrade_status: 'NO_UPGRADE_NEEDED', + migration_status: 'NO_MIGRATION_NEEDED', }); await act(async () => { @@ -37,7 +37,7 @@ describe('Overview - Migrate system indices - Step completion', () => { test(`It's incomplete when migration is needed`, async () => { httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({ - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', }); await act(async () => { @@ -57,7 +57,7 @@ describe('Overview - Migrate system indices - Step completion', () => { // First request should make the step be incomplete httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({ - upgrade_status: 'IN_PROGRESS', + migration_status: 'IN_PROGRESS', }); testBed = await setupOverviewPage(); @@ -73,7 +73,7 @@ describe('Overview - Migrate system indices - Step completion', () => { expect(exists('migrateSystemIndicesStep-incomplete')).toBe(true); httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({ - upgrade_status: 'NO_UPGRADE_NEEDED', + migration_status: 'NO_MIGRATION_NEEDED', }); // Resolve the polling timeout. diff --git a/x-pack/plugins/upgrade_assistant/common/types.ts b/x-pack/plugins/upgrade_assistant/common/types.ts index ac4cd62aa2bea..0de19630bcebd 100644 --- a/x-pack/plugins/upgrade_assistant/common/types.ts +++ b/x-pack/plugins/upgrade_assistant/common/types.ts @@ -230,12 +230,12 @@ export interface DeprecationLoggingStatus { isDeprecationLoggingEnabled: boolean; } -export type UPGRADE_STATUS = 'UPGRADE_NEEDED' | 'NO_UPGRADE_NEEDED' | 'IN_PROGRESS' | 'ERROR'; +export type MIGRATION_STATUS = 'MIGRATION_NEEDED' | 'NO_MIGRATION_NEEDED' | 'IN_PROGRESS' | 'ERROR'; export interface SystemIndicesMigrationFeature { id?: string; feature_name: string; minimum_index_version: string; - upgrade_status: UPGRADE_STATUS; + migration_status: MIGRATION_STATUS; indices: Array<{ index: string; version: string; @@ -243,7 +243,7 @@ export interface SystemIndicesMigrationFeature { } export interface SystemIndicesMigrationStatus { features: SystemIndicesMigrationFeature[]; - upgrade_status: UPGRADE_STATUS; + migration_status: MIGRATION_STATUS; } export interface SystemIndicesMigrationStarted { features: SystemIndicesMigrationFeature[]; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/flyout.tsx index 612fcdc2e4c03..0eac26fae2be3 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/flyout.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/flyout.tsx @@ -27,7 +27,7 @@ import { import { SystemIndicesMigrationStatus, SystemIndicesMigrationFeature, - UPGRADE_STATUS, + MIGRATION_STATUS, } from '../../../../../common/types'; export interface SystemIndicesFlyoutProps { @@ -84,8 +84,8 @@ const i18nTexts = { ), }; -const renderMigrationStatus = (status: UPGRADE_STATUS) => { - if (status === 'NO_UPGRADE_NEEDED') { +const renderMigrationStatus = (status: MIGRATION_STATUS) => { + if (status === 'NO_MIGRATION_NEEDED') { return ( @@ -100,7 +100,7 @@ const renderMigrationStatus = (status: UPGRADE_STATUS) => { ); } - if (status === 'UPGRADE_NEEDED') { + if (status === 'MIGRATION_NEEDED') { return (

{i18nTexts.needsMigrationLabel}

@@ -150,7 +150,7 @@ const columns = [ render: (name: string) => startCase(name), }, { - field: 'upgrade_status', + field: 'migration_status', name: i18nTexts.statusTableColumn, sortable: true, render: renderMigrationStatus, diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/migrate_system_indices.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/migrate_system_indices.tsx index 75806f43bb19e..7d0405dbbb874 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/migrate_system_indices.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/migrate_system_indices.tsx @@ -83,10 +83,10 @@ const MigrateSystemIndicesStep: FunctionComponent = ({ setIsComplete }) = useMigrateSystemIndices(); useEffect(() => { - setIsComplete(migrationStatus.data?.upgrade_status === 'NO_UPGRADE_NEEDED'); + setIsComplete(migrationStatus.data?.migration_status === 'NO_MIGRATION_NEEDED'); // Depending upon setIsComplete would create an infinite loop. // eslint-disable-next-line react-hooks/exhaustive-deps - }, [migrationStatus.data?.upgrade_status]); + }, [migrationStatus.data?.migration_status]); if (migrationStatus.error) { return ( @@ -111,7 +111,7 @@ const MigrateSystemIndicesStep: FunctionComponent = ({ setIsComplete }) = ); } - if (migrationStatus.data?.upgrade_status === 'NO_UPGRADE_NEEDED') { + if (migrationStatus.data?.migration_status === 'NO_MIGRATION_NEEDED') { return ( @@ -127,7 +127,7 @@ const MigrateSystemIndicesStep: FunctionComponent = ({ setIsComplete }) = } const isButtonDisabled = migrationStatus.isInitialRequest && migrationStatus.isLoading; - const isMigrating = migrationStatus.data?.upgrade_status === 'IN_PROGRESS'; + const isMigrating = migrationStatus.data?.migration_status === 'IN_PROGRESS'; return ( <> diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/use_migrate_system_indices.ts b/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/use_migrate_system_indices.ts index 0d4ea9bfaf35c..d66b4009cd02f 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/use_migrate_system_indices.ts +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/migrate_system_indices/use_migrate_system_indices.ts @@ -37,7 +37,7 @@ export const useMigrateSystemIndices = () => { const { data, error, isLoading, resendRequest, isInitialRequest } = api.useLoadSystemIndicesMigrationStatus(); - const isInProgress = data?.upgrade_status === 'IN_PROGRESS'; + const isInProgress = data?.migration_status === 'IN_PROGRESS'; // We only want to poll for the status while the migration process is in progress. useInterval(resendRequest, isInProgress ? SYSTEM_INDICES_MIGRATION_POLL_INTERVAL_MS : null); diff --git a/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.test.ts index d27a02ae97fdd..06c0352ebcdca 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.test.ts @@ -46,7 +46,7 @@ describe('getESUpgradeStatus', () => { { feature_name: 'machine_learning', minimum_index_version: '7.1.1', - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', indices: [ { index: '.ml-config', @@ -55,7 +55,7 @@ describe('getESUpgradeStatus', () => { ], }, ], - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', }) ); diff --git a/x-pack/plugins/upgrade_assistant/server/lib/es_system_indices_migration.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/es_system_indices_migration.test.ts index 6f4ca5a341218..560d42712b5da 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/es_system_indices_migration.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/es_system_indices_migration.test.ts @@ -13,7 +13,7 @@ const esUpgradeSystemIndicesStatusMock: SystemIndicesMigrationStatus = { { feature_name: 'machine_learning', minimum_index_version: '7.1.1', - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', indices: [ { index: '.ml-config', @@ -28,7 +28,7 @@ const esUpgradeSystemIndicesStatusMock: SystemIndicesMigrationStatus = { { feature_name: 'security', minimum_index_version: '7.1.1', - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', indices: [ { index: '.ml-config', @@ -37,7 +37,7 @@ const esUpgradeSystemIndicesStatusMock: SystemIndicesMigrationStatus = { ], }, ], - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', }; describe('convertFeaturesToIndicesArray', () => { diff --git a/x-pack/plugins/upgrade_assistant/server/routes/system_indices_migration.test.ts b/x-pack/plugins/upgrade_assistant/server/routes/system_indices_migration.test.ts index 2d15bed7e29e3..8e928fb3bc7c9 100644 --- a/x-pack/plugins/upgrade_assistant/server/routes/system_indices_migration.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/routes/system_indices_migration.test.ts @@ -21,7 +21,7 @@ const mockedResponse = { { feature_name: 'security', minimum_index_version: '7.1.1', - upgrade_status: 'NO_UPGRADE_NEEDED', + migration_status: 'NO_MIGRATION_NEEDED', indices: [ { index: '.security-7', @@ -30,7 +30,7 @@ const mockedResponse = { ], }, ], - upgrade_status: 'UPGRADE_NEEDED', + migration_status: 'MIGRATION_NEEDED', }; /**