Skip to content

chore: refactor time.Duration -> int64 milliseconds for FE consumption #1944

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 8 commits into from
Jun 2, 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
update storybook
  • Loading branch information
johnstcn committed Jun 2, 2022
commit 1b37ad66151c9dea3a0b8f3d920463feb075fac6
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ export default {

const Template: Story<WorkspaceScheduleProps> = (args) => <WorkspaceSchedule {...args} />

export const NoScheduleNoTTL = Template.bind({})
NoScheduleNoTTL.args = {
workspace: {
...Mocks.MockWorkspace,

latest_build: {
...Mocks.MockWorkspaceBuild,
transition: "stop",
},
autostart_schedule: undefined,
ttl_ms: undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unfamiliar with stories, but since we're using omitempty, should we perhaps not define these here? There's a slight change in semantic meaning between x: undefined and omitting it entirely. In the former case, the key is defined on the object and does not mimic API behavior 1:1.

},
}

export const NoTTL = Template.bind({})
NoTTL.args = {
workspace: {
Expand All @@ -29,7 +43,7 @@ NoTTL.args = {
// SEE: #1834
deadline: "0001-01-01T00:00:00Z",
},
ttl: undefined,
ttl_ms: undefined,
},
}

Expand All @@ -42,7 +56,7 @@ ShutdownSoon.args = {
deadline: dayjs().add(ONE, "hour").utc().format(),
transition: "start",
},
ttl: 2 * 60 * 60 * 1000 * 1_000_000, // 2 hours
ttl_ms: 2 * 60 * 60 * 1000 // 2 hours
},
}

Expand All @@ -56,7 +70,7 @@ ShutdownLong.args = {
deadline: dayjs().add(SEVEN, "days").utc().format(),
transition: "start",
},
ttl: 7 * 24 * 60 * 60 * 1000 * 1_000_000, // 7 days
ttl_ms: 7 * 24 * 60 * 60 * 1000 // 7 days
},
}

Expand All @@ -69,7 +83,7 @@ WorkspaceOffShort.args = {
...Mocks.MockWorkspaceBuild,
transition: "stop",
},
ttl: 2 * 60 * 60 * 1000 * 1_000_000, // 2 hours
ttl_ms: 2 * 60 * 60 * 1000, // 2 hours
},
}

Expand All @@ -82,6 +96,6 @@ WorkspaceOffLong.args = {
...Mocks.MockWorkspaceBuild,
transition: "stop",
},
ttl: 2 * 365 * 24 * 60 * 60 * 1000 * 1_000_000, // 2 years
ttl_ms: 2 * 365 * 24 * 60 * 60 * 1000, // 2 years
},
}