[Client] Improve admin dashboard

This commit is contained in:
syuilo 2018-11-16 05:21:52 +09:00
parent 672b7a4c3d
commit a3c4e8a1bc
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
1 changed files with 13 additions and 9 deletions

View File

@ -20,7 +20,7 @@
<div><fa icon="user"/></div> <div><fa icon="user"/></div>
<div> <div>
<span>{{ $t('accounts') }}</span> <span>{{ $t('accounts') }}</span>
<b class="primary">{{ stats.originalUsersCount | number }}</b> <b>{{ stats.originalUsersCount | number }}</b>
</div> </div>
</div> </div>
<div> <div>
@ -33,7 +33,7 @@
<div><fa icon="pencil-alt"/></div> <div><fa icon="pencil-alt"/></div>
<div> <div>
<span>{{ $t('notes') }}</span> <span>{{ $t('notes') }}</span>
<b class="primary">{{ stats.originalNotesCount | number }}</b> <b>{{ stats.originalNotesCount | number }}</b>
</div> </div>
</div> </div>
<div> <div>
@ -109,6 +109,7 @@ export default Vue.extend({
connection: null, connection: null,
meta: null, meta: null,
instances: [], instances: [],
clock: null,
faDatabase faDatabase
}; };
}, },
@ -116,14 +117,13 @@ export default Vue.extend({
created() { created() {
this.connection = this.$root.stream.useSharedConnection('serverStats'); this.connection = this.$root.stream.useSharedConnection('serverStats');
this.updateStats();
this.clock = setInterval(this.updateStats, 1000);
this.$root.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
}); });
this.$root.api('stats').then(stats => {
this.stats = stats;
});
this.$root.api('instances', { this.$root.api('instances', {
sort: '+notes' sort: '+notes'
}).then(instances => { }).then(instances => {
@ -139,11 +139,18 @@ export default Vue.extend({
beforeDestroy() { beforeDestroy() {
this.connection.dispose(); this.connection.dispose();
clearInterval(this.clock);
}, },
methods: { methods: {
setChartSrc(src) { setChartSrc(src) {
this.$refs.charts.setSrc(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 > b
display block display block
&.primary
color var(--primary)
> div:last-child > div:last-child
display flex display flex
padding 6px 16px padding 6px 16px