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

Use IdentifiersInput Vue component for work identifier UI #10032

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

schu96
Copy link
Contributor

@schu96 schu96 commented Nov 14, 2024

Partially addresses #3430

Feature

Technical

DRY implementation of work identifiers but currently unable to save the changes made by users into Solr.

The work identifiers currently displayed in this component are based off of this list: https://openlibrary.org/config/work

Testing

  1. Navigate to a work/book and click on the edit button

  2. Switch from the edition edit tab to the Work Details edit tab
    image

  3. Scroll to Work Identifiers section and add/remove work identifiers.

    • Duplicates are currently not allowed for work identifiers. Adding a duplicate will warn the user that an identifier already exists.
      image
      image
  4. After adding new work identifiers, save the changes and return to the editing page -> Work Details tab to check that the newly added work identifiers are still present.

Stakeholders

@cdrini

Cleaning up and resolving merge conflicts
@schu96 schu96 force-pushed the 3430/feature/add-work-ids-ui branch from 05db8f5 to 807342f Compare December 2, 2024 22:55
@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 17.44%. Comparing base (347bff9) to head (e6cb911).
Report is 141 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10032      +/-   ##
==========================================
+ Coverage   17.12%   17.44%   +0.31%     
==========================================
  Files          89       89              
  Lines        4752     4792      +40     
  Branches      831      848      +17     
==========================================
+ Hits          814      836      +22     
- Misses       3428     3436       +8     
- Partials      510      520      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@schu96 schu96 marked this pull request as ready for review December 4, 2024 23:13
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

This looks great @schu96 !! Great work stitching together the data from all the different places. Librarians have been asking for this feature for quite a while 😊

One question on if we can DRY the python method, one small fix which I'll apply through github; otherwise looks great!

get_work_config().identifiers, names, self.identifiers
)

def _process_identifiers(self, config_, names, values):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this method the same for editions? If so I think we might want to create a helper method at the bottom of this file that both classes call, to avoid duplicating the code, if possible!

openlibrary/templates/books/edit.html Outdated Show resolved Hide resolved
@cdrini cdrini added the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Dec 10, 2024
<div id="hiddenWorkIdentifiers"></div>
<div id="identifiers-display-works">
$ admin = str(ctx.user.is_admin() or ctx.user.is_super_librarian())
$:render_component('IdentifiersInput', attrs=dict(assigned_ids_string=work.get_identifiers().values(), output_selector='#hiddenWorkIdentifiers', id_config_string=work_config, input_prefix='work--identifiers', admin=admin))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh this should also add a list of identifiers, like editions; I noticed it saved a single string value:

https://openlibrary.org/works/OL1063588W/Les_Mis%C3%A9rables?_compare=Compare&b=28&a=27&m=diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants