2018-08-14 01:05:58 +09:00
|
|
|
<template>
|
2018-08-25 15:40:22 +09:00
|
|
|
<div class="obdskegsannmntldydackcpzezagxqfy mk-admin-card">
|
2018-08-18 03:52:24 +09:00
|
|
|
<header>%i18n:@dashboard%</header>
|
|
|
|
<div v-if="stats" class="stats">
|
|
|
|
<div><b>%fa:user% {{ stats.originalUsersCount | number }}</b><span>%i18n:@original-users%</span></div>
|
2018-08-18 04:52:06 +09:00
|
|
|
<div><span>%fa:user% {{ stats.usersCount | number }}</span><span>%i18n:@all-users%</span></div>
|
2018-08-18 03:52:24 +09:00
|
|
|
<div><b>%fa:pen% {{ stats.originalNotesCount | number }}</b><span>%i18n:@original-notes%</span></div>
|
2018-08-18 04:52:06 +09:00
|
|
|
<div><span>%fa:pen% {{ stats.notesCount | number }}</span><span>%i18n:@all-notes%</span></div>
|
|
|
|
</div>
|
|
|
|
<div class="cpu-memory">
|
|
|
|
<x-cpu-memory :connection="connection"/>
|
2018-08-14 16:53:57 +09:00
|
|
|
</div>
|
2018-08-17 19:17:23 +09:00
|
|
|
<div>
|
2018-08-23 03:19:57 +09:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" v-model="disableRegistration" @change="updateMeta">
|
|
|
|
<span>disableRegistration</span>
|
|
|
|
</label>
|
2018-08-17 19:17:23 +09:00
|
|
|
<button class="ui" @click="invite">%i18n:@invite%</button>
|
|
|
|
<p v-if="inviteCode">Code: <code>{{ inviteCode }}</code></p>
|
|
|
|
</div>
|
2018-08-14 01:05:58 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from "vue";
|
2018-08-18 04:52:06 +09:00
|
|
|
import XCpuMemory from "./admin.cpu-memory.vue";
|
2018-08-14 01:05:58 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-08-18 04:52:06 +09:00
|
|
|
components: {
|
|
|
|
XCpuMemory
|
|
|
|
},
|
2018-08-14 01:05:58 +09:00
|
|
|
data() {
|
|
|
|
return {
|
2018-08-17 19:17:23 +09:00
|
|
|
stats: null,
|
2018-08-23 03:19:57 +09:00
|
|
|
disableRegistration: false,
|
2018-08-18 04:52:06 +09:00
|
|
|
inviteCode: null,
|
|
|
|
connection: null,
|
|
|
|
connectionId: null
|
2018-08-14 01:05:58 +09:00
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
2018-08-18 04:52:06 +09:00
|
|
|
this.connection = (this as any).os.streams.serverStatsStream.getConnection();
|
|
|
|
this.connectionId = (this as any).os.streams.serverStatsStream.use();
|
|
|
|
|
2018-08-23 03:19:57 +09:00
|
|
|
(this as any).os.getMeta().then(meta => {
|
|
|
|
this.disableRegistration = meta.disableRegistration;
|
|
|
|
});
|
|
|
|
|
2018-08-14 01:05:58 +09:00
|
|
|
(this as any).api('stats').then(stats => {
|
|
|
|
this.stats = stats;
|
|
|
|
});
|
2018-08-17 19:17:23 +09:00
|
|
|
},
|
2018-08-18 04:52:06 +09:00
|
|
|
beforeDestroy() {
|
|
|
|
(this as any).os.streams.serverStatsStream.dispose(this.connectionId);
|
|
|
|
},
|
2018-08-17 19:17:23 +09:00
|
|
|
methods: {
|
|
|
|
invite() {
|
|
|
|
(this as any).api('admin/invite').then(x => {
|
|
|
|
this.inviteCode = x.code;
|
|
|
|
});
|
2018-08-23 03:19:57 +09:00
|
|
|
},
|
|
|
|
updateMeta() {
|
|
|
|
(this as any).api('admin/update-meta', {
|
|
|
|
disableRegistration: this.disableRegistration
|
|
|
|
});
|
2018-08-17 19:17:23 +09:00
|
|
|
}
|
2018-08-14 01:05:58 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2018-08-14 04:30:42 +09:00
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-08-18 03:52:24 +09:00
|
|
|
@import '~const.styl'
|
|
|
|
|
|
|
|
.obdskegsannmntldydackcpzezagxqfy
|
|
|
|
> .stats
|
|
|
|
display flex
|
|
|
|
justify-content center
|
|
|
|
margin-bottom 16px
|
2018-08-18 04:52:06 +09:00
|
|
|
padding 16px
|
|
|
|
border solid 1px #eee
|
|
|
|
border-radius 8px
|
2018-08-18 03:52:24 +09:00
|
|
|
|
|
|
|
> div
|
|
|
|
flex 1
|
|
|
|
text-align center
|
|
|
|
|
2018-08-18 04:52:06 +09:00
|
|
|
> *:first-child
|
2018-08-18 03:52:24 +09:00
|
|
|
display block
|
|
|
|
color $theme-color
|
|
|
|
|
2018-08-18 04:52:06 +09:00
|
|
|
> *:last-child
|
2018-08-18 03:52:24 +09:00
|
|
|
font-size 70%
|
|
|
|
|
2018-08-19 03:32:01 +09:00
|
|
|
> .cpu-memory
|
|
|
|
margin-bottom 16px
|
|
|
|
padding 16px
|
|
|
|
border solid 1px #eee
|
|
|
|
border-radius: 8px
|
|
|
|
|
2018-08-14 04:30:42 +09:00
|
|
|
</style>
|