mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Add resource deployment filtering by option values (#14101)
* Add resource deployment filtering by option values * Fix compile error
This commit is contained in:
@@ -13,6 +13,7 @@ import { IToolsService } from '../services/toolsService';
|
||||
import { getErrorMessage } from '../common/utils';
|
||||
import { ResourceTypePage } from './resourceTypePage';
|
||||
import { ResourceTypeWizard } from './resourceTypeWizard';
|
||||
import { OptionValuesFilter as OptionValuesFilter } from '../services/resourceTypeService';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -41,7 +42,7 @@ export class ToolsAndEulaPage extends ResourceTypePage {
|
||||
return this.wizard.toolsService;
|
||||
}
|
||||
|
||||
constructor(wizard: ResourceTypeWizard) {
|
||||
constructor(wizard: ResourceTypeWizard, private optionValuesFilter?: OptionValuesFilter) {
|
||||
super(localize('notebookWizard.toolsAndEulaPageTitle', "Deployment pre-requisites"), '', wizard);
|
||||
this._resourceType = wizard.resourceType;
|
||||
}
|
||||
@@ -192,19 +193,25 @@ export class ToolsAndEulaPage extends ResourceTypePage {
|
||||
}).component();
|
||||
this._optionsContainer.addItem(optionsTitle);
|
||||
this._resourceType.options.forEach((option, index) => {
|
||||
let optionValues = option.values;
|
||||
const optionValueFilter = this.optionValuesFilter?.[this._resourceType.name]?.[option.name];
|
||||
if (optionValueFilter) {
|
||||
optionValues = optionValues.filter(optionValue => optionValueFilter.includes(optionValue.name));
|
||||
}
|
||||
const optionLabel = this.view.modelBuilder.text().withProperties<azdata.TextComponentProperties>({
|
||||
value: option.displayName,
|
||||
}).component();
|
||||
optionLabel.width = '150px';
|
||||
|
||||
const optionSelectedValue = (this.wizard.toolsEulaPagePresets) ? this.wizard.toolsEulaPagePresets[index] : option.values[0];
|
||||
const optionSelectedValue = (this.wizard.toolsEulaPagePresets) ? this.wizard.toolsEulaPagePresets[index] : optionValues[0];
|
||||
const optionSelectBox = this.view.modelBuilder.dropDown().withProperties<azdata.DropDownProperties>({
|
||||
values: option.values,
|
||||
values: optionValues,
|
||||
value: optionSelectedValue,
|
||||
width: '300px',
|
||||
ariaLabel: option.displayName
|
||||
}).component();
|
||||
|
||||
|
||||
resourceTypeOptions.push(optionSelectedValue);
|
||||
|
||||
this.wizard.registerDisposable(optionSelectBox.onValueChanged(async () => {
|
||||
@@ -216,6 +223,7 @@ export class ToolsAndEulaPage extends ResourceTypePage {
|
||||
}));
|
||||
|
||||
this._optionDropDownMap.set(option.name, optionSelectBox);
|
||||
this.wizard.provider = this.getCurrentProvider();
|
||||
const row = this.view.modelBuilder.flexContainer().withItems([optionLabel, optionSelectBox], { flex: '0 0 auto', CSSStyles: { 'margin-right': '20px' } }).withLayout({ flexFlow: 'row', alignItems: 'center' }).component();
|
||||
this._optionsContainer.addItem(row);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user