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