Skip to content

feat: offer to restart workspace when ttl is changed #5391

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 19 commits into from
Dec 21, 2022
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
Format
  • Loading branch information
presleyp committed Dec 12, 2022
commit 700593048a32ee662d9c27220a10cb29c45f56f4
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { MockUser, MockWorkspace, renderWithAuth } from "testHelpers/renderHelpers"
import {
MockUser,
MockWorkspace,
renderWithAuth,
} from "testHelpers/renderHelpers"
import userEvent from "@testing-library/user-event"
import { screen } from "@testing-library/react"
import {
Expand Down Expand Up @@ -256,14 +260,16 @@ describe("WorkspaceSchedulePage", () => {
it("shows if autoStop is changed", async () => {
renderWithAuth(<WorkspaceSchedulePage />, {
route: `/@${MockUser.username}/${MockWorkspace.name}/schedule`,
path: "/@:username/:workspace/schedule"
path: "/@:username/:workspace/schedule",
})
const user = userEvent.setup()
const autoStopToggle = await screen.findByLabelText(
FormLanguage.stopSwitch,
)
await user.click(autoStopToggle)
const submitButton = await screen.findByRole("button", { name: /submit/i })
const submitButton = await screen.findByRole("button", {
name: /submit/i,
})
await user.click(submitButton)
const dialog = await screen.findByText(PageLanguage.dialogTitle)
expect(dialog).toBeInTheDocument()
Expand All @@ -272,14 +278,16 @@ describe("WorkspaceSchedulePage", () => {
it("doesn't show if autoStop is not changed", async () => {
renderWithAuth(<WorkspaceSchedulePage />, {
route: `/@${MockUser.username}/${MockWorkspace.name}/schedule`,
path: "/@:username/:workspace/schedule"
path: "/@:username/:workspace/schedule",
})
const user = userEvent.setup()
const autoStartToggle = await screen.findByLabelText(
FormLanguage.startSwitch,
)
await user.click(autoStartToggle)
const submitButton = await screen.findByRole("button", { name: /submit/i })
const submitButton = await screen.findByRole("button", {
name: /submit/i,
})
await user.click(submitButton)
const dialog = screen.queryByText(PageLanguage.dialogTitle)
expect(dialog).not.toBeInTheDocument()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export const WorkspaceSchedulePage: React.FC = () => {
return (
<WorkspaceScheduleForm
submitScheduleError={submitScheduleError}
initialValues={{ ...getAutoStart(workspace), ...getAutoStop(workspace) }}
initialValues={{
...getAutoStart(workspace),
...getAutoStop(workspace),
}}
isLoading={scheduleState.tags.has("loading")}
onCancel={() => {
navigate(`/@${username}/${workspaceName}`)
Expand Down
2 changes: 1 addition & 1 deletion site/src/testHelpers/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const handlers = [
const permissions = [
...Object.keys(permissionsToCheck),
"canUpdateTemplate",
"updateWorkspace"
"updateWorkspace",
]
const response = permissions.reduce((obj, permission) => {
return {
Expand Down