-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
base: master
Are you sure you want to change the base?
Use IdentifiersInput Vue component for work identifier UI #10032
Conversation
05db8f5
to
807342f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
There was a problem hiding this 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): |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
openlibrary/openlibrary/plugins/upstream/utils.py
Lines 1171 to 1202 in 7a4fec1
def get_identifier_config(identifier: Literal['work', 'edition', 'author']) -> Storage: | |
return _get_identifier_config(identifier) | |
@web.memoize | |
def _get_identifier_config(identifier: Literal['work', 'edition', 'author']) -> Storage: | |
""" | |
Returns the identifier config. | |
The results are cached on the first invocation. Any changes to /config/{identifier} page require restarting the app. | |
This is cached because fetching and creating the Thing object was taking about 20ms of time for each book request. | |
""" | |
with open( | |
f'openlibrary/plugins/openlibrary/config/{identifier}/identifiers.yml' | |
) as in_file: | |
id_config = yaml.safe_load(in_file) | |
identifiers = [ | |
Storage(id) for id in id_config.get('identifiers', []) if 'name' in id | |
] | |
if identifier == 'edition': | |
thing = web.ctx.site.get('/config/edition') | |
classifications = [ | |
Storage(t.dict()) for t in thing.classifications if 'name in t' | |
] | |
roles = thing.roles | |
return Storage( | |
classifications=classifications, identifiers=identifiers, roles=roles | |
) | |
return Storage(identifiers=identifiers) |
Is this something close to what you had in mind? I noticed that the author identifier config method followed a similar pattern to the work config method as well
e6cb911
to
3ba4710
Compare
Cleaning up and resolving merge conflicts
… calls Fix failing test
7a4fec1
to
7276ac1
Compare
3e06667
to
a13e95d
Compare
c4ce674
to
c1d245b
Compare
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
Work Details
edit tabDuplicates are currently not allowed for work identifiers. Adding a duplicate will warn the user that an identifier already exists.Stakeholders
@cdrini