2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div v-if="meta" v-show="page === 'index'" class="xhexznfu _section">
|
|
|
|
<MkFolder>
|
2021-04-20 23:22:59 +09:00
|
|
|
<template #header><i class="fas fa-tachometer-alt"></i> {{ $ts.overview }}</template>
|
2020-08-09 15:51:02 +09:00
|
|
|
|
2020-08-13 17:58:16 +09:00
|
|
|
<div class="sboqnrfi" :style="{ gridTemplateRows: overviewHeight }">
|
2021-04-10 18:17:42 +09:00
|
|
|
<MkInstanceStats :chart-limit="300" :detailed="true" class="_gap" ref="stats"/>
|
2020-08-13 23:02:43 +09:00
|
|
|
|
2021-04-16 12:17:22 +09:00
|
|
|
<MkContainer :foldable="true" class="_gap">
|
2021-04-20 23:22:59 +09:00
|
|
|
<template #header><i class="fas fa-info-circle"></i>{{ $ts.instanceInfo }}</template>
|
2020-08-09 15:51:02 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_content">
|
|
|
|
<div class="_keyValue"><b>Misskey</b><span>v{{ version }}</span></div>
|
2020-08-09 15:51:02 +09:00
|
|
|
</div>
|
|
|
|
<div class="_content" v-if="serverInfo">
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_keyValue"><b>Node.js</b><span>{{ serverInfo.node }}</span></div>
|
|
|
|
<div class="_keyValue"><b>PostgreSQL</b><span>v{{ serverInfo.psql }}</span></div>
|
|
|
|
<div class="_keyValue"><b>Redis</b><span>v{{ serverInfo.redis }}</span></div>
|
2020-08-09 15:51:02 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</MkContainer>
|
|
|
|
|
2021-04-16 12:17:22 +09:00
|
|
|
<MkContainer :foldable="true" :scrollable="true" class="_gap" style="height: 300px;">
|
2021-04-20 23:22:59 +09:00
|
|
|
<template #header><i class="fas fa-database"></i>{{ $ts.database }}</template>
|
2020-10-17 20:12:00 +09:00
|
|
|
|
|
|
|
<div class="_content" v-if="dbInfo">
|
|
|
|
<table style="border-collapse: collapse; width: 100%;">
|
|
|
|
<tr style="opacity: 0.7;">
|
|
|
|
<th style="text-align: left; padding: 0 8px 8px 0;">Table</th>
|
|
|
|
<th style="text-align: left; padding: 0 8px 8px 0;">Records</th>
|
|
|
|
<th style="text-align: left; padding: 0 0 8px 0;">Size</th>
|
|
|
|
</tr>
|
|
|
|
<tr v-for="table in dbInfo" :key="table[0]">
|
|
|
|
<th style="text-align: left; padding: 0 8px 0 0; word-break: break-all;">{{ table[0] }}</th>
|
|
|
|
<td style="padding: 0 8px 0 0;">{{ number(table[1].count) }}</td>
|
|
|
|
<td style="padding: 0; opacity: 0.7;">{{ bytes(table[1].size) }}</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2020-08-09 15:51:02 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</MkContainer>
|
2020-02-17 02:27:14 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</MkFolder>
|
|
|
|
</div>
|
|
|
|
<div v-if="page === 'logs'" class="_section">
|
|
|
|
<MkFolder>
|
2021-04-20 23:22:59 +09:00
|
|
|
<template #header><i class="fas fa-stream"></i> {{ $ts.logs }}</template>
|
2020-08-09 15:51:02 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="_keyValue" v-for="log in modLogs">
|
|
|
|
<b>{{ log.type }}</b><span>by {{ log.user.username }}</span><MkTime :time="log.createdAt" style="opacity: 0.7;"/>
|
2020-02-17 02:27:14 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</MkFolder>
|
|
|
|
</div>
|
|
|
|
<div v-if="page === 'metrics'">
|
|
|
|
<XMetrics/>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 20:12:00 +09:00
|
|
|
import { computed, defineComponent, markRaw } from 'vue';
|
2020-02-18 21:27:43 +09:00
|
|
|
import VueJsonPretty from 'vue-json-pretty';
|
2021-03-23 17:30:14 +09:00
|
|
|
import MkInstanceStats from '@client/components/instance-stats.vue';
|
|
|
|
import MkButton from '@client/components/ui/button.vue';
|
|
|
|
import MkSelect from '@client/components/ui/select.vue';
|
|
|
|
import MkInput from '@client/components/ui/input.vue';
|
|
|
|
import MkContainer from '@client/components/ui/container.vue';
|
|
|
|
import MkFolder from '@client/components/ui/folder.vue';
|
|
|
|
import { version, url } from '@client/config';
|
2020-10-17 20:12:00 +09:00
|
|
|
import bytes from '../../filters/bytes';
|
|
|
|
import number from '../../filters/number';
|
2020-08-10 20:23:51 +09:00
|
|
|
import MkInstanceInfo from './instance.vue';
|
2020-10-17 20:12:00 +09:00
|
|
|
import XMetrics from './index.metrics.vue';
|
2021-03-23 17:30:14 +09:00
|
|
|
import * as os from '@client/os';
|
2021-04-10 12:54:12 +09:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-02-17 02:21:27 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
export default defineComponent({
|
2020-01-30 04:37:25 +09:00
|
|
|
components: {
|
2020-02-17 02:21:27 +09:00
|
|
|
MkInstanceStats,
|
2020-02-18 21:27:43 +09:00
|
|
|
MkButton,
|
|
|
|
MkSelect,
|
|
|
|
MkInput,
|
2020-08-09 15:51:02 +09:00
|
|
|
MkContainer,
|
|
|
|
MkFolder,
|
2020-10-17 20:12:00 +09:00
|
|
|
XMetrics,
|
2020-08-09 15:51:02 +09:00
|
|
|
VueJsonPretty,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-10 12:54:12 +09:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-11-03 20:36:12 +09:00
|
|
|
tabs: [{
|
2020-10-17 20:12:00 +09:00
|
|
|
id: 'index',
|
|
|
|
title: null,
|
2020-12-26 10:47:36 +09:00
|
|
|
tooltip: this.$ts.instance,
|
2021-04-20 23:22:59 +09:00
|
|
|
icon: 'fas fa-server',
|
2020-10-17 20:12:00 +09:00
|
|
|
onClick: () => { this.page = 'index'; },
|
|
|
|
selected: computed(() => this.page === 'index')
|
|
|
|
}, {
|
|
|
|
id: 'metrics',
|
|
|
|
title: null,
|
2020-12-26 10:47:36 +09:00
|
|
|
tooltip: this.$ts.metrics,
|
2021-04-20 23:22:59 +09:00
|
|
|
icon: 'fas fa-heartbeat',
|
2020-10-17 20:12:00 +09:00
|
|
|
onClick: () => { this.page = 'metrics'; },
|
|
|
|
selected: computed(() => this.page === 'metrics')
|
|
|
|
}, {
|
|
|
|
id: 'logs',
|
|
|
|
title: null,
|
2020-12-26 10:47:36 +09:00
|
|
|
tooltip: this.$ts.logs,
|
2021-04-20 23:22:59 +09:00
|
|
|
icon: 'fas fa-stream',
|
2020-10-17 20:12:00 +09:00
|
|
|
onClick: () => { this.page = 'logs'; },
|
|
|
|
selected: computed(() => this.page === 'logs')
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
page: 'index',
|
2020-01-30 04:37:25 +09:00
|
|
|
version,
|
2020-02-09 19:18:06 +09:00
|
|
|
url,
|
2020-01-30 04:37:25 +09:00
|
|
|
stats: null,
|
|
|
|
serverInfo: null,
|
2020-08-09 15:51:02 +09:00
|
|
|
modLogs: [],
|
2020-08-13 17:58:16 +09:00
|
|
|
dbInfo: null,
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-02-10 23:17:42 +09:00
|
|
|
computed: {
|
|
|
|
meta() {
|
2020-12-19 10:55:52 +09:00
|
|
|
return this.$instance;
|
2020-02-10 23:17:42 +09:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2020-02-17 02:21:27 +09:00
|
|
|
mounted() {
|
2020-08-09 15:51:02 +09:00
|
|
|
this.fetchJobs();
|
|
|
|
this.fetchModLogs();
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('admin/server-info', {}).then(res => {
|
2020-02-17 02:21:27 +09:00
|
|
|
this.serverInfo = res;
|
2020-01-30 04:37:25 +09:00
|
|
|
});
|
2020-08-13 17:58:16 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('admin/get-table-stats', {}).then(res => {
|
2020-08-13 19:56:46 +09:00
|
|
|
this.dbInfo = Object.entries(res).sort((a, b) => b[1].size - a[1].size);
|
2020-08-13 17:58:16 +09:00
|
|
|
});
|
2020-02-17 02:21:27 +09:00
|
|
|
},
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
methods: {
|
2020-08-10 20:23:51 +09:00
|
|
|
async showInstanceInfo(q) {
|
|
|
|
let instance = q;
|
|
|
|
if (typeof q === 'string') {
|
2020-10-17 20:12:00 +09:00
|
|
|
instance = await os.api('federation/show-instance', {
|
2020-08-10 20:23:51 +09:00
|
|
|
host: q
|
|
|
|
});
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
os.popup(MkInstanceInfo, {
|
2020-08-10 20:23:51 +09:00
|
|
|
instance: instance
|
2020-10-17 20:12:00 +09:00
|
|
|
}, {}, 'closed');
|
2020-02-18 21:27:43 +09:00
|
|
|
},
|
|
|
|
|
2020-08-09 15:51:02 +09:00
|
|
|
fetchJobs() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('admin/queue/deliver-delayed', {}).then(jobs => {
|
2020-08-09 15:51:02 +09:00
|
|
|
this.jobs = jobs;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
fetchModLogs() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('admin/show-moderation-logs', {}).then(logs => {
|
2020-08-09 15:51:02 +09:00
|
|
|
this.modLogs = logs;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
bytes,
|
2020-08-13 23:02:43 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
number,
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|