Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/azd/.vscode/cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ words:
- Canonicalize
- Chans
- chinacloudapi
- cmds
- Codespace
- Codespaces
- cooldown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ func newPromptCommand() *cobra.Command {
Prompt().
PromptResourceGroup(ctx, &azdext.PromptResourceGroupRequest{
AzureContext: &azureContext,
Options: &azdext.PromptResourceGroupOptions{
SelectOptions: &azdext.PromptResourceSelectOptions{
AllowNewResource: to.Ptr(false),
},
},
})
if err != nil {
return err
Expand Down
7 changes: 7 additions & 0 deletions cli/azd/grpc/proto/prompt.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ message PromptLocationResponse {

message PromptResourceGroupRequest {
AzureContext azure_context = 1;
PromptResourceGroupOptions options = 2;
}

message PromptResourceGroupResponse {
Expand Down Expand Up @@ -182,4 +183,10 @@ message PromptResourceSelectOptions {
string loading_message = 7;
optional bool display_numbers = 8;
int32 display_count = 9;
string hint = 10;
optional bool enable_filtering = 11;
}

message PromptResourceGroupOptions {
PromptResourceSelectOptions select_options = 1;
}
27 changes: 26 additions & 1 deletion cli/azd/internal/grpcserver/prompt_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ func (s *promptService) PromptResourceGroup(
return nil, err
}

selectedResourceGroup, err := s.prompter.PromptResourceGroup(ctx, azureContext, nil)
options := createResourceGroupOptions(req.Options)

selectedResourceGroup, err := s.prompter.PromptResourceGroup(ctx, azureContext, options)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -418,6 +420,8 @@ func createResourceOptions(options *azdext.PromptResourceOptions) prompt.Resourc
DisplayCount: int(options.SelectOptions.DisplayCount),
DisplayNumbers: options.SelectOptions.DisplayNumbers,
AllowNewResource: options.SelectOptions.AllowNewResource,
Hint: options.SelectOptions.Hint,
EnableFiltering: options.SelectOptions.EnableFiltering,
}
}

Expand All @@ -431,6 +435,27 @@ func createResourceOptions(options *azdext.PromptResourceOptions) prompt.Resourc
return resourceOptions
}

func createResourceGroupOptions(options *azdext.PromptResourceGroupOptions) *prompt.ResourceGroupOptions {
if options == nil || options.SelectOptions == nil {
return nil
}

return &prompt.ResourceGroupOptions{
SelectorOptions: &prompt.SelectOptions{
ForceNewResource: options.SelectOptions.ForceNewResource,
AllowNewResource: options.SelectOptions.AllowNewResource,
NewResourceMessage: options.SelectOptions.NewResourceMessage,
Message: options.SelectOptions.Message,
HelpMessage: options.SelectOptions.HelpMessage,
LoadingMessage: options.SelectOptions.LoadingMessage,
DisplayCount: int(options.SelectOptions.DisplayCount),
DisplayNumbers: options.SelectOptions.DisplayNumbers,
Hint: options.SelectOptions.Hint,
EnableFiltering: options.SelectOptions.EnableFiltering,
},
}
}

func convertToInt32(input *int) *int32 {
if input == nil {
return nil // Handle the nil case
Expand Down
Loading
Loading