mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): fix error when loading workspaces with dormant (#11291)
This commit is contained in:
Generated
+1
-1
@@ -6331,7 +6331,7 @@ const docTemplate = `{
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Search query in the format ` + "`" + `key:value` + "`" + `. Available keys are: owner, template, name, status, has-agent, is-dormant, last_used_after, last_used_before.",
|
||||
"description": "Search query in the format ` + "`" + `key:value` + "`" + `. Available keys are: owner, template, name, status, has-agent, dormant, last_used_after, last_used_before.",
|
||||
"name": "q",
|
||||
"in": "query"
|
||||
},
|
||||
|
||||
Generated
+1
-1
@@ -5577,7 +5577,7 @@
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Search query in the format `key:value`. Available keys are: owner, template, name, status, has-agent, is-dormant, last_used_after, last_used_before.",
|
||||
"description": "Search query in the format `key:value`. Available keys are: owner, template, name, status, has-agent, dormant, last_used_after, last_used_before.",
|
||||
"name": "q",
|
||||
"in": "query"
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
Generated
+5
-5
@@ -457,11 +457,11 @@ curl -X GET http://coder-server:8080/api/v2/workspaces \
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | In | Type | Required | Description |
|
||||
| -------- | ----- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `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. |
|
||||
| `limit` | query | integer | false | Page limit |
|
||||
| `offset` | query | integer | false | Page offset |
|
||||
| Name | In | Type | Required | Description |
|
||||
| -------- | ----- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `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. |
|
||||
| `limit` | query | integer | false | Page limit |
|
||||
| `offset` | query | integer | false | Page offset |
|
||||
|
||||
### Example responses
|
||||
|
||||
|
||||
@@ -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 />}
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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={
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user