Skip to content

Commit

Permalink
fix(pro): add runner to workspace instance from pro CLI; set default
Browse files Browse the repository at this point in the history
template
  • Loading branch information
pascalbreuninger committed Jan 29, 2025
1 parent dde3ea7 commit 7996f43
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/platform/form/form.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"slices"
"strconv"
"strings"

Expand Down Expand Up @@ -110,6 +111,9 @@ func CreateInstance(ctx context.Context, baseClient client.Client, id, uid strin
Name: selectedTemplate.GetName(),
Version: selectedTemplateVersion,
},
RunnerRef: storagev1.RunnerRef{
Runner: selectedRunner.GetName(),
},
Parameters: renderedParameters,
},
},
Expand Down Expand Up @@ -306,17 +310,22 @@ func getTemplateOptions(ctx context.Context, client client.Client, project *mana
return nil
}

var defaultOpt huh.Option[*managementv1.DevPodWorkspaceTemplate]
for _, template := range templates.DevPodWorkspaceTemplates {
t := &template
opt := huh.Option[*managementv1.DevPodWorkspaceTemplate]{
Key: platform.DisplayName(template.GetName(), template.Spec.DisplayName),
Value: t,
}
if t.GetName() == templates.DefaultDevPodWorkspaceTemplate {
opt = opt.Selected(true)
defaultOpt = opt
continue
}
opts = append(opts, opt)
}
// make sure the default template is the first
opts = slices.Insert(opts, 0, defaultOpt)

return opts
}

Expand Down

0 comments on commit 7996f43

Please sign in to comment.