-
Notifications
You must be signed in to change notification settings - Fork 886
fix(site): disable autostart and autostop according to template settings #11809
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
Conversation
@@ -311,14 +315,14 @@ export const WorkspaceScheduleForm: FC< | |||
<Stack direction="row"> | |||
<TextField | |||
{...formHelpers("startTime")} | |||
disabled={isLoading || !form.values.autostartEnabled} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why we were looking at the form values here...I assume this was a typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's because that's where the state of the form is. So if someone turns on autostart, this is the place to check its value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, the disabled state matches their checkbox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching me here - I've fixed the attribute and added some test cases.
Down the road, we might want to reconsider the prop architecture of the form as it accepts initialValues
, and one could try to disable autostart
or autostop
using this prop, e.g. :
initialValues={{
autoStartEnabled: false
autoStopEnabled: false
}}
But this wouldn't affect the top toggle of each feature; only the secondary fields associated with them. So it's a bit of a bizarre API, but I'd rather not touch it in this PR.
✔️ PR 11809 Updated successfully.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM +1 for tests!
thank you for this @Kira-Pilot - wanted to check whether this PR also addresses the below:
|
That's great @Kira-Pilot . I noticed the week start day is different on Template and Workspace settings. It starts with Sunday vs Monday. Could you also align the week start day here? |
@matifali fixed! |
resolves #10930
resolves #10931
Deployed a PR below
Disabling these fields on a template level:

will disable them on a workspace level (but will not reset any workspace values set before disablement):

Similarly, when specific days of the week are allowed to be configured per the template:

only those days of the week are enabled in the workspace settings:
