Browse Source

Remove vuex from stats page

pull/1235/head
Hironsan 3 years ago
parent
commit
1b9469897e
1 changed files with 20 additions and 23 deletions
  1. 43
      frontend/pages/projects/_id/statistics/index.vue

43
frontend/pages/projects/_id/statistics/index.vue

@ -1,12 +1,12 @@
<template> <template>
<v-row v-if="stats">
<v-row v-if="!isEmpty">
<v-col <v-col
cols="12" cols="12"
lg="4" lg="4"
> >
<v-card> <v-card>
<doughnut-chart <doughnut-chart
:chart-data="progressLocale()"
:chart-data="stats.progress"
/> />
</v-card> </v-card>
</v-col> </v-col>
@ -16,7 +16,7 @@
> >
<v-card> <v-card>
<bar-chart <bar-chart
:chart-data="labelStatsLocale()"
:chart-data="stats.label"
/> />
</v-card> </v-card>
</v-col> </v-col>
@ -26,7 +26,7 @@
> >
<v-card> <v-card>
<bar-chart <bar-chart
:chart-data="userStatsLocale()"
:chart-data="stats.user"
/> />
</v-card> </v-card>
</v-col> </v-col>
@ -34,7 +34,7 @@
</template> </template>
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'
import _ from 'lodash'
import DoughnutChart from '@/components/molecules/DoughnutChart' import DoughnutChart from '@/components/molecules/DoughnutChart'
import BarChart from '@/components/molecules/BarChart' import BarChart from '@/components/molecules/BarChart'
@ -46,28 +46,25 @@ export default {
BarChart BarChart
}, },
computed: {
...mapGetters('statistics', ['userStats', 'labelStats', 'progress']),
...mapState('statistics', ['stats'])
data() {
return {
stats: {}
}
}, },
async created() {
await this.fetchStatistics({
projectId: this.$route.params.id
})
computed: {
isEmpty() {
return _.isEmpty(this.stats)
}
}, },
methods: {
...mapActions('statistics', ['fetchStatistics']),
progressLocale() {
return this.progress(this.$t('statistics.progress'))
},
labelStatsLocale() {
return this.labelStats(this.$t('statistics.labelStats'))
},
userStatsLocale() {
return this.userStats(this.$t('statistics.userStats'))
}
async created() {
this.stats = await this.$services.statistics.fetchStatistics(
this.$route.params.id,
this.$t('statistics.labelStats'),
this.$t('statistics.userStats'),
this.$t('statistics.progress')
)
}, },
validate({ params }) { validate({ params }) {

Loading…
Cancel
Save