Skip to content

Commit

Permalink
Update stats panel
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpereira committed Jun 11, 2023
1 parent 4eb385b commit 7bf5121
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 31 deletions.
16 changes: 5 additions & 11 deletions src/components/Button/ButtonExpand.global.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<template>
<button
type="button"
class="
button-expand
bg-base-foreground
text-secondary-color
w-5
h-5"
:title="isExpanded ? 'Close' : 'Expand'"
class="button-expand bg-base-foreground text-secondary-color w-5 h-5"
@click="isExpanded = !isExpanded"
>
<IconMinusCircle
v-if="isExpanded"
v-if="isExpanded"
class="w-5 h-5"
/>
<IconPlusCircle
Expand All @@ -21,7 +17,6 @@
</template>

<script setup>
import { computed } from 'vue'
const props = defineProps({
Expand All @@ -34,13 +29,12 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue'])
const isExpanded = computed({
get () {
get() {
return props.modelValue
},
set (value) {
set(value) {
emit('update:modelValue', value)
}
})
</script>
61 changes: 45 additions & 16 deletions src/modules/otus/components/Panel/PanelStats/PanelStats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,56 @@
<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>
<VTable>
<VTableHeader>
<VTableHeaderRow>
<VTableHeaderCell class="bg-base-foreground" />
<VTableHeaderCell>Taxa</VTableHeaderCell>
<VTableHeaderCell class="border-l border-base-border"
>Names</VTableHeaderCell
>
<VTableHeaderCell
colspan="2"
class="bg-base-foreground"
/>
</VTableHeaderRow>
<VTableHeaderRow>
<VTableHeaderCell>Rank</VTableHeaderCell>
<VTableHeaderCell>Total</VTableHeaderCell>
<VTableHeaderCell class="border-l border-base-border">
Total
</VTableHeaderCell>
<VTableHeaderCell> Valid </VTableHeaderCell>
<VTableHeaderCell> Invalid </VTableHeaderCell>
</VTableHeaderRow>
</VTableHeader>
<VTableBody>
<VTableBodyRow
v-for="(value, rank) in store.catalog.stats.taxa"
:key="rank"
>
<VTableBodyCell class="capitalize">{{ rank }}</VTableBodyCell>
<VTableBodyCell>{{ value }}</VTableBodyCell>

<VTableBodyCell class="border-l border-base-border">{{
store.catalog.stats.names[rank].invalid +
store.catalog.stats.names[rank].valid
}}</VTableBodyCell>
<VTableBodyCell>{{
store.catalog.stats.names[rank].valid
}}</VTableBodyCell>
<VTableBodyCell>{{
store.catalog.stats.names[rank].invalid
}}</VTableBodyCell>
</VTableBodyRow>
</VTableBody>
</VTable>
</VCardContent>
</VCard>
</template>

<script setup>
import VTableHeaderCellGlobal from '@/components/Table/VTableHeaderCell.global.vue'
import { useOtuStore } from '@/modules/otus/store/store'
const props = defineProps({
Expand Down
4 changes: 0 additions & 4 deletions src/modules/otus/store/actions/loadCatalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ export const actionLoadCatalog = {

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>`)
)
Expand Down

0 comments on commit 7bf5121

Please sign in to comment.