Skip to content

Commit dc4538f

Browse files
committed
Fix subscription ID not being disabled on Azure provisioning dialog
1 parent 25b785a commit dc4538f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/Aspire.Hosting.Azure/Provisioning/Internal/RunModeProvisioningContextProvider.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,26 +155,13 @@ private async Task RetrieveAzureProvisioningOptions(CancellationToken cancellati
155155
// show the value as from the configuration and disable the input
156156
// there should be no option to change it
157157

158-
inputs.Add(new InteractionInput
158+
InputLoadOptions? subscriptionLoadOptions = null;
159+
if (string.IsNullOrEmpty(_options.SubscriptionId))
159160
{
160-
Name = SubscriptionIdName,
161-
InputType = string.IsNullOrEmpty(_options.SubscriptionId) ? InputType.Choice : InputType.Text,
162-
Label = AzureProvisioningStrings.SubscriptionIdLabel,
163-
Required = true,
164-
AllowCustomChoice = true,
165-
Placeholder = AzureProvisioningStrings.SubscriptionIdPlaceholder,
166-
Disabled = !string.IsNullOrEmpty(_options.SubscriptionId),
167-
Value = _options.SubscriptionId,
168-
DynamicLoading = new InputLoadOptions
161+
subscriptionLoadOptions = new InputLoadOptions
169162
{
170163
LoadCallback = async (context) =>
171164
{
172-
if (!string.IsNullOrEmpty(_options.SubscriptionId))
173-
{
174-
// If subscription ID is not set, we don't need to load options
175-
return;
176-
}
177-
178165
// Get tenant ID from input if tenant selection is enabled, otherwise use configured value
179166
var tenantId = context.AllInputs[TenantName].Value ?? string.Empty;
180167

@@ -186,8 +173,21 @@ private async Task RetrieveAzureProvisioningOptions(CancellationToken cancellati
186173
: [];
187174
context.Input.Disabled = false;
188175
},
189-
DependsOnInputs = string.IsNullOrEmpty(_options.SubscriptionId) ? [TenantName] : []
190-
}
176+
DependsOnInputs = [TenantName]
177+
};
178+
}
179+
180+
inputs.Add(new InteractionInput
181+
{
182+
Name = SubscriptionIdName,
183+
InputType = string.IsNullOrEmpty(_options.SubscriptionId) ? InputType.Choice : InputType.Text,
184+
Label = AzureProvisioningStrings.SubscriptionIdLabel,
185+
Required = true,
186+
AllowCustomChoice = true,
187+
Placeholder = AzureProvisioningStrings.SubscriptionIdPlaceholder,
188+
Disabled = true,
189+
Value = _options.SubscriptionId,
190+
DynamicLoading = subscriptionLoadOptions
191191
});
192192

193193
inputs.Add(new InteractionInput

0 commit comments

Comments
 (0)