-
Notifications
You must be signed in to change notification settings - Fork 21
feat: introduce linked records section on record detail pages #653
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
base: master
Are you sure you want to change the base?
Conversation
jrcastro2
commented
Dec 14, 2025
- closes 4 - Show related records on landing page (based on related identifiers) #631
| // CDS-RDM is free software; you can redistribute it and/or modify it under | ||
| // the terms of the MIT License; see LICENSE file for more details. | ||
|
|
||
| export const apiConfig = (endpoint, baseQuery) => ({ |
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.
just for my understanding: do we need the custom function for this? isn't there one already somewhere?
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.
The main point of having this is that I am using the interceptors to enable the searchbar, and this is unique for this case. Without this we cannot hide the default query - needed to filter only related records - from the user input component, so we need to use the interceptors to build it with the user input query. I checked the hiddenParams but this doesn't allow queries, it works similar to filters, unless I am missing something.
| const layoutProps = (result) => { | ||
| return { | ||
| accessStatusId: _get(result, "ui.access_status.id", "open"), | ||
| accessStatus: _get(result, "ui.access_status.title_l10n", "Open"), | ||
| accessStatusIcon: _get(result, "ui.access_status.icon", "unlock"), | ||
| createdDate: _get(result, "ui.created_date_l10n_long", "Unknown date"), | ||
| creators: _get(result, "ui.creators.creators", []).slice(0, 3), | ||
| resourceType: _get(result, "ui.resource_type.title_l10n", "No resource type"), | ||
| title: _get(result, "metadata.title", "No title"), | ||
| link: _get(result, "links.self_html", "#"), | ||
| }; | ||
| }; |
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.
could this part be imported from somewhere so we don't need to maintain it?
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.
Unless I am mistaken there is no other place we can import this from. I see that we usually do it on the cmp itself, f.e. check here RecordsResultsListItem from invenio-app-rdm. Not sure how reusable this is, as different cmps might want to display different things. I am happy to move this somewhere more resusable. If you think we should, let me know where we should do it, invenio-rdm-records or invenio-app-rdm (or somewhere else?)
site/cds_rdm/assets/semantic-ui/js/cds_rdm/linked-records/components/RecordItem.js
Outdated
Show resolved
Hide resolved
site/cds_rdm/views.py
Outdated
| # Part 1: Records that this record references (forward) | ||
| # Search by record id using the CDS identifier | ||
| for cds_id in cds_related_ids: | ||
| query_parts.append(f'id:"{cds_id}"') |
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 might be a bit tricky, because we now have a mix of old CDS recids and new pids in this field. The old recids sometimes point to the new platform, but sometimes they point to the old (f.e. if record was published in a conference, it will still refer to the legacy conference record).
My point is if you search for id:123456, even if the record is migrated, search will not find it, because it has a new recid.
If you have old recid pattern, you need to search also in identifiers.identifier:{cds_id}
if it is a new pid pattern, this is correct
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.
Good point! Thanks for this, I fixed it 👍
| # Exclude the current record and only show published records | ||
| final_query = f'({combined_query}) AND is_published:true NOT id:"{record_id}"' | ||
|
|
||
| return final_query |
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.
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.
Too complicated no? Do you have any specific use case in mind? Otherwise, I would keep it simple maybe for now i.e only direct relations X -> A, and A -> X.
c335172 to
619424e
Compare
619424e to
83beeee
Compare