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