Skip to content
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

Validate widget state before save #81729

Closed
narsaynorath opened this issue Dec 5, 2024 · 2 comments
Closed

Validate widget state before save #81729

narsaynorath opened this issue Dec 5, 2024 · 2 comments

Comments

@narsaynorath
Copy link
Member

The widget should be validated before saving so we can block an attempt at saving something malformed. This also trickles down to features related to on-demand

@getsantry
Copy link
Contributor

getsantry bot commented Dec 6, 2024

Routing to @getsentry/product-owners-dashboards for triage ⏲️

@wmak wmak assigned wmak and unassigned wmak Dec 13, 2024
@nikkikapadia nikkikapadia self-assigned this Jan 2, 2025
nikkikapadia added a commit that referenced this issue Jan 3, 2025
We're reusing the `validateWidget` function that is being used in the
current widget builder. I've added that validation check to the save
button so it will validate before carrying out the saving and closing
process. When the widget is not valid it displays the message as such:

<img width="1292" alt="image"
src="https://github.com/user-attachments/assets/78698bd0-186b-4454-a870-f5f3479ad5db"
/>

In future PRs I will implement field highlighting for the fields that
are causing validation errors.

Related to #81729
nikkikapadia added a commit that referenced this issue Jan 6, 2025
Add an error field to the widget builder state. It is just a regular
state, not a queryParamState so it is not stored in the URL. This will
be used to keep track of the errors we get on validation so we can
highlight the correct fields to prompt users to change the input. This
PR is the baseline to set up that functionality.

Contributes to #81729
nikkikapadia added a commit that referenced this issue Jan 6, 2025
Added an error message to the name field to handle validation errors on
submit. I've just repurposed the type of field that we use on the
current widget builder as it has the error message functionality built
in. When the user starts typing in that field it will get rid of the
error.

Looks like this :
<img width="724" alt="image"
src="https://github.com/user-attachments/assets/b8ac2ec2-aed4-4495-ae00-6d10fc7dea34"
/>

Contributes to #81729
nikkikapadia added a commit that referenced this issue Jan 6, 2025
Shows an error beside the widget type selector if there is an error. The
way we have the widget builder set up right now there should be no error
that arises however it's good to have the error indicator/message there
anyways.

This is what it would look like if an error arises: 
<img width="594" alt="Screenshot 2025-01-06 at 4 07 43 PM"
src="https://github.com/user-attachments/assets/22a66fad-4955-4a96-8418-71785903eb84"
/>

Contributes to #81729
nikkikapadia added a commit that referenced this issue Jan 8, 2025
)

Added the ability to show an error message for the visualize field when
validation fails. There are errors specifically for chart and non-chart
widgets so the correct error message will be displayed. This follows the
same error conventions that are in the current widget builder. The
following is an example of what the error message would look like:

<img width="553" alt="image"
src="https://github.com/user-attachments/assets/c9db10c3-99a3-48d9-8545-ae219b3903fb"
/>

Contributes to #81729

Note: There's a lot of random spacing changes so it's best to take a
look with hiding whitespace
@nikkikapadia
Copy link
Member

Closed with #83103. Thresholds errors are the only ones left but I've put that task in the threshold ticket

@linear linear bot added the Migrated label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants