dashboard: add "Edit Title" option for submissions without an attached INSPIRE ID#961
Conversation
…INSPIRE ID Agent-Logs-Url: https://github.com/HEPData/hepdata/sessions/32e73825-d444-4737-b992-19c670171d01 Co-authored-by: GraemeWatt <11544204+GraemeWatt@users.noreply.github.com>
Now just creates the client object once and logs it in initially.
Sets url to variable as it is reused
Now disables the submission button when the edit title input is empty on the dashboard. Error message is now displayed on input and not click for empty state.
Function was using incorrect tabs instead of two space indent
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #961 +/- ##
==========================================
+ Coverage 86.09% 86.14% +0.05%
==========================================
Files 59 59
Lines 5759 5782 +23
==========================================
+ Hits 4958 4981 +23
Misses 801 801 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Coverage Report for CI Build 25801350675Coverage increased (+0.06%) to 86.147%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions18 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
GraemeWatt
left a comment
There was a problem hiding this comment.
@ItIsJordan : thanks, looks good. I made a comment about the logic for displaying the "Please provide a title" message. It would be useful to extend the tests to cover the three missing lines in the new update_submission_title function. Please also update the branch from main.
…e-option Co-authored-by: GraemeWatt <11544204+GraemeWatt@users.noreply.github.com>
…sion_title Agent-Logs-Url: https://github.com/HEPData/hepdata/sessions/42217021-0160-48da-8c7c-8641439a6060 Co-authored-by: GraemeWatt <11544204+GraemeWatt@users.noreply.github.com>
Done in 9b70861 — fixed the JS logic bug and added the three missing test cases (submission is None → 404, no permissions → 403, record is None → 404). Also merged from |
There was a problem hiding this comment.
Pull request overview
Adds a dashboard feature allowing coordinators/admins to edit the provisional title of submissions that do not yet have an attached INSPIRE ID.
Changes:
- Added a new backend endpoint
POST /dashboard/update_title/<recid>to persist a new submission title (with permission + INSPIRE checks). - Added an “Edit Title” button, modal widget, and dashboard JS to launch the modal and submit the update via AJAX.
- Added tests for key error cases and the happy path.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
hepdata/modules/dashboard/views.py |
Adds the update_submission_title route that updates the record title. |
hepdata/modules/dashboard/templates/hepdata_dashboard/dashboard-submissions.html |
Adds an “Edit Title” button next to “Attach INSPIRE Record”. |
hepdata/modules/dashboard/templates/hepdata_dashboard/edit-title-widget.html |
Introduces the modal UI for editing and saving the title. |
hepdata/modules/dashboard/templates/hepdata_dashboard/dashboard.html |
Includes the new edit-title widget on the dashboard page. |
hepdata/modules/dashboard/assets/js/hepdata_dashboard.js |
Adds modal open/close logic, validation UI, and the AJAX POST to update the title. |
tests/dashboard_test.py |
Adds endpoint tests for success and various failure scenarios. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Needed for "Submissions Overview" to display updated title. * Extend test to check that title was updated in admin index.
GraemeWatt
left a comment
There was a problem hiding this comment.
I've accepted most of the Copilot review comments and also made a commit b00e68d to update the admin index when updating the title (needed by the "Submissions Overview").
* Sleep 1s after updating title before searching admin index. * Also check original title in admin index before updating it.
Add a comment and update variable. Moves unittest.mock inport to top.
Currently the edit title widget does not pass any error message received by the server. Updates this to happen.
ItIsJordan
left a comment
There was a problem hiding this comment.
Feedback in PR comments.
POST /dashboard/update_title/<recid>indashboard/views.pyto update submission title (checks: no INSPIRE ID, coordinator/admin only, non-empty title)dashboard-submissions.htmlnext to "Attach INSPIRE Record"edit-title-widget.htmlmodal for editing the titlehepdata_dashboard.jsdashboard.htmltitleis a Boolean (=== ''), so useif (title)notif (!title)in input event handlersubmission is Nonecase (→ 404)record is Nonecase (→ 404)main