From 8c90e72baa5aff5f14c29366c6fd7607da3ed222 Mon Sep 17 00:00:00 2001
From: Beecher Baker
Date: Tue, 20 Aug 2024 11:45:47 -0400
Subject: [PATCH] inventory panel: remove CollectionObjects api results;
relabel 'In the Collection'
---
.../PanelDescendants/PanelDescendants.vue | 4 +-
.../Panel/PanelInventory/PanelInventory.vue | 73 ++++---------------
src/modules/otus/services/TaxonWorks.js | 2 +-
3 files changed, 16 insertions(+), 63 deletions(-)
diff --git a/src/modules/otus/components/Panel/PanelDescendants/PanelDescendants.vue b/src/modules/otus/components/Panel/PanelDescendants/PanelDescendants.vue
index d075a88..eece489 100644
--- a/src/modules/otus/components/Panel/PanelDescendants/PanelDescendants.vue
+++ b/src/modules/otus/components/Panel/PanelDescendants/PanelDescendants.vue
@@ -26,8 +26,8 @@
taxonomy &&
!taxonomy.nomenclatural_synonyms.length &&
!taxonomy.descendants.length
- ">
- No descendants.
+ " >
+ No descendants of .
diff --git a/src/modules/otus/components/Panel/PanelInventory/PanelInventory.vue b/src/modules/otus/components/Panel/PanelInventory/PanelInventory.vue
index a7380cd..f5a4e3b 100644
--- a/src/modules/otus/components/Panel/PanelInventory/PanelInventory.vue
+++ b/src/modules/otus/components/Panel/PanelInventory/PanelInventory.vue
@@ -2,45 +2,22 @@
- Inventory
- [{{inventory.length}}]
+ In the Collection
+ [{{ inventoryDWC.length }}]
-
-
- Collection Objects
- [{{collectionObjects.length}}]
-
-
-
- -
-
-
- {{ collectionObject.id }} — length {{JSON.stringify(collectionObject).length}}
-
-
- -
- {{ entry[0] }}: {{ entry[1] }}
-
-
-
-
-
-
-
- Inventory
-
+
- -
+
-
{{ makeInventoryLabel(inventoryItem) }}
@@ -79,9 +56,8 @@ const props = defineProps({
}
})
-const collectionObjects = ref("Loading...")
-const inventory = ref("Loading...")
-const isLoading = ref({collectionObjects: false, inventory: false})
+const inventoryDWC = ref("Loading...")
+const isLoading = ref(false)
/** Based on taxonpages-orthoptera PanelSpecimentRecords. */
function makeInventoryLabel(item) {
@@ -133,41 +109,18 @@ watch(
() => props.otuId,
async () => {
if (!props.otuId) {
- collectionObjects.value = 'No OTU specified.'
- inventory.value = 'No OTU specified.'
+ inventoryDWC.value = 'No OTU specified.'
return
}
- isLoading.value = {...isLoading.value, collectionObjects: true}
+ isLoading.value = true
useOtuPageRequest('panel:inventory', () =>
- TaxonWorks.getCollectionObjects(props.otuId)
+ TaxonWorks.getOtuInventoryDarwinCore(props.otuId)
).then(({data}) => {
- collectionObjects.value = data
- console.log('CollectionObjects', data)
+ inventoryDWC.value = data
}).catch(
- e => collectionObjects.value = `Error: ${e}`
- ).finally(() => isLoading.value = {...isLoading.value, collectionObjects: false})
- },
- {immediate: true}
- )
-
-watch(
- () => props.otuId,
- async () => {
- if (!props.otuId) {
- inventory.value = 'No OTU specified.'
- return
- }
-
- isLoading.value = {...isLoading.value, inventory: true}
- useOtuPageRequest('panel:inventory', () =>
- TaxonWorks.getInventoryDarwinCore(props.otuId)
- ).then(({data}) => {
- inventory.value = data
- console.log('Inventory (Darwin Core)', data)
- }).catch(
- e => inventory.value = `Error: ${e}`
- ).finally(() => isLoading.value = {...isLoading.value, inventory: false})
+ e => inventoryDWC.value = `Error: ${e}`
+ ).finally(() => isLoading.value = false)
},
{immediate: true}
)
diff --git a/src/modules/otus/services/TaxonWorks.js b/src/modules/otus/services/TaxonWorks.js
index 9a29d57..b7197c5 100644
--- a/src/modules/otus/services/TaxonWorks.js
+++ b/src/modules/otus/services/TaxonWorks.js
@@ -75,7 +75,7 @@ export default class TaxonWorks {
// return makeAPIRequest.get(`/collection_objects?otu_id[]=${otuId}/dwc.json`, opt)
}
- static getInventoryDarwinCore(otuId, opt) {
+ static getOtuInventoryDarwinCore(otuId, opt) {
return makeAPIRequest.get(`/otus/${otuId}/inventory/dwc.json`, opt)
}