-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jlpereira
committed
Jun 6, 2023
1 parent
93d1cbf
commit c729963
Showing
8 changed files
with
103 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/modules/otus/components/Panel/PanelStats/PanelStats.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| <template> | ||
| <VCard> | ||
| <VCardHeader class="flex justify-between"> | ||
| <h2 class="text-md">Stats</h2> | ||
| </VCardHeader> | ||
| <VCardContent class="text-sm"> | ||
| <div> | ||
| <p> | ||
| Taxa: | ||
| <span class="capitalize"> | ||
| {{ store.catalog.stats.taxa }} | ||
| </span> | ||
| </p> | ||
| </div> | ||
| <div> | ||
| <p> | ||
| Names: | ||
| <span class="capitalize"> | ||
| {{ store.catalog.stats.names }} | ||
| </span> | ||
| </p> | ||
| </div> | ||
| </VCardContent> | ||
| </VCard> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| import { useOtuStore } from '@/modules/otus/store/store' | ||
| const props = defineProps({ | ||
| otuId: { | ||
| type: [Number, String], | ||
| required: true | ||
| }, | ||
| taxonId: { | ||
| type: [Number, String], | ||
| required: true | ||
| }, | ||
| taxon: { | ||
| type: Object, | ||
| default: undefined | ||
| }, | ||
| otu: { | ||
| type: Object, | ||
| default: undefined | ||
| } | ||
| }) | ||
| const store = useOtuStore() | ||
| </script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| export * from './loadCatalog' | ||
| export * from './loadDistribution' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import TaxonWorks from '../../services/TaxonWorks' | ||
|
|
||
| function parseStats(obj) { | ||
| return Object.entries(obj) | ||
| .filter(([_, count]) => count) | ||
| .map((item) => item.join(': ')) | ||
| .join('; ') | ||
| } | ||
|
|
||
| export const actionLoadCatalog = { | ||
| async loadCatalog(taxonId) { | ||
| const { data } = await TaxonWorks.getTaxonNameCitations(taxonId) | ||
|
|
||
| this.catalog = { | ||
| ...data, | ||
| stats: { | ||
| taxa: parseStats(data.stats.taxa), | ||
| names: parseStats(data.stats.names) | ||
| }, | ||
| sources: data.sources.map(({ cached, url }) => | ||
| cached.replace(url, `<a href="${url}">${url}</a>`) | ||
| ) | ||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters