Skip to content

Commit 72eec40

Browse files
committed
fixing behavior of arrow icon
1 parent 98a5e35 commit 72eec40

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

src/views/Browsers/OntologyBrowser.vue

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,28 @@
3939
<div
4040
:style="{ paddingLeft: `${item.depth * 24}px` }"
4141
class="d-flex align-center py-1 cursor-pointer hover-bg"
42-
@click="toggleNode(item)"
4342
>
4443
<div class="d-flex justify-center" style="width: 24px">
4544
<v-icon
4645
v-if="item.hasChildren"
4746
:icon="
48-
openedTerms.includes(item.identifier)
47+
isOpen(item.identifier)
4948
? 'fas fa-caret-down'
5049
: 'fas fa-caret-right'
5150
"
5251
size="small"
53-
@click.stop="toggleNode(item)"
52+
@click="toggleNode(item)"
5453
/>
5554
</div>
5655

5756
<div
5857
class="d-flex flex-row justify-center align-center flex-grow-1"
58+
@click="searchTerm(item)"
5959
>
6060
<span
6161
:class="[
6262
'chip-mimic mr-2',
63-
item.isTarget
63+
item.isTarget || activeTerms.includes(item.identifier)
6464
? `bg-${color} text-white font-weight-bold elevation-2 border-0`
6565
: `text-${color} border-${color}`,
6666
]"
@@ -344,6 +344,21 @@ export default {
344344
"openTerms",
345345
"leavePage",
346346
]),
347+
/**
348+
* Give the result of the term selected
349+
* @param term
350+
*/
351+
352+
searchTerm(term) {
353+
this.resetPagination();
354+
if (this.activeTerms.includes(term.identifier))
355+
this.$router.push({ path: this.$route.path });
356+
else
357+
this.$router.push({
358+
path: this.$route.path,
359+
query: { term: encodeURIComponent(term.name) },
360+
});
361+
},
347362
348363
// --- UPDATED HELPER: Find ALL Paths ---
349364
// Returns Array of Arrays: [[Root, Child, Target], [Root, OtherChild, Target]]
@@ -426,6 +441,15 @@ export default {
426441
}
427442
return filtered;
428443
},
444+
445+
/**
446+
* SAFE CHECK: Checks if a node is open regardless of ID type (String/Number)
447+
*/
448+
isOpen(identifier) {
449+
if (!this.openedTerms) return false;
450+
// Convert everything to String for comparison
451+
return this.openedTerms.map(String).includes(String(identifier));
452+
},
429453
},
430454
};
431455
</script>

0 commit comments

Comments
 (0)