Skip to content

fix: error messages from workspaceScheduleXService #3255

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 14 commits into from
Jul 28, 2022

Conversation

presleyp
Copy link
Contributor

@presleyp presleyp commented Jul 27, 2022

Addresses part of #3097

  • Surfaces errors from backend when submitting the schedule fails
  • Eliminates use of error snackbar for schedule; none of the use cases seemed to require dismissibility anyway
  • Extends form utils to allow you to match up backend and frontend fields with different names (in this case the backend sends ttl_ms but the frontend displays TTL in hours so it doesn't use the same name).
  • Renames variables in form utils for clarity.

Screen Shot 2022-07-27 at 6 55 58 PM

Screen Shot 2022-07-27 at 6 56 03 PM

Testing

Given I enter a number greater than my template allows (24 for coder-ts),
When I click Submit
Then I see an error message at the top of the page and a more specific message under the Time Until Shutdown field
(note that if the frontend validation is fixed by the time this is tested, there will only be a message under the field)

@presleyp presleyp marked this pull request as ready for review July 28, 2022 01:14
@presleyp presleyp requested a review from a team as a code owner July 28, 2022 01:14
@presleyp presleyp changed the title Schedule errors/presleyp/3097 fix: error messages from workspaceScheduleXService Jul 28, 2022
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

Looks great!

Copy link
Contributor

@AbhineetJain AbhineetJain 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 great! 🙌

@@ -49,7 +51,7 @@ export const getFormHelpers =
export const getFormHelpersWithError = <T>(
form: FormikContextType<T>,
error?: Error | unknown,
): ((name: keyof T, HelperText?: ReactNode) => FormHelpers) => {
): ((name: keyof T, HelperText?: ReactNode, errorName?: string) => FormHelpers) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Instead of ‘errorName’, we can call the argument field ‘fieldName’ or ‘backendFieldName’.

@presleyp presleyp merged commit 73f145e into main Jul 28, 2022
@presleyp presleyp deleted the schedule-errors/presleyp/3097 branch July 28, 2022 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants