2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2020-10-17 13:12:00 +02:00
|
|
|
<div v-if="meta" v-show="page === 'index'" class="xhexznfu _section">
|
|
|
|
<MkFolder>
|
2021-04-20 16:22:59 +02:00
|
|
|
<template #header><i class="fas fa-tachometer-alt"></i> {{ $ts.overview }}</template>
|
2020-08-09 08:51:02 +02:00
|
|
|
|
2020-08-13 10:58:16 +02:00
|
|
|
<div class="sboqnrfi" :style="{ gridTemplateRows: overviewHeight }">
|
2021-04-10 11:17:42 +02:00
|
|
|
<MkInstanceStats :chart-limit="300" :detailed="true" class="_gap" ref="stats"/>
|
2020-08-13 16:02:43 +02:00
|
|
|
|
2021-04-16 05:17:22 +02:00
|
|
|
<MkContainer :foldable="true" class="_gap">
|
2021-04-20 16:22:59 +02:00
|
|
|
<template #header><i class="fas fa-info-circle"></i>{{ $ts.instanceInfo }}</template>
|
2020-08-09 08:51:02 +02:00
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
<div class="_content">
|
|
|
|
<div class="_keyValue"><b>Misskey</b><span>v{{ version }}</span></div>
|
2020-08-09 08:51:02 +02:00
|
|
|
</div>
|
|
|
|
<div class="_content" v-if="serverInfo">
|
2020-10-17 13:12:00 +02: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 08:51:02 +02:00
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</MkContainer>
|
|
|
|
|
2021-04-16 05:17:22 +02:00
|
|
|
<MkContainer :foldable="true" :scrollable="true" class="_gap" style="height: 300px;">
|
2021-04-20 16:22:59 +02:00
|
|
|
<template #header><i class="fas fa-database"></i>{{ $ts.database }}</template>
|
2020-10-17 13:12:00 +02: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 08:51:02 +02:00
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</MkContainer>
|
2020-02-16 18:27:14 +01:00
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</MkFolder>
|
|
|
|
</div>
|
|
|
|
<div v-if="page === 'logs'" class="_section">
|
|
|
|
<MkFolder>
|
2021-04-20 16:22:59 +02:00
|
|
|
<template #header><i class="fas fa-stream"></i> {{ $ts.logs }}</template>
|
2020-08-09 08:51:02 +02:00
|
|
|
|
2020-10-17 13:12:00 +02: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-16 18:27:14 +01:00
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</MkFolder>
|
|
|
|
</div>
|
|
|
|
<div v-if="page === 'metrics'">
|
|
|
|
<XMetrics/>
|
2020-01-29 20:37:25 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 13:12:00 +02:00
|
|
|
import { computed, defineComponent, markRaw } from 'vue';
|
2020-02-18 13:27:43 +01:00
|
|
|
import VueJsonPretty from 'vue-json-pretty';
|
2021-03-23 09:30:14 +01: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 13:12:00 +02:00
|
|
|
import bytes from '../../filters/bytes';
|
|
|
|
import number from '../../filters/number';
|
2020-08-10 13:23:51 +02:00
|
|
|
import MkInstanceInfo from './instance.vue';
|
2020-10-17 13:12:00 +02:00
|
|
|
import XMetrics from './index.metrics.vue';
|
2021-03-23 09:30:14 +01:00
|
|
|
import * as os from '@client/os';
|
2021-04-10 05:54:12 +02:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-02-16 18:21:27 +01:00
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
export default defineComponent({
|
2020-01-29 20:37:25 +01:00
|
|
|
components: {
|
2020-02-16 18:21:27 +01:00
|
|
|
MkInstanceStats,
|
2020-02-18 13:27:43 +01:00
|
|
|
MkButton,
|
|
|
|
MkSelect,
|
|
|
|
MkInput,
|
2020-08-09 08:51:02 +02:00
|
|
|
MkContainer,
|
|
|
|
MkFolder,
|
2020-10-17 13:12:00 +02:00
|
|
|
XMetrics,
|
2020-08-09 08:51:02 +02:00
|
|
|
VueJsonPretty,
|
2020-01-29 20:37:25 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-10 05:54:12 +02:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-11-03 12:36:12 +01:00
|
|
|
tabs: [{
|
2020-10-17 13:12:00 +02:00
|
|
|
id: 'index',
|
|
|
|
title: null,
|
2020-12-26 02:47:36 +01:00
|
|
|
tooltip: this.$ts.instance,
|
2021-04-20 16:22:59 +02:00
|
|
|
icon: 'fas fa-server',
|
2020-10-17 13:12:00 +02:00
|
|
|
onClick: () => { this.page = 'index'; },
|
|
|
|
selected: computed(() => this.page === 'index')
|
|
|
|
}, {
|
|
|
|
id: 'metrics',
|
|
|
|
title: null,
|
2020-12-26 02:47:36 +01:00
|
|
|
tooltip: this.$ts.metrics,
|
2021-04-20 16:22:59 +02:00
|
|
|
icon: 'fas fa-heartbeat',
|
2020-10-17 13:12:00 +02:00
|
|
|
onClick: () => { this.page = 'metrics'; },
|
|
|
|
selected: computed(() => this.page === 'metrics')
|
|
|
|
}, {
|
|
|
|
id: 'logs',
|
|
|
|
title: null,
|
2020-12-26 02:47:36 +01:00
|
|
|
tooltip: this.$ts.logs,
|
2021-04-20 16:22:59 +02:00
|
|
|
icon: 'fas fa-stream',
|
2020-10-17 13:12:00 +02:00
|
|
|
onClick: () => { this.page = 'logs'; },
|
|
|
|
selected: computed(() => this.page === 'logs')
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
page: 'index',
|
2020-01-29 20:37:25 +01:00
|
|
|
version,
|
2020-02-09 11:18:06 +01:00
|
|
|
url,
|
2020-01-29 20:37:25 +01:00
|
|
|
stats: null,
|
|
|
|
serverInfo: null,
|
2020-08-09 08:51:02 +02:00
|
|
|
modLogs: [],
|
2020-08-13 10:58:16 +02:00
|
|
|
dbInfo: null,
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-02-10 15:17:42 +01:00
|
|
|
computed: {
|
|
|
|
meta() {
|
2020-12-19 02:55:52 +01:00
|
|
|
return this.$instance;
|
2020-02-10 15:17:42 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2020-02-16 18:21:27 +01:00
|
|
|
mounted() {
|
2020-08-09 08:51:02 +02:00
|
|
|
this.fetchJobs();
|
|
|
|
this.fetchModLogs();
|
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
os.api('admin/server-info', {}).then(res => {
|
2020-02-16 18:21:27 +01:00
|
|
|
this.serverInfo = res;
|
2020-01-29 20:37:25 +01:00
|
|
|
});
|
2020-08-13 10:58:16 +02:00
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
os.api('admin/get-table-stats', {}).then(res => {
|
2020-08-13 12:56:46 +02:00
|
|
|
this.dbInfo = Object.entries(res).sort((a, b) => b[1].size - a[1].size);
|
2020-08-13 10:58:16 +02:00
|
|
|
});
|
2020-02-16 18:21:27 +01:00
|
|
|
},
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
methods: {
|
2020-08-10 13:23:51 +02:00
|
|
|
async showInstanceInfo(q) {
|
|
|
|
let instance = q;
|
|
|
|
if (typeof q === 'string') {
|
2020-10-17 13:12:00 +02:00
|
|
|
instance = await os.api('federation/show-instance', {
|
2020-08-10 13:23:51 +02:00
|
|
|
host: q
|
|
|
|
});
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
os.popup(MkInstanceInfo, {
|
2020-08-10 13:23:51 +02:00
|
|
|
instance: instance
|
2020-10-17 13:12:00 +02:00
|
|
|
}, {}, 'closed');
|
2020-02-18 13:27:43 +01:00
|
|
|
},
|
|
|
|
|
2020-08-09 08:51:02 +02:00
|
|
|
fetchJobs() {
|
2020-10-17 13:12:00 +02:00
|
|
|
os.api('admin/queue/deliver-delayed', {}).then(jobs => {
|
2020-08-09 08:51:02 +02:00
|
|
|
this.jobs = jobs;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
fetchModLogs() {
|
2020-10-17 13:12:00 +02:00
|
|
|
os.api('admin/show-moderation-logs', {}).then(logs => {
|
2020-08-09 08:51:02 +02:00
|
|
|
this.modLogs = logs;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
bytes,
|
2020-08-13 16:02:43 +02:00
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
number,
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|