Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hover dataset callback #71

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
:activeId="activeId"
@tabClicked="tabClicked"
@search-changed="searchChanged($event)"
@hover-changed="hoverChanged($event)"
@actionClick="action"
/>
</div>
Expand Down Expand Up @@ -110,6 +111,9 @@ export default {
}
},
methods: {
hoverChanged: function (data) {
console.log('hoverChanged', data)
},
searchChanged: function (data) {
console.log(data)
},
Expand Down
2 changes: 2 additions & 0 deletions src/algolia/algolia.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -167,6 +168,7 @@ export class AlgoliaClient {
'item.name',
'item.description',
'objectID',
'anatomy.organ.curie'
],
})
.then(response => {
Expand Down
16 changes: 12 additions & 4 deletions src/components/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
:envVars="envVars"
:ref="tab.id"
@search-changed="searchChanged(tab.id, $event)"
@hover-changed="hoverChanged($event)"
/>
</template>
</div>
Expand Down Expand Up @@ -113,11 +114,18 @@ export default {
}
},
methods: {
/**
* This event is emitted when the mouse hover are changed.
* @arg data
*/
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 })
},
/**
Expand Down
19 changes: 17 additions & 2 deletions src/components/SidebarContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@
No results found - Please change your search / filter criteria.
</div>
<div v-for="result in results" :key="result.doi" class="step-item">
<DatasetCard :entry="result" :envVars="envVars"></DatasetCard>
<DatasetCard
class="dataset-card"
:entry="result"
:envVars="envVars"
@mouseenter="hoverChanged(result)"
@mouseleave="hoverChanged(undefined)"
/>
</div>
<el-pagination
class="pagination"
Expand Down Expand Up @@ -154,6 +160,9 @@ export default {
},
},
methods: {
hoverChanged: function (data) {
this.$emit('hover-changed', data)
},
resetSearch: function () {
this.numberOfHits = 0
this.discoverIds = []
Expand Down Expand Up @@ -449,6 +458,12 @@ export default {
</script>

<style lang="scss" scoped>
.dataset-card:hover {
border-style: solid;
border-color: var(--el-color-primary);
border-radius: 5px;
}

.content-card {
height: 100%;
flex-flow: column;
Expand Down Expand Up @@ -527,7 +542,7 @@ export default {
}

.content :deep(.step-item:not(:first-child) .seperator-path) {
width: 486px;
width: 455px;
height: 0px;
border: solid 1px #e4e7ed;
background-color: #e4e7ed;
Expand Down