Skip to content

feat: ui autostop extension #1987

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 5 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
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
fixup! refactor: workspaceScheduleBanner -> ...Machine
  • Loading branch information
greyscaled committed Jun 2, 2022
commit 0b3abe0f94bff155c337eba87c2d0104402a0c42
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { action } from "@storybook/addon-actions"
import { Story } from "@storybook/react"
import dayjs from "dayjs"
import utc from "dayjs/plugin/utc"
Expand All @@ -16,7 +15,6 @@ const Template: Story<WorkspaceScheduleBannerProps> = (args) => <WorkspaceSchedu

export const Example = Template.bind({})
Example.args = {
__onExtend: action("extend"),
workspace: {
...Mocks.MockWorkspace,
latest_build: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const shouldDisplay = (workspace: TypesGen.Workspace): boolean => {
}
}

export const WorkspaceScheduleBanner: FC<WorkspaceScheduleBannerProps> = ({ __onExtend, workspace }) => {
export const WorkspaceScheduleBanner: FC<WorkspaceScheduleBannerProps> = ({ workspace }) => {
const [bannerState, bannerSend] = useMachine(workspaceScheduleBannerMachine)

if (!shouldDisplay(workspace)) {
Expand All @@ -48,11 +48,7 @@ export const WorkspaceScheduleBanner: FC<WorkspaceScheduleBannerProps> = ({ __on
color="inherit"
disabled={bannerState.hasTag("loading")}
onClick={() => {
if (__onExtend) {
__onExtend()
} else {
bannerSend({ type: "EXTEND_DEADLINE_DEFAULT", workspaceId: workspace.id })
}
bannerSend({ type: "EXTEND_DEADLINE_DEFAULT", workspaceId: workspace.id })
}}
size="small"
>
Expand Down