-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use HTMX for PRIMED-specific audit buttons #456
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This new structure is more intuitive when we add a "resolve" url and view.
This view re-runs the audit and takes the appropriate action. In future commits we can add htmx functionality to this view. Part of this view meant reworking the audit structure itself. Use the same action url for all types of AccessAuditResult and set the action text in subclasses. Add str methods for the audit result classes so the text can be displayed on the audit resolve page. Finally, add a get_all_results method to the audit class that returns the concatenation of audit results for all SignedAgreements.
Add an html snippet that renders the button based on the table record. This will make it easier to replace with htmx.
In the action column of the SignedAgreementAudit tables, post directly to the view that resolves the audit by modifying the template column to use a form instead of a link button to the audit resolve view. As part of this (and for temporarily interactive testing) comment out the parts of the view that make API calls to AnVIL. This causes the tests to fail (as desired, so I remember to uncomment them later.)
Install the django-htmx package into the project settings file. Check whether the request is htmx in the view, and if it is, return an htmx response that replaces the button with appropriate text.
This is pretty simple; just need to add the hx-disabled-elt attribute to to the html. No jquery required!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #456 +/- ##
==========================================
+ Coverage 98.46% 98.59% +0.13%
==========================================
Files 262 274 +12
Lines 20002 21505 +1503
==========================================
+ Hits 19694 21202 +1508
+ Misses 308 303 -5 ☔ View full report in Codecov by Sentry. |
This way, if we change it anywhere, we only have to change it in one place.
The script used the wrong group as a (second) auth domain.
Add a view that runs an audit on a specific CDSA workpsace and (if a post request) handles that audit appropriately. The view can also handle htmx requests. Modify the workspace_audit classes for CDSA workspaces as necessary to achieve this: add a str method that can be displayed on the detail page; set the "action" text for different classes with a default, and change the action_url to be the same for all the different types of audit result classes. Add a get_all_results method to the WorkspaceAccessAudit class.
I also had to rename the template for the signed agreement audit action button, since it can't be reused by both signed agreements and workspaces. This commit also implements the htmx tags for CDSA workspace audit handling.
Add a view that runs an audit on a specific dbGaPApplication and dbGaPWorkspace and (if a post request) handles that audit appopriately. The view can also handle htmx requests. Modify the workspace audit classes for dbGaPWorkspaces as necessary to achieve this: add a str method that can be displayed on the detail page; set the "action" text for different classes with a default, and change the action_url to be the same for all the different types of audit result classes. Add a get_all_results method to the dbGaPAccessAudit class.
Instead of auditing the group access in the _audit_workspace method, add a specific method that will audit the access to a collaborative analysis workspace for a group.
Add a view that runs an audit on a specific email and CollaborativeAnalysisWorkspace and (if a post request) handles that audit appopriately. The view can also handle htmx requests. Modify the workspace audit classes for CollaborativeAnalsyisWorkspaces as necessary to achieve this: add a str method that can be displayed on the detail page; set the "action" text for different classes with a default, and change the action_url to be the same for all the different types of audit result classes. Add a get_all_results method to the CollaborativeAnalysisWorkspaceAccessAudit class.
Only call the AnVIL create/delete methods after the local create/ delete methods when resolving an audit.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use htmx to handle the audit resolution for CDSA, dbGaP, and collaborative analysis workspaces audits. Make parallel changes for all the apps so they work similarly.
Implement the above changes for the following apps:
Closes #122