aboutsummaryrefslogtreecommitdiff
path: root/src/site
diff options
context:
space:
mode:
Diffstat (limited to 'src/site')
-rw-r--r--src/site/pages/dashboard/admin/statistics.vue14
-rw-r--r--src/site/store/admin.js15
2 files changed, 23 insertions, 6 deletions
diff --git a/src/site/pages/dashboard/admin/statistics.vue b/src/site/pages/dashboard/admin/statistics.vue
index ecee102..c1e79fc 100644
--- a/src/site/pages/dashboard/admin/statistics.vue
+++ b/src/site/pages/dashboard/admin/statistics.vue
@@ -16,6 +16,10 @@
<h2 class="title">
{{ category }} <span v-if="stats[category].meta" class="is-size-7 is-pulled-right is-family-monospace has-text-grey-light">
generated on {{ stats[category].meta.generatedOn }}
+ <b-icon class="is-pulled-right ml1 is-clickable"
+ size="is-small"
+ icon="reload"
+ @click.native="refresh(category)" />
</span>
</h2>
@@ -84,7 +88,15 @@ export default {
computed: mapState({
stats: state => state.admin.statistics
}),
- methods: {},
+ methods: {
+ refresh(category) {
+ try {
+ this.$store.dispatch('admin/fetchStatistics', category);
+ } catch (error) {
+ this.$notifier.error(error.message);
+ }
+ }
+ },
head() {
return {
title: 'Service statistics'
diff --git a/src/site/store/admin.js b/src/site/store/admin.js
index b2d1926..0d0360b 100644
--- a/src/site/store/admin.js
+++ b/src/site/store/admin.js
@@ -22,9 +22,10 @@ export const actions = {
return response;
},
- async fetchStatistics({ commit }) {
- const response = await this.$axios.$get('service/statistics');
- commit('setStatistics', response);
+ async fetchStatistics({ commit }, category) {
+ const url = category ? `service/statistics/${category}` : 'service/statistics';
+ const response = await this.$axios.$get(url);
+ commit('setStatistics', { statistics: response.statistics, category: category });
return response;
},
@@ -96,8 +97,12 @@ export const mutations = {
setSettings(state, { config }) {
state.settings = config;
},
- setStatistics(state, { statistics }) {
- state.statistics = statistics;
+ setStatistics(state, { statistics, category }) {
+ if (category) {
+ state.statistics[category] = statistics[category];
+ } else {
+ state.statistics = statistics;
+ }
},
setUsers(state, { users }) {
state.users = users;