Skip to content

Commit 9afa9a2

Browse files
Merge pull request #697 from reactome/spec016/highlighted-values
Spec 016, from #691's review: a highlighted identifier shown as text
2 parents d9639f2 + dde037f commit 9afa9a2

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<a [href]="`${CONTENT_DETAIL}/${icon().stId}`" target="_blank" [matTooltip]="`Open origin of icon ${icon().name}`">
1+
<a [href]="`${CONTENT_DETAIL}/${icon().id}`" target="_blank" [matTooltip]="`Open origin of icon ${icon().name}`">
22
<div [innerHTML]="iconSVG()! | safe: 'html' : true"></div>
33
</a>

‎projects/website-angular/src/app/content/detail/interactor-detail/interactor-detail.component.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,11 @@ export class InteractorDetailComponent implements OnInit {
125125
.flatMap((group) => group.entries)
126126
.find((hit) => hit.databaseName && hit.referenceIdentifier);
127127
if (entry) {
128-
const cleanId = (entry.referenceIdentifier ?? acc).replace(/<[^>]*>/g, '');
129-
this.displayName.set(`${entry.databaseName}:${cleanId} ${entry.name}`);
128+
// The search is highlighted: an identifier or name that matched
129+
// the accession arrives wrapped in markup.
130+
const plain = (text: string) => text.replace(/<[^>]*>/g, '');
131+
const cleanId = plain(entry.referenceIdentifier ?? acc);
132+
this.displayName.set(`${entry.databaseName}:${cleanId} ${plain(entry.name ?? '')}`);
130133
this.interactorType.set(
131134
`${entry.type}${entry.exactType && entry.exactType !== entry.type ? ' (' + entry.exactType + ')' : ''}`
132135
);

‎projects/website-angular/src/app/search/search.component.html‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,10 @@ <h2>{{ group.typeName }} ({{ group.entriesCount }})</h2>
495495
<div class="entry-reference">
496496
Reference:
497497
<a [href]="entry.referenceURL" target="_blank" rel="noopener"
498-
><span [innerHTML]="entry.referenceName ?? entry.databaseName"></span> ({{
499-
entry.referenceIdentifier
500-
}})</a
498+
><span [innerHTML]="entry.referenceName ?? entry.databaseName"></span> (<span
499+
[innerHTML]="entry.referenceIdentifier"
500+
></span
501+
>)</a
501502
>
502503
</div>
503504
}
@@ -536,7 +537,7 @@ <h2>{{ group.typeName }} ({{ group.entriesCount }})</h2>
536537
<!-- eslint-disable @angular-eslint/template/prefer-ngsrc -- a library icon is any shape, fitted to its box by CSS -->
537538
<img
538539
[src]="iconSvgUrl(entry)"
539-
[alt]="entry.stId"
540+
[alt]="entry.id"
540541
loading="lazy"
541542
(error)="onImgError($event)"
542543
width="100"
@@ -629,7 +630,10 @@ <h2>{{ group.typeName }} ({{ group.entriesCount }})</h2>
629630
<div class="entry-reference">
630631
Reference:
631632
<a [href]="entry.referenceURL" target="_blank" rel="noopener"
632-
><span [innerHTML]="entry.referenceName"></span> ({{ entry.referenceIdentifier }})</a
633+
><span [innerHTML]="entry.referenceName"></span> (<span
634+
[innerHTML]="entry.referenceIdentifier"
635+
></span
636+
>)</a
633637
>
634638
</div>
635639
}

‎specs/016-api-contract/tasks.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ description: 'Tasks for spec 016: one API contract for the content service and t
6060
- [x] T010 [US2] Make the site's `SearchEntry` and `IconEntry` re-export the contract's, and narrow by kind where `search.component.ts`, `interactor-detail.component.ts`, `icon-lib.component.ts` and `icon-detail.component.ts` read kind-specific fields.
6161
- Escape or render `Highlighted` fields as each reader does today, with no change visible on the page.
6262
- Check the search page and an icon page in a browser.
63-
- Done in #691. The site's `SearchEntry` is the contract's `SearchEntryView`: any kind, what every kind carries required, the rest optional (FR-003's view, since the search page shows every kind side by side and a template cannot read a field one kind lacks); `IconEntry` is the contract's kind. Two readers changed: the protein forms' key drops a fallback `id` already covers (`id` is the stId, or the dbId, never empty), and an icon's image is found by `id`, the same value as `stId` but never highlighted. From #690's review, the icon library too (#691): its search is highlighted, and asking beta's service for `R-ICO-012449` there answers `stId` as `<span class="highlighting" >R-ICO-012449</span>`, `id` plain, so its image, link, fetch and shown id were built from markup; they take `id` now, as does the pathway browser's icon load. Nothing else visible changes; the search, search-error and icon-library end-to-end specs pass (46 and 78 tests with the specs below). The single icon page reads only type changes; no recording opens one (the `gap` T014 closes).
63+
- Done in #691. The site's `SearchEntry` is the contract's `SearchEntryView`: any kind, what every kind carries required, the rest optional (FR-003's view, since the search page shows every kind side by side and a template cannot read a field one kind lacks); `IconEntry` is the contract's kind. Two readers changed: the protein forms' key drops a fallback `id` already covers (`id` is the stId, or the dbId, never empty), and an icon's image is found by `id`, the same value as `stId` but never highlighted. From #690's review, the icon library too (#691): its search is highlighted, and asking beta's service for `R-ICO-012449` there answers `stId` as `<span class="highlighting" >R-ICO-012449</span>`, `id` plain, so its image, link, fetch and shown id were built from markup; they take `id` now, as does the pathway browser's icon load. From #691's review (#697): the search page printed a highlighted reference identifier as text, `PTEN (<span class="highlighting" >P60484</span>)` for a search of P60484, seen in the browser against beta's services; it is rendered as its neighbours are (`[innerHTML]`) and reads `PTEN (P60484)`. An icon's alt text and the pathway browser's icon link take `id`, and the interactor page strips a highlighted name as it strips the identifier. Nothing else visible changes; the search, search-error and icon-library end-to-end specs pass (46 and 78 tests with the specs below). The single icon page reads only type changes; no recording opens one (the `gap` T014 closes).
6464
- [x] T011 [US2] Make the pathway browser's `Search.Entry` and `Search.Icon.Entry` re-export the contract's, keeping the value `EMPTY_RESULTS` in the namespace. Adjust `viewport/search/search.component.ts`, `services/icon.service.ts` and `details/tabs/description-tab/icon/icon.component.ts`, and check the diagram search in a browser.
6565
- Done in #691. `Search.Entry` is the view, `Search.Icon.Entry` the icon kind, and an icon query's groups hold any kind (three of the five recorded answers are proteins, compounds or drugs), so `fetchIcon` takes an entry only when it is an icon, not deleted, besides its group's name. Its unit spec's icon is now one as the search writes it, and a deleted icon in an icon group gives none (failing without the check). The flag button takes `id`. The in-diagram search, flagging, pathway-browser, entity popup, structures and pathway-data specs pass; their recordings answer the icon query with icons (R-ICO-013990, R-ICO-012536) and with other kinds.
6666
- [x] T012 [US2] Recount `tools/api-types/known-problems.json`. Record what remains on the search routes, each item with its reason, in this task's PR and here.

0 commit comments

Comments
 (0)