From 6d53e647985ba8a63369898331c712bf04fcee96 Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Sat, 18 Aug 2018 04:52:06 +0900
Subject: Improve control panel

---
 .../desktop/views/pages/admin/admin.dashboard.vue  | 28 ++++++++++++++++++----
 1 file changed, 23 insertions(+), 5 deletions(-)

(limited to 'src/client/app/desktop/views/pages/admin/admin.dashboard.vue')

diff --git a/src/client/app/desktop/views/pages/admin/admin.dashboard.vue b/src/client/app/desktop/views/pages/admin/admin.dashboard.vue
index 182d974601..efe7ea0ca4 100644
--- a/src/client/app/desktop/views/pages/admin/admin.dashboard.vue
+++ b/src/client/app/desktop/views/pages/admin/admin.dashboard.vue
@@ -3,9 +3,12 @@
 	<header>%i18n:@dashboard%</header>
 	<div v-if="stats" class="stats">
 		<div><b>%fa:user% {{ stats.originalUsersCount | number }}</b><span>%i18n:@original-users%</span></div>
-		<div><b>%fa:user% {{ stats.usersCount | number }}</b><span>%i18n:@all-users%</span></div>
+		<div><span>%fa:user% {{ stats.usersCount | number }}</span><span>%i18n:@all-users%</span></div>
 		<div><b>%fa:pen% {{ stats.originalNotesCount | number }}</b><span>%i18n:@original-notes%</span></div>
-		<div><b>%fa:pen% {{ stats.notesCount | number }}</b><span>%i18n:@all-notes%</span></div>
+		<div><span>%fa:pen% {{ stats.notesCount | number }}</span><span>%i18n:@all-notes%</span></div>
+	</div>
+	<div class="cpu-memory">
+		<x-cpu-memory :connection="connection"/>
 	</div>
 	<div>
 		<button class="ui" @click="invite">%i18n:@invite%</button>
@@ -16,19 +19,31 @@
 
 <script lang="ts">
 import Vue from "vue";
+import XCpuMemory from "./admin.cpu-memory.vue";
 
 export default Vue.extend({
+	components: {
+		XCpuMemory
+	},
 	data() {
 		return {
 			stats: null,
-			inviteCode: null
+			inviteCode: null,
+			connection: null,
+			connectionId: null
 		};
 	},
 	created() {
+		this.connection = (this as any).os.streams.serverStatsStream.getConnection();
+		this.connectionId = (this as any).os.streams.serverStatsStream.use();
+
 		(this as any).api('stats').then(stats => {
 			this.stats = stats;
 		});
 	},
+	beforeDestroy() {
+		(this as any).os.streams.serverStatsStream.dispose(this.connectionId);
+	},
 	methods: {
 		invite() {
 			(this as any).api('admin/invite').then(x => {
@@ -47,16 +62,19 @@ export default Vue.extend({
 		display flex
 		justify-content center
 		margin-bottom 16px
+		padding 16px
+		border solid 1px #eee
+		border-radius 8px
 
 		> div
 			flex 1
 			text-align center
 
-			> b
+			> *:first-child
 				display block
 				color $theme-color
 
-			> span
+			> *:last-child
 				font-size 70%
 
 </style>
-- 
cgit v1.2.3-freya

