feat: add Relationships tab#2416
Conversation
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
datasets.selectors.spec.ts, theselectCurrentRelationshipstest is still asserting againstselectCurrentAttachments.projector(dataset)anddataset.attachments, which looks like a copy-paste error and should be updated to exerciseselectCurrentRelationshipsand therelationshipsfield. - In
RelationshipsComponent, you can simplify state handling by bindingrelationships$directly to thedynamic-mat-tablevia theasyncpipe instead of manually subscribing into aBehaviorSubject, which would remove the explicit subscription andconsole.logerror handling inngOnInit/ngOnDestroy.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `datasets.selectors.spec.ts`, the `selectCurrentRelationships` test is still asserting against `selectCurrentAttachments.projector(dataset)` and `dataset.attachments`, which looks like a copy-paste error and should be updated to exercise `selectCurrentRelationships` and the `relationships` field.
- In `RelationshipsComponent`, you can simplify state handling by binding `relationships$` directly to the `dynamic-mat-table` via the `async` pipe instead of manually subscribing into a `BehaviorSubject`, which would remove the explicit subscription and `console.log` error handling in `ngOnInit`/`ngOnDestroy`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Hello Regina (@rkweehinzmann ) Thank you for your feedback. With a small code change to the dynamic detail page, it is possible to add the relationships to the Related Documents tile as follows: {
"element": "tag",
"source": "relationships",
"order": 5
}
However, I'm not sure this is very useful: the user cannot visit the links or copy text from the Of course, we can add richer support for relationships with more code changes to dynamic detail page. But I wonder if it's a good idea. I remember @nitrosx mentioning on Slack that we should prefer a dedicated component i.e. the Relationships tab. In any case, let's discuss this in tomorrow's SciCat collaborators meeting:) |
| @switch (entry.identifierType) { | ||
| @case ('URL') { | ||
| <a [href]="entry.identifier">{{entry.externalId ?? entry.identifier}}</a> | ||
| } @case ('DOI') { |
There was a problem hiding this comment.
should we prefer the URL when a URL is present when the case is DOI (or this is not possible) ?


Description
In SciCatProject/backend#2661, we updated the Relationship schema to align with Datacite's related identifier concept. This PR adds a frontend component, a relationships tab with a table, to display these relationships.
Dynamic table is used, with client side pagination and sorting - as we don't expect many relationships per dataset.
URLandDOIidentifier types are rendered specially as a link, and other types of identifiers are shown as is.The tab visibility is configurable via
datasetRelationshipsEnabledconfig key. Backend PR - SciCatProject/backend#2780Motivation
Complements the backend schema change.
Fixes:
Please provide a list of the fixes implemented in this PR
Changes:
Please provide a list of the changes implemented by this PR
Tests included
Documentation
official documentation info
If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included
Backend version
Screenshot
Summary by Sourcery
Add a configurable Relationships tab to dataset details to display dataset relationships in a dynamic table.
New Features:
Enhancements:
Tests:
Summary by Sourcery
Add a configurable Relationships tab to the dataset details dashboard to display dataset relationships in a dynamic table, including link rendering for URL and DOI identifiers.
New Features:
Tests: