mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Changing how connection is stored in Migration Wizard and some misc code cleanup (#13951)
* Disabling pages that are not needed Some source connection code cleanup * Enabled some pages
This commit is contained in:
@@ -20,10 +20,18 @@ class SQLMigration {
|
|||||||
async registerCommands(): Promise<void> {
|
async registerCommands(): Promise<void> {
|
||||||
const commandDisposables: vscode.Disposable[] = [ // Array of disposables returned by registerCommand
|
const commandDisposables: vscode.Disposable[] = [ // Array of disposables returned by registerCommand
|
||||||
vscode.commands.registerCommand('sqlmigration.start', async () => {
|
vscode.commands.registerCommand('sqlmigration.start', async () => {
|
||||||
const connection = await azdata.connection.openConnectionDialog();
|
let activeConnection = await azdata.connection.getCurrentConnection();
|
||||||
|
let connectionId: string = '';
|
||||||
|
if (!activeConnection) {
|
||||||
|
const connection = await azdata.connection.openConnectionDialog();
|
||||||
|
if (connection) {
|
||||||
|
connectionId = connection.connectionId;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
connectionId = activeConnection.connectionId;
|
||||||
|
}
|
||||||
const wizardController = new WizardController(this.context);
|
const wizardController = new WizardController(this.context);
|
||||||
await wizardController.openWizard(connection);
|
await wizardController.openWizard(connectionId);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
vscode.commands.registerCommand('sqlmigration.testDialog', async () => {
|
vscode.commands.registerCommand('sqlmigration.testDialog', async () => {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export interface DatabaseBackupModel {
|
|||||||
azureSecurityToken: string;
|
azureSecurityToken: string;
|
||||||
}
|
}
|
||||||
export interface Model {
|
export interface Model {
|
||||||
readonly sourceConnection: azdata.connection.Connection;
|
readonly sourceConnectionId: string;
|
||||||
readonly currentState: State;
|
readonly currentState: State;
|
||||||
gatheringInformationError: string | undefined;
|
gatheringInformationError: string | undefined;
|
||||||
skuRecommendations: SKURecommendations | undefined;
|
skuRecommendations: SKURecommendations | undefined;
|
||||||
@@ -89,7 +89,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _extensionContext: vscode.ExtensionContext,
|
private readonly _extensionContext: vscode.ExtensionContext,
|
||||||
private readonly _sourceConnection: azdata.connection.Connection,
|
private readonly _sourceConnectionId: string,
|
||||||
public readonly migrationService: mssql.ISqlMigrationService
|
public readonly migrationService: mssql.ISqlMigrationService
|
||||||
) {
|
) {
|
||||||
this._currentState = State.INIT;
|
this._currentState = State.INIT;
|
||||||
@@ -112,8 +112,8 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
|||||||
this._databaseBackup = dbBackup;
|
this._databaseBackup = dbBackup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get sourceConnection(): azdata.connection.Connection {
|
public get sourceConnectionId(): string {
|
||||||
return this._sourceConnection;
|
return this._sourceConnectionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get currentState(): State {
|
public get currentState(): State {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export class SourceConfigurationPage extends MigrationWizardPage {
|
|||||||
|
|
||||||
await view.initializeModel(form);
|
await view.initializeModel(form);
|
||||||
|
|
||||||
let connectionUri: string = await azdata.connection.getUriForConnection(this.migrationStateModel.sourceConnection.connectionId);
|
let connectionUri: string = await azdata.connection.getUriForConnection(this.migrationStateModel.sourceConnectionId);
|
||||||
this.migrationStateModel.migrationService.getAssessments(connectionUri).then(results => {
|
this.migrationStateModel.migrationService.getAssessments(connectionUri).then(results => {
|
||||||
if (results) {
|
if (results) {
|
||||||
this.migrationStateModel.assessmentResults = results.items;
|
this.migrationStateModel.assessmentResults = results.items;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { SourceConfigurationPage } from './sourceConfigurationPage';
|
|||||||
import { WIZARD_TITLE } from '../models/strings';
|
import { WIZARD_TITLE } from '../models/strings';
|
||||||
import { MigrationWizardPage } from '../models/migrationWizardPage';
|
import { MigrationWizardPage } from '../models/migrationWizardPage';
|
||||||
import { SKURecommendationPage } from './skuRecommendationPage';
|
import { SKURecommendationPage } from './skuRecommendationPage';
|
||||||
import { SubscriptionSelectionPage } from './subscriptionSelectionPage';
|
// import { SubscriptionSelectionPage } from './subscriptionSelectionPage';
|
||||||
import { DatabaseBackupPage } from './databaseBackupPage';
|
import { DatabaseBackupPage } from './databaseBackupPage';
|
||||||
import { AccountsSelectionPage } from './accountsSelectionPage';
|
import { AccountsSelectionPage } from './accountsSelectionPage';
|
||||||
|
|
||||||
@@ -19,10 +19,10 @@ export class WizardController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async openWizard(profile: azdata.connection.Connection): Promise<void> {
|
public async openWizard(connectionId: string): Promise<void> {
|
||||||
const api = (await vscode.extensions.getExtension(mssql.extension.name)?.activate()) as mssql.IExtension;
|
const api = (await vscode.extensions.getExtension(mssql.extension.name)?.activate()) as mssql.IExtension;
|
||||||
if (api) {
|
if (api) {
|
||||||
const stateModel = new MigrationStateModel(this.extensionContext, profile, api.sqlMigration);
|
const stateModel = new MigrationStateModel(this.extensionContext, connectionId, api.sqlMigration);
|
||||||
this.extensionContext.subscriptions.push(stateModel);
|
this.extensionContext.subscriptions.push(stateModel);
|
||||||
this.createWizard(stateModel);
|
this.createWizard(stateModel);
|
||||||
}
|
}
|
||||||
@@ -32,13 +32,18 @@ export class WizardController {
|
|||||||
const wizard = azdata.window.createWizard(WIZARD_TITLE, 'wide');
|
const wizard = azdata.window.createWizard(WIZARD_TITLE, 'wide');
|
||||||
wizard.generateScriptButton.enabled = false;
|
wizard.generateScriptButton.enabled = false;
|
||||||
wizard.generateScriptButton.hidden = true;
|
wizard.generateScriptButton.hidden = true;
|
||||||
|
// Disabling unused pages
|
||||||
const sourceConfigurationPage = new SourceConfigurationPage(wizard, stateModel);
|
const sourceConfigurationPage = new SourceConfigurationPage(wizard, stateModel);
|
||||||
const skuRecommendationPage = new SKURecommendationPage(wizard, stateModel);
|
const skuRecommendationPage = new SKURecommendationPage(wizard, stateModel);
|
||||||
const subscriptionSelectionPage = new SubscriptionSelectionPage(wizard, stateModel);
|
// const subscriptionSelectionPage = new SubscriptionSelectionPage(wizard, stateModel);
|
||||||
const azureAccountsPage = new AccountsSelectionPage(wizard, stateModel);
|
const azureAccountsPage = new AccountsSelectionPage(wizard, stateModel);
|
||||||
const databaseBackupPage = new DatabaseBackupPage(wizard, stateModel);
|
const databaseBackupPage = new DatabaseBackupPage(wizard, stateModel);
|
||||||
const pages: MigrationWizardPage[] = [sourceConfigurationPage, skuRecommendationPage, subscriptionSelectionPage, azureAccountsPage, databaseBackupPage];
|
const pages: MigrationWizardPage[] = [
|
||||||
|
// subscriptionSelectionPage,
|
||||||
|
azureAccountsPage,
|
||||||
|
sourceConfigurationPage,
|
||||||
|
skuRecommendationPage,
|
||||||
|
databaseBackupPage];
|
||||||
|
|
||||||
wizard.pages = pages.map(p => p.getwizardPage());
|
wizard.pages = pages.map(p => p.getwizardPage());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user