[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>
<span>{{ $t('accounts') }}</span>
<b class="primary">{{ stats.originalUsersCount | number }}</b>
<b>{{ stats.originalUsersCount | number }}</b>
</div>
</div>
<div>
@ -33,7 +33,7 @@
<div><fa icon="pencil-alt"/></div>
<div>
<span>{{ $t('notes') }}</span>
<b class="primary">{{ stats.originalNotesCount | number }}</b>
<b>{{ stats.originalNotesCount | number }}</b>
</div>
</div>
<div>
@ -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