mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 01:28:26 -05:00
Cleanup Resource Deployment ModelView (#13510)
This commit is contained in:
@@ -210,7 +210,6 @@
|
||||
"type": "azure_account",
|
||||
"required": true,
|
||||
"subscriptionVariableName": "AZDATA_NB_VAR_ARC_SUBSCRIPTION",
|
||||
"displaySubscriptionVariableName": "AZDATA_NB_VAR_ARC_DISPLAY_SUBSCRIPTION",
|
||||
"resourceGroupVariableName": "AZDATA_NB_VAR_ARC_RESOURCE_GROUP"
|
||||
},
|
||||
{
|
||||
@@ -219,7 +218,6 @@
|
||||
"defaultValue": "eastus",
|
||||
"required": true,
|
||||
"locationVariableName": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_LOCATION",
|
||||
"displayLocationVariableName": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_DISPLAY_LOCATION",
|
||||
"locations": [
|
||||
"australiaeast",
|
||||
"centralus",
|
||||
@@ -273,7 +271,7 @@
|
||||
"defaultValue": "",
|
||||
"enabled": {
|
||||
"target": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_CONNECTIVITY_MODE",
|
||||
"value": "%arc.data.controller.direct%"
|
||||
"value": "direct"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -284,7 +282,7 @@
|
||||
"defaultValue": "",
|
||||
"enabled": {
|
||||
"target": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_CONNECTIVITY_MODE",
|
||||
"value": "%arc.data.controller.direct%"
|
||||
"value": "direct"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -295,7 +293,7 @@
|
||||
"defaultValue": "",
|
||||
"enabled": {
|
||||
"target": "AZDATA_NB_VAR_ARC_DATA_CONTROLLER_CONNECTIVITY_MODE",
|
||||
"value": "%arc.data.controller.direct%"
|
||||
"value": "direct"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -542,7 +540,7 @@
|
||||
"label": "%arc.data.controller.summary.subscription%",
|
||||
"type": "readonly_text",
|
||||
"isEvaluated": true,
|
||||
"defaultValue": "$(AZDATA_NB_VAR_ARC_DISPLAY_SUBSCRIPTION)",
|
||||
"defaultValue": "$(AZDATA_NB_VAR_ARC_SUBSCRIPTION)",
|
||||
"inputWidth": "600"
|
||||
},
|
||||
{
|
||||
@@ -555,7 +553,7 @@
|
||||
"label": "%arc.data.controller.summary.location%",
|
||||
"type": "readonly_text",
|
||||
"isEvaluated": true,
|
||||
"defaultValue": "$(AZDATA_NB_VAR_ARC_DATA_CONTROLLER_DISPLAY_LOCATION)"
|
||||
"defaultValue": "$(AZDATA_NB_VAR_ARC_DATA_CONTROLLER_LOCATION)"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -296,7 +296,6 @@
|
||||
"defaultValue": "westus",
|
||||
"required": true,
|
||||
"locationVariableName": "AZDATA_NB_VAR_ASDE_AZURE_LOCATION",
|
||||
"displayLocationVariableName": "AZDATA_NB_VAR_ASDE_AZURE_LOCATION_TEXT",
|
||||
"locations": [
|
||||
"australiaeast",
|
||||
"australiasoutheast",
|
||||
|
||||
@@ -316,7 +316,6 @@ export interface KubeClusterContextFieldInfo extends FieldInfo {
|
||||
configFileVariableName?: string;
|
||||
}
|
||||
export interface AzureAccountFieldInfo extends AzureLocationsFieldInfo {
|
||||
displaySubscriptionVariableName?: string;
|
||||
subscriptionVariableName?: string;
|
||||
resourceGroupVariableName?: string;
|
||||
allowNewResourceGroup?: boolean;
|
||||
@@ -326,7 +325,6 @@ export interface AzureAccountFieldInfo extends AzureLocationsFieldInfo {
|
||||
|
||||
export interface AzureLocationsFieldInfo extends FieldInfo {
|
||||
locationVariableName?: string;
|
||||
displayLocationVariableName?: string;
|
||||
locations?: string[]
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ export type InputComponent = azdata.TextComponent | azdata.InputBoxComponent | a
|
||||
export type InputComponentInfo<T extends InputComponent> = {
|
||||
component: T;
|
||||
getValue: () => Promise<InputValueType>;
|
||||
getDisplayValue?: () => Promise<string>;
|
||||
onValueChanged: vscode.Event<void>;
|
||||
isPassword?: boolean
|
||||
};
|
||||
@@ -262,6 +263,7 @@ export function createDropdownInputInfo(view: azdata.ModelView, info: { defaultV
|
||||
return {
|
||||
component: dropdown,
|
||||
getValue: async (): Promise<InputValueType> => typeof dropdown.value === 'string' ? dropdown.value : dropdown.value?.name,
|
||||
getDisplayValue: async (): Promise<string> => (typeof dropdown.value === 'string' ? dropdown.value : dropdown.value?.displayName) || '',
|
||||
onValueChanged: dropdown.onValueChanged,
|
||||
};
|
||||
}
|
||||
@@ -753,7 +755,7 @@ function processEvaluatedTextField(context: FieldContext): ReadOnlyFieldInputs {
|
||||
|
||||
/**
|
||||
* Returns a string that interpolates all variable names in the {@param inputValue} string de-marked as $(VariableName)
|
||||
* substituted with their corresponding values.
|
||||
* substituted with their corresponding values. Will use the display value of the target input values if possible.
|
||||
*
|
||||
* Only variables in the current model starting with {@see NoteBookEnvironmentVariablePrefix} are replaced.
|
||||
*
|
||||
@@ -764,7 +766,7 @@ async function substituteVariableValues(inputComponents: InputComponents, inputV
|
||||
await Promise.all(Object.keys(inputComponents)
|
||||
.filter(key => key.startsWith(NoteBookEnvironmentVariablePrefix))
|
||||
.map(async key => {
|
||||
const value = (await inputComponents[key].getValue()) ?? '<undefined>';
|
||||
const value = (await (inputComponents[key].getDisplayValue ? inputComponents[key].getDisplayValue!() : inputComponents[key].getValue())) ?? '<undefined>';
|
||||
const re: RegExp = new RegExp(`\\\$\\\(${key}\\\)`, 'gi');
|
||||
inputValue = inputValue?.replace(re, value.toString());
|
||||
})
|
||||
@@ -927,6 +929,7 @@ async function createRadioOptions(context: FieldContext, getRadioButtonInfo?: ((
|
||||
context.onNewInputComponentCreated(context.fieldInfo.variableName || context.fieldInfo.label, {
|
||||
component: radioGroupLoadingComponentBuilder,
|
||||
getValue: async (): Promise<InputValueType> => radioGroupLoadingComponentBuilder.value,
|
||||
getDisplayValue: async (): Promise<string> => radioGroupLoadingComponentBuilder.displayValue,
|
||||
onValueChanged: radioGroupLoadingComponentBuilder.onValueChanged,
|
||||
});
|
||||
addLabelInputPairToContainer(context.view, context.components, label, radioGroupLoadingComponentBuilder.component(), context.fieldInfo);
|
||||
@@ -1118,15 +1121,9 @@ function createAzureSubscriptionDropdown(
|
||||
const inputValue = (await subscriptionDropdown.getValue())?.toString() || '';
|
||||
return subscriptionValueToSubscriptionMap.get(inputValue)?.id || inputValue;
|
||||
},
|
||||
getDisplayValue: subscriptionDropdown.getDisplayValue,
|
||||
onValueChanged: subscriptionDropdown.onValueChanged
|
||||
});
|
||||
if (context.fieldInfo.displaySubscriptionVariableName) {
|
||||
context.fieldInfo.subFields!.push({
|
||||
label: label.value!,
|
||||
variableName: context.fieldInfo.displaySubscriptionVariableName
|
||||
});
|
||||
context.onNewInputComponentCreated(context.fieldInfo.displaySubscriptionVariableName!, subscriptionDropdown);
|
||||
}
|
||||
addLabelInputPairToContainer(context.view, context.components, label, subscriptionDropdown.component, context.fieldInfo);
|
||||
return subscriptionDropdown.component;
|
||||
}
|
||||
@@ -1341,22 +1338,6 @@ async function processAzureLocationsField(context: AzureLocationsFieldContext):
|
||||
});
|
||||
context.onNewInputComponentCreated(context.fieldInfo.locationVariableName, locationDropdown);
|
||||
}
|
||||
if (context.fieldInfo.displayLocationVariableName) {
|
||||
context.fieldInfo.subFields!.push({
|
||||
label: label.value!,
|
||||
variableName: context.fieldInfo.displayLocationVariableName
|
||||
});
|
||||
// Create a special input component that maps the dropdown to the display name for the location
|
||||
// so that we have two variables - one for the value and one for the display name
|
||||
context.onNewInputComponentCreated(context.fieldInfo.displayLocationVariableName, {
|
||||
component: locationDropdown.component,
|
||||
getValue: async (): Promise<InputValueType> => {
|
||||
const inputValue = (await locationDropdown.getValue())?.toString();
|
||||
return apiService.azurecoreApi.getRegionDisplayName(inputValue);
|
||||
},
|
||||
onValueChanged: locationDropdown.onValueChanged,
|
||||
});
|
||||
}
|
||||
addLabelInputPairToContainer(context.view, context.components, label, locationDropdown.component, context.fieldInfo);
|
||||
return locationDropdown.component;
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ export class RadioGroupLoadingComponentBuilder implements azdata.ComponentBuilde
|
||||
: op as azdata.CategoryValue;
|
||||
const radioOption = this._view!.modelBuilder.radioButton().withProperties<azdata.RadioButtonProperties>({
|
||||
label: option.displayName,
|
||||
value: option.name,
|
||||
checked: option.displayName === defaultValue,
|
||||
name: option.name,
|
||||
enabled: instanceOfDynamicEnablementInfo(this._fieldInfo.enabled) ? false : this._fieldInfo.enabled // Dynamic enablement is initially set to false
|
||||
}).component();
|
||||
if (radioOption.checked) {
|
||||
@@ -75,7 +75,11 @@ export class RadioGroupLoadingComponentBuilder implements azdata.ComponentBuilde
|
||||
}
|
||||
|
||||
get value(): string | undefined {
|
||||
return this._currentRadioOption?.label;
|
||||
return this._currentRadioOption?.value || this._currentRadioOption?.label;
|
||||
}
|
||||
|
||||
get displayValue(): string {
|
||||
return this._currentRadioOption.label || '';
|
||||
}
|
||||
|
||||
get checked(): azdata.RadioButtonComponent {
|
||||
|
||||
Reference in New Issue
Block a user