Retry sql migration (#17376)

This commit is contained in:
Rachel Kim
2021-10-21 10:06:10 -07:00
committed by GitHub
parent decad711c5
commit 4b26be5742
23 changed files with 663 additions and 337 deletions

View File

@@ -3,7 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { MigrationContext } from '../models/migrationLocalStorage';
import { MigrationContext, MigrationStatus } from '../models/migrationLocalStorage';
import { MigrationMode, MigrationTargetType } from '../models/stateMachine';
import * as loc from './strings';
export enum SQLTargetAssetType {
@@ -22,6 +23,28 @@ export function getMigrationTargetType(migration: MigrationContext): string {
}
}
export function getMigrationMode(migration: MigrationContext): string {
return migration.migrationContext.properties.offlineConfiguration?.offline?.valueOf() ? loc.OFFLINE : loc.OFFLINE;
export function getMigrationTargetTypeEnum(migration: MigrationContext): MigrationTargetType | undefined {
switch (migration.targetManagedInstance.type) {
case SQLTargetAssetType.SQLMI:
return MigrationTargetType.SQLMI;
case SQLTargetAssetType.SQLVM:
return MigrationTargetType.SQLVM;
default:
return undefined;
}
}
export function getMigrationMode(migration: MigrationContext): string {
return migration.migrationContext.properties.offlineConfiguration?.offline?.valueOf() ? loc.OFFLINE : loc.ONLINE;
}
export function getMigrationModeEnum(migration: MigrationContext): MigrationMode {
return migration.migrationContext.properties.offlineConfiguration?.offline?.valueOf() ? MigrationMode.OFFLINE : MigrationMode.ONLINE;
}
export function canRetryMigration(status: string | undefined): boolean {
return status === undefined ||
status === MigrationStatus.Failed ||
status === MigrationStatus.Succeeded ||
status === MigrationStatus.Canceled;
}

View File

@@ -39,6 +39,7 @@ export class IconPathHelper {
public static newSupportRequest: IconPath;
public static emptyTable: IconPath;
public static addAzureAccount: IconPath;
public static retry: IconPath;
public static setExtensionContext(context: vscode.ExtensionContext) {
IconPathHelper.copy = {
@@ -153,5 +154,9 @@ export class IconPathHelper {
light: context.asAbsolutePath('images/noAzureAccount.svg'),
dark: context.asAbsolutePath('images/noAzureAccount.svg')
};
IconPathHelper.retry = {
light: context.asAbsolutePath('images/retry.svg'),
dark: context.asAbsolutePath('images/retry.svg')
};
}
}

View File

@@ -537,7 +537,14 @@ export const AUTHENTICATION_TYPE = localize('sql.migration.authentication.type',
export const REFRESH_BUTTON_LABEL = localize('sql.migration.status.refresh.label', 'Refresh');
// Saved Assessment Dialog
export const NEXT_LABEL = localize('sql.migration.saved.assessment.next', "Next");
export const CANCEL_LABEL = localize('sql.migration.saved.assessment.cancel', "Cancel");
export const SAVED_ASSESSMENT_RESULT = localize('sql.migration.saved.assessment.result', "Saved assessment result");
// Retry Migration
export const MIGRATION_CANNOT_RETRY = localize('sql.migration.cannot.retry', 'Migration cannot be retried.');
export const RETRY_MIGRATION = localize('sql.migration.retry.migration', "Retry migration");
export const MIGRATION_RETRY_ERROR = localize('sql.migration.retry.migration.error', 'An error occurred while retrying the migration.');
export const INVALID_OWNER_URI = localize('sql.migration.invalid.owner.uri.error', 'Cannot connect to the database due to invalid OwnerUri (Parameter \'OwnerUri\')');
export const DATABASE_BACKUP_PAGE_LOAD_ERROR = localize('sql.migration.database.backup.load.error', 'An error occurred while accessing database details.');