SQL-Migration: enable cross subscription service migration (#22876)

* x subscription migration support

* refresh after cutover

* fix service irregular status load behavior

* queue service status requests, fix typo

* add migationTargetServerName helper method

* save context before api call
This commit is contained in:
brian-harris
2023-04-27 16:28:32 -07:00
committed by GitHub
parent 65f8915b7e
commit fe32180c71
15 changed files with 347 additions and 240 deletions

View File

@@ -776,12 +776,12 @@ export class DashboardTab extends TabBase<DashboardTab> {
this.serviceContextChangedEvent.event(
async (e) => {
if (e.connectionId === await getSourceConnectionId()) {
await this.updateServiceContext(this._serviceContextButton);
await this.updateServiceButtonContext(this._serviceContextButton);
await this.refresh();
}
}
));
await this.updateServiceContext(this._serviceContextButton);
await this.updateServiceButtonContext(this._serviceContextButton);
return this._serviceContextButton;
}

View File

@@ -147,7 +147,7 @@ export abstract class MigrationDetailsTabBase<T> extends TabBase<T> {
await this.refresh();
const dialog = new ConfirmCutoverDialog(this.model);
await dialog.initialize();
await this.refresh();
if (this.model.CutoverError) {
await this.statusBar.showError(
loc.MIGRATION_CUTOVER_ERROR,

View File

@@ -78,7 +78,7 @@ export class MigrationsListTab extends TabBase<MigrationsListTab> {
}
}
public async refresh(): Promise<void> {
public async refresh(initialize?: boolean): Promise<void> {
if (this.isRefreshing ||
this._refreshLoader === undefined) {
@@ -91,6 +91,10 @@ export class MigrationsListTab extends TabBase<MigrationsListTab> {
await this.statusBar.clearError();
if (initialize) {
await this.updateServiceButtonContext(this._serviceContextButton);
}
await this._statusTable.updateProperty('data', []);
this._migrations = await getCurrentMigrations();
await this._populateMigrationTable();
@@ -180,12 +184,11 @@ export class MigrationsListTab extends TabBase<MigrationsListTab> {
this.serviceContextChangedEvent.event(
async (e) => {
if (e.connectionId === await getSourceConnectionId()) {
await this.updateServiceContext(this._serviceContextButton);
await this.refresh();
await this.refresh(true);
}
}
));
await this.updateServiceContext(this._serviceContextButton);
await this.updateServiceButtonContext(this._serviceContextButton);
this._searchBox = this.view.modelBuilder.inputBox()
.withProps({

View File

@@ -57,7 +57,7 @@ export class MigrationsTab extends TabBase<MigrationsTab> {
switch (this._selectedTabId) {
case undefined:
case MigrationsListTabId:
return this._migrationsListTab.refresh();
return this._migrationsListTab.refresh(true);
default:
return this._migrationDetailsViewTab.refresh();
}
@@ -155,11 +155,10 @@ export class MigrationsTab extends TabBase<MigrationsTab> {
return undefined;
}
private async _openTab(tab: azdata.Tab): Promise<void> {
private async _openTab(tab: TabBase<any>): Promise<void> {
if (tab.id === this._selectedTabId) {
return;
}
await this.statusBar.clearError();
this._tab.clearItems();
this._tab.addItem(tab.content);

View File

@@ -82,16 +82,12 @@ export abstract class TabBase<T> implements azdata.Tab, vscode.Disposable {
return new Date(stringDate1) > new Date(stringDate2) ? -sortDir : sortDir;
}
protected async updateServiceContext(button: azdata.ButtonComponent): Promise<void> {
protected async updateServiceButtonContext(button: azdata.ButtonComponent): Promise<void> {
const label = await getSelectedServiceStatus();
if (button.label !== label ||
button.title !== label) {
button.label = label;
button.title = label;
await this.refresh();
}
await button.updateProperty('label', '');
await button.updateProperty('title', '');
await button.updateProperty('label', label);
await button.updateProperty('title', label);
}
protected createNewLoginMigrationButton(): azdata.ButtonComponent {