mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
feat: support dynamic parameters on create template request (#18636)
Future work is to add this checkbox to the UI to opt into dynamic parameters from the first template create.
This commit is contained in:
@ -197,16 +197,20 @@ func (api *API) postTemplateByOrganization(rw http.ResponseWriter, r *http.Reque
|
||||
return
|
||||
}
|
||||
|
||||
// Default is true until dynamic parameters are promoted to stable.
|
||||
useClassicParameterFlow := ptr.NilToDefault(createTemplate.UseClassicParameterFlow, true)
|
||||
|
||||
// Make a temporary struct to represent the template. This is used for
|
||||
// auditing if any of the following checks fail. It will be overwritten when
|
||||
// the template is inserted into the db.
|
||||
templateAudit.New = database.Template{
|
||||
OrganizationID: organization.ID,
|
||||
Name: createTemplate.Name,
|
||||
Description: createTemplate.Description,
|
||||
CreatedBy: apiKey.UserID,
|
||||
Icon: createTemplate.Icon,
|
||||
DisplayName: createTemplate.DisplayName,
|
||||
OrganizationID: organization.ID,
|
||||
Name: createTemplate.Name,
|
||||
Description: createTemplate.Description,
|
||||
CreatedBy: apiKey.UserID,
|
||||
Icon: createTemplate.Icon,
|
||||
DisplayName: createTemplate.DisplayName,
|
||||
UseClassicParameterFlow: useClassicParameterFlow,
|
||||
}
|
||||
|
||||
_, err := api.Database.GetTemplateByOrganizationAndName(ctx, database.GetTemplateByOrganizationAndNameParams{
|
||||
@ -404,6 +408,7 @@ func (api *API) postTemplateByOrganization(rw http.ResponseWriter, r *http.Reque
|
||||
Icon: createTemplate.Icon,
|
||||
AllowUserCancelWorkspaceJobs: allowUserCancelWorkspaceJobs,
|
||||
MaxPortSharingLevel: maxPortShareLevel,
|
||||
UseClassicParameterFlow: useClassicParameterFlow,
|
||||
})
|
||||
if err != nil {
|
||||
return xerrors.Errorf("insert template: %s", err)
|
||||
|
Reference in New Issue
Block a user