Skip to content

fix: use template default ttl when enabling auto-stop #5494

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 6 commits into from
Dec 22, 2022
Merged
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
Convert ms to hours
  • Loading branch information
presleyp committed Dec 21, 2022
commit 01780a42bf2ac3c6d4bcca1e202f03c2e5ceedd5
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useMachine } from "@xstate/react"
import { AlertBanner } from "components/AlertBanner/AlertBanner"
import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog"
import { Margins } from "components/Margins/Margins"
import dayjs from "dayjs"
import { scheduleToAutoStart } from "pages/WorkspaceSchedulePage/schedule"
import { ttlMsToAutoStop } from "pages/WorkspaceSchedulePage/ttl"
import React, { useEffect } from "react"
Expand Down Expand Up @@ -61,7 +62,7 @@ export const WorkspaceSchedulePage: React.FC = () => {
return <Navigate to="/workspaces" />
}

if (scheduleState.hasTag("loading")) {
if (scheduleState.hasTag("loading") || !template) {
return <FullScreenLoader />
}

Expand Down Expand Up @@ -105,7 +106,7 @@ export const WorkspaceSchedulePage: React.FC = () => {
...getAutoStop(workspace),
}}
isLoading={scheduleState.tags.has("loading")}
defaultTTL={template.default_ttl_ms}
defaultTTL={dayjs.duration(template.default_ttl_ms, "ms").asHours()}
onCancel={() => {
navigate(`/@${username}/${workspaceName}`)
}}
Expand Down