Skip to content
Merged
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
37 changes: 19 additions & 18 deletions site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export const CreateWorkspacePageView: FC<
})

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,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linked bug ticket mentions that terraform values set to sensitive shouldn't appear in the UI. Does the sensitive key map to redisplay_value or is this something we have to check for separately?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap, it should do!


const getFieldHelpers = getFormHelpers<TypesGen.CreateWorkspaceRequest>(
form,
Expand Down Expand Up @@ -271,29 +275,26 @@ export const CreateWorkspacePageView: FC<
)}

{/* Template params */}
{props.templateSchema && props.templateSchema.length > 0 && (
{schemaToBeDisplayed && schemaToBeDisplayed.length > 0 && (
<FormSection
title="Template params"
description="These values are provided by your template's Terraform configuration."
>
<FormFields>
{props.templateSchema
// We only want to show schema that have redisplay_value equals true
.filter((schema) => schema.redisplay_value)
.map((schema) => (
<ParameterInput
disabled={form.isSubmitting}
key={schema.id}
defaultValue={parameterValues[schema.name]}
onChange={(value) => {
setParameterValues({
...parameterValues,
[schema.name]: value,
})
}}
schema={schema}
/>
))}
{schemaToBeDisplayed.map((schema) => (
<ParameterInput
disabled={form.isSubmitting}
key={schema.id}
defaultValue={parameterValues[schema.name]}
onChange={(value) => {
setParameterValues({
...parameterValues,
[schema.name]: value,
})
}}
schema={schema}
/>
))}
</FormFields>
</FormSection>
)}
Expand Down