From a3c4e8a1bc00302580d24725daeae101c0a0043c Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 16 Nov 2018 05:21:52 +0900 Subject: [PATCH] [Client] Improve admin dashboard --- src/client/app/admin/views/dashboard.vue | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/client/app/admin/views/dashboard.vue b/src/client/app/admin/views/dashboard.vue index 8cd57831a..2a6d9a310 100644 --- a/src/client/app/admin/views/dashboard.vue +++ b/src/client/app/admin/views/dashboard.vue @@ -20,7 +20,7 @@
{{ $t('accounts') }} - {{ stats.originalUsersCount | number }} + {{ stats.originalUsersCount | number }}
@@ -33,7 +33,7 @@
{{ $t('notes') }} - {{ stats.originalNotesCount | number }} + {{ stats.originalNotesCount | number }}
@@ -109,6 +109,7 @@ export default Vue.extend({ connection: null, meta: null, instances: [], + clock: null, faDatabase }; }, @@ -116,14 +117,13 @@ export default Vue.extend({ created() { this.connection = this.$root.stream.useSharedConnection('serverStats'); + this.updateStats(); + this.clock = setInterval(this.updateStats, 1000); + this.$root.getMeta().then(meta => { this.meta = meta; }); - this.$root.api('stats').then(stats => { - this.stats = stats; - }); - this.$root.api('instances', { sort: '+notes' }).then(instances => { @@ -139,11 +139,18 @@ export default Vue.extend({ beforeDestroy() { this.connection.dispose(); + clearInterval(this.clock); }, methods: { setChartSrc(src) { this.$refs.charts.setSrc(src); + }, + + updateStats() { + this.$root.api('stats').then(stats => { + this.stats = stats; + }); } } }); @@ -236,9 +243,6 @@ export default Vue.extend({ > b display block - &.primary - color var(--primary) - > div:last-child display flex padding 6px 16px