Skip to content

feat: add all safe experiments to the deployment page #10276

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 15 commits into from
Oct 17, 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
Next Next commit
altered design
  • Loading branch information
Kira-Pilot committed Oct 17, 2023
commit 42e8bd6da5e8a03e434075ba6f7c17a1546a9ce6
2 changes: 1 addition & 1 deletion coderd/coderd.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ func New(options *Options) *API {
})
r.Route("/experiments", func(r chi.Router) {
r.Use(apiKeyMiddleware)
r.Get("/available", api.handleExperimentsSafe)
r.Get("/available", handleExperimentsSafe)
r.Get("/", api.handleExperimentsGet)
})
r.Get("/updatecheck", api.updateCheck)
Expand Down
2 changes: 1 addition & 1 deletion coderd/experiments.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (api *API) handleExperimentsGet(rw http.ResponseWriter, r *http.Request) {
// @Tags General
// @Success 200 {array} codersdk.Experiment
// @Router /experiments/available [get]
func (api *API) handleExperimentsSafe(rw http.ResponseWriter, r *http.Request) {
func handleExperimentsSafe(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
httpapi.Write(ctx, rw, http.StatusOK, codersdk.AvailableExperiments{
Safe: codersdk.ExperimentsAll,
Expand Down
18 changes: 13 additions & 5 deletions site/src/components/DeploySettingsLayout/Option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
const listStyles = css`
margin: 0,
padding: 0,
listStylePosition: "inside",
display: "flex",
flexDirection: "column",
gap: theme.spacing(0.5),
Expand All @@ -84,18 +83,26 @@ export const OptionValue: FC<OptionValueProps> = (props) => {

if (typeof children === "object" && !Array.isArray(children)) {
return (
<ul css={listStyles}>
<ul css={listStyles && { listStyle: "none" }}>
{Object.entries(children)
.sort((a, b) => a[0].localeCompare(b[0]))
.map(([option, isEnabled]) => (
<li key={option} css={optionStyles}>
<li
key={option}
css={
optionStyles &&
!isEnabled && {
marginLeft: "32px",
color: theme.palette.text.disabled,
}
}
>
<Box
sx={{
display: "inline-flex",
alignItems: "center",
}}
>
{option}
{isEnabled && (
<CheckCircleOutlined
sx={{
Expand All @@ -106,6 +113,7 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
}}
/>
)}
{option}
</Box>
</li>
))}
Expand All @@ -115,7 +123,7 @@ export const OptionValue: FC<OptionValueProps> = (props) => {

if (Array.isArray(children)) {
return (
<ul css={listStyles}>
<ul css={listStyles && { listStylePosition: "inside" }}>
{children.map((item) => (
<li key={item} css={optionStyles}>
{item}
Expand Down