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

Add support for linked SingleItem in holdings #1091

Merged
merged 5 commits into from
Aug 21, 2024

Conversation

olovy
Copy link
Contributor

@olovy olovy commented Aug 19, 2024

Checklist:

  • I have run the unit tests. yarn test:unit
  • I have run the linter. yarn lint

Description

Add support for SingleItems (sv: exemplar) in holdings.
Initially to be used for pinpointing itemUsed in digital reproductions.

An Item in hasComponent can be converted to a SingleItem.
It looks similiar to when extracting linked works.
Skärmbild från 2024-08-19 17-52-22
Skärmbild från 2024-08-19 17-53-27

The single items are always stored in their own records and linked from the the holding record.
Note the id in the top right corner.
Skärmbild från 2024-08-19 17-53-46

But they can be edited in place as if the were part of the same record.
Skärmbild från 2024-08-19 17-54-07

There are separate options for removing the linked entity or just the link.
Reused the ❌ for removing links. Maybe needs to be more obvious.
Skärmbild från 2024-08-19 17-54-53
Skärmbild från 2024-08-19 17-55-16

There can of course be many linked items and mixed with local items.
Skärmbild från 2024-08-19 17-56-32

The feature is currently only available for sigel S.

Depends on libris/definitions#494
Depends on libris/librisxl#1467

Tickets involved

LXL-4504

Summary of changes

  • Add settings.extractableMappedTypes that specifies which types can be extracted and which type they should be converted to. That is, Item can be extracted to its own document and should then be converted to 'SingleItem. This is a bit clumsy but does the job for now.

  • When loading a record/document, other documents that should be inlined are moved from quoted to the main inspector data.

    • This is done for linked things in properties with category compositional (only hasComponent...).
      • TODO? Should be compositional + integral
    • Their ETags are fetched and stored for later use.
    • We count on embellish data to include the whole docs and don't fetch the doc data separately.
  • When saving, inlined documents are extracted and updated before the main document in separate requests.

  • Inlined records that should be deleted are deleted after the main doc is saved (this might fail...).

  • 81208b0 breaks out the id-pill used in the top right corner of entity-summary to its own component. Taken from Feature/lxl 4504 cataloguing items #1073

  • bcf023b contains the main changes.

  • The other commits just remove obsolete and dead code that I encountered.

Not in scope

There is no way to move (link) a SingleItem to another holding record.

TODO

  • Check MARC21 conversion
  • Don't include inlined documents in "Download as JSON-LD" (?)
  • Duplicating or copying a SingleItem creates a local SingleItem. Is this desired?
  • Handle deletion of the whole holding?
  • Future: have a way to update multiple records atomically.

olovy and others added 3 commits August 19, 2024 16:02
It has not been used in a long time. Works are now handled like any
other node.
Move the id-fnurgel pill seen in the top right corner of cards to its
own component. Use it in item-local as well.

Co-authored-by: Lars Rosenström <[email protected]>
@@ -559,7 +603,7 @@ export default {
/>

<entity-action
v-if="inspector.status.editing && !isLocked"
v-if="inspector.status.editing && !isLocked && !isInlinedRecord && !isExtracting"
Copy link
Contributor Author

@olovy olovy Aug 20, 2024

Choose a reason for hiding this comment

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

!isExtracting is a workaround for a bug in the old "extract" code.
If you start extracting an entity and then delete it you get an error when saving.

It is still possible to trigger:

  • Add a new Item in hasComponent
  • Click "Extract Single item" / "Extrahera Exemplar"
  • Click Undo (removing the added item)
  • Save
  • Error!

@olovy olovy force-pushed the feature/lxl-4504-catalogue-single-item branch from 2f48f5d to 6fbccd8 Compare August 20, 2024 14:33
@olovy olovy marked this pull request as ready for review August 20, 2024 14:35
@jesperengstrom
Copy link
Contributor

LGTM!

Must say I have little knowledge of this part of the code, but all looks reasonable. Nice cleaning job too.

Have tried creating/extracting, editing, viewing (both inline and on its own) and unlinking/deleting singleItems. Seems to work as expected.

The only thing I noticed is an alert saying I have unsaved changes when I try to navigate away in edit mode, even if I save and try again. Using the green button does it. Maybe it’s always been like this.

@olovy olovy merged commit 1f34c0a into develop Aug 21, 2024
1 check passed
@olovy olovy deleted the feature/lxl-4504-catalogue-single-item branch August 21, 2024 07:09
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.

3 participants