2021-04-22 13:29:33 +00:00
|
|
|
<template>
|
2021-11-19 10:36:12 +00:00
|
|
|
<div v-size="{ max: [740] }" class="edbbcaef">
|
2021-10-23 19:03:07 +00:00
|
|
|
<div v-if="stats" class="cfcdecdf" style="margin: var(--margin)">
|
|
|
|
<div class="number _panel">
|
|
|
|
<div class="label">Users</div>
|
|
|
|
<div class="value _monospace">
|
|
|
|
{{ number(stats.originalUsersCount) }}
|
2022-05-25 07:37:35 +00:00
|
|
|
<MkNumberDiff v-if="usersComparedToThePrevDay != null" v-tooltip="i18n.ts.dayOverDayChanges" class="diff" :value="usersComparedToThePrevDay"><template #before>(</template><template #after>)</template></MkNumberDiff>
|
2021-04-22 13:29:33 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-10-23 19:03:07 +00:00
|
|
|
<div class="number _panel">
|
|
|
|
<div class="label">Notes</div>
|
|
|
|
<div class="value _monospace">
|
|
|
|
{{ number(stats.originalNotesCount) }}
|
2022-05-25 07:37:35 +00:00
|
|
|
<MkNumberDiff v-if="notesComparedToThePrevDay != null" v-tooltip="i18n.ts.dayOverDayChanges" class="diff" :value="notesComparedToThePrevDay"><template #before>(</template><template #after>)</template></MkNumberDiff>
|
2021-10-21 20:36:48 +00:00
|
|
|
</div>
|
2021-10-23 19:03:07 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-10-22 15:04:19 +00:00
|
|
|
|
2021-10-23 19:03:07 +00:00
|
|
|
<MkContainer :foldable="true" class="charts">
|
2022-05-25 07:37:35 +00:00
|
|
|
<template #header><i class="fas fa-chart-bar"></i>{{ i18n.ts.charts }}</template>
|
2022-01-04 06:36:14 +00:00
|
|
|
<div style="padding: 12px;">
|
2021-10-23 19:03:07 +00:00
|
|
|
<MkInstanceStats :chart-limit="500" :detailed="true"/>
|
2021-10-22 15:04:19 +00:00
|
|
|
</div>
|
2021-10-23 19:03:07 +00:00
|
|
|
</MkContainer>
|
|
|
|
|
|
|
|
<div class="queue">
|
|
|
|
<MkContainer :foldable="true" :thin="true" class="deliver">
|
|
|
|
<template #header>Queue: deliver</template>
|
|
|
|
<MkQueueChart :connection="queueStatsConnection" domain="deliver"/>
|
|
|
|
</MkContainer>
|
|
|
|
<MkContainer :foldable="true" :thin="true" class="inbox">
|
|
|
|
<template #header>Queue: inbox</template>
|
|
|
|
<MkQueueChart :connection="queueStatsConnection" domain="inbox"/>
|
|
|
|
</MkContainer>
|
|
|
|
</div>
|
2021-10-22 15:04:19 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
<!--<XMetrics/>-->
|
2021-10-21 20:36:48 +00:00
|
|
|
|
2021-10-23 19:03:07 +00:00
|
|
|
<MkFolder style="margin: var(--margin)">
|
2022-05-25 07:37:35 +00:00
|
|
|
<template #header><i class="fas fa-info-circle"></i> {{ i18n.ts.info }}</template>
|
2021-10-23 19:03:07 +00:00
|
|
|
<div class="cfcdecdf">
|
|
|
|
<div class="number _panel">
|
|
|
|
<div class="label">Misskey</div>
|
|
|
|
<div class="value _monospace">{{ version }}</div>
|
2021-10-21 20:36:48 +00:00
|
|
|
</div>
|
2021-11-19 10:36:12 +00:00
|
|
|
<div v-if="serverInfo" class="number _panel">
|
2021-10-23 19:03:07 +00:00
|
|
|
<div class="label">Node.js</div>
|
|
|
|
<div class="value _monospace">{{ serverInfo.node }}</div>
|
|
|
|
</div>
|
2021-11-19 10:36:12 +00:00
|
|
|
<div v-if="serverInfo" class="number _panel">
|
2021-10-23 19:03:07 +00:00
|
|
|
<div class="label">PostgreSQL</div>
|
|
|
|
<div class="value _monospace">{{ serverInfo.psql }}</div>
|
|
|
|
</div>
|
2021-11-19 10:36:12 +00:00
|
|
|
<div v-if="serverInfo" class="number _panel">
|
2021-10-23 19:03:07 +00:00
|
|
|
<div class="label">Redis</div>
|
|
|
|
<div class="value _monospace">{{ serverInfo.redis }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="number _panel">
|
|
|
|
<div class="label">Vue</div>
|
|
|
|
<div class="value _monospace">{{ vueVersion }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2021-10-21 20:36:48 +00:00
|
|
|
</div>
|
2021-04-22 13:29:33 +00:00
|
|
|
</template>
|
|
|
|
|
2022-05-25 07:37:35 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { markRaw, version as vueVersion, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
2022-06-20 08:38:49 +00:00
|
|
|
import XMetrics from './metrics.vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import MkInstanceStats from '@/components/instance-stats.vue';
|
|
|
|
import MkNumberDiff from '@/components/number-diff.vue';
|
|
|
|
import MkContainer from '@/components/ui/container.vue';
|
|
|
|
import MkFolder from '@/components/ui/folder.vue';
|
|
|
|
import MkQueueChart from '@/components/queue-chart.vue';
|
|
|
|
import { version, url } from '@/config';
|
|
|
|
import number from '@/filters/number';
|
|
|
|
import * as os from '@/os';
|
2021-12-29 13:13:09 +00:00
|
|
|
import { stream } from '@/stream';
|
2022-05-25 07:37:35 +00:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 08:38:49 +00:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2022-05-25 07:37:35 +00:00
|
|
|
let stats: any = $ref(null);
|
|
|
|
let serverInfo: any = $ref(null);
|
|
|
|
let usersComparedToThePrevDay: any = $ref(null);
|
|
|
|
let notesComparedToThePrevDay: any = $ref(null);
|
|
|
|
const queueStatsConnection = markRaw(stream.useChannel('queueStats'));
|
2021-10-21 20:36:48 +00:00
|
|
|
|
2022-05-25 07:37:35 +00:00
|
|
|
onMounted(async () => {
|
|
|
|
os.api('stats', {}).then(statsResponse => {
|
|
|
|
stats = statsResponse;
|
2021-10-21 20:36:48 +00:00
|
|
|
|
2022-06-25 09:26:31 +00:00
|
|
|
os.apiGet('charts/users', { limit: 2, span: 'day' }).then(chart => {
|
2022-05-25 07:37:35 +00:00
|
|
|
usersComparedToThePrevDay = stats.originalUsersCount - chart.local.total[1];
|
2021-10-21 20:36:48 +00:00
|
|
|
});
|
|
|
|
|
2022-06-25 09:26:31 +00:00
|
|
|
os.apiGet('charts/notes', { limit: 2, span: 'day' }).then(chart => {
|
2022-05-25 07:37:35 +00:00
|
|
|
notesComparedToThePrevDay = stats.originalNotesCount - chart.local.total[1];
|
2021-10-21 20:36:48 +00:00
|
|
|
});
|
2022-05-25 07:37:35 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
os.api('admin/server-info').then(serverInfoResponse => {
|
|
|
|
serverInfo = serverInfoResponse;
|
|
|
|
});
|
2021-10-22 15:04:19 +00:00
|
|
|
|
2022-05-25 07:37:35 +00:00
|
|
|
nextTick(() => {
|
|
|
|
queueStatsConnection.send('requestLog', {
|
|
|
|
id: Math.random().toString().substr(2, 8),
|
2022-06-20 08:38:49 +00:00
|
|
|
length: 200,
|
2021-10-22 15:04:19 +00:00
|
|
|
});
|
2022-05-25 07:37:35 +00:00
|
|
|
});
|
|
|
|
});
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2022-05-25 07:37:35 +00:00
|
|
|
onBeforeUnmount(() => {
|
|
|
|
queueStatsConnection.dispose();
|
|
|
|
});
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.dashboard,
|
|
|
|
icon: 'fas fa-tachometer-alt',
|
|
|
|
bg: 'var(--bg)',
|
2021-04-22 13:29:33 +00:00
|
|
|
});
|
|
|
|
</script>
|
2021-10-21 20:36:48 +00:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.edbbcaef {
|
2021-10-22 08:15:12 +00:00
|
|
|
.cfcdecdf {
|
2021-10-21 20:36:48 +00:00
|
|
|
display: grid;
|
|
|
|
grid-gap: 8px;
|
2021-10-22 05:03:08 +00:00
|
|
|
grid-template-columns: repeat(auto-fill,minmax(150px,1fr));
|
2021-10-21 20:36:48 +00:00
|
|
|
|
|
|
|
> .number {
|
|
|
|
padding: 12px 16px;
|
|
|
|
|
|
|
|
> .label {
|
|
|
|
opacity: 0.7;
|
|
|
|
font-size: 0.8em;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .value {
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1.2em;
|
|
|
|
|
|
|
|
> .diff {
|
|
|
|
font-size: 0.8em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .charts {
|
|
|
|
margin: var(--margin);
|
|
|
|
}
|
2021-10-22 15:04:19 +00:00
|
|
|
|
|
|
|
> .queue {
|
|
|
|
margin: var(--margin);
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
> .deliver,
|
|
|
|
> .inbox {
|
|
|
|
flex: 1;
|
|
|
|
width: 50%;
|
|
|
|
|
|
|
|
&:not(:first-child) {
|
|
|
|
margin-left: var(--margin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-23 13:09:48 +00:00
|
|
|
&.max-width_740px {
|
2021-10-22 15:04:19 +00:00
|
|
|
> .queue {
|
|
|
|
display: block;
|
|
|
|
|
|
|
|
> .deliver,
|
|
|
|
> .inbox {
|
2021-10-23 13:09:48 +00:00
|
|
|
width: 100%;
|
|
|
|
|
2021-10-22 15:04:19 +00:00
|
|
|
&:not(:first-child) {
|
|
|
|
margin-top: var(--margin);
|
|
|
|
margin-left: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-10-21 20:36:48 +00:00
|
|
|
}
|
|
|
|
</style>
|