mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 17:22:29 -05:00
* Removing canary host * Rebranding extension name to Azure SQL Migration * stopping instance table overflow in assessment dialog * Added info message for details copied * Limiting storage account and DMS to the same subscription as target * making accounts page look like figma mockups * converting error messages to warnings in cutover dialog * making source config page look like figma mockups * adding more filters for storage account and dms * Adding validations for target database names. * Fixing branding in other strings * Adding types for SQL Managed Instance
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { getMigrationStatus, DatabaseMigration, startMigrationCutover, stopMigration } from '../../api/azure';
|
|
import { MigrationContext } from '../../models/migrationLocalStorage';
|
|
|
|
export enum MigrationStatus {
|
|
Failed = 'Failed',
|
|
Succeeded = 'Succeeded',
|
|
InProgress = 'InProgress',
|
|
Canceled = 'Canceled'
|
|
}
|
|
|
|
export class MigrationCutoverDialogModel {
|
|
|
|
public migrationStatus!: DatabaseMigration;
|
|
|
|
constructor(public _migration: MigrationContext) {
|
|
}
|
|
|
|
public async fetchStatus(): Promise<void> {
|
|
this.migrationStatus = (await getMigrationStatus(
|
|
this._migration.azureAccount,
|
|
this._migration.subscription,
|
|
this._migration.migrationContext
|
|
));
|
|
// Logging status to help debugging.
|
|
console.log(this.migrationStatus);
|
|
}
|
|
|
|
public async startCutover(): Promise<DatabaseMigration | undefined> {
|
|
try {
|
|
if (this.migrationStatus) {
|
|
return await startMigrationCutover(
|
|
this._migration.azureAccount,
|
|
this._migration.subscription,
|
|
this.migrationStatus
|
|
);
|
|
}
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
return undefined!;
|
|
}
|
|
|
|
public async cancelMigration(): Promise<void> {
|
|
try {
|
|
if (this.migrationStatus) {
|
|
await stopMigration(
|
|
this._migration.azureAccount,
|
|
this._migration.subscription,
|
|
this.migrationStatus
|
|
);
|
|
}
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
return undefined!;
|
|
}
|
|
}
|