From d8e94bffa9d3a64c60b0aa46ff3a8e3ae53fe407 Mon Sep 17 00:00:00 2001 From: "David J. Yu" <87633683+ddjnw1yu@users.noreply.github.com> Date: Tue, 14 May 2024 10:28:00 +1200 Subject: [PATCH 1/2] add hover-changed callback to return anatomy --- src/App.vue | 4 ++++ src/algolia/algolia.js | 2 ++ src/components/SideBar.vue | 12 ++++++++---- src/components/SidebarContent.vue | 19 +++++++++++++++++-- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index 6b930851..f241f5e3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -22,6 +22,7 @@ :activeId="activeId" @tabClicked="tabClicked" @search-changed="searchChanged($event)" + @hover-changed="hoverChanged($event)" @actionClick="action" /> @@ -110,6 +111,9 @@ export default { } }, methods: { + hoverChanged: function (data) { + console.log('hoverChanged', data) + }, searchChanged: function (data) { console.log(data) }, diff --git a/src/algolia/algolia.js b/src/algolia/algolia.js index ec9586cf..c50c4157 100644 --- a/src/algolia/algolia.js +++ b/src/algolia/algolia.js @@ -100,6 +100,7 @@ export class AlgoliaClient { for (let res of results) { newResult = { ...res } newResult = { + anatomy: res.anatomy ? res.anatomy.organ.map((organ => organ.curie)) : undefined, doi: res.item.curie.split(':')[1], name: res.item.name, description: res.item.description, @@ -167,6 +168,7 @@ export class AlgoliaClient { 'item.name', 'item.description', 'objectID', + 'anatomy.organ.curie' ], }) .then(response => { diff --git a/src/components/SideBar.vue b/src/components/SideBar.vue index 35b7943b..5a195e41 100644 --- a/src/components/SideBar.vue +++ b/src/components/SideBar.vue @@ -35,6 +35,7 @@ :envVars="envVars" :ref="tab.id" @search-changed="searchChanged(tab.id, $event)" + @hover-changed="hoverChanged($event)" /> @@ -113,11 +114,14 @@ export default { } }, methods: { + hoverChanged: function (data) { + this.$emit('hover-changed', data) + }, + /** + * This event is emitted when the search filters are changed. + * @arg `obj` {data, id} + */ searchChanged: function (id, data) { - /** - * This event is emitted when the search filters are changed. - * @arg `obj` {data, id} - */ this.$emit('search-changed', { ...data, id: id }) }, /** diff --git a/src/components/SidebarContent.vue b/src/components/SidebarContent.vue index d9662ad6..455b7fba 100644 --- a/src/components/SidebarContent.vue +++ b/src/components/SidebarContent.vue @@ -39,7 +39,13 @@ No results found - Please change your search / filter criteria.