Repository navigation
feat(views): label template links with the template's own label - #935
Merged
Merged
Conversation
A template_iri cell without a label in its sibling column showed the bare template IRI. It now falls back to the template's label as Nanodash already knows it, from a loaded template or from the template listings, without fetching anything. Only a template unknown here still shows its IRI. Seen on the I-ADOPT space, whose pinned template was pinned by pasting its IRI, so the pin recorded no label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 5.23.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A query column ending in
template_iriis rendered as a link to the template's form. Its text comes from the sibling…_labelcolumn, and when that column is empty the link shows the bare template IRI.That happened on the I-ADOPT space: its pinned template was pinned by pasting the IRI
…/RAlibtZp…/templateinstead of choosing it from the list, so the pin nanopub recorded nont:hasLabelFromApi, and the 📋 Pinned templates view showed the IRI. Nanodash knows that template's label anyway, from the template listings.Change
TemplateData.getKnownTemplateLabel(id)returns the label of a template that is known here already: from a loadedTemplate, or else from the assertion/provenance/pubinfo listings. It never fetches anything, so rendering a long list costs no extra requests. It takes both forms of template ID, the nanopub URI and an embedded template-node IRI.QueryResult.templateLinkLabel(…)picks the label to show: the sibling label column, then the known label, then null so the caller can fall back to the IRI as before. List, table and item-list views all use it fortemplate_iricells.TemplateDataKnownLabelTestcovers lookup by nanopub URI, by template-node IRI, an unknown template, and a missing ID.This doesn't conflict with #917: that PR changes how the listings are loaded but never leaves them null, and its hunks in
TemplateDatadon't overlap with this one.Matching view change (already live)
The pinned-templates query used to build its own HTML link, so it could not benefit from this change. Two new versions were published on 2026-11-18:
RAtbxJD3…/get-pinned-templates-for-resourcenow returnstemplate_iriandtemplate_iri_label;RAo-_2YK…points at it.Pinned-template links therefore already open the latest template version (
template-version=latest). With this PR, a pin that recorded no label shows the template's label instead of its IRI.Tests
mvn test -Dtest='TemplateDataKnownLabelTest,QueryResultPublishLinkTest': 14 tests, all passing. Not tried in a running instance.🤖 Generated with Claude Code