-
Notifications
You must be signed in to change notification settings - Fork 943
feat(site): add build parameters option when starting or restarting a workspace #8524
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
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5334762
Add base for ephemeral form
BrunoQuaresma 6872b63
Make fields look better
BrunoQuaresma c4984b8
Add empty state
BrunoQuaresma 606b5ea
Merge branch 'main' into bq/ephemeral-parameter
matifali fddfead
Merge branch 'main' into bq/ephemeral-parameter
BrunoQuaresma 36e5c8c
Fix initial values
BrunoQuaresma 1269df1
Remove context value
BrunoQuaresma f5a820b
Add ephemeral parameters section
BrunoQuaresma 09f40e3
Merge branch 'bq/ephemeral-parameter' of https://github.com/coder/cod…
BrunoQuaresma e172354
Merge branch 'main' into bq/ephemeral-parameter
mtojek 98fd6f8
Don't show ephemeral parameters on create form
BrunoQuaresma e4f1a3c
Merge branch 'bq/ephemeral-parameter' of https://github.com/coder/cod…
BrunoQuaresma 469dca2
Minor improvements
BrunoQuaresma e4d9243
Fix circular json error
BrunoQuaresma 5d35955
Always use default values for ephemeral parameters
BrunoQuaresma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add base for ephemeral form
- Loading branch information
commit 5334762aa7b1b00d9c0e4a984af61a873a177bb8
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
import { FC } from "react" | ||
import { forwardRef } from "react" | ||
import MuiLoadingButton, { | ||
LoadingButtonProps as MuiLoadingButtonProps, | ||
} from "@mui/lab/LoadingButton" | ||
|
||
export type LoadingButtonProps = MuiLoadingButtonProps | ||
|
||
export const LoadingButton: FC<LoadingButtonProps> = ({ | ||
children, | ||
loadingIndicator, | ||
...buttonProps | ||
}) => { | ||
export const LoadingButton = forwardRef< | ||
HTMLButtonElement, | ||
MuiLoadingButtonProps | ||
>(({ children, loadingIndicator, ...buttonProps }, ref) => { | ||
return ( | ||
<MuiLoadingButton variant="outlined" color="neutral" {...buttonProps}> | ||
<MuiLoadingButton | ||
variant="outlined" | ||
color="neutral" | ||
ref={ref} | ||
{...buttonProps} | ||
> | ||
{/* known issue: https://github.com/mui/material-ui/issues/27853 */} | ||
<span> | ||
{buttonProps.loading && loadingIndicator ? loadingIndicator : children} | ||
</span> | ||
</MuiLoadingButton> | ||
) | ||
} | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
site/src/components/WorkspaceActions/BuildParametersPopover.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { | ||
TemplateVersionParameter, | ||
WorkspaceBuildParameter, | ||
} from "api/typesGenerated" | ||
import { RichParameterInput } from "components/RichParameterInput/RichParameterInput" | ||
import { useFormik } from "formik" | ||
import { getFormHelpers } from "utils/formUtils" | ||
import { getInitialParameterValues } from "utils/richParameters" | ||
|
||
export const BuildParametersForm = ({ | ||
ephemeralParameters, | ||
buildParameters, | ||
}: { | ||
ephemeralParameters: TemplateVersionParameter[] | ||
buildParameters: WorkspaceBuildParameter[] | ||
}) => { | ||
const form = useFormik({ | ||
initialValues: { | ||
rich_parameter_values: getInitialParameterValues( | ||
ephemeralParameters, | ||
buildParameters, | ||
), | ||
}, | ||
onSubmit: () => {}, | ||
}) | ||
const getFieldHelpers = getFormHelpers(form) | ||
|
||
return ( | ||
<form action=""> | ||
{ephemeralParameters.map((parameter, index) => { | ||
return ( | ||
<RichParameterInput | ||
{...getFieldHelpers("rich_parameter_values[" + index + "].value")} | ||
key={parameter.name} | ||
parameter={parameter} | ||
initialValue="" | ||
index={index} | ||
onChange={async (value) => { | ||
await form.setFieldValue(`rich_parameter_values[${index}]`, { | ||
name: parameter.name, | ||
value: value, | ||
}) | ||
}} | ||
/> | ||
) | ||
})} | ||
</form> | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.