Skip to content

Commit 79d2742

Browse files
committed
Show model list for single model views
The model list for joining nodes is now shown even when only a single model is in the view. Refs pombase/pombase-gocam#98
1 parent 86da69e commit 79d2742

1 file changed

Lines changed: 32 additions & 13 deletions

File tree

‎gocam_view/templates/gocam_view/index.html‎

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@
157157
padding: 0;
158158
font-size: 95%;
159159
}
160+
.current-model {
161+
font-weight: bold;
162+
}
160163
.popper-div {
161164
position: relative;
162165
background-color: #eee;
@@ -204,11 +207,13 @@
204207

205208
let url = '/api/v1/dataset/latest/data/go-cam-cytoscape/' + gocamId;
206209

210+
let gocamIdNoFlags = gocamId;
207211
let flags = [];
208212

209213
if (gocamId.includes(':')) {
210214
const parts = gocamId.split(':');
211215
flags = parts[1].split(',');
216+
gocamIdNoFlags = parts[0];
212217
}
213218

214219
if (flags.includes('retain_genes') || flags.includes('trim_models')) {
@@ -776,27 +781,30 @@
776781
if (nodeId) {
777782
showCyPanel();
778783

779-
const makeLink = (id, label) => {
784+
const makeLink = (id, label, title) => {
785+
if (!title) {
786+
title = "";
787+
}
780788
const bits = id.split(":");
781789
if (bits.length == 2) {
782790
if (bits[0] == 'PomBase') {
783-
return `<a target="_blank" href="/gene/${bits[1]}">${label}</a>`;
791+
return `<a title="${title}" target="_blank" href="/gene/${bits[1]}">${label}</a>`;
784792
} else {
785793
if (bits[0] == 'CHEBI') {
786-
return `<a target="_blank" href="https://www.ebi.ac.uk/chebi/chebiOntology.do?chebiId=${id}">${label} (${id})</a>`;
794+
return `<a title="${title}" target="_blank" href="https://www.ebi.ac.uk/chebi/chebiOntology.do?chebiId=${id}">${label} (${id})</a>`;
787795
} else {
788796
if (bits[0] == 'GO') {
789-
return `<a target="_blank" href="/term/${id}">${label} (${id})</a>`;
797+
return `<a title="${title}" target="_blank" href="/term/${id}">${label} (${id})</a>`;
790798
} else {
791799
if (bits[0].startsWith('gomodel')) {
792800
const modelId = bits[1];
793-
const modelDetails = findModel(modelId);
794-
795-
if (modelDetails) {
796-
return `<a target="_blank" href="/gocam/pombase-view/docs/${modelId}">${modelDetails.title}</a>`;
797-
} else {
798-
return modelId;
801+
let href = `/gocam/pombase-view/docs/${modelId}`;
802+
const highlightArray =
803+
[...highlightGeneIds].filter(g => g !== '');
804+
if (highlightArray.length > 0) {
805+
href += '/' + highlightArray.join(',');
799806
}
807+
return `<a title="${title}" target="_blank" href="${href}">${label}</a>`;
800808
}
801809
}
802810
}
@@ -880,10 +888,21 @@
880888
}
881889

882890
if (nodeType !== 'model') {
883-
if (isMergedModel) {
891+
if (isMergedModel || currentData.is_connecting_node) {
884892
newContent += '<div class="models">models:</div><ul class="model-list">';
885-
for (const longModelId of currentData.model_ids) {
886-
newContent += '<li class="model-id">' + makeLink(longModelId) + '</li>';
893+
for (const [longModelId, modelTitle] of currentData.models) {
894+
let extraClass = '';
895+
let linkTitle = '';
896+
if (!isMergedModel) {
897+
if (longModelId == 'gomodel:' + gocamIdNoFlags) {
898+
extraClass = 'current-model';
899+
linkTitle = 'Current model: ';
900+
} else {
901+
linkTitle = 'Connected model: ';
902+
}
903+
}
904+
linkTitle += modelTitle + ' (click to view)';
905+
newContent += '<li class="model-id ' + extraClass + '">' + makeLink(longModelId, modelTitle, linkTitle) + '</li>';
887906
}
888907
newContent += '</ul>';
889908
}

0 commit comments

Comments
 (0)