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

rewrite visual forms using react instead of jQuery #1162

Open
wants to merge 33 commits into
base: dp-to-visual
Choose a base branch
from

Conversation

shapiromatron
Copy link
Owner

@shapiromatron shapiromatron commented Jan 28, 2025

This PR should be reviewed after #1114

There were a few legacy jQuery applications for building custom visuals in HAWC. These user-interfaces did not perform well and had some bugs, but because they were so complicated, we never were able to fix them and they remained in this painful state. Because of the inability to change the applications, we had a really complicated django view and form layout too, since we had multiple different approaches depending on the frontend technology being used. This PR removes the jQuery applications and fully switch to a react frontend. This should dramatically improve stability of the application.

This rewrites the form frontend for Crossview, RobHeatmap, and RobBarchart.

In addition:

  • Refactor and standardize visual form startup javascript
  • Rewrite how the django-form panel is being used in React. Instead of recreating the django form with React, we have move the form in the react tab, and then out of the react tab, so that we're not duplicating state.
  • Rewrite the dose units selector widget to use React instead of the jQuery custom solution. See PreferredWidget.
  • Added tests to improve test coverage for the diversity of visual types and evidence types
  • Remove VisualizationCreateTester
  • Refactor how data for preview of visualizations is generated and passed to the application.

@shapiromatron shapiromatron changed the base branch from main to dp-to-visual January 28, 2025 04:18
@shapiromatron shapiromatron marked this pull request as ready for review February 6, 2025 05:02
Copy link
Collaborator

@caseyhans caseyhans left a comment

Choose a reason for hiding this comment

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

I'm having trouble getting the Crossview form to work. I'm looking at the fixture crossview (summary/visual/assessment/2/crossview/) and once I navigate to Settings > Crossview Filters or Settings > References, the frontend crashes; looks like it's trying to call to_string on a null integer value.

Opening the Settings > Legend Settings tab on the RoB barchart (summary/visual/assessment/2/rob-barchart/update/) also produces a failed prop type error on a checkbox input. Checking 'Show NR in Legend' produces an error re: controlled/uncontrolled inputs. No such issues in the RoB heatmap.

The first one is my main concern. Let me know if you have trouble reproducing these errors!

@caseyhans caseyhans assigned shapiromatron and unassigned caseyhans Feb 14, 2025
Copy link
Collaborator

@rabstejnek rabstejnek left a comment

Choose a reason for hiding this comment

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

Looks good. I did not find any additional problems in this PR aside from the ones Casey identified (which I was able to reproduce). I did notice though that the smart tag form is not working correctly, but this bug seems to predate this PR. It may be worth fixing in this PR though if its a simple fix (looks like maybe jQuery just needs to be imported before select2).

@rabstejnek rabstejnek removed their assignment Feb 18, 2025
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