Skip to content

dashboard: add "Edit Title" option for submissions without an attached INSPIRE ID#961

Merged
GraemeWatt merged 17 commits into
mainfrom
copilot/add-edit-title-option
May 13, 2026
Merged

dashboard: add "Edit Title" option for submissions without an attached INSPIRE ID#961
GraemeWatt merged 17 commits into
mainfrom
copilot/add-edit-title-option

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

  • Add backend route POST /dashboard/update_title/<recid> in dashboard/views.py to update submission title (checks: no INSPIRE ID, coordinator/admin only, non-empty title)
  • Add "Edit Title" button in dashboard-submissions.html next to "Attach INSPIRE Record"
  • Create edit-title-widget.html modal for editing the title
  • Add JavaScript handler for the Edit Title modal in hepdata_dashboard.js
  • Include the new widget in dashboard.html
  • Fix JS logic bug: title is a Boolean (=== ''), so use if (title) not if (!title) in input event handler
  • Add test for submission is None case (→ 404)
  • Add test for no permissions case (→ 403)
  • Add test for record is None case (→ 404)
  • Merge from main

…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>
Copilot AI changed the title [WIP] Add 'Edit Title' option for submissions without INSPIRE ID dashboard: add "Edit Title" option for submissions without an attached INSPIRE ID Mar 31, 2026
Copilot AI requested a review from GraemeWatt March 31, 2026 18:27
@GraemeWatt GraemeWatt requested review from ItIsJordan April 1, 2026 13:46
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
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.14%. Comparing base (51a18b0) to head (1615759).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 23, 2026

Coverage Report for CI Build 25801350675

Coverage increased (+0.06%) to 86.147%

Details

  • Coverage increased (+0.06%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 18 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

18 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
modules/dashboard/views.py 18 82.12%

Coverage Stats

Coverage Status
Relevant Lines: 5782
Covered Lines: 4981
Line Coverage: 86.15%
Coverage Strength: 0.86 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Member

@GraemeWatt GraemeWatt left a comment

Choose a reason for hiding this comment

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

@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.

Comment thread hepdata/modules/dashboard/assets/js/hepdata_dashboard.js
Comment thread hepdata/modules/dashboard/views.py
Comment thread hepdata/modules/dashboard/views.py
Comment thread hepdata/modules/dashboard/views.py
Copilot AI and others added 2 commits April 24, 2026 12:12
…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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 24, 2026

@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...

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 main.

Copilot AI requested a review from GraemeWatt April 24, 2026 12:16
@GraemeWatt GraemeWatt marked this pull request as ready for review April 24, 2026 12:53
Copilot AI review requested due to automatic review settings April 24, 2026 12:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread hepdata/modules/dashboard/views.py Outdated
Comment thread hepdata/modules/dashboard/views.py
Comment thread hepdata/modules/dashboard/templates/hepdata_dashboard/edit-title-widget.html Outdated
Comment thread hepdata/modules/dashboard/assets/js/hepdata_dashboard.js Outdated
Comment thread hepdata/modules/dashboard/assets/js/hepdata_dashboard.js Outdated
Comment thread tests/dashboard_test.py Outdated
GraemeWatt and others added 2 commits April 27, 2026 12:53
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.
Copy link
Copy Markdown
Member

@GraemeWatt GraemeWatt left a comment

Choose a reason for hiding this comment

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

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").

Comment thread hepdata/modules/dashboard/assets/js/hepdata_dashboard.js Outdated
Comment thread hepdata/modules/dashboard/templates/hepdata_dashboard/edit-title-widget.html Outdated
Comment thread hepdata/modules/dashboard/views.py Outdated
Comment thread hepdata/modules/dashboard/views.py
Comment thread tests/dashboard_test.py Outdated
GraemeWatt and others added 6 commits April 27, 2026 17:32
* 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.
Copy link
Copy Markdown
Collaborator

@ItIsJordan ItIsJordan left a comment

Choose a reason for hiding this comment

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

Feedback in PR comments.

@GraemeWatt GraemeWatt merged commit 5145873 into main May 13, 2026
10 checks passed
@GraemeWatt GraemeWatt deleted the copilot/add-edit-title-option branch May 13, 2026 14:25
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.

dashboard: add an "Edit Title" option for submissions without an attached INSPIRE ID

5 participants