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

Feat/list of networks #232

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
44a1533
feat: first implementation of list of networks. It shows the networks…
svituz Apr 16, 2021
f7ba503
feat: adds biobanks to network tab in network view mode
svituz Apr 16, 2021
688140c
feat: adds viewmode state property to differentiate between biobank a…
svituz Apr 16, 2021
9e23437
fix: fix 'loading' writing in network view mode
svituz Apr 19, 2021
827277c
refactor: changes name of GetNetworkInfo function
svituz Apr 19, 2021
39cc223
fix: fix create bookmark: now it doesn't include filters that are not…
svituz Apr 19, 2021
6e4b4ee
feat: network view now have biobank cards as children
svituz May 7, 2021
295d7da
feat: adds filters for common parameters for networks
svituz May 7, 2021
87b4a52
refactor(network view): refactor in filterDefinitions and ux style
svituz May 11, 2021
def2646
test(network view): adds some tests and adapts others to new features
svituz May 11, 2021
681f213
feat(network view): adds network result information in the result header
svituz May 11, 2021
c3ebab8
feat(network view): adds collections not directly in the network but …
svituz May 11, 2021
e378749
test(network view): adds tests for action GetNetworkInfo
svituz May 11, 2021
b6e1d1e
test(network view): adds tests for BiobankExplorerContainer
svituz May 11, 2021
d21a774
test(network view): adds tests for BiobankCardsContainer
svituz May 11, 2021
cf07a2f
test(network view): adds tests for NetworkCard, NetworkCardsContainer…
svituz May 12, 2021
b095c89
test: adds tests for ActiveFilterList
svituz May 17, 2021
ee26ee7
test: adds some tests for actions
svituz May 17, 2021
8646458
test: adds tests for getters
svituz May 17, 2021
0b63687
test: adds tests for mutations
svituz May 18, 2021
bea369a
feat: changes the biobank network filters logic
svituz May 19, 2021
14b7351
feat: changes network filter and biobank filter in rsql to be in or
svituz May 19, 2021
bbb4c26
test: adds test for arrayEqual
svituz May 19, 2021
3c288d6
feat: adds search by name for networks
svituz May 19, 2021
8b444c7
test: changes tests GetBiobankIdsInNetwork and GetNetworkIds
svituz May 19, 2021
4912aa1
refactor: removes unused file
svituz May 25, 2021
17fc8e1
Changes network card icon and adds plus button to open the card
svituz Jun 29, 2021
23e5348
feat(network-view): changes collapse icon for network card to caret-r…
svituz Jun 29, 2021
8836fde
fix(network-view): bug that didn't show the biobanks with collections…
svituz Jun 30, 2021
9aa9af5
fix(network-view): fix a bug that included all the collections to a n…
svituz Jul 2, 2021
96bdd4c
feat(network-view): some minor changes
svituz Jul 2, 2021
d783548
feat: restores old beahviour that opened the card of the first biobank
svituz Jul 2, 2021
ba5a0df
refactor(networkview): Changed implementation after rebase and update…
svituz Sep 9, 2021
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
38 changes: 33 additions & 5 deletions src/components/BiobankExplorerContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@

<div class="row">
<div class="col-md-12">
<biobank-cards-container></biobank-cards-container>
<network-cards-container v-if="mode === 'networkview'"></network-cards-container>
<biobank-cards-container v-else></biobank-cards-container>
</div>
</div>
</div>
Expand Down Expand Up @@ -145,6 +146,7 @@
<script>
import { CartSelectionToast } from '@molgenis-ui/components-library'
import BiobankCardsContainer from './cards/BiobankCardsContainer'
import NetworkCardsContainer from './cards/NetworkCardsContainer'
import FilterContainer from './filters/FilterContainer'
import ResultHeader from './ResultHeader'
import { mapGetters, mapActions, mapState, mapMutations } from 'vuex'
Expand All @@ -153,8 +155,15 @@ import CollectionSelectAll from '@/components/buttons/CollectionSelectAll.vue'

export default {
name: 'biobank-explorer-container',
props: {
mode: {
type: String,
default: 'biobankview'
}
},
components: {
BiobankCardsContainer,
NetworkCardsContainer,
FilterContainer,
ResultHeader,
CartSelectionToast,
Expand All @@ -170,10 +179,12 @@ export default {
...mapGetters([
'rsql',
'biobankRsql',
'networkRsql',
'loading',
'foundCollectionIds',
'activeFilters',
'collectionsInPodium',
'selectedBiobankInNetwork',
'selectedBiobankQuality',
'selectedCollectionQuality',
'satisfyAllBiobankQuality',
Expand Down Expand Up @@ -214,6 +225,10 @@ export default {
}
},
watch: {
selectedBiobankInNetwork: {
immediate: false,
handler: 'GetBiobankIdsInNetwork'
},
selectedBiobankQuality: {
immediate: true,
handler: 'GetBiobankIdsForQuality'
Expand All @@ -231,26 +246,32 @@ export default {
handler: 'GetCollectionIdsForQuality'
},
rsql: {
immediate: true,
immediate: false,
handler: 'GetCollectionInfo'
},
biobankRsql: {
immediate: true,
immediate: false,
handler: 'GetBiobankIds'
},
networkRsql: {
immediate: false,
handler: 'GetNetworkInfo'
},
isPodium: {
immediate: true,
handler: 'GetPodiumCollections'
}
},
methods: {
...mapMutations(['RemoveCollectionsFromSelection', 'MapQueryToState']),
...mapMutations(['RemoveCollectionsFromSelection', 'MapQueryToState', 'SetViewMode']),
...mapActions([
'GetCollectionInfo',
'GetBiobankIds',
'GetNetworkInfo',
'GetPodiumCollections',
'GetBiobankIdsForQuality',
'GetCollectionIdsForQuality'
'GetCollectionIdsForQuality',
'GetBiobankIdsInNetwork'
]),
isNonCommercialCollection (collectionId) {
return this.nonCommercialCollections.indexOf(collectionId) >= 0
Expand Down Expand Up @@ -319,6 +340,13 @@ export default {
if (this.selectedCollections.length) {
createBookmark(this.activeFilters, this.selectedCollections)
}
this.SetViewMode(this.mode)
this.GetBiobankIds()
if (this.mode === 'networkview') {
this.GetNetworkInfo()
} else {
this.GetCollectionInfo()
}
}
}
</script>
Expand Down
5 changes: 4 additions & 1 deletion src/components/ResultHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<div class="biobank-number-report-container">
<small class="biobank-number-report">
<em>
<template v-if="foundNetworks > 0">
{{ foundNetworks }} networks with
</template>
{{ foundBiobanks }} organisations with
{{ parentCollections.length }} collection(s)
<template v-if="numberOfSubCollections > 0">
Expand Down Expand Up @@ -50,7 +53,7 @@ import { mapGetters } from 'vuex'

export default {
computed: {
...mapGetters(['foundBiobanks', 'foundCollectionIds', 'parentCollections']),
...mapGetters(['foundNetworks', 'foundBiobanks', 'foundCollectionIds', 'parentCollections']),
numberOfSubCollections () {
return this.foundCollectionIds.length - this.parentCollections.length
}
Expand Down
45 changes: 31 additions & 14 deletions src/components/cards/BiobankCardsContainer.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div class="biobank-cards-container">
<div v-if="!loading && foundBiobanks > 0">
<div v-if="!loading && numberOfBiobanks > 0">
<b-pagination
v-if="foundBiobanks > pageSize"
v-if="numberOfBiobanks > pageSize"
size="md"
align="center"
:total-rows="foundBiobanks"
:total-rows="numberOfBiobanks"
v-model="currentPage"
:per-page="pageSize"></b-pagination>
<biobank-card
Expand All @@ -16,15 +16,15 @@
</biobank-card>

<b-pagination
v-if="foundBiobanks > pageSize"
v-if="numberOfBiobanks > pageSize"
size="md"
align="center"
:total-rows="foundBiobanks"
:total-rows="numberOfBiobanks"
v-model="currentPage"
:per-page="pageSize"></b-pagination>
</div>

<div v-else-if="!loading && foundBiobanks === 0" class="status-text">
<div v-else-if="!loading && numberOfBiobanks === 0" class="status-text">
<h4>No biobanks were found</h4>
</div>

Expand Down Expand Up @@ -61,23 +61,34 @@ export default {
pageSize: 10
}
},
props: {
biobanks: {
type: [Array]
}
},
methods: {
...mapActions(['GetBiobanks'])
},
computed: {
...mapGetters([
'biobanks',
'foundBiobanks',
'loading'
]),
...mapGetters({
globalBiobanks: 'biobanks',
foundBiobanks: 'foundBiobanks',
loading: 'loading',
viewMode: 'viewMode'
}),
biobanksShown () {
return this.loading ? [] : this.biobanks.slice(this.pageSize * (this.currentPage - 1), this.pageSize * this.currentPage)
const biobanks = this.$props.biobanks ? this.$props.biobanks : this.globalBiobanks
return this.loading ? [] : biobanks.slice(this.pageSize * (this.currentPage - 1), this.pageSize * this.currentPage)
},
biobankIds () {
return this.loading ? [] : this.biobanks.map(it => it.id || it)
const biobanks = this.$props.biobanks ? this.$props.biobanks : this.globalBiobanks
return this.loading ? [] : biobanks.map(it => it.id || it)
},
biobankIdsToFetch () {
return this.biobanksShown.filter(it => typeof it === 'string')
},
numberOfBiobanks () {
return this.$props.biobanks ? this.$props.biobanks.length : this.foundBiobanks
}
},
components: {
Expand All @@ -91,10 +102,16 @@ export default {
}
},
biobankIdsToFetch (value) {
if (value.length) {
if (value.length > 0) {
this.GetBiobanks(value)
}
}
},
mounted () {
// Forces fetching of first set of biobanks since, in networkview, the first set of biobanksIds is not fetched automatically
if (this.viewMode === 'networkview' && this.biobankIdsToFetch.length > 0) {
this.GetBiobanks(this.biobankIdsToFetch)
}
}
}
</script>
114 changes: 114 additions & 0 deletions src/components/cards/NetworkCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<template>
<div class="card network-card">
<div
class="card-header network-card-header">
<div class="row">
<div class="collapse-column" v-if="!loading">
<font-awesome-icon
icon="caret-right"
:style="iconStyle"
class="collapse-button mr-2"
@click.prevent="collapsed=!collapsed"/>
</div>
<div class="col-md-5 d-flex flex-column" v-if="!loading">
<div class="mb-2">
<h5>
<router-link :to="'/network/' + network.id">
<font-awesome-icon
transform="shrink-3"
class="mr-2"
:icon="['fas', 'project-diagram']"/>
</router-link>
<span id="network-name">{{ network.name }}</span>
</h5>
</div>
</div>
<div class="col-md-6" v-if="!loading">
<p>
<small class="mr-2">
<span class="font-weight-bold">Number of biobanks:</span>
</small>
<small>{{ network.biobanks.length }}</small>
<br />
</p>
</div>
<div v-else class="col-md-12 text-center">
<span class="fa fa-spinner fa-spin" aria-hidden="true"></span>
</div>
</div>
</div>
<div class="card-body" v-if="!collapsed && !loading">
<biobank-cards-container
:biobanks="network.biobanks">
</biobank-cards-container>
</div>
</div>
</template>

<script>
import BiobankCardsContainer from './BiobankCardsContainer.vue'

export default {
name: 'network-card',
components: {
BiobankCardsContainer
},
props: {
network: {
type: [Object, String]
},
initCollapsed: {
type: Boolean,
required: false,
default: true
}
},
data () {
return {
collapsed: this.initCollapsed
}
},
computed: {
loading () {
return typeof this.network === 'string'
},
iconStyle () {
return {
transform: `rotate(${this.collapsed ? 0 : 90}deg)`,
transition: 'transform 0.2s'
}
}
}
}
</script>

<style>
.collapse-column {
margin-left: 10px;
margin-right: 6px;
display: table-cell !important;
vertical-align: middle;
}

.collapse-button {
cursor: pointer;
}

.network-card {
margin-bottom: 1em;
}

.network-card-header {
background-color: #e4e4e4;
}

.network-icon:hover {
cursor: pointer;
}

.icon-alignment {
position: relative;
top: 1px;
left: 2px;
}
</style>
Loading