mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
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
This commit is contained in:
@@ -4,3 +4,6 @@ out/**
|
||||
extension.webpack.config.js
|
||||
tsconfig.json
|
||||
yarn.lock
|
||||
coverConfig.json
|
||||
*.vsix
|
||||
coverage
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -125,8 +125,8 @@ export class AzureSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
}]
|
||||
}]
|
||||
};
|
||||
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<DeployClusterWizard> {
|
||||
});
|
||||
}
|
||||
|
||||
public onEnter(): void {
|
||||
public async onEnter(): Promise<void> {
|
||||
this.wizard.wizardObject.registerNavigationValidator((pcInfo) => {
|
||||
this.wizard.wizardObject.message = { text: '' };
|
||||
if (pcInfo.newPage > pcInfo.lastPage) {
|
||||
|
||||
@@ -201,8 +201,8 @@ export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
}
|
||||
]
|
||||
};
|
||||
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<DeployClusterWizard> {
|
||||
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<DeployClusterWizard> {
|
||||
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<DeployClusterWizard> {
|
||||
});
|
||||
}
|
||||
|
||||
public onEnter() {
|
||||
public async onEnter(): Promise<void> {
|
||||
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);
|
||||
|
||||
@@ -216,7 +216,7 @@ export class DeploymentProfilePage extends WizardPageBase<DeployClusterWizard> {
|
||||
.component();
|
||||
}
|
||||
|
||||
public onEnter() {
|
||||
public async onEnter(): Promise<void> {
|
||||
this.wizard.wizardObject.registerNavigationValidator((pcInfo) => {
|
||||
this.wizard.wizardObject.message = { text: '' };
|
||||
if (pcInfo.newPage > pcInfo.lastPage) {
|
||||
|
||||
@@ -114,9 +114,9 @@ export class ServiceSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
]
|
||||
};
|
||||
|
||||
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<azdata.GroupContainer> => {
|
||||
return await createSection({
|
||||
view: view,
|
||||
container: this.wizard.wizardObject,
|
||||
inputComponents: this.inputComponents,
|
||||
@@ -131,7 +131,7 @@ export class ServiceSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
}
|
||||
});
|
||||
};
|
||||
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<DeployClusterWizard> {
|
||||
};
|
||||
}
|
||||
|
||||
public onEnter(): void {
|
||||
public async onEnter(): Promise<void> {
|
||||
this.setInputBoxValue(VariableNames.ComputePoolScale_VariableName);
|
||||
this.setInputBoxValue(VariableNames.DataPoolScale_VariableName);
|
||||
this.setInputBoxValue(VariableNames.HDFSPoolScale_VariableName);
|
||||
|
||||
@@ -29,7 +29,7 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
});
|
||||
}
|
||||
|
||||
public onEnter() {
|
||||
public async onEnter(): Promise<void> {
|
||||
this.wizard.showCustomButtons();
|
||||
this.formItems.forEach(item => {
|
||||
this.form!.removeFormItem(item);
|
||||
@@ -279,10 +279,10 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
]
|
||||
};
|
||||
|
||||
const createSectionFunc = (sectionInfo: SectionInfo): azdata.FormComponent => {
|
||||
const createSectionFunc = async (sectionInfo: SectionInfo): Promise<azdata.FormComponent> => {
|
||||
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<DeployClusterWizard> {
|
||||
};
|
||||
|
||||
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<DeployClusterWizard> {
|
||||
component: this.createStorageSection()
|
||||
};
|
||||
if (this.wizard.model.getStringValue(VariableNames.AksName_VariableName)) {
|
||||
const azureSection = createSectionFunc(azureSectionInfo);
|
||||
const azureSection = await createSectionFunc(azureSectionInfo);
|
||||
this.formItems.push(azureSection);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ export class TargetClusterContextPage extends WizardPageBase<DeployClusterWizard
|
||||
});
|
||||
}
|
||||
|
||||
public onEnter() {
|
||||
public async onEnter(): Promise<void> {
|
||||
if (this.loadDefaultKubeConfigFile) {
|
||||
let defaultKubeConfigPath = this.wizard.kubeService.getDefaultConfigPath();
|
||||
this.loadClusterContexts(defaultKubeConfigPath);
|
||||
|
||||
@@ -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<azdata.GroupContainer> {
|
||||
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<azdata.Component> {
|
||||
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<void> {
|
||||
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<void> {
|
||||
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<string, string>([
|
||||
['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<azdata.DropDownComponent> {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export class NotebookWizardAutoSummaryPage extends NotebookWizardPage {
|
||||
this.wizard.wizardObject.message = { text: '' };
|
||||
}
|
||||
|
||||
public onEnter(): void {
|
||||
public async onEnter(): Promise<void> {
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export class NotebookWizardPage extends WizardPageBase<NotebookWizard> {
|
||||
});
|
||||
}
|
||||
|
||||
public onEnter(): void {
|
||||
public async onEnter(): Promise<void> {
|
||||
if (this.pageInfo.isSummaryPage) {
|
||||
setModelValues(this.wizard.inputComponents, this.wizard.model);
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ export abstract class WizardBase<T, P extends WizardPageBase<T>, M extends Model
|
||||
this.wizardObject = azdata.window.createWizard(title);
|
||||
}
|
||||
|
||||
public open(): Thenable<void> {
|
||||
public async open(): Promise<void> {
|
||||
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<T, P extends WizardPageBase<T>, 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;
|
||||
|
||||
@@ -23,7 +23,7 @@ export abstract class WizardPageBase<T> {
|
||||
return this._wizard;
|
||||
}
|
||||
|
||||
public onEnter(): void { }
|
||||
public async onEnter(): Promise<void> { }
|
||||
|
||||
public onLeave(): void { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user