Skip to content

refactor(site): Highlight immutable parameters and do a few tweaks #6490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 8, 2023
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
Fix tests
  • Loading branch information
BrunoQuaresma committed Mar 8, 2023
commit 134ba0ea48675f25adb51058e3b08548609792d2
5 changes: 2 additions & 3 deletions site/src/components/RichParameterInput/RichParameterInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import FormControlLabel from "@material-ui/core/FormControlLabel"
import Radio from "@material-ui/core/Radio"
import RadioGroup from "@material-ui/core/RadioGroup"
import { makeStyles } from "@material-ui/core/styles"
import TextField from "@material-ui/core/TextField"
import TextField, { TextFieldProps } from "@material-ui/core/TextField"
import { Stack } from "components/Stack/Stack"
import { FC, useState } from "react"
import { TemplateVersionParameter } from "../../api/typesGenerated"
Expand Down Expand Up @@ -50,9 +50,8 @@ const ParameterLabel: FC<ParameterLabelProps> = ({ id, parameter }) => {
)
}

export interface RichParameterInputProps {
export type RichParameterInputProps = TextFieldProps & {
index: number
disabled?: boolean
parameter: TemplateVersionParameter
onChange: (value: string) => void
initialValue?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ describe("CreateWorkspacePage", () => {

const secondParameterField = await screen.findByLabelText(
MockTemplateVersionParameter2.name,
{ exact: false },
)
expect(secondParameterField).toBeDefined()

Expand Down Expand Up @@ -212,6 +213,7 @@ describe("CreateWorkspacePage", () => {

const thirdParameterField = await screen.findByLabelText(
MockTemplateVersionParameter3.name,
{ exact: false },
)
expect(thirdParameterField).toBeDefined()
fireEvent.change(thirdParameterField, {
Expand Down
13 changes: 4 additions & 9 deletions site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ export const CreateWorkspacePageView: FC<
{props.canCreateForUser && (
<FormSection
title="Workspace owner"
description=" The user that is going to own this workspace. If you are
admin, you can create workspace for others."
description="The user that is going to own this workspace. If you are admin, you can create workspace for others."
>
<FormFields>
<UserAutocomplete
Expand All @@ -250,8 +249,7 @@ export const CreateWorkspacePageView: FC<
{props.templateGitAuth && props.templateGitAuth.length > 0 && (
<FormSection
title="Git Authentication"
description="This template requires authentication to automatically perform
Git operations on create."
description="This template requires authentication to automatically perform Git operations on create."
>
<FormFields>
{props.templateGitAuth.map((auth, index) => (
Expand All @@ -271,8 +269,7 @@ export const CreateWorkspacePageView: FC<
{props.templateSchema && props.templateSchema.length > 0 && (
<FormSection
title="Template params"
description="Those values are provided by your template's Terraform
configuration."
description="Those values are provided by your template's Terraform configuration."
>
<FormFields>
{props.templateSchema
Expand Down Expand Up @@ -301,9 +298,7 @@ export const CreateWorkspacePageView: FC<
props.templateParameters.filter((p) => p.mutable).length > 0 && (
<FormSection
title="Parameters"
description="Those values are provided by your template's Terraform
configuration. Values can be changed after creating the
workspace."
description="Those values are provided by your template's Terraform configuration. Values can be changed after creating the workspace."
>
<FormFields>
{props.templateParameters.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ describe("WorkspaceBuildParametersPage", () => {

const firstParameter = await screen.findByLabelText(
MockTemplateVersionParameter1.name,
{ exact: false },
)
expect(firstParameter).toBeDefined()

const secondParameter = await screen.findByLabelText(
MockTemplateVersionParameter2.name,
{ exact: false },
)
expect(secondParameter).toBeDefined()
})
Expand Down Expand Up @@ -113,6 +115,7 @@ describe("WorkspaceBuildParametersPage", () => {

const secondParameterField = await screen.findByLabelText(
MockTemplateVersionParameter2.name,
{ exact: false },
)
expect(secondParameterField).toBeDefined()

Expand Down Expand Up @@ -151,6 +154,7 @@ describe("WorkspaceBuildParametersPage", () => {

const secondParameterField = await screen.findByLabelText(
MockTemplateVersionParameter2.name,
{ exact: false },
)
expect(secondParameterField).toBeDefined()

Expand Down Expand Up @@ -189,6 +193,7 @@ describe("WorkspaceBuildParametersPage", () => {

const secondParameterField = await screen.findByLabelText(
MockTemplateVersionParameter5.name,
{ exact: false },
)
expect(secondParameterField).toBeDefined()

Expand Down