mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 17:23:02 -05:00
Save And Close Functionality (#17000)
* save and close * wip * working save and close * cleanup * pr changes * pr changes * fix capitalization * fix build * pr fix
This commit is contained in:
@@ -21,14 +21,13 @@ export const WIZARD_INPUT_COMPONENT_WIDTH = '600px';
|
||||
export class WizardController {
|
||||
private _wizardObject!: azdata.window.Wizard;
|
||||
private _model!: MigrationStateModel;
|
||||
constructor(private readonly extensionContext: vscode.ExtensionContext) {
|
||||
|
||||
constructor(private readonly extensionContext: vscode.ExtensionContext, model: MigrationStateModel) {
|
||||
this._model = model;
|
||||
}
|
||||
|
||||
public async openWizard(connectionId: string): Promise<void> {
|
||||
const api = (await vscode.extensions.getExtension(mssql.extension.name)?.activate()) as mssql.IExtension;
|
||||
if (api) {
|
||||
this._model = new MigrationStateModel(this.extensionContext, connectionId, api.sqlMigration);
|
||||
this.extensionContext.subscriptions.push(this._model);
|
||||
await this.createWizard(this._model);
|
||||
}
|
||||
@@ -39,6 +38,8 @@ export class WizardController {
|
||||
this._wizardObject = azdata.window.createWizard(loc.WIZARD_TITLE(serverName), 'MigrationWizard', 'wide');
|
||||
this._wizardObject.generateScriptButton.enabled = false;
|
||||
this._wizardObject.generateScriptButton.hidden = true;
|
||||
const saveAndCloseButton = azdata.window.createButton(loc.SAVE_AND_CLOSE);
|
||||
this._wizardObject.customButtons = [saveAndCloseButton];
|
||||
const skuRecommendationPage = new SKURecommendationPage(this._wizardObject, stateModel);
|
||||
const migrationModePage = new MigrationModePage(this._wizardObject, stateModel);
|
||||
const databaseSelectorPage = new DatabaseSelectorPage(this._wizardObject, stateModel);
|
||||
@@ -62,8 +63,11 @@ export class WizardController {
|
||||
const wizardSetupPromises: Thenable<void>[] = [];
|
||||
wizardSetupPromises.push(...pages.map(p => p.registerWizardContent()));
|
||||
wizardSetupPromises.push(this._wizardObject.open());
|
||||
if (this._model.resumeAssessment) {
|
||||
wizardSetupPromises.push(this._wizardObject.setCurrentPage(this._model.savedInfo.closedPage));
|
||||
}
|
||||
|
||||
this.extensionContext.subscriptions.push(this._wizardObject.onPageChanged(async (pageChangeInfo: azdata.window.WizardPageChangeInfo) => {
|
||||
this._model.extensionContext.subscriptions.push(this._wizardObject.onPageChanged(async (pageChangeInfo: azdata.window.WizardPageChangeInfo) => {
|
||||
const newPage = pageChangeInfo.newPage;
|
||||
const lastPage = pageChangeInfo.lastPage;
|
||||
this.sendPageButtonClickEvent(pageChangeInfo).catch(e => console.log(e));
|
||||
@@ -82,13 +86,17 @@ export class WizardController {
|
||||
});
|
||||
|
||||
await Promise.all(wizardSetupPromises);
|
||||
this.extensionContext.subscriptions.push(this._wizardObject.onPageChanged(async (pageChangeInfo: azdata.window.WizardPageChangeInfo) => {
|
||||
this._model.extensionContext.subscriptions.push(this._wizardObject.onPageChanged(async (pageChangeInfo: azdata.window.WizardPageChangeInfo) => {
|
||||
await pages[0].onPageEnter(pageChangeInfo);
|
||||
}));
|
||||
|
||||
this.extensionContext.subscriptions.push(this._wizardObject.doneButton.onClick(async (e) => {
|
||||
this._model.extensionContext.subscriptions.push(this._wizardObject.doneButton.onClick(async (e) => {
|
||||
await stateModel.startMigration();
|
||||
}));
|
||||
saveAndCloseButton.onClick(async () => {
|
||||
await stateModel.saveInfo(serverName, this._wizardObject.currentPage);
|
||||
await this._wizardObject.close();
|
||||
});
|
||||
|
||||
this._wizardObject.cancelButton.onClick(e => {
|
||||
sendSqlMigrationActionEvent(
|
||||
|
||||
Reference in New Issue
Block a user