2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-04-22 15:29:33 +02:00
|
|
|
<template>
|
2023-05-19 13:52:15 +02:00
|
|
|
<MkSpacer :contentMax="1000">
|
2023-05-14 03:21:56 +02:00
|
|
|
<div ref="rootEl" :class="$style.root">
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-23 07:21:55 +01:00
|
|
|
<template #header>Stats</template>
|
|
|
|
<XStats/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-12-27 01:47:54 +01:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-23 07:21:55 +01:00
|
|
|
<template #header>Active users</template>
|
|
|
|
<XActiveUsers/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-12-27 01:47:54 +01:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-27 01:47:54 +01:00
|
|
|
<template #header>Heatmap</template>
|
|
|
|
<XHeatmap/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-12-27 01:47:54 +01:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-27 06:31:24 +01:00
|
|
|
<template #header>Retention rate</template>
|
|
|
|
<XRetention/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-12-27 06:31:24 +01:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-26 01:22:39 +01:00
|
|
|
<template #header>Moderators</template>
|
|
|
|
<XModerators/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-12-27 01:47:54 +01:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-23 07:21:55 +01:00
|
|
|
<template #header>Federation</template>
|
|
|
|
<XFederation/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2023-07-08 00:08:16 +02:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-23 07:21:55 +01:00
|
|
|
<template #header>Instances</template>
|
|
|
|
<XInstances/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-12-27 01:47:54 +01:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-23 07:21:55 +01:00
|
|
|
<template #header>Ap requests</template>
|
|
|
|
<XApRequests/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-12-27 01:47:54 +01:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-23 07:21:55 +01:00
|
|
|
<template #header>New users</template>
|
|
|
|
<XUsers/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-12-27 01:47:54 +01:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-23 07:21:55 +01:00
|
|
|
<template #header>Deliver queue</template>
|
|
|
|
<XQueue domain="deliver"/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-12-27 01:47:54 +01:00
|
|
|
|
2023-01-09 01:41:25 +01:00
|
|
|
<MkFoldableSection class="item">
|
2022-12-23 07:21:55 +01:00
|
|
|
<template #header>Inbox queue</template>
|
|
|
|
<XQueue domain="inbox"/>
|
2023-01-09 01:41:25 +01:00
|
|
|
</MkFoldableSection>
|
2022-06-25 16:01:40 +02:00
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
2021-04-22 15:29:33 +02:00
|
|
|
</template>
|
|
|
|
|
2022-05-25 09:37:35 +02:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
import { markRaw, onMounted, onBeforeUnmount, nextTick, shallowRef, ref, computed } from 'vue';
|
2023-12-26 06:19:35 +01:00
|
|
|
import * as Misskey from 'misskey-js';
|
2022-06-25 16:01:40 +02:00
|
|
|
import XFederation from './overview.federation.vue';
|
2022-12-23 07:21:55 +01:00
|
|
|
import XInstances from './overview.instances.vue';
|
|
|
|
import XQueue from './overview.queue.vue';
|
|
|
|
import XApRequests from './overview.ap-requests.vue';
|
|
|
|
import XUsers from './overview.users.vue';
|
|
|
|
import XActiveUsers from './overview.active-users.vue';
|
|
|
|
import XStats from './overview.stats.vue';
|
2022-12-27 06:31:24 +01:00
|
|
|
import XRetention from './overview.retention.vue';
|
2022-12-26 01:22:39 +01:00
|
|
|
import XModerators from './overview.moderators.vue';
|
2022-12-27 01:47:54 +01:00
|
|
|
import XHeatmap from './overview.heatmap.vue';
|
2023-12-26 06:19:35 +01:00
|
|
|
import type { InstanceForPie } from './overview.pie.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import * as os from '@/os.js';
|
2024-01-04 10:32:46 +01:00
|
|
|
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { useStream } from '@/stream.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2023-01-09 01:41:25 +01:00
|
|
|
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
2022-06-25 16:01:40 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const rootEl = shallowRef<HTMLElement>();
|
2023-12-26 06:19:35 +01:00
|
|
|
const serverInfo = ref<Misskey.entities.ServerInfoResponse | null>(null);
|
|
|
|
const topSubInstancesForPie = ref<InstanceForPie[] | null>(null);
|
|
|
|
const topPubInstancesForPie = ref<InstanceForPie[] | null>(null);
|
2023-12-07 06:42:09 +01:00
|
|
|
const federationPubActive = ref<number | null>(null);
|
|
|
|
const federationPubActiveDiff = ref<number | null>(null);
|
|
|
|
const federationSubActive = ref<number | null>(null);
|
|
|
|
const federationSubActiveDiff = ref<number | null>(null);
|
2023-12-26 06:19:35 +01:00
|
|
|
const newUsers = ref<Misskey.entities.UserDetailed[] | null>(null);
|
|
|
|
const activeInstances = shallowRef<Misskey.entities.FederationInstance | null>(null);
|
2023-05-15 12:08:46 +02:00
|
|
|
const queueStatsConnection = markRaw(useStream().useChannel('queueStats'));
|
2022-06-25 16:01:40 +02:00
|
|
|
const now = new Date();
|
2022-06-26 06:28:47 +02:00
|
|
|
const filesPagination = {
|
|
|
|
endpoint: 'admin/drive/files' as const,
|
|
|
|
limit: 9,
|
|
|
|
noPaging: true,
|
|
|
|
};
|
2022-06-25 16:01:40 +02:00
|
|
|
|
2022-06-29 14:22:15 +02:00
|
|
|
function onInstanceClick(i) {
|
|
|
|
os.pageWindow(`/instance-info/${i.host}`);
|
|
|
|
}
|
|
|
|
|
2022-06-25 16:01:40 +02:00
|
|
|
onMounted(async () => {
|
|
|
|
/*
|
|
|
|
const magicGrid = new MagicGrid({
|
|
|
|
container: rootEl,
|
|
|
|
static: true,
|
|
|
|
animate: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
magicGrid.listen();
|
|
|
|
*/
|
|
|
|
|
2024-01-04 10:32:46 +01:00
|
|
|
misskeyApiGet('charts/federation', { limit: 2, span: 'day' }).then(chart => {
|
2023-12-07 06:42:09 +01:00
|
|
|
federationPubActive.value = chart.pubActive[0];
|
|
|
|
federationPubActiveDiff.value = chart.pubActive[0] - chart.pubActive[1];
|
|
|
|
federationSubActive.value = chart.subActive[0];
|
|
|
|
federationSubActiveDiff.value = chart.subActive[0] - chart.subActive[1];
|
2022-06-25 18:45:33 +02:00
|
|
|
});
|
|
|
|
|
2024-01-04 10:32:46 +01:00
|
|
|
misskeyApiGet('federation/stats', { limit: 10 }).then(res => {
|
2023-12-26 06:19:35 +01:00
|
|
|
topSubInstancesForPie.value = [
|
|
|
|
...res.topSubInstances.map(x => ({
|
|
|
|
name: x.host,
|
|
|
|
color: x.themeColor,
|
|
|
|
value: x.followersCount,
|
|
|
|
onClick: () => {
|
|
|
|
os.pageWindow(`/instance-info/${x.host}`);
|
|
|
|
},
|
|
|
|
})),
|
|
|
|
{ name: '(other)', color: '#80808080', value: res.otherFollowersCount },
|
|
|
|
];
|
|
|
|
topPubInstancesForPie.value = [
|
|
|
|
...res.topPubInstances.map(x => ({
|
|
|
|
name: x.host,
|
|
|
|
color: x.themeColor,
|
|
|
|
value: x.followingCount,
|
|
|
|
onClick: () => {
|
|
|
|
os.pageWindow(`/instance-info/${x.host}`);
|
|
|
|
},
|
|
|
|
})),
|
|
|
|
{ name: '(other)', color: '#80808080', value: res.otherFollowingCount },
|
|
|
|
];
|
2022-06-28 03:42:26 +02:00
|
|
|
});
|
|
|
|
|
2024-01-04 10:32:46 +01:00
|
|
|
misskeyApi('admin/server-info').then(serverInfoResponse => {
|
2023-12-07 06:42:09 +01:00
|
|
|
serverInfo.value = serverInfoResponse;
|
2022-05-25 09:37:35 +02:00
|
|
|
});
|
2021-10-22 17:04:19 +02:00
|
|
|
|
2024-01-04 10:32:46 +01:00
|
|
|
misskeyApi('admin/show-users', {
|
2022-06-25 18:45:33 +02:00
|
|
|
limit: 5,
|
|
|
|
sort: '+createdAt',
|
|
|
|
}).then(res => {
|
2023-12-07 06:42:09 +01:00
|
|
|
newUsers.value = res;
|
2022-06-25 18:45:33 +02:00
|
|
|
});
|
|
|
|
|
2024-01-04 10:32:46 +01:00
|
|
|
misskeyApi('federation/instances', {
|
2023-01-03 01:00:42 +01:00
|
|
|
sort: '+latestRequestReceivedAt',
|
2022-06-29 14:22:15 +02:00
|
|
|
limit: 25,
|
|
|
|
}).then(res => {
|
2023-12-07 06:42:09 +01:00
|
|
|
activeInstances.value = res;
|
2022-06-29 14:22:15 +02:00
|
|
|
});
|
|
|
|
|
2022-05-25 09:37:35 +02:00
|
|
|
nextTick(() => {
|
|
|
|
queueStatsConnection.send('requestLog', {
|
2023-07-14 00:59:54 +02:00
|
|
|
id: Math.random().toString().substring(2, 10),
|
2022-06-26 06:28:47 +02:00
|
|
|
length: 100,
|
2021-10-22 17:04:19 +02:00
|
|
|
});
|
2022-05-25 09:37:35 +02:00
|
|
|
});
|
|
|
|
});
|
2021-04-22 15:29:33 +02:00
|
|
|
|
2022-05-25 09:37:35 +02:00
|
|
|
onBeforeUnmount(() => {
|
|
|
|
queueStatsConnection.dispose();
|
|
|
|
});
|
2021-04-22 15:29:33 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.dashboard,
|
2022-12-19 11:01:30 +01:00
|
|
|
icon: 'ti ti-dashboard',
|
2021-04-22 15:29:33 +02:00
|
|
|
});
|
|
|
|
</script>
|
2021-10-21 22:36:48 +02:00
|
|
|
|
2023-05-14 03:21:56 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2022-12-23 07:21:55 +01:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
|
|
|
|
grid-gap: 16px;
|
2021-10-21 22:36:48 +02:00
|
|
|
}
|
|
|
|
</style>
|