Skip to content

feat: allow autostop to be specified in minutes and seconds #10707

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 2 commits into from
Nov 15, 2023

Conversation

Kira-Pilot
Copy link
Member

resolves #10183

@Kira-Pilot Kira-Pilot requested review from a team and Parkreiner and removed request for a team November 14, 2023 22:42
Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

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

This looks good! Just had one question about possible edge cases in the input validation

@@ -404,7 +399,7 @@ export const WorkspaceScheduleForm: FC<
<TextField
{...formHelpers("ttl", ttlShutdownAt(form.values.ttl), "ttl_ms")}
disabled={isLoading || !form.values.autostopEnabled}
inputProps={{ min: 0, step: 1 }}
inputProps={{ min: 0, step: "any" }}
Copy link
Member

@Parkreiner Parkreiner Nov 15, 2023

Choose a reason for hiding this comment

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

Since the validator got updated to remove the integer constraint, I'm guessing the step was changed to allow floats. Just want to make sure, though: are negative and zero steps are expected here?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Parkreiner Good eye! Don't worry - we still validate against negative and 0 inputs here.

I am using a step of 'any' because this defaults to a step of 1 while still allowing for floats.

@Kira-Pilot Kira-Pilot merged commit 38163ed into main Nov 15, 2023
@Kira-Pilot Kira-Pilot deleted the minute-autostop/kira-pilot branch November 15, 2023 16:01
@github-actions github-actions bot locked and limited conversation to collaborators Nov 15, 2023
@matifali
Copy link
Member

@Kira-Pilot, how do we do this from the UI? The auto stop increment/decrement only allows hours as per the latest dev.coder.com
image

@Kira-Pilot
Copy link
Member Author

@matifali the autostop setting in the workspace schedule form accepts floats now, e.g:
Screenshot 2023-11-30 at 10 01 20 AM

I will create a follow-up PR for the widget in your screenshot.

@Kira-Pilot
Copy link
Member Author

@matifali after some further testing, seems like the BE isn't accepting floats, so I am going to reopen this ticket and work on it this sprint.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow autostop timeout to be specified in minutes
3 participants