Dev/brih/hotfix status page (#16407)

* add dispose pattern, fix migration status enum

* format strings

* add dispose handler to more events
This commit is contained in:
brian-harris
2021-07-22 22:20:10 -07:00
committed by GitHub
parent 107023c7d0
commit df5ed2c889
22 changed files with 351 additions and 249 deletions

View File

@@ -30,6 +30,7 @@ export class SqlMigrationServiceDetailsDialog {
private _dialog: azdata.window.Dialog;
private _migrationServiceAuthKeyTable!: azdata.DeclarativeTableComponent;
private _disposables: vscode.Disposable[] = [];
constructor(private migrationContext: MigrationContext) {
this._dialog = azdata.window.createModelViewDialog(
@@ -41,9 +42,16 @@ export class SqlMigrationServiceDetailsDialog {
async initialize(): Promise<void> {
this._dialog.registerContent(
async (view: azdata.ModelView) => await this.createServiceContent(
view,
this.migrationContext));
async (view: azdata.ModelView) => {
this._disposables.push(view.onClosed(e => {
this._disposables.forEach(
d => { try { d.dispose(); } catch { } });
}));
await this.createServiceContent(
view,
this.migrationContext);
});
this._dialog.okButton.label = constants.SQL_MIGRATION_SERVICE_DETAILS_BUTTON_LABEL;
this._dialog.okButton.focused = true;
@@ -238,10 +246,10 @@ export class SqlMigrationServiceDetailsDialog {
})
.component();
copyKey1Button.onDidClick((e) => {
this._disposables.push(copyKey1Button.onDidClick((e) => {
vscode.env.clipboard.writeText(keys.authKey1);
vscode.window.showInformationMessage(constants.SERVICE_KEY1_COPIED_HELP);
});
}));
const copyKey2Button = view.modelBuilder
.button()
@@ -254,10 +262,10 @@ export class SqlMigrationServiceDetailsDialog {
})
.component();
copyKey2Button.onDidClick((e) => {
this._disposables.push(copyKey2Button.onDidClick((e) => {
vscode.env.clipboard.writeText(keys.authKey2);
vscode.window.showInformationMessage(constants.SERVICE_KEY2_COPIED_HELP);
});
}));
const refreshKey1Button = view.modelBuilder
.button()
@@ -269,8 +277,8 @@ export class SqlMigrationServiceDetailsDialog {
ariaLabel: constants.REFRESH_KEY1,
})
.component();
refreshKey1Button.onDidClick(
async (e) => await this._regenerateAuthKey(view, migrationContext, AUTH_KEY1));
this._disposables.push(refreshKey1Button.onDidClick(
async (e) => await this._regenerateAuthKey(view, migrationContext, AUTH_KEY1)));
const refreshKey2Button = view.modelBuilder
.button()
@@ -282,8 +290,8 @@ export class SqlMigrationServiceDetailsDialog {
ariaLabel: constants.REFRESH_KEY2,
})
.component();
refreshKey2Button.onDidClick(
async (e) => await this._regenerateAuthKey(view, migrationContext, AUTH_KEY2));
this._disposables.push(refreshKey2Button.onDidClick(
async (e) => await this._regenerateAuthKey(view, migrationContext, AUTH_KEY2)));
this._migrationServiceAuthKeyTable.updateProperties({
dataValues: [