Add new wizard for login migrations experience (#21317)

This commit is contained in:
AkshayMata
2022-12-17 12:11:25 -05:00
committed by GitHub
parent ff4dc9fe86
commit e223b4e870
22 changed files with 2569 additions and 50 deletions

View File

@@ -141,6 +141,7 @@ export class DashboardTab extends TabBase<DashboardTab> {
const toolbar = view.modelBuilder.toolbarContainer();
toolbar.addToolbarItems([
<azdata.ToolbarComponent>{ component: this.createNewMigrationButton() },
// <azdata.ToolbarComponent>{ component: this.createNewLoginMigrationButton() }, // TODO Enable when login migrations is ready for public consumption
<azdata.ToolbarComponent>{ component: this.createNewSupportRequestButton() },
<azdata.ToolbarComponent>{ component: this.createFeedbackButton() },
]);

View File

@@ -143,6 +143,7 @@ export class MigrationsListTab extends TabBase<MigrationsListTab> {
}).component();
toolbar.addToolbarItems([
// <azdata.ToolbarComponent>{ component: this.createNewLoginMigrationButton(), toolbarSeparatorAfter: true },
<azdata.ToolbarComponent>{ component: this.createNewMigrationButton(), toolbarSeparatorAfter: true },
<azdata.ToolbarComponent>{ component: this.createNewSupportRequestButton() },
<azdata.ToolbarComponent>{ component: this.createFeedbackButton(), toolbarSeparatorAfter: true },

View File

@@ -337,6 +337,11 @@ export class DashboardWidget {
MenuCommands.StartMigration,
async () => await this.launchMigrationWizard()));
this._context.subscriptions.push(
vscode.commands.registerCommand(
MenuCommands.StartLoginMigration,
async () => await this.launchLoginMigrationWizard()));
this._context.subscriptions.push(
vscode.commands.registerCommand(
MenuCommands.OpenNotebooks,
@@ -369,6 +374,11 @@ export class DashboardWidget {
MenuCommands.StartMigration,
async () => await this.launchMigrationWizard()));
this._context.subscriptions.push(azdata.tasks.registerTask(
MenuCommands.StartLoginMigration,
async () => await this.launchLoginMigrationWizard()));
this._context.subscriptions.push(
azdata.tasks.registerTask(
MenuCommands.NewSupportRequest,
@@ -456,6 +466,34 @@ export class DashboardWidget {
}
}
public async launchLoginMigrationWizard(): Promise<void> {
const activeConnection = await azdata.connection.getCurrentConnection();
let connectionId: string = '';
let serverName: string = '';
if (!activeConnection) {
const connection = await azdata.connection.openConnectionDialog();
if (connection) {
connectionId = connection.connectionId;
serverName = connection.options.server;
}
} else {
connectionId = activeConnection.connectionId;
serverName = activeConnection.serverName;
}
if (serverName) {
const api = (await vscode.extensions.getExtension(mssql.extension.name)?.activate()) as mssql.IExtension;
if (api) {
this.stateModel = new MigrationStateModel(this._context, connectionId, api.sqlMigration);
this._context.subscriptions.push(this.stateModel);
const wizardController = new WizardController(
this._context,
this.stateModel,
this._onServiceContextChanged);
await wizardController.openLoginWizard(connectionId);
}
}
}
private checkSavedInfo(serverName: string): SavedInfo | undefined {
return this._context.globalState.get<SavedInfo>(`${this.stateModel.mementoString}.${serverName}`);
}

View File

@@ -12,6 +12,7 @@ import { DatabaseMigration } from '../api/azure';
import { getSelectedServiceStatus } from '../models/migrationLocalStorage';
import { MenuCommands, SqlMigrationExtensionId } from '../api/utils';
import { DashboardStatusBar } from './DashboardStatusBar';
import { ShowStatusMessageDialog } from '../dialog/generic/genericDialogs';
export const EmptySettingValue = '-';
@@ -95,6 +96,29 @@ export abstract class TabBase<T> implements azdata.Tab, vscode.Disposable {
}
}
protected createNewLoginMigrationButton(): azdata.ButtonComponent {
const newLoginMigrationButton = this.view.modelBuilder.button()
.withProps({
buttonType: azdata.ButtonType.Normal,
label: loc.DESKTOP_LOGIN_MIGRATION_BUTTON_LABEL,
description: loc.DESKTOP_LOGIN_MIGRATION_BUTTON_DESCRIPTION,
height: 24,
iconHeight: 24,
iconWidth: 24,
iconPath: IconPathHelper.addNew,
}).component();
this.disposables.push(
newLoginMigrationButton.onDidClick(async () => {
const actionId = MenuCommands.StartLoginMigration;
const args = {
extensionId: SqlMigrationExtensionId,
issueTitle: loc.DASHBOARD_LOGIN_MIGRATE_TASK_BUTTON_TITLE,
};
return await vscode.commands.executeCommand(actionId, args);
}));
return newLoginMigrationButton;
}
protected createNewMigrationButton(): azdata.ButtonComponent {
const newMigrationButton = this.view.modelBuilder.button()
.withProps({
@@ -179,50 +203,6 @@ export abstract class TabBase<T> implements azdata.Tab, vscode.Disposable {
statusMessage: string,
errorMessage: string,
): void {
const tab = azdata.window.createTab(title);
tab.registerContent(async (view) => {
const flex = view.modelBuilder.flexContainer()
.withItems([
view.modelBuilder.text()
.withProps({ value: statusMessage })
.component(),
])
.withLayout({
flexFlow: 'column',
width: 420,
})
.withProps({ CSSStyles: { 'margin': '0 15px' } })
.component();
if (errorMessage.length > 0) {
flex.addItem(
view.modelBuilder.inputBox()
.withProps({
value: errorMessage,
readOnly: true,
multiline: true,
inputType: 'text',
height: 100,
CSSStyles: { 'overflow': 'hidden auto' },
})
.component()
);
}
await view.initializeModel(flex);
});
const dialog = azdata.window.createModelViewDialog(
title,
'messageDialog',
450,
'normal');
dialog.content = [tab];
dialog.okButton.hidden = true;
dialog.cancelButton.focused = true;
dialog.cancelButton.label = loc.CLOSE;
dialog.cancelButton.position = 'left';
azdata.window.openDialog(dialog);
ShowStatusMessageDialog(title, statusMessage, errorMessage);
}
}