Skip to content
Prev Previous commit
Next Next commit
update storybook
  • Loading branch information
johnstcn committed Jun 14, 2022
commit f5ce8a35bc5dc92784f9087eeb64af478af1b30e
Original file line number Diff line number Diff line change
Expand Up @@ -18,97 +18,51 @@ export default {

const Template: Story<WorkspaceScheduleFormProps> = (args) => <WorkspaceScheduleForm {...args} />

export const WorkspaceNotRunning = Template.bind({})
WorkspaceNotRunning.args = {
now: dayjs("2022-05-17T17:40:00Z"),
export const WorkspaceWillNotShutDown = Template.bind({})
WorkspaceWillNotShutDown.args = {
initialValues: {
...defaultWorkspaceSchedule(5),
timezone: "UTC",
},
workspace: {
...Mocks.MockWorkspace,
latest_build: {
...Mocks.MockWorkspaceBuild,
transition: "stop",
updated_at: "2022-05-17T17:39:00Z",
},
ttl: 0,
},
onCancel: () => action("onCancel"),
onSubmit: () => action("onSubmit"),
}

export const WorkspaceWillNotShutDown = Template.bind({})
WorkspaceWillNotShutDown.args = {
now: dayjs("2022-05-17T17:40:00Z"),
export const WorkspaceWillShutdownInAnHour = Template.bind({})
WorkspaceWillShutdownInAnHour.args = {
initialValues: {
...defaultWorkspaceSchedule(5),
timezone: "UTC",
ttl: 0,
},
workspace: {
...Mocks.MockWorkspace,
latest_build: {
...Mocks.MockWorkspaceBuild,
updated_at: "2022-05-17T17:39:00Z",
},
ttl: 1,
},
onCancel: () => action("onCancel"),
onSubmit: () => action("onSubmit"),
}

export const WorkspaceWillShutdown = Template.bind({})
WorkspaceWillShutdown.args = {
now: dayjs("2022-05-17T17:40:00Z"),
export const WorkspaceWillShutdownInTwoHours = Template.bind({})
WorkspaceWillShutdownInTwoHours.args = {
initialValues: {
...defaultWorkspaceSchedule(5),
timezone: "UTC",
},
workspace: {
...Mocks.MockWorkspace,
latest_build: {
...Mocks.MockWorkspaceBuild,
updated_at: "2022-05-17T17:39:00Z",
},
...defaultWorkspaceSchedule(2),
ttl: 2,
},
onCancel: () => action("onCancel"),
onSubmit: () => action("onSubmit"),
}

export const WorkspaceWillShutdownSoon = Template.bind({})
WorkspaceWillShutdownSoon.args = {
now: dayjs("2022-05-17T16:39:00Z"),
export const WorkspaceWillShutdownInADay = Template.bind({})
WorkspaceWillShutdownInADay.args = {
initialValues: {
...defaultWorkspaceSchedule(2),
timezone: "UTC",
ttl: 1,
},
workspace: {
...Mocks.MockWorkspace,
latest_build: {
...Mocks.MockWorkspaceBuild,
deadline: "2022-05-17T18:09:00Z",
},
ttl_ms: 2 * 60 * 60 * 1000, // 2 hours = shuts off at 18:09
ttl: 24,
},
onCancel: () => action("onCancel"),
onSubmit: () => action("onSubmit"),
}

export const WorkspaceWillShutdownImmediately = Template.bind({})
WorkspaceWillShutdownImmediately.args = {
now: dayjs("2022-05-17T17:09:00Z"),
export const WorkspaceWillShutdownInTwoDays = Template.bind({})
WorkspaceWillShutdownInTwoDays.args = {
initialValues: {
...defaultWorkspaceSchedule(1),
timezone: "UTC",
ttl: 1,
},
workspace: {
...Mocks.MockWorkspace,
latest_build: {
...Mocks.MockWorkspaceBuild,
deadline: "2022-05-17T18:09:00Z",
},
ttl_ms: 2 * 60 * 60 * 1000, // 2 hours = shuts off at 18:09
...defaultWorkspaceSchedule(2),
ttl: 48,
},
onCancel: () => action("onCancel"),
onSubmit: () => action("onSubmit"),
Expand Down