From ff48adf8a1daef0c490982999894f77d3e35dc5f Mon Sep 17 00:00:00 2001 From: Presley Pizzo Date: Tue, 2 Aug 2022 14:43:21 +0000 Subject: [PATCH] Update storybook --- .../WorkspaceScheduleForm.stories.tsx | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/site/src/components/WorkspaceScheduleForm/WorkspaceScheduleForm.stories.tsx b/site/src/components/WorkspaceScheduleForm/WorkspaceScheduleForm.stories.tsx index 811a616c47..e6e2e96137 100644 --- a/site/src/components/WorkspaceScheduleForm/WorkspaceScheduleForm.stories.tsx +++ b/site/src/components/WorkspaceScheduleForm/WorkspaceScheduleForm.stories.tsx @@ -3,12 +3,10 @@ import dayjs from "dayjs" import advancedFormat from "dayjs/plugin/advancedFormat" import timezone from "dayjs/plugin/timezone" import utc from "dayjs/plugin/utc" +import { defaultSchedule, emptySchedule } from "pages/WorkspacesPage/schedule" +import { emptyTTL } from "pages/WorkspacesPage/ttl" import { makeMockApiError } from "testHelpers/entities" -import { - defaultWorkspaceSchedule, - WorkspaceScheduleForm, - WorkspaceScheduleFormProps, -} from "./WorkspaceScheduleForm" +import { WorkspaceScheduleForm, WorkspaceScheduleFormProps } from "./WorkspaceScheduleForm" dayjs.extend(advancedFormat) dayjs.extend(utc) @@ -24,53 +22,51 @@ export default { onSubmit: { action: "onSubmit", }, + toggleAutoStart: { + action: "toggleAutoStart", + }, + toggleAutoStop: { + action: "toggleAutoStop", + }, }, } const Template: Story = (args) => -export const WorkspaceWillNotShutDown = Template.bind({}) -WorkspaceWillNotShutDown.args = { - initialValues: { - ...defaultWorkspaceSchedule(5), - ttl: 0, - }, +export const AllDisabled = Template.bind({}) +AllDisabled.args = { + autoStart: { enabled: false, schedule: emptySchedule }, + autoStop: { enabled: false, ttl: emptyTTL }, } -export const WorkspaceWillShutdownInAnHour = Template.bind({}) -WorkspaceWillShutdownInAnHour.args = { - initialValues: { - ...defaultWorkspaceSchedule(5), - ttl: 1, - }, +export const AutoStart = Template.bind({}) +AutoStart.args = { + autoStart: { enabled: true, schedule: defaultSchedule() }, + autoStop: { enabled: false, ttl: emptyTTL }, } export const WorkspaceWillShutdownInTwoHours = Template.bind({}) WorkspaceWillShutdownInTwoHours.args = { - initialValues: { - ...defaultWorkspaceSchedule(2), - ttl: 2, - }, + autoStart: { enabled: true, schedule: defaultSchedule() }, + autoStop: { enabled: true, ttl: 2 }, } export const WorkspaceWillShutdownInADay = Template.bind({}) WorkspaceWillShutdownInADay.args = { - initialValues: { - ...defaultWorkspaceSchedule(2), - ttl: 24, - }, + autoStart: { enabled: true, schedule: defaultSchedule() }, + autoStop: { enabled: true, ttl: 24 }, } export const WorkspaceWillShutdownInTwoDays = Template.bind({}) WorkspaceWillShutdownInTwoDays.args = { - initialValues: { - ...defaultWorkspaceSchedule(2), - ttl: 48, - }, + autoStart: { enabled: true, schedule: defaultSchedule() }, + autoStop: { enabled: true, ttl: 48 }, } export const WithError = Template.bind({}) WithError.args = { + autoStart: { enabled: false, schedule: emptySchedule }, + autoStop: { enabled: true, ttl: 100 }, initialTouched: { ttl: true }, submitScheduleError: makeMockApiError({ message: "Something went wrong.", @@ -79,4 +75,8 @@ WithError.args = { } export const Loading = Template.bind({}) -Loading.args = { isLoading: true } +Loading.args = { + autoStart: { enabled: true, schedule: defaultSchedule() }, + autoStop: { enabled: true, ttl: 2 }, + isLoading: true, +}