mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
fix(site): Do not show template params if there is no param to be displayed (#7263)
This commit is contained in:
@ -135,6 +135,10 @@ export const CreateWorkspacePageView: FC<
|
|||||||
})
|
})
|
||||||
|
|
||||||
const isLoading = props.loadingTemplateSchema || props.loadingTemplates
|
const isLoading = props.loadingTemplateSchema || props.loadingTemplates
|
||||||
|
// We only want to show schema that have redisplay_value equals true
|
||||||
|
const schemaToBeDisplayed = props.templateSchema?.filter(
|
||||||
|
(schema) => schema.redisplay_value,
|
||||||
|
)
|
||||||
|
|
||||||
const getFieldHelpers = getFormHelpers<TypesGen.CreateWorkspaceRequest>(
|
const getFieldHelpers = getFormHelpers<TypesGen.CreateWorkspaceRequest>(
|
||||||
form,
|
form,
|
||||||
@ -271,16 +275,13 @@ export const CreateWorkspacePageView: FC<
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Template params */}
|
{/* Template params */}
|
||||||
{props.templateSchema && props.templateSchema.length > 0 && (
|
{schemaToBeDisplayed && schemaToBeDisplayed.length > 0 && (
|
||||||
<FormSection
|
<FormSection
|
||||||
title="Template params"
|
title="Template params"
|
||||||
description="These values are provided by your template's Terraform configuration."
|
description="These values are provided by your template's Terraform configuration."
|
||||||
>
|
>
|
||||||
<FormFields>
|
<FormFields>
|
||||||
{props.templateSchema
|
{schemaToBeDisplayed.map((schema) => (
|
||||||
// We only want to show schema that have redisplay_value equals true
|
|
||||||
.filter((schema) => schema.redisplay_value)
|
|
||||||
.map((schema) => (
|
|
||||||
<ParameterInput
|
<ParameterInput
|
||||||
disabled={form.isSubmitting}
|
disabled={form.isSubmitting}
|
||||||
key={schema.id}
|
key={schema.id}
|
||||||
|
Reference in New Issue
Block a user