Skip to content

feat: add Relationships tab#2416

Open
omkar-ethz wants to merge 3 commits into
masterfrom
relationships-tab
Open

feat: add Relationships tab#2416
omkar-ethz wants to merge 3 commits into
masterfrom
relationships-tab

Conversation

@omkar-ethz

@omkar-ethz omkar-ethz commented Jun 11, 2026

Copy link
Copy Markdown
Member

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.

URL and DOI identifier types are rendered specially as a link, and other types of identifiers are shown as is.

The tab visibility is configurable via datasetRelationshipsEnabled config key. Backend PR - SciCatProject/backend#2780

Motivation

Complements the backend schema change.

Fixes:

Please provide a list of the fixes implemented in this PR

  • Items added

Changes:

Please provide a list of the changes implemented by this PR

  • changes made

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

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

  • Does it require a specific version of the backend
  • which version of the backend is required:

Screenshot

scicat_relationships_tab

Summary by Sourcery

Add a configurable Relationships tab to dataset details to display dataset relationships in a dynamic table.

New Features:

  • Introduce a Relationships tab in the dataset details dashboard showing relationships via a dynamic material table.
  • Add a custom cell component to render relationship identifiers, linking out for URL and DOI types.
  • Expose relationships for the current dataset through a new NgRx selector.

Enhancements:

  • Wire the Relationships tab into the dataset details routing and navigation.
  • Extend application configuration to allow enabling or disabling the Relationships tab via a datasetRelationshipsEnabled flag.

Tests:

  • Add unit test scaffolding for the Relationships table and related identifier cell components.
  • Extend dataset selectors tests to cover selection of relationships from the current dataset.

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:

  • Expose current dataset relationships via a new selector for use in the UI.
  • Introduce a Relationships tab in the dataset details dashboard that shows relationships in a dynamic material table.
  • Add a custom cell component to render related identifiers, linking out for URL and DOI types.
  • Extend application configuration with a datasetRelationshipsEnabled flag to control Relationships tab visibility.

Tests:

  • Add test coverage scaffolding for the relationships selector and Relationships/RelatedIdentifier components.

@omkar-ethz omkar-ethz marked this pull request as ready for review June 11, 2026 12:00
@omkar-ethz omkar-ethz requested a review from a team as a code owner June 11, 2026 12:00

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • 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.
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`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@rkweehinzmann

Copy link
Copy Markdown
Member

Hi Omkar, thanks a lot for that great work! one question, and you also mentioned it that we do not expect to have per dataset many identifiers. I therefore would potentially prefer the tile in dataset details where one has already related identifiers and simply add of eg the id of a logbook entry or the doi, (see screenshot of current tile) and not necessarily a whole new tab. Now if we'd switched off that tab, would still the relation be made between say doi and datasets so one can, with some modifications of the tile widget, add the desired identifier?

Here is how the tile currently looks like:
1

Thank you.

@omkar-ethz

Copy link
Copy Markdown
Member Author

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
  }
Screenshot from 2026-06-22 14-46-27

However, I'm not sure this is very useful: the user cannot visit the links or copy text from the tag element.

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:)

@minottic minottic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thansk! a minor comment

@switch (entry.identifierType) {
@case ('URL') {
<a [href]="entry.identifier">{{entry.externalId ?? entry.identifier}}</a>
} @case ('DOI') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we prefer the URL when a URL is present when the case is DOI (or this is not possible) ?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

4 participants