Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0d34ca

Browse files
fix(site): fix error when loading workspaces with dormant (coder#11291)
1 parent 24080b1 commit e0d34ca

File tree

8 files changed

+31
-44
lines changed

8 files changed

+31
-44
lines changed

coderd/apidoc/docs.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/workspaces.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func (api *API) workspace(rw http.ResponseWriter, r *http.Request) {
118118
// @Security CoderSessionToken
119119
// @Produce json
120120
// @Tags Workspaces
121-
// @Param q query string false "Search query in the format `key:value`. Available keys are: owner, template, name, status, has-agent, is-dormant, last_used_after, last_used_before."
121+
// @Param q query string false "Search query in the format `key:value`. Available keys are: owner, template, name, status, has-agent, dormant, last_used_after, last_used_before."
122122
// @Param limit query int false "Page limit"
123123
// @Param offset query int false "Page offset"
124124
// @Success 200 {object} codersdk.WorkspacesResponse

docs/api/workspaces.md

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/components/Form/Form.tsx

+2-11
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,7 @@ export const FormSection: FC<
120120
}}
121121
className={classes.sectionInfo}
122122
>
123-
<h2
124-
css={[
125-
styles.formSectionInfoTitle,
126-
alpha && styles.formSectionInfoTitleAlpha,
127-
]}
128-
className={classes.infoTitle}
129-
>
123+
<h2 css={styles.formSectionInfoTitle} className={classes.infoTitle}>
130124
{title}
131125
{alpha && <AlphaBadge />}
132126
{deprecated && <DeprecatedBadge />}
@@ -154,14 +148,11 @@ const styles = {
154148
fontWeight: 400,
155149
margin: 0,
156150
marginBottom: 8,
157-
}),
158-
159-
formSectionInfoTitleAlpha: {
160151
display: "flex",
161152
flexDirection: "row",
162153
alignItems: "center",
163154
gap: 12,
164-
},
155+
}),
165156

166157
formSectionInfoDescription: (theme) => ({
167158
fontSize: 14,

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/ScheduleDialog.tsx

+19-23
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,25 @@ export const ScheduleDialog: FC<PropsWithChildren<ScheduleDialogProps>> = ({
6767
{showDormancyWarning && (
6868
<>
6969
<h4>Dormancy Threshold</h4>
70-
<Stack direction="row" spacing={5}>
71-
<div css={styles.dialogDescription}>
72-
This change will result in {inactiveWorkspacesToGoDormant}{" "}
73-
workspaces being immediately transitioned to the dormant state
74-
and {inactiveWorkspacesToGoDormantInWeek} over the next seven
75-
days. To prevent this, do you want to reset the inactivity
76-
period for all template workspaces?
77-
</div>
78-
<FormControlLabel
79-
css={{ marginTop: 16 }}
80-
control={
81-
<Checkbox
82-
size="small"
83-
onChange={(e) => {
84-
updateInactiveWorkspaces(e.target.checked);
85-
}}
86-
/>
87-
}
88-
label="Reset"
89-
/>
90-
</Stack>
70+
<p css={styles.dialogDescription}>
71+
This change will result in {inactiveWorkspacesToGoDormant}{" "}
72+
workspaces being immediately transitioned to the dormant state
73+
and {inactiveWorkspacesToGoDormantInWeek} over the next seven
74+
days. To prevent this, do you want to reset the inactivity
75+
period for all template workspaces?
76+
</p>
77+
<FormControlLabel
78+
css={{ marginTop: 16 }}
79+
control={
80+
<Checkbox
81+
size="small"
82+
onChange={(e) => {
83+
updateInactiveWorkspaces(e.target.checked);
84+
}}
85+
/>
86+
}
87+
label="Reset"
88+
/>
9189
</>
9290
)}
9391

@@ -140,8 +138,6 @@ const styles = {
140138
"& .MuiPaper-root": {
141139
background: theme.palette.background.paper,
142140
border: `1px solid ${theme.palette.divider}`,
143-
width: "100%",
144-
maxWidth: 1000,
145141
},
146142
"& .MuiDialogActions-spacing": {
147143
padding: "0 40px 40px",

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateScheduleForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
427427
description="Define the maximum lifetime for workspaces created from this template."
428428
deprecated
429429
>
430-
<Stack direction="column">
430+
<Stack direction="column" spacing={4}>
431431
<Stack direction="row" alignItems="center">
432432
<FormControlLabel
433433
control={

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/useWorkspacesToBeDeleted.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const useWorkspacesToBeDeleted = (
4444
const { data } = useWorkspacesData({
4545
page: 0,
4646
limit: 0,
47-
query: "template:" + template.name + " is-dormant:true",
47+
query: "template:" + template.name + " dormant:true",
4848
});
4949
return data?.workspaces?.filter((workspace: Workspace) => {
5050
if (!workspace.dormant_at || !formValues.time_til_dormant_autodelete_ms) {

0 commit comments

Comments
 (0)