Skip to content

Commit 4558066

Browse files
committed
Fetch default ttl - wip
1 parent 5a568d8 commit 4558066

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

site/src/components/WorkspaceScheduleForm/WorkspaceScheduleForm.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
defaultSchedule,
2222
emptySchedule,
2323
} from "pages/WorkspaceSchedulePage/schedule"
24-
import { defaultTTL } from "pages/WorkspaceSchedulePage/ttl"
2524
import { ChangeEvent, FC } from "react"
2625
import * as Yup from "yup"
2726
import { getFormHelpers } from "../../util/formUtils"
@@ -81,6 +80,7 @@ export interface WorkspaceScheduleFormProps {
8180
onSubmit: (values: WorkspaceScheduleFormValues) => void
8281
// for storybook
8382
initialTouched?: FormikTouched<WorkspaceScheduleFormValues>
83+
defaultTTL: number
8484
}
8585

8686
export interface WorkspaceScheduleFormValues {
@@ -192,6 +192,7 @@ export const WorkspaceScheduleForm: FC<
192192
onCancel,
193193
onSubmit,
194194
initialTouched,
195+
defaultTTL
195196
}) => {
196197
const styles = useStyles()
197198

site/src/pages/WorkspaceSchedulePage/WorkspaceSchedulePage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const WorkspaceSchedulePage: React.FC = () => {
3535
getWorkspaceError,
3636
permissions,
3737
workspace,
38+
template
3839
} = scheduleState.context
3940

4041
// Get workspace on mount and whenever the args for getting a workspace change.
@@ -103,6 +104,7 @@ export const WorkspaceSchedulePage: React.FC = () => {
103104
submitScheduleError={submitScheduleError}
104105
initialValues={{ ...autoStart, ...autoStop }}
105106
isLoading={scheduleState.tags.has("loading")}
107+
defaultTTL={template.default_ttl_ms}
106108
onCancel={() => {
107109
navigate(`/@${username}/${workspaceName}`)
108110
}}

site/src/pages/WorkspaceSchedulePage/ttl.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ export interface AutoStop {
55

66
export const emptyTTL = 0
77

8-
export const defaultTTL = 12
9-
108
const msToHours = (ms: number) => Math.round(ms / (1000 * 60 * 60))
119

1210
export const ttlMsToAutoStop = (ttl_ms?: number): AutoStop =>

0 commit comments

Comments
 (0)