diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-08-13 23:02:43 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-08-13 23:02:43 +0900 |
| commit | b5fe4ba9bef376a5977c23c82f4666458abcecfd (patch) | |
| tree | 815953d2abfa87910413dbc09cc20983e3ef5989 /src/client/pages/instance | |
| parent | Merge branch 'develop' of https://github.com/syuilo/misskey into develop (diff) | |
| download | sharkey-b5fe4ba9bef376a5977c23c82f4666458abcecfd.tar.gz sharkey-b5fe4ba9bef376a5977c23c82f4666458abcecfd.tar.bz2 sharkey-b5fe4ba9bef376a5977c23c82f4666458abcecfd.zip | |
WIP: Improve admin dashboard
Diffstat (limited to 'src/client/pages/instance')
| -rw-r--r-- | src/client/pages/instance/index.queue-chart.vue | 14 | ||||
| -rw-r--r-- | src/client/pages/instance/index.vue | 22 |
2 files changed, 33 insertions, 3 deletions
diff --git a/src/client/pages/instance/index.queue-chart.vue b/src/client/pages/instance/index.queue-chart.vue index 78dfc9a667..3b7823d924 100644 --- a/src/client/pages/instance/index.queue-chart.vue +++ b/src/client/pages/instance/index.queue-chart.vue @@ -1,6 +1,8 @@ <template> <mk-container :body-togglable="false"> <template #header><slot name="title"></slot></template> + <template #func><button class="_button" @click="resume" :disabled="!paused"><fa :icon="faPlay"/></button><button class="_button" @click="pause" :disabled="paused"><fa :icon="faPause"/></button></template> + <div class="_content _table"> <div class="_row"> <div class="_cell"><div class="_label">Process</div>{{ activeSincePrevTick | number }}</div> @@ -18,6 +20,7 @@ <script lang="ts"> import Vue from 'vue'; import Chart from 'chart.js'; +import { faPlay, faPause } from '@fortawesome/free-solid-svg-icons'; import MkContainer from '../../components/ui/container.vue'; const alpha = (hex, a) => { @@ -49,6 +52,8 @@ export default Vue.extend({ active: 0, waiting: 0, delayed: 0, + paused: false, + faPlay, faPause } }, @@ -155,6 +160,7 @@ export default Vue.extend({ methods: { onStats(stats) { + if (this.paused) return; this.activeSincePrevTick = stats[this.domain].activeSincePrevTick; this.active = stats[this.domain].active; this.waiting = stats[this.domain].waiting; @@ -179,6 +185,14 @@ export default Vue.extend({ this.onStats(stats); } }, + + pause() { + this.paused = true; + }, + + resume() { + this.paused = false; + }, } }); </script> diff --git a/src/client/pages/instance/index.vue b/src/client/pages/instance/index.vue index c32fe81df0..f55a53b5f3 100644 --- a/src/client/pages/instance/index.vue +++ b/src/client/pages/instance/index.vue @@ -53,6 +53,7 @@ <div class="segusily"> <mk-container :body-togglable="false" :resize-base-el="() => $el"> <template #header><fa :icon="faMicrochip"/>{{ $t('cpuAndMemory') }}</template> + <template #func><button class="_button" @click="resume" :disabled="!paused"><fa :icon="faPlay"/></button><button class="_button" @click="pause" :disabled="paused"><fa :icon="faPause"/></button></template> <div class="_content" style="margin-top: -8px; margin-bottom: -12px;"> <canvas ref="cpumem"></canvas> @@ -72,8 +73,10 @@ </div> </div> </mk-container> + <mk-container :body-togglable="false" :resize-base-el="() => $el"> <template #header><fa :icon="faHdd"/> {{ $t('disk') }}</template> + <template #func><button class="_button" @click="resume" :disabled="!paused"><fa :icon="faPlay"/></button><button class="_button" @click="pause" :disabled="paused"><fa :icon="faPause"/></button></template> <div class="_content" style="margin-top: -8px; margin-bottom: -12px;"> <canvas ref="disk"></canvas> @@ -88,8 +91,10 @@ </div> </div> </mk-container> + <mk-container :body-togglable="false" :resize-base-el="() => $el"> <template #header><fa :icon="faExchangeAlt"/> {{ $t('network') }}</template> + <template #func><button class="_button" @click="resume" :disabled="!paused"><fa :icon="faPlay"/></button><button class="_button" @click="pause" :disabled="paused"><fa :icon="faPause"/></button></template> <div class="_content" style="margin-top: -8px; margin-bottom: -12px;"> <canvas ref="net"></canvas> @@ -180,7 +185,7 @@ <script lang="ts"> import Vue from 'vue'; -import { faDatabase, faServer, faExchangeAlt, faMicrochip, faHdd, faStream, faTrashAlt, faInfoCircle, faExclamationTriangle, faTachometerAlt, faHeartbeat, faClipboardList } from '@fortawesome/free-solid-svg-icons'; +import { faPlay, faPause, faDatabase, faServer, faExchangeAlt, faMicrochip, faHdd, faStream, faTrashAlt, faInfoCircle, faExclamationTriangle, faTachometerAlt, faHeartbeat, faClipboardList } from '@fortawesome/free-solid-svg-icons'; import Chart from 'chart.js'; import VueJsonPretty from 'vue-json-pretty'; import MkInstanceStats from '../../components/instance-stats.vue'; @@ -240,7 +245,8 @@ export default Vue.extend({ dbInfo: null, overviewHeight: '1fr', queueHeight: '1fr', - faDatabase, faServer, faExchangeAlt, faMicrochip, faHdd, faStream, faTrashAlt, faInfoCircle, faExclamationTriangle, faTachometerAlt, faHeartbeat, faClipboardList, + paused: false, + faPlay, faPause, faDatabase, faServer, faExchangeAlt, faMicrochip, faHdd, faStream, faTrashAlt, faInfoCircle, faExclamationTriangle, faTachometerAlt, faHeartbeat, faClipboardList, } }, @@ -580,6 +586,8 @@ export default Vue.extend({ }, onStats(stats) { + if (this.paused) return; + const cpu = (stats.cpu * 100).toFixed(0); const memActive = (stats.mem.active / this.serverInfo.mem.total * 100).toFixed(0); const memUsed = (stats.mem.used / this.serverInfo.mem.total * 100).toFixed(0); @@ -616,7 +624,15 @@ export default Vue.extend({ for (const stats of [...statsLog].reverse()) { this.onStats(stats); } - } + }, + + pause() { + this.paused = true; + }, + + resume() { + this.paused = false; + }, } }); </script> |