Skip to content

Commit

Permalink
added ranking
Browse files Browse the repository at this point in the history
  • Loading branch information
emilie19 committed Nov 28, 2023
1 parent ade10a2 commit d6c86e1
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 30 deletions.
Binary file added src/assets/images/icon_sortasc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/icon_sortascsel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/icon_sortdsc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/icon_sortdscsel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions src/components/FacetsComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

</div>

<SortDropdown :updateSort="this.updateRanking" :options="filters.ranking" :selected="user_query.ranking"/>

<h2>Filters</h2>

<div v-for="facet in this.filters.facets" :key="facet.name">
Expand All @@ -36,13 +34,11 @@
import { mapState } from 'vuex'
import FacetElement from '@/components/FacetElement.vue'
import '../assets/css/ebiodiv.css'
import SortDropdown from '@/components/SortDropdown.vue'
export default {
name: 'FacetsComponent',
components: {
FacetElement,
SortDropdown
},
props: {
item_size: {
Expand Down
9 changes: 9 additions & 0 deletions src/components/OccurrencesElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ import shared_fields from '@/components/shared_fields.js'
this.$gtag.event('displayOccurrence');
},
getValue(variable){
if (variable == "occurrence.eventDate"){
var content = eval("this."+variable)
if (content != null){
return content.slice(0, 10);
}
else{
return ""
}
}
if (variable == "occurrence.typeStatus"){
return (this.display_value_typeStatus(eval("this."+variable)))
}
Expand Down
35 changes: 35 additions & 0 deletions src/components/OccurrencesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
<img :src="require('../assets/images/icon_more.png')" class="mini" />
</button>
{{ get_occurrence_name }} ID
<template>
<img v-if="!isRanking('gbifDoi', 'dsc')" :src="require('../assets/images/icon_sortdsc.png')" class="extramini" @click="sortBy('gbifDoi', 'dsc')"/>
<img v-if="isRanking('gbifDoi', 'dsc')" :src="require('../assets/images/icon_sortdscsel.png')" class="extramini"/>
<img v-if="!isRanking('gbifDoi', 'asc')" :src="require('../assets/images/icon_sortasc.png')" class="extramini" @click="sortBy('gbifDoi', 'asc')"/>
<img v-if="isRanking('gbifDoi', 'asc')" :src="require('../assets/images/icon_sortascsel.png')" class="extramini"/>
</template>

<div :class="fields_popup" :style="{ top: modalTop + 'px', left: modalLeft + 'px', zIndex: modalZIndex }">

Expand Down Expand Up @@ -75,6 +81,12 @@
<th v-for="field in fields_to_display" :key="'display_'+field.field">
<span v-if="field.title == 'nb'">{{ get_curation_name }}</span>
{{ field.title }}
<template v-if="field.sortable">
<img v-if="!isRanking(field.field, 'dsc')" :src="require('../assets/images/icon_sortdsc.png')" class="extramini" @click="sortBy(field.field, 'dsc')"/>
<img v-if="isRanking(field.field, 'dsc')" :src="require('../assets/images/icon_sortdscsel.png')" class="extramini"/>
<img v-if="!isRanking(field.field, 'asc')" :src="require('../assets/images/icon_sortasc.png')" class="extramini" @click="sortBy(field.field, 'asc')"/>
<img v-if="isRanking(field.field, 'asc')" :src="require('../assets/images/icon_sortascsel.png')" class="extramini"/>
</template>
</th>
<th>Status</th>
<th></th>
Expand Down Expand Up @@ -199,6 +211,7 @@ export default {
fields_popup(){
return "fields-popup "+this.popup_visibility
},
},
methods: {
...mapActions([
Expand Down Expand Up @@ -316,6 +329,24 @@ export default {
}
this.updateOccurrenceCharacteristics(fields)
},
getRankingValue(field, order){
var value = ""
if (order == "dsc"){
value = "-"
}
value += field.replace("occurrence.", "")
return value
},
sortBy(field, order){
var value = this.getRankingValue(field, order)
this.updateRanking(value)
},
isRanking(field, order){
if (this.getRankingValue(field, order) == this.user_query.ranking){
return true
}
return false
}
},
watch: {
"user_query.page": function () {
Expand Down Expand Up @@ -449,6 +480,10 @@ th {
width: 13px;
cursor: pointer;
}
.extramini {
width: 8px;
cursor: pointer;
}
.button-th {
display: inline-block;
Expand Down
52 changes: 26 additions & 26 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,32 +174,32 @@ export default new Vuex.Store({
],
},
occurrence_characteristics: [
{title: 'Scientific name', field: 'occurrence.scientificName', selection: true},
{title: 'Type', field: 'occurrence.typeStatus', selection: true},
{title: 'Record', field: 'occurrence.basisOfRecord', selection: true},
{title: 'Year', field: 'occurrence.year', selection: true},
{title: 'EventDate', field: 'occurrence.eventDate', selection: true},
{title: 'nb', field: 'relation_count', selection: true},
{title: 'Verbatim label', field: 'occurrence.verbatimLabel', selection: false},
{title: 'Kingdom', field: 'occurrence.kingdom', selection: false},
{title: 'Phylum', field: 'occurrence.phylum', selection: false},
{title: 'Order', field: 'occurrence.order', selection: false},
{title: 'Family', field: 'occurrence.family', selection: false},
{title: 'Genus', field: 'occurrence.genus', selection: false},
{title: 'Species', field: 'occurrence.species', selection: false},
{title: 'Specific epithet', field: 'occurrence.specificEpithet', selection: false},
{title: 'Taxon rank', field: 'occurrence.taxonRank', selection: false},
{title: 'Country', field: 'occurrence.country', selection: false},
{title: 'Locality', field: 'occurrence.locality', selection: false},
{title: 'Institution code', field: 'occurrence.institutionCode', selection: false},
{title: 'Collection code', field: 'occurrence.collectionCode', selection: false},
{title: 'Recorded by', field: 'occurrence.recordedBy', selection: false},
{title: 'Undecidable', field: 'occurrence.occurrenceRelationSummary.UDCB', selection: false},
{title: 'Pending', field: 'occurrence.occurrenceRelationSummary.PNDG', selection: false},
{title: 'Done', field: 'occurrence.occurrenceRelationSummary.DONE', selection: false},
{title: 'Done (YES)', field: 'occurrence.occurrenceRelationSummary.DONE_YES', selection: false},
{title: 'Done (NO)', field: 'occurrence.occurrenceRelationSummary.DONE_NO', selection: false},
{title: 'Comments', field: 'comment_count', selection: false},
{title: 'Scientific name', field: 'occurrence.scientificName', selection: true, sortable: true},
{title: 'Type', field: 'occurrence.typeStatus', selection: true, sortable: true},
{title: 'Record', field: 'occurrence.basisOfRecord', selection: true, sortable: false},
{title: 'Publication year', field: 'occurrence.year', selection: true, sortable: false},
{title: 'Collection date', field: 'occurrence.eventDate', selection: true, sortable: true},
{title: 'nb', field: 'relation_count', selection: true, sortable: false},
{title: 'Verbatim label', field: 'occurrence.verbatimLabel', selection: false, sortable: false},
{title: 'Kingdom', field: 'occurrence.kingdom', selection: false, sortable: true},
{title: 'Phylum', field: 'occurrence.phylum', selection: false, sortable: true},
{title: 'Order', field: 'occurrence.order', selection: false, sortable: true},
{title: 'Family', field: 'occurrence.family', selection: false, sortable: true},
{title: 'Genus', field: 'occurrence.genus', selection: false, sortable: true},
{title: 'Species', field: 'occurrence.species', selection: false, sortable: false},
{title: 'Specific epithet', field: 'occurrence.specificEpithet', selection: false, sortable: true},
{title: 'Taxon rank', field: 'occurrence.taxonRank', selection: false, sortable: true},
{title: 'Country', field: 'occurrence.country', selection: false, sortable: true},
{title: 'Locality', field: 'occurrence.locality', selection: false, sortable: false},
{title: 'Institution code', field: 'occurrence.institutionCode', selection: false, sortable: true},
{title: 'Collection code', field: 'occurrence.collectionCode', selection: false, sortable: true},
{title: 'Recorded by', field: 'occurrence.recordedBy', selection: false, sortable: true},
{title: 'Undecidable', field: 'occurrence.occurrenceRelationSummary.UDCB', selection: false, sortable: false},
{title: 'Pending', field: 'occurrence.occurrenceRelationSummary.PNDG', selection: false, sortable: false},
{title: 'Done', field: 'occurrence.occurrenceRelationSummary.DONE', selection: false, sortable: false},
{title: 'Done (YES)', field: 'occurrence.occurrenceRelationSummary.DONE_YES', selection: false, sortable: false},
{title: 'Done (NO)', field: 'occurrence.occurrenceRelationSummary.DONE_NO', selection: false, sortable: false},
{title: 'Comments', field: 'comment_count', selection: false, sortable: false},
],
curation_characteristics: [
{name: 'Family', score: 'family', value: ['family']},
Expand Down

0 comments on commit d6c86e1

Please sign in to comment.