diff --git a/extensions/sql-migration/src/api/azure.ts b/extensions/sql-migration/src/api/azure.ts index 30ce4ab993..2b4f1b9d37 100644 --- a/extensions/sql-migration/src/api/azure.ts +++ b/extensions/sql-migration/src/api/azure.ts @@ -480,7 +480,7 @@ export interface MigrationStatusDetails { isFullBackupRestored: boolean; restoreBlockingReason: string; fileUploadBlockingErrors: string[]; - currentRestoringFileName: string; + currentRestoringFilename: string; lastRestoredFilename: string; pendingLogBackupsCount: number; invalidFiles: string[]; diff --git a/extensions/sql-migration/src/constants/strings.ts b/extensions/sql-migration/src/constants/strings.ts index 47f48d64e6..b3b6acaba1 100644 --- a/extensions/sql-migration/src/constants/strings.ts +++ b/extensions/sql-migration/src/constants/strings.ts @@ -346,6 +346,8 @@ export const FULL_BACKUP_FILES = localize('sql.migration.full.backup.files', "Fu export const LAST_APPLIED_LSN = localize('sql.migration.last.applied.lsn', "Last applied LSN"); export const LAST_APPLIED_BACKUP_FILES = localize('sql.migration.last.applied.backup.files', "Last applied backup files"); export const LAST_APPLIED_BACKUP_FILES_TAKEN_ON = localize('sql.migration.last.applied.files.taken.on', "Last applied backup files taken on"); +export const CURRENTLY_RESTORING_FILE = localize('sql.migration.currently.restoring.file', "Currently restoring file"); +export const ALL_BACKUPS_RESTORED = localize('sql.migration.all.backups.restored', "All backups restored"); export const ACTIVE_BACKUP_FILES = localize('sql.migration.active.backup.files', "Active backup files"); export const MIGRATION_STATUS_REFRESH_ERROR = localize('sql.migration.cutover.status.refresh.error', 'An error occurred while refreshing the migration status.'); export const MIGRATION_CANCELLATION_ERROR = localize('sql.migration.cancel.error', 'An error occurred while canceling the migration.'); diff --git a/extensions/sql-migration/src/dialog/migrationCutover/migrationCutoverDialog.ts b/extensions/sql-migration/src/dialog/migrationCutover/migrationCutoverDialog.ts index e063040668..4ca18d6191 100644 --- a/extensions/sql-migration/src/dialog/migrationCutover/migrationCutoverDialog.ts +++ b/extensions/sql-migration/src/dialog/migrationCutover/migrationCutoverDialog.ts @@ -47,6 +47,7 @@ export class MigrationCutoverDialog { private _lastLSNInfoField!: InfoFieldSchema; private _lastAppliedBackupInfoField!: InfoFieldSchema; private _lastAppliedBackupTakenOnInfoField!: InfoFieldSchema; + private _currentRestoringFileInfoField!: InfoFieldSchema; private _fileCount!: azdata.TextComponent; private _fileTable!: azdata.DeclarativeTableComponent; @@ -534,9 +535,11 @@ export class MigrationCutoverDialog { this._lastLSNInfoField = await this.createInfoField(loc.LAST_APPLIED_LSN, '', isBlobMigration); this._lastAppliedBackupInfoField = await this.createInfoField(loc.LAST_APPLIED_BACKUP_FILES, ''); this._lastAppliedBackupTakenOnInfoField = await this.createInfoField(loc.LAST_APPLIED_BACKUP_FILES_TAKEN_ON, '', isBlobMigration); + this._currentRestoringFileInfoField = await this.createInfoField(loc.CURRENTLY_RESTORING_FILE, '', !isBlobMigration); addInfoFieldToContainer(this._lastLSNInfoField, flexFile); addInfoFieldToContainer(this._lastAppliedBackupInfoField, flexFile); addInfoFieldToContainer(this._lastAppliedBackupTakenOnInfoField, flexFile); + addInfoFieldToContainer(this._currentRestoringFileInfoField, flexFile); const flexInfoProps = { flex: '0', @@ -696,6 +699,16 @@ export class MigrationCutoverDialog { this._lastAppliedBackupInfoField.text.value = this._model.migrationStatus.properties.migrationStatusDetails?.lastRestoredFilename ?? '-'; this._lastAppliedBackupTakenOnInfoField.text.value = lastAppliedBackupFileTakenOn! ? convertIsoTimeToLocalTime(lastAppliedBackupFileTakenOn).toLocaleString() : '-'; + if (isBlobMigration) { + if (!this._model.migrationStatus.properties.migrationStatusDetails?.currentRestoringFilename) { + this._currentRestoringFileInfoField.text.value = '-'; + } else if (this._model.migrationStatus.properties.migrationStatusDetails?.lastRestoredFilename === this._model.migrationStatus.properties.migrationStatusDetails?.currentRestoringFilename) { + this._currentRestoringFileInfoField.text.value = loc.ALL_BACKUPS_RESTORED; + } else { + this._currentRestoringFileInfoField.text.value = this._model.migrationStatus.properties.migrationStatusDetails?.currentRestoringFilename; + } + } + if (this._shouldDisplayBackupFileTable()) { await this._fileCount.updateCssStyles({ ...styles.SECTION_HEADER_CSS, @@ -738,11 +751,16 @@ export class MigrationCutoverDialog { this._cutoverButton.enabled = false; if (migrationStatusTextValue === MigrationStatus.InProgress) { - const restoredCount = this._model.migrationStatus.properties.migrationStatusDetails?.activeBackupSets?.filter( - (a) => a.listOfBackupFiles[0].status === BackupFileInfoStatus.Restored)?.length ?? 0; - - if (restoredCount > 0 || isBlobMigration) { - this._cutoverButton.enabled = true; + if (isBlobMigration) { + if (this._model.migrationStatus.properties.migrationStatusDetails?.lastRestoredFilename) { + this._cutoverButton.enabled = true; + } + } else { + const restoredCount = this._model.migrationStatus.properties.migrationStatusDetails?.activeBackupSets?.filter( + (a) => a.listOfBackupFiles[0].status === BackupFileInfoStatus.Restored)?.length ?? 0; + if (restoredCount > 0) { + this._cutoverButton.enabled = true; + } } } @@ -766,9 +784,13 @@ export class MigrationCutoverDialog { text: azdata.TextComponent, icon?: azdata.ImageComponent }> { - const flexContainer = this._view.modelBuilder.flexContainer().withLayout({ - flexFlow: 'column' - }).component(); + const flexContainer = this._view.modelBuilder.flexContainer() + .withProps({ + CSSStyles: { + 'flex-direction': 'column', + 'padding-right': '12px' + } + }).component(); if (defaultHidden) { await flexContainer.updateCssStyles({