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

Skip to content

fix(site): fix error when loading workspaces with dormant #11291

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 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion coderd/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (api *API) workspace(rw http.ResponseWriter, r *http.Request) {
// @Security CoderSessionToken
// @Produce json
// @Tags Workspaces
// @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."
// @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."
// @Param limit query int false "Page limit"
// @Param offset query int false "Page offset"
// @Success 200 {object} codersdk.WorkspacesResponse
Expand Down
10 changes: 5 additions & 5 deletions docs/api/workspaces.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 2 additions & 11 deletions site/src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,7 @@ export const FormSection: FC<
}}
className={classes.sectionInfo}
>
<h2
css={[
styles.formSectionInfoTitle,
alpha && styles.formSectionInfoTitleAlpha,
]}
className={classes.infoTitle}
>
<h2 css={styles.formSectionInfoTitle} className={classes.infoTitle}>
{title}
{alpha && <AlphaBadge />}
{deprecated && <DeprecatedBadge />}
Expand Down Expand Up @@ -154,14 +148,11 @@ const styles = {
fontWeight: 400,
margin: 0,
marginBottom: 8,
}),

formSectionInfoTitleAlpha: {
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: 12,
},
}),

formSectionInfoDescription: (theme) => ({
fontSize: 14,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,25 @@ export const ScheduleDialog: FC<PropsWithChildren<ScheduleDialogProps>> = ({
{showDormancyWarning && (
<>
<h4>Dormancy Threshold</h4>
<Stack direction="row" spacing={5}>
<div css={styles.dialogDescription}>
This change will result in {inactiveWorkspacesToGoDormant}{" "}
workspaces being immediately transitioned to the dormant state
and {inactiveWorkspacesToGoDormantInWeek} over the next seven
days. To prevent this, do you want to reset the inactivity
period for all template workspaces?
</div>
<FormControlLabel
css={{ marginTop: 16 }}
control={
<Checkbox
size="small"
onChange={(e) => {
updateInactiveWorkspaces(e.target.checked);
}}
/>
}
label="Reset"
/>
</Stack>
<p css={styles.dialogDescription}>
This change will result in {inactiveWorkspacesToGoDormant}{" "}
workspaces being immediately transitioned to the dormant state
and {inactiveWorkspacesToGoDormantInWeek} over the next seven
days. To prevent this, do you want to reset the inactivity
period for all template workspaces?
</p>
<FormControlLabel
css={{ marginTop: 16 }}
control={
<Checkbox
size="small"
onChange={(e) => {
updateInactiveWorkspaces(e.target.checked);
}}
/>
}
label="Reset"
/>
</>
)}

Expand Down Expand Up @@ -140,8 +138,6 @@ const styles = {
"& .MuiPaper-root": {
background: theme.palette.background.paper,
border: `1px solid ${theme.palette.divider}`,
width: "100%",
maxWidth: 1000,
},
"& .MuiDialogActions-spacing": {
padding: "0 40px 40px",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
description="Define the maximum lifetime for workspaces created from this template."
deprecated
>
<Stack direction="column">
<Stack direction="column" spacing={4}>
<Stack direction="row" alignItems="center">
<FormControlLabel
control={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const useWorkspacesToBeDeleted = (
const { data } = useWorkspacesData({
page: 0,
limit: 0,
query: "template:" + template.name + " is-dormant:true",
query: "template:" + template.name + " dormant:true",
});
return data?.workspaces?.filter((workspace: Workspace) => {
if (!workspace.dormant_at || !formValues.time_til_dormant_autodelete_ms) {
Expand Down