Skip to content

Commit

Permalink
Sort sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpereira committed Jun 13, 2023
1 parent 5d4de80 commit 467ab29
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<VCard v-if="typeMaterials.length">
<VCardHeader class="flex justify-between">
<h2 class="text-md">Type specimen</h2>
<PanelDropdown panel-key="type-material" />
<PanelDropdown panel-key="panel:typeMaterial" />
</VCardHeader>
<VCardContent class="text-sm">
<p>
Expand Down Expand Up @@ -35,7 +35,7 @@ watch(
return
}
useOtuPageRequest('type-material', () =>
useOtuPageRequest('panel:typeMaterial', () =>
TaxonWorks.getOtuTypeMaterial(props.otuId)
).then(({ data }) => {
typeMaterials.value = data.type_materials_catalog_labels.sort(
Expand Down
2 changes: 1 addition & 1 deletion src/modules/otus/components/SiteMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</template>

<script setup>
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { useOtuPageRequestStore } from '../store/request'
const isModalVisible = ref(false)
Expand Down
7 changes: 5 additions & 2 deletions src/modules/otus/store/actions/loadDistribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import {
makeGeoJSONFeature
} from '../../utils'
import TaxonWorks from '../../services/TaxonWorks'
import { useOtuPageRequest } from '../../helpers/useOtuPageRequest'

export const actionLoadDistribution = {
async loadDistribution({ otuId, rankString }) {
const isSpeciesGroup = rankString && isRankGrpup('SpeciesGroup', rankString)

const getAggregateShape = async (otuId) => {
TaxonWorks.getOtuDistribution(otuId)
useOtuPageRequest('panel:map', () => TaxonWorks.getOtuDistribution(otuId))
.then(({ data }) => {
const geojson = JSON.parse(data.cached_map.geo_json)

Expand All @@ -27,7 +28,9 @@ export const actionLoadDistribution = {
}

if (isSpeciesGroup) {
TaxonWorks.getOtuGeoJSONDistribution(otuId)
useOtuPageRequest('panel:map', () =>
TaxonWorks.getOtuGeoJSONDistribution(otuId)
)
.then(({ data }) => {
if (data.request_too_large) {
this.distribution.geojson = null
Expand Down
9 changes: 4 additions & 5 deletions src/modules/otus/store/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ export const useOtuPageRequestStore = defineStore('otuPageRequest', {
},

sitemap: (state) => {
const entries = Object.entries(state.requests).map(([key, value]) => [
key,
value.url
])
const keys = Object.keys(state.requests).sort()

return Object.fromEntries(entries)
return Object.fromEntries(
keys.map((key) => [key, state.requests[key].url])
)
}
},

Expand Down

0 comments on commit 467ab29

Please sign in to comment.