Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a conditional setLocation in ResourceGroupListStep #1313

Merged
merged 4 commits into from
Dec 22, 2022

Conversation

MicroFish91
Copy link
Contributor

@MicroFish91 MicroFish91 commented Dec 19, 2022

Closes #1290

Similar to how it's done in StorageAccountListStep.

@@ -46,6 +45,9 @@ export class ResourceGroupListStep<T extends types.IResourceGroupWizardContext>
// Cache resource group separately per subscription
const options: IAzureQuickPickOptions = { placeHolder: 'Select a resource group for new resources.', id: `ResourceGroupListStep/${wizardContext.subscriptionId}` };
wizardContext.resourceGroup = (await wizardContext.ui.showQuickPick(this.getQuickPicks(wizardContext), options)).data;
if (wizardContext.resourceGroup) {
await LocationListStep.setLocation(wizardContext, nonNullProp(wizardContext.resourceGroup, 'location'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion question...

Should we always set location whenever we pick a resource group, or should it only be set if _location is undefined? Whenever we go through the flow to create a resource group, we automatically select and set the location, so I'm kind of leaning towards option A but could see both ways being feasible but having different side effects.

A)

if (wizardContext.resourceGroup) {
  ...
}

OR

B)

if (wizardContext.resourceGroup && !LocationListStep.hasLocation(wizardContext)) {
  ...
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I prefer option B a little bit better. If we set the location ahead of time for whatever reason, I'd prefer to respect those settings.

@MicroFish91 MicroFish91 marked this pull request as ready for review December 20, 2022 23:18
@MicroFish91 MicroFish91 requested a review from a team as a code owner December 20, 2022 23:18
@MicroFish91 MicroFish91 merged commit f0349ef into main Dec 22, 2022
@MicroFish91 MicroFish91 deleted the mwf/rg-set-location branch December 22, 2022 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResourceGroupListStep should call LocationListStep.setLocation() after a resource group is selected
2 participants