From 064ada1d2fbc23d324d9a24d8c83d1302ccf0f5f Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Mon, 29 Jun 2020 12:44:04 -0700 Subject: [PATCH] Change Azure region dropdown to use azurecore API (#11131) * Change Azure region dropdown to use azurecore API for getting display name * Fix compile errors * Adding a few things to the vscodeignore * and another --- extensions/arc/.vscodeignore | 3 + extensions/arc/package.json | 14 ++-- .../pages/azureSettingsPage.ts | 6 +- .../pages/clusterSettingsPage.ts | 10 +-- .../pages/deploymentProfilePage.ts | 2 +- .../pages/serviceSettingsPage.ts | 10 +-- .../deployClusterWizard/pages/summaryPage.ts | 14 ++-- .../pages/targetClusterPage.ts | 2 +- .../src/ui/modelViewUtils.ts | 70 +++++++------------ .../notebookWizardAutoSummaryPage.ts | 9 +-- .../ui/notebookWizard/notebookWizardPage.ts | 2 +- .../resource-deployment/src/ui/wizardBase.ts | 16 ++--- .../src/ui/wizardPageBase.ts | 2 +- 13 files changed, 70 insertions(+), 90 deletions(-) diff --git a/extensions/arc/.vscodeignore b/extensions/arc/.vscodeignore index 602ebf11c0..770c782593 100644 --- a/extensions/arc/.vscodeignore +++ b/extensions/arc/.vscodeignore @@ -4,3 +4,6 @@ out/** extension.webpack.config.js tsconfig.json yarn.lock +coverConfig.json +*.vsix +coverage diff --git a/extensions/arc/package.json b/extensions/arc/package.json index 18cde7c9c1..799dcec018 100644 --- a/extensions/arc/package.json +++ b/extensions/arc/package.json @@ -286,17 +286,17 @@ { "type": "azure_locations", "label": "%arc.control.plane.arc.data.controller.location%", - "defaultValue": "East US", + "defaultValue": "eastus", "required": true, "locationVariableName": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_LOCATION", "displayLocationVariableName": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_DISPLAY_LOCATION", "locations": [ - "East US", - "East US 2", - "Central US", - "West Europe", - "Southeast Asia", - "West US 2" + "eastus", + "eastus2", + "centralus", + "westus2", + "southeastasia", + "westeurope" ] }, { diff --git a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/azureSettingsPage.ts b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/azureSettingsPage.ts index 7f23be50c1..1f21572259 100644 --- a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/azureSettingsPage.ts +++ b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/azureSettingsPage.ts @@ -125,8 +125,8 @@ export class AzureSettingsPage extends WizardPageBase { }] }] }; - this.pageObject.registerContent((view: azdata.ModelView) => { - const azureGroup = createSection({ + this.pageObject.registerContent(async (view: azdata.ModelView) => { + const azureGroup = await createSection({ sectionInfo: azureSection, view: view, onNewDisposableCreated: (disposable: vscode.Disposable): void => { @@ -157,7 +157,7 @@ export class AzureSettingsPage extends WizardPageBase { }); } - public onEnter(): void { + public async onEnter(): Promise { this.wizard.wizardObject.registerNavigationValidator((pcInfo) => { this.wizard.wizardObject.message = { text: '' }; if (pcInfo.newPage > pcInfo.lastPage) { diff --git a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/clusterSettingsPage.ts b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/clusterSettingsPage.ts index ba9a15ef73..d4e77f7689 100644 --- a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/clusterSettingsPage.ts +++ b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/clusterSettingsPage.ts @@ -201,8 +201,8 @@ export class ClusterSettingsPage extends WizardPageBase { } ] }; - this.pageObject.registerContent((view: azdata.ModelView) => { - const basicSettingsGroup = createSection({ + this.pageObject.registerContent(async (view: azdata.ModelView) => { + const basicSettingsGroup = await createSection({ view: view, container: self.wizard.wizardObject, inputComponents: this.wizard.inputComponents, @@ -217,7 +217,7 @@ export class ClusterSettingsPage extends WizardPageBase { self.validators.push(validator); } }); - const activeDirectorySettingsGroup = createSection({ + const activeDirectorySettingsGroup = await createSection({ view: view, container: self.wizard.wizardObject, inputComponents: this.wizard.inputComponents, @@ -232,7 +232,7 @@ export class ClusterSettingsPage extends WizardPageBase { self.validators.push(validator); } }); - const dockerSettingsGroup = createSection({ + const dockerSettingsGroup = await createSection({ view: view, container: self.wizard.wizardObject, inputComponents: this.wizard.inputComponents, @@ -301,7 +301,7 @@ export class ClusterSettingsPage extends WizardPageBase { }); } - public onEnter() { + public async onEnter(): Promise { getInputBoxComponent(VariableNames.DockerRegistry_VariableName, this.inputComponents).value = this.wizard.model.getStringValue(VariableNames.DockerRegistry_VariableName); getInputBoxComponent(VariableNames.DockerRepository_VariableName, this.inputComponents).value = this.wizard.model.getStringValue(VariableNames.DockerRepository_VariableName); getInputBoxComponent(VariableNames.DockerImageTag_VariableName, this.inputComponents).value = this.wizard.model.getStringValue(VariableNames.DockerImageTag_VariableName); diff --git a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/deploymentProfilePage.ts b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/deploymentProfilePage.ts index 4206869c2c..088d2a47e3 100644 --- a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/deploymentProfilePage.ts +++ b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/deploymentProfilePage.ts @@ -216,7 +216,7 @@ export class DeploymentProfilePage extends WizardPageBase { .component(); } - public onEnter() { + public async onEnter(): Promise { this.wizard.wizardObject.registerNavigationValidator((pcInfo) => { this.wizard.wizardObject.message = { text: '' }; if (pcInfo.newPage > pcInfo.lastPage) { diff --git a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/serviceSettingsPage.ts b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/serviceSettingsPage.ts index 8fca7865d5..e0854441a0 100644 --- a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/serviceSettingsPage.ts +++ b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/serviceSettingsPage.ts @@ -114,9 +114,9 @@ export class ServiceSettingsPage extends WizardPageBase { ] }; - this.pageObject.registerContent((view: azdata.ModelView) => { - const createSectionFunc = (sectionInfo: SectionInfo): azdata.GroupContainer => { - return createSection({ + this.pageObject.registerContent(async (view: azdata.ModelView) => { + const createSectionFunc = async (sectionInfo: SectionInfo): Promise => { + return await createSection({ view: view, container: this.wizard.wizardObject, inputComponents: this.inputComponents, @@ -131,7 +131,7 @@ export class ServiceSettingsPage extends WizardPageBase { } }); }; - const scaleSection = createSectionFunc(scaleSectionInfo); + const scaleSection = await createSectionFunc(scaleSectionInfo); this.endpointSection = this.createEndpointSection(view); const storageSection = this.createStorageSection(view); @@ -322,7 +322,7 @@ export class ServiceSettingsPage extends WizardPageBase { }; } - public onEnter(): void { + public async onEnter(): Promise { this.setInputBoxValue(VariableNames.ComputePoolScale_VariableName); this.setInputBoxValue(VariableNames.DataPoolScale_VariableName); this.setInputBoxValue(VariableNames.HDFSPoolScale_VariableName); diff --git a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/summaryPage.ts b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/summaryPage.ts index 768184baad..34e98801f8 100644 --- a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/summaryPage.ts +++ b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/summaryPage.ts @@ -29,7 +29,7 @@ export class SummaryPage extends WizardPageBase { }); } - public onEnter() { + public async onEnter(): Promise { this.wizard.showCustomButtons(); this.formItems.forEach(item => { this.form!.removeFormItem(item); @@ -279,10 +279,10 @@ export class SummaryPage extends WizardPageBase { ] }; - const createSectionFunc = (sectionInfo: SectionInfo): azdata.FormComponent => { + const createSectionFunc = async (sectionInfo: SectionInfo): Promise => { return { title: '', - component: createSection({ + component: await createSection({ container: this.wizard.wizardObject, inputComponents: this.wizard.inputComponents, sectionInfo: sectionInfo, @@ -295,12 +295,12 @@ export class SummaryPage extends WizardPageBase { }; if (this.wizard.deploymentType === BdcDeploymentType.ExistingAKS || this.wizard.deploymentType === BdcDeploymentType.ExistingKubeAdm) { - const deploymentTargetSection = createSectionFunc(deploymentTargetSectionInfo); + const deploymentTargetSection = await createSectionFunc(deploymentTargetSectionInfo); this.formItems.push(deploymentTargetSection); } - const clusterSection = createSectionFunc(clusterSectionInfo); - const scaleSection = createSectionFunc(scaleSectionInfo); + const clusterSection = await createSectionFunc(clusterSectionInfo); + const scaleSection = await createSectionFunc(scaleSectionInfo); const endpointSection = { title: '', component: this.createEndpointSection() @@ -310,7 +310,7 @@ export class SummaryPage extends WizardPageBase { component: this.createStorageSection() }; if (this.wizard.model.getStringValue(VariableNames.AksName_VariableName)) { - const azureSection = createSectionFunc(azureSectionInfo); + const azureSection = await createSectionFunc(azureSectionInfo); this.formItems.push(azureSection); } diff --git a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/targetClusterPage.ts b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/targetClusterPage.ts index 58b40d12e8..b7b4c06525 100644 --- a/extensions/resource-deployment/src/ui/deployClusterWizard/pages/targetClusterPage.ts +++ b/extensions/resource-deployment/src/ui/deployClusterWizard/pages/targetClusterPage.ts @@ -51,7 +51,7 @@ export class TargetClusterContextPage extends WizardPageBase { if (this.loadDefaultKubeConfigFile) { let defaultKubeConfigPath = this.wizard.kubeService.getDefaultConfigPath(); this.loadClusterContexts(defaultKubeConfigPath); diff --git a/extensions/resource-deployment/src/ui/modelViewUtils.ts b/extensions/resource-deployment/src/ui/modelViewUtils.ts index 112869edca..78459c83a8 100644 --- a/extensions/resource-deployment/src/ui/modelViewUtils.ts +++ b/extensions/resource-deployment/src/ui/modelViewUtils.ts @@ -7,7 +7,6 @@ import { EOL, homedir as os_homedir } from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as azurecore from '../../../azurecore/src/azurecore'; import { azureResource } from '../../../azurecore/src/azureResource/azure-resource'; import { AzureAccountFieldInfo, AzureLocationsFieldInfo, ComponentCSSStyles, DialogInfoBase, FieldInfo, FieldType, KubeClusterContextFieldInfo, LabelPosition, NoteBookEnvironmentVariablePrefix, OptionsInfo, OptionsType, PageInfoBase, RowInfo, SectionInfo, TextCSSStyles } from '../interfaces'; import * as loc from '../localizedConstants'; @@ -176,8 +175,8 @@ export function initializeDialog(dialogContext: DialogContext): void { const tabs: azdata.window.DialogTab[] = []; dialogContext.dialogInfo.tabs.forEach(tabInfo => { const tab = azdata.window.createTab(tabInfo.title); - tab.registerContent((view: azdata.ModelView) => { - const sections = tabInfo.sections.map(sectionInfo => { + tab.registerContent(async (view: azdata.ModelView) => { + const sections = await Promise.all(tabInfo.sections.map(sectionInfo => { sectionInfo.inputWidth = sectionInfo.inputWidth || tabInfo.inputWidth || DefaultInputWidth; sectionInfo.labelWidth = sectionInfo.labelWidth || tabInfo.labelWidth || DefaultLabelWidth; sectionInfo.fieldAlignItems = sectionInfo.fieldAlignItems || tabInfo.fieldAlignItems || DefaultFieldAlignItems; @@ -193,7 +192,7 @@ export function initializeDialog(dialogContext: DialogContext): void { container: dialogContext.container, inputComponents: dialogContext.inputComponents }); - }); + })); const formBuilder = view.modelBuilder.formContainer().withFormItems( sections.map(section => { return { title: '', component: section }; @@ -212,8 +211,8 @@ export function initializeDialog(dialogContext: DialogContext): void { } export function initializeWizardPage(context: WizardPageContext): void { - context.page.registerContent((view: azdata.ModelView) => { - const sections = context.pageInfo.sections.map(sectionInfo => { + context.page.registerContent(async (view: azdata.ModelView) => { + const sections = await Promise.all(context.pageInfo.sections.map(sectionInfo => { sectionInfo.inputWidth = sectionInfo.inputWidth || context.pageInfo.inputWidth || context.wizardInfo.inputWidth || DefaultInputWidth; sectionInfo.labelWidth = sectionInfo.labelWidth || context.pageInfo.labelWidth || context.wizardInfo.labelWidth || DefaultLabelWidth; sectionInfo.fieldAlignItems = sectionInfo.fieldAlignItems || context.pageInfo.fieldAlignItems || DefaultFieldAlignItems; @@ -229,7 +228,7 @@ export function initializeWizardPage(context: WizardPageContext): void { onNewValidatorCreated: context.onNewValidatorCreated, sectionInfo: sectionInfo }); - }); + })); const formBuilder = view.modelBuilder.formContainer().withFormItems( sections.map(section => { return { title: '', component: section }; }), { @@ -242,7 +241,7 @@ export function initializeWizardPage(context: WizardPageContext): void { }); } -export function createSection(context: SectionContext): azdata.GroupContainer { +export async function createSection(context: SectionContext): Promise { const components: azdata.Component[] = []; context.sectionInfo.inputWidth = context.sectionInfo.inputWidth || DefaultInputWidth; context.sectionInfo.labelWidth = context.sectionInfo.labelWidth || DefaultLabelWidth; @@ -250,11 +249,11 @@ export function createSection(context: SectionContext): azdata.GroupContainer { context.sectionInfo.fieldWidth = context.sectionInfo.fieldWidth || DefaultFieldWidth; context.sectionInfo.fieldHeight = context.sectionInfo.fieldHeight || DefaultFieldHeight; if (context.sectionInfo.fields) { - processFields(context.sectionInfo.fields, components, context); + await processFields(context.sectionInfo.fields, components, context); } else if (context.sectionInfo.rows) { - context.sectionInfo.rows.forEach(rowInfo => { - components.push(processRow(rowInfo, context)); - }); + for (const rowInfo of context.sectionInfo.rows) { + components.push(await processRow(rowInfo, context)); + } } return createGroupContainer(context.view, components, { @@ -264,19 +263,19 @@ export function createSection(context: SectionContext): azdata.GroupContainer { }); } -function processRow(rowInfo: RowInfo, context: SectionContext): azdata.Component { +async function processRow(rowInfo: RowInfo, context: SectionContext): Promise { const items: azdata.Component[] = []; if ('items' in rowInfo.items[0]) { // rowInfo.items is RowInfo[] const rowItems = rowInfo.items as RowInfo[]; - items.push(...rowItems.map(rowInfo => processRow(rowInfo, context))); + items.push(...(await Promise.all(rowItems.map(rowInfo => processRow(rowInfo, context))))); } else { // rowInfo.items is FieldInfo[] const fieldItems = rowInfo.items as FieldInfo[]; - processFields(fieldItems, items, context, context.sectionInfo.spaceBetweenFields === undefined ? '50px' : context.sectionInfo.spaceBetweenFields); + await processFields(fieldItems, items, context, context.sectionInfo.spaceBetweenFields === undefined ? '50px' : context.sectionInfo.spaceBetweenFields); } return createFlexContainer(context.view, items, true, context.sectionInfo.fieldWidth, context.sectionInfo.fieldHeight, context.sectionInfo.fieldAlignItems, rowInfo.cssStyles); } -function processFields(fieldInfoArray: FieldInfo[], components: azdata.Component[], context: SectionContext, spaceBetweenFields?: string): void { +async function processFields(fieldInfoArray: FieldInfo[], components: azdata.Component[], context: SectionContext, spaceBetweenFields?: string): Promise { for (let i = 0; i < fieldInfoArray.length; i++) { const fieldInfo = fieldInfoArray[i]; fieldInfo.labelWidth = fieldInfo.labelWidth || context.sectionInfo.labelWidth; @@ -285,7 +284,7 @@ function processFields(fieldInfoArray: FieldInfo[], components: azdata.Component fieldInfo.fieldWidth = fieldInfo.fieldWidth || context.sectionInfo.fieldWidth; fieldInfo.fieldHeight = fieldInfo.fieldHeight || context.sectionInfo.fieldHeight; fieldInfo.labelPosition = fieldInfo.labelPosition === undefined ? context.sectionInfo.labelPosition : fieldInfo.labelPosition; - processField({ + await processField({ view: context.view, onNewDisposableCreated: context.onNewDisposableCreated, onNewInputComponentCreated: context.onNewInputComponentCreated, @@ -338,7 +337,7 @@ function addLabelInputPairToContainer(view: azdata.ModelView, components: azdata } } -function processField(context: FieldContext): void { +async function processField(context: FieldContext): Promise { switch (context.fieldInfo.type) { case FieldType.Options: processOptionsTypeField(context); @@ -366,7 +365,7 @@ function processField(context: FieldContext): void { processAzureAccountField(context); break; case FieldType.AzureLocations: - processAzureLocationsField(context); + await processAzureLocationsField(context); break; case FieldType.FilePicker: processFilePickerField(context); @@ -735,7 +734,7 @@ async function processAzureAccountField(context: AzureAccountFieldContext): Prom const accountDropdown = createAzureAccountDropdown(context); const subscriptionDropdown = createAzureSubscriptionDropdown(context, subscriptionValueToSubscriptionMap); const resourceGroupDropdown = createAzureResourceGroupsDropdown(context, accountDropdown, accountValueToAccountMap, subscriptionDropdown, subscriptionValueToSubscriptionMap); - const locationDropdown = context.fieldInfo.locations && processAzureLocationsField(context); + const locationDropdown = context.fieldInfo.locations && await processAzureLocationsField(context); accountDropdown.onValueChanged(async selectedItem => { const selectedAccount = accountValueToAccountMap.get(selectedItem.selected)!; await handleSelectedAccountChanged(context, selectedAccount, subscriptionDropdown, subscriptionValueToSubscriptionMap, resourceGroupDropdown, locationDropdown); @@ -942,35 +941,26 @@ async function handleSelectedSubscriptionChanged(context: AzureAccountFieldConte } } -/** - * Map of known Azure location friendly names to their internal names - */ -const knownAzureLocationNameMappings = new Map([ - ['East US', azurecore.AzureRegion.eastus], - ['East US 2', azurecore.AzureRegion.eastus2], - ['Central US', azurecore.AzureRegion.centralus], - ['West Europe', azurecore.AzureRegion.westeurope], - ['Southeast Asia', azurecore.AzureRegion.southeastasia], - ['West US 2', azurecore.AzureRegion.westus2] -]); - /** * An Azure Locations field consists of a dropdown field for azure locations * @param context The context to use to create the field */ -function processAzureLocationsField(context: AzureLocationsFieldContext): azdata.DropDownComponent { +async function processAzureLocationsField(context: AzureLocationsFieldContext): Promise { const label = createLabel(context.view, { text: context.fieldInfo.label || loc.location, required: context.fieldInfo.required, width: context.fieldInfo.labelWidth, cssStyles: context.fieldInfo.labelCSSStyles }); + const azurecoreApi = await apiService.getAzurecoreApi(); + const locationValues = context.fieldInfo.locations?.map(l => { return { name: l, displayName: azurecoreApi.getRegionDisplayName(l) }; }); const locationDropdown = createDropdown(context.view, { + defaultValue: locationValues?.find(l => l.name === context.fieldInfo.defaultValue), width: context.fieldInfo.inputWidth, editable: false, required: context.fieldInfo.required, label: loc.location, - values: context.fieldInfo.locations + values: locationValues }); locationDropdown.fireOnTextChange = true; context.fieldInfo.subFields = context.fieldInfo.subFields || []; @@ -979,12 +969,6 @@ function processAzureLocationsField(context: AzureLocationsFieldContext): azdata label: label.value!, variableName: context.fieldInfo.locationVariableName }); - context.onNewInputComponentCreated(context.fieldInfo.locationVariableName, { - component: locationDropdown, - inputValueTransformer: (inputValue: string) => { - return knownAzureLocationNameMappings.get(inputValue) || inputValue; - } - }); } if (context.fieldInfo.displayLocationVariableName) { context.fieldInfo.subFields!.push({ @@ -993,12 +977,6 @@ function processAzureLocationsField(context: AzureLocationsFieldContext): azdata }); context.onNewInputComponentCreated(context.fieldInfo.displayLocationVariableName, { component: locationDropdown }); } - context.onNewInputComponentCreated(context.fieldInfo.variableName!, { - component: locationDropdown, - inputValueTransformer: (inputValue: string) => { - return knownAzureLocationNameMappings.get(inputValue) || inputValue; - } - }); addLabelInputPairToContainer(context.view, context.components, label, locationDropdown, context.fieldInfo); return locationDropdown; } diff --git a/extensions/resource-deployment/src/ui/notebookWizard/notebookWizardAutoSummaryPage.ts b/extensions/resource-deployment/src/ui/notebookWizard/notebookWizardAutoSummaryPage.ts index 9f9866bbad..6b952160b8 100644 --- a/extensions/resource-deployment/src/ui/notebookWizard/notebookWizardAutoSummaryPage.ts +++ b/extensions/resource-deployment/src/ui/notebookWizard/notebookWizardAutoSummaryPage.ts @@ -37,7 +37,7 @@ export class NotebookWizardAutoSummaryPage extends NotebookWizardPage { this.wizard.wizardObject.message = { text: '' }; } - public onEnter(): void { + public async onEnter(): Promise { this.formItems.forEach(item => { this.form!.removeFormItem(item); }); @@ -50,7 +50,8 @@ export class NotebookWizardAutoSummaryPage extends NotebookWizardPage { const labelPosition = this.pageInfo.labelPosition || this.wizard.wizardInfo.labelPosition || LabelPosition.Left; const inputWidth = this.pageInfo.inputWidth || this.wizard.wizardInfo.inputWidth || DefaultInputWidth; - this.wizard.wizardInfo.pages.filter((undefined, index) => index < this._pageIndex).forEach(pageInfo => { + const filteredPages = this.wizard.wizardInfo.pages.filter((undefined, index) => index < this._pageIndex); + for (const pageInfo of filteredPages) { const summarySectionInfo: SectionInfo = { labelPosition: labelPosition, labelWidth: labelWidth, @@ -76,7 +77,7 @@ export class NotebookWizardAutoSummaryPage extends NotebookWizardPage { if (summarySectionInfo!.rows!.length > 0) { const formComponent: azdata.FormComponent = { title: pageInfo.title, - component: createSection({ + component: await createSection({ container: this.wizard.wizardObject, inputComponents: this.wizard.inputComponents, sectionInfo: summarySectionInfo, @@ -88,7 +89,7 @@ export class NotebookWizardAutoSummaryPage extends NotebookWizardPage { }; this.formItems.push(formComponent); } - }); + } this.form.addFormItems(this.formItems); } diff --git a/extensions/resource-deployment/src/ui/notebookWizard/notebookWizardPage.ts b/extensions/resource-deployment/src/ui/notebookWizard/notebookWizardPage.ts index 5d25cd94f4..7e95b24c43 100644 --- a/extensions/resource-deployment/src/ui/notebookWizard/notebookWizardPage.ts +++ b/extensions/resource-deployment/src/ui/notebookWizard/notebookWizardPage.ts @@ -63,7 +63,7 @@ export class NotebookWizardPage extends WizardPageBase { }); } - public onEnter(): void { + public async onEnter(): Promise { if (this.pageInfo.isSummaryPage) { setModelValues(this.wizard.inputComponents, this.wizard.model); } diff --git a/extensions/resource-deployment/src/ui/wizardBase.ts b/extensions/resource-deployment/src/ui/wizardBase.ts index 7282f9787e..9ae86e1b70 100644 --- a/extensions/resource-deployment/src/ui/wizardBase.ts +++ b/extensions/resource-deployment/src/ui/wizardBase.ts @@ -24,14 +24,14 @@ export abstract class WizardBase, M extends Model this.wizardObject = azdata.window.createWizard(title); } - public open(): Thenable { + public async open(): Promise { this.initialize(); this.wizardObject.customButtons = this.customButtons; - this.toDispose.push(this.wizardObject.onPageChanged((e) => { + this.toDispose.push(this.wizardObject.onPageChanged(async (e) => { let previousPage = this.pages[e.lastPage]; let newPage = this.pages[e.newPage]; previousPage.onLeave(); - newPage.onEnter(); + await newPage.onEnter(); })); this.toDispose.push(this.wizardObject.doneButton.onClick(async () => { @@ -43,12 +43,10 @@ export abstract class WizardBase, M extends Model this.dispose(); })); - return this.wizardObject.open().then(() => { - if (this.pages && this.pages.length > 0) { - this.pages[0].onEnter(); - } - }); - + await this.wizardObject.open(); + if (this.pages && this.pages.length > 0) { + await this.pages[0].onEnter(); + } } protected abstract initialize(): void; diff --git a/extensions/resource-deployment/src/ui/wizardPageBase.ts b/extensions/resource-deployment/src/ui/wizardPageBase.ts index 09501ea9e8..6cc3e30492 100644 --- a/extensions/resource-deployment/src/ui/wizardPageBase.ts +++ b/extensions/resource-deployment/src/ui/wizardPageBase.ts @@ -23,7 +23,7 @@ export abstract class WizardPageBase { return this._wizard; } - public onEnter(): void { } + public async onEnter(): Promise { } public onLeave(): void { }