Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
chore: add ui settings for changing to classic flow
  • Loading branch information
Emyrk committed May 14, 2025
commit 6a49f681ce820f20d385a1c11d048322049e9025
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
-- We want the new experience to be tried first.
ALTER TABLE templates ADD COLUMN classic_parameter_flow BOOL NOT NULL DEFAULT false;

-- Existing templates will default to `true` for the classic parameter flow.
-- They will be incompatible with the new parameter flow until they are re-imported.
UPDATE templates SET classic_parameter_flow = true;

COMMENT ON COLUMN templates.classic_parameter_flow IS
'Determines whether to default to the dynamic parameter creation flow for this template '
'or continue using the legacy classic parameter creation flow.'
Expand Down
2 changes: 1 addition & 1 deletion codersdk/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ type UpdateTemplateMeta struct {
// "dynamic-parameters" enabled. This setting will live for a period after the experiment is
// made the default.
// An "opt-out" is present in case the new feature breaks some existing templates.
ClassicParameterFlow *bool `json:"dynamic_parameter_flow,omitempty"`
ClassicParameterFlow *bool `json:"classic_parameter_flow,omitempty"`
}

type TemplateExample struct {
Expand Down
2 changes: 2 additions & 0 deletions site/src/api/typesGenerated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const validationSchema = Yup.object({
allow_user_cancel_workspace_jobs: Yup.boolean(),
icon: iconValidator,
require_active_version: Yup.boolean(),
classic_parameter_flow: Yup.boolean(),
deprecation_message: Yup.string(),
max_port_sharing_level: Yup.string().oneOf(WorkspaceAppSharingLevels),
});
Expand Down Expand Up @@ -89,6 +90,7 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
deprecation_message: template.deprecation_message,
disable_everyone_group_access: false,
max_port_share_level: template.max_port_share_level,
classic_parameter_flow: template.classic_parameter_flow,
},
validationSchema,
onSubmit,
Expand Down Expand Up @@ -222,6 +224,33 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
</StackLabel>
}
/>
<FormControlLabel
control={
<Checkbox
size="small"
id="classic_parameter_flow"
name="classic_parameter_flow"
checked={form.values.classic_parameter_flow}
onChange={form.handleChange}
disabled={false}
/>
}
label={
<StackLabel>
Use classic workspace creation form
<StackLabelHelperText>
<span>
If enabled, users will see the original workspace creation experience without dynamic parameters or live form updates.
This is recommended if your provisioners haven&apos;t been updated for dynamic parameters, or if you&apos;re experiencing
issues or incorrect behavior with the new form.{" "}
<strong>
Users can always manually switch experiences in the workspace creation form.
</strong>
</span>
</StackLabelHelperText>
</StackLabel>
}
/>
</FormFields>
</FormSection>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const validFormValues: FormValues = {
require_active_version: false,
disable_everyone_group_access: false,
max_port_share_level: "owner",
classic_parameter_flow: false,
};

const renderTemplateSettingsPage = async () => {
Expand Down
1 change: 1 addition & 0 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ export const MockTemplate: TypesGen.Template = {
deprecated: false,
deprecation_message: "",
max_port_share_level: "public",
classic_parameter_flow: false
};

const MockTemplateVersionFiles: TemplateVersionFiles = {
Expand Down
Loading