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