Added fix for the infinite page refresh in resource Deployment tools page (#13813)

* Added fixed for the infinite loop in resource Deployment tools page
Generating events for select boxes only when the select box value is changed.

* Fixed the check logic in select method

* Reverted to old code and fixed some bugs

* Fixed event generation check logic
This commit is contained in:
Aasim Khan
2020-12-18 10:06:12 -08:00
committed by GitHub
parent 2d6074706a
commit 0b00533f99
2 changed files with 12 additions and 5 deletions

View File

@@ -198,19 +198,22 @@ export class ToolsAndEulaPage extends ResourceTypePage {
}).component();
optionLabel.width = '150px';
const optionSelectedValue = (this.wizard.toolsEulaPagePresets) ? this.wizard.toolsEulaPagePresets[index] : option.values[0];
const optionSelectBox = this.view.modelBuilder.dropDown().withProperties<azdata.DropDownProperties>({
values: option.values,
value: (this.wizard.toolsEulaPagePresets) ? this.wizard.toolsEulaPagePresets[index] : option.values[0],
value: optionSelectedValue,
width: '300px',
ariaLabel: option.displayName
}).component();
resourceTypeOptions.push(option.values[0]);
resourceTypeOptions.push(optionSelectedValue);
this.wizard.registerDisposable(optionSelectBox.onValueChanged(async () => {
resourceTypeOptions[index] = <ResourceTypeOptionValue>optionSelectBox.value;
this.wizard.provider = this.getCurrentProvider();
await this.wizard.open();
if (resourceTypeOptions[index].name !== (<ResourceTypeOptionValue>optionSelectBox.value).name) {
resourceTypeOptions[index] = <ResourceTypeOptionValue>optionSelectBox.value;
this.wizard.provider = this.getCurrentProvider();
await this.wizard.open();
}
}));
this._optionDropDownMap.set(option.name, optionSelectBox);

View File

@@ -197,6 +197,10 @@ export class SelectBox extends vsSelectBox {
}
public select(index: number): void {
let selectedOptionIndex = this._optionsDictionary.get(this._selectedOption);
if (selectedOptionIndex === index) { // Not generating an event if the same value is selected.
return;
}
super.select(index);
if (this._dialogOptions !== undefined) {
this._selectedOption = this._dialogOptions[index]?.value;