Skip to content

fix: improve checkbox text in template schedule settings dialog #13669

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 4 commits into from
Jun 27, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { action } from "@storybook/addon-actions";
import type { Meta, StoryObj } from "@storybook/react";
import { ScheduleDialog } from "./ScheduleDialog";

const meta: Meta<typeof ScheduleDialog> = {
title: "pages/TemplateSettingsPage/ScheduleDialog",
component: ScheduleDialog,
args: {
onConfirm: action("onConfirm"),
onClose: action("onClose"),
open: true,
title: "Workspace Scheduling",
},
};

export default meta;
type Story = StoryObj<typeof ScheduleDialog>;

export const DormancyThreshold: Story = {
args: {
dormantValueChanged: true,
inactiveWorkspacesToGoDormant: 1,
inactiveWorkspacesToGoDormantInWeek: 5,
},
};

export const DormancyDeletion: Story = {
args: {
deletionValueChanged: true,
dormantWorkspacesToBeDeleted: 1,
dormantWorkspacesToBeDeletedInWeek: 5,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Interpolation, Theme } from "@emotion/react";
import Checkbox from "@mui/material/Checkbox";
import DialogActions from "@mui/material/DialogActions";
import FormControlLabel from "@mui/material/FormControlLabel";
import { Stack } from "@mui/system";
import type { FC } from "react";
import type { ConfirmDialogProps } from "components/Dialogs/ConfirmDialog/ConfirmDialog";
import { Dialog, DialogActionButtons } from "components/Dialogs/Dialog";
Expand Down Expand Up @@ -68,11 +67,18 @@ export const ScheduleDialog: FC<ScheduleDialogProps> = ({
<>
<h4>Dormancy Threshold</h4>
<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?
This change will result in{" "}
<strong>{inactiveWorkspacesToGoDormant}</strong>{" "}
{inactiveWorkspacesToGoDormant === 1
? "workspace"
: "workspaces"}{" "}
being immediately transitioned to the dormant state and{" "}
<strong>{inactiveWorkspacesToGoDormantInWeek}</strong>{" "}
{inactiveWorkspacesToGoDormantInWeek === 1
? "workspace"
: "workspaces"}{" "}
over the next 7 days. To prevent this, do you want to reset the
inactivity period for all template workspaces?
</p>
<FormControlLabel
css={{ marginTop: 16 }}
Expand All @@ -84,35 +90,40 @@ export const ScheduleDialog: FC<ScheduleDialogProps> = ({
}}
/>
}
label="Reset"
label="Prevent Dormancy - Reset all workspace inactivity periods"
/>
</>
)}

{showDeletionWarning && (
<>
<h4>Dormancy Auto-Deletion</h4>
<Stack direction="row" spacing={5}>
<p css={styles.dialogDescription}>
This change will result in {dormantWorkspacesToBeDeleted}{" "}
workspaces being immediately deleted and{" "}
{dormantWorkspacesToBeDeletedInWeek} over the next 7 days. To
prevent this, do you want to reset the dormancy period for all
template workspaces?
</p>
<FormControlLabel
css={{ marginTop: 16 }}
control={
<Checkbox
size="small"
onChange={(e) => {
updateDormantWorkspaces(e.target.checked);
}}
/>
}
label="Reset"
/>
</Stack>
<p css={styles.dialogDescription}>
This change will result in{" "}
<strong>{dormantWorkspacesToBeDeleted}</strong>{" "}
{dormantWorkspacesToBeDeleted === 1
? "workspace"
: "workspaces"}{" "}
being immediately deleted and{" "}
<strong>{dormantWorkspacesToBeDeletedInWeek}</strong>{" "}
{dormantWorkspacesToBeDeletedInWeek === 1
? "workspace"
: "workspaces"}{" "}
over the next 7 days. To prevent this, do you want to reset the
dormancy period for all template workspaces?
</p>
<FormControlLabel
css={{ marginTop: 16 }}
control={
<Checkbox
size="small"
onChange={(e) => {
updateDormantWorkspaces(e.target.checked);
}}
/>
}
label="Prevent Deletion - Reset all workspace dormancy periods"
/>
</>
)}
</>
Expand Down
Loading