2021-04-22 22:29:33 +09:00
|
|
|
<template>
|
2022-12-23 15:21:55 +09:00
|
|
|
<MkSpacer :content-max="1000">
|
2022-12-26 09:22:39 +09:00
|
|
|
<div ref="rootEl" class="edbbcaef">
|
2022-12-23 15:21:55 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Stats</template>
|
|
|
|
<XStats/>
|
|
|
|
</MkFolder>
|
2022-12-27 09:47:54 +09:00
|
|
|
|
2022-12-23 15:21:55 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Active users</template>
|
|
|
|
<XActiveUsers/>
|
|
|
|
</MkFolder>
|
2022-12-27 09:47:54 +09:00
|
|
|
|
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Heatmap</template>
|
|
|
|
<XHeatmap/>
|
|
|
|
</MkFolder>
|
|
|
|
|
2022-12-27 14:31:24 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Retention rate</template>
|
|
|
|
<XRetention/>
|
|
|
|
</MkFolder>
|
|
|
|
|
2022-12-26 09:22:39 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Moderators</template>
|
|
|
|
<XModerators/>
|
|
|
|
</MkFolder>
|
2022-12-27 09:47:54 +09:00
|
|
|
|
2022-12-23 15:21:55 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Federation</template>
|
|
|
|
<XFederation/>
|
|
|
|
</MkFolder>
|
2022-12-27 09:47:54 +09:00
|
|
|
|
2022-12-23 15:21:55 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Instances</template>
|
|
|
|
<XInstances/>
|
|
|
|
</MkFolder>
|
2022-12-27 09:47:54 +09:00
|
|
|
|
2022-12-23 15:21:55 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Ap requests</template>
|
|
|
|
<XApRequests/>
|
|
|
|
</MkFolder>
|
2022-12-27 09:47:54 +09:00
|
|
|
|
2022-12-23 15:21:55 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>New users</template>
|
|
|
|
<XUsers/>
|
|
|
|
</MkFolder>
|
2022-12-27 09:47:54 +09:00
|
|
|
|
2022-12-23 15:21:55 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Deliver queue</template>
|
|
|
|
<XQueue domain="deliver"/>
|
|
|
|
</MkFolder>
|
2022-12-27 09:47:54 +09:00
|
|
|
|
2022-12-23 15:21:55 +09:00
|
|
|
<MkFolder class="item">
|
|
|
|
<template #header>Inbox queue</template>
|
|
|
|
<XQueue domain="inbox"/>
|
|
|
|
</MkFolder>
|
2022-06-25 23:01:40 +09:00
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
2021-04-22 22:29:33 +09:00
|
|
|
</template>
|
|
|
|
|
2022-05-25 16:37:35 +09:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { markRaw, version as vueVersion, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
2022-06-25 23:01:40 +09:00
|
|
|
import XFederation from './overview.federation.vue';
|
2022-12-23 15:21:55 +09: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 14:31:24 +09:00
|
|
|
import XRetention from './overview.retention.vue';
|
2022-12-26 09:22:39 +09:00
|
|
|
import XModerators from './overview.moderators.vue';
|
2022-12-27 09:47:54 +09:00
|
|
|
import XHeatmap from './overview.heatmap.vue';
|
2022-08-31 00:24:33 +09:00
|
|
|
import MkTagCloud from '@/components/MkTagCloud.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import { version, url } from '@/config';
|
|
|
|
import * as os from '@/os';
|
2021-12-29 22:13:09 +09:00
|
|
|
import { stream } from '@/stream';
|
2022-05-25 16:37:35 +09:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2022-06-25 23:01:40 +09:00
|
|
|
import 'chartjs-adapter-date-fns';
|
|
|
|
import { defaultStore } from '@/store';
|
2022-08-31 00:24:33 +09:00
|
|
|
import MkFileListForAdmin from '@/components/MkFileListForAdmin.vue';
|
2022-12-23 15:21:55 +09:00
|
|
|
import MkFolder from '@/components/MkFolder.vue';
|
2022-06-25 23:01:40 +09:00
|
|
|
|
|
|
|
const rootEl = $ref<HTMLElement>();
|
2022-05-25 16:37:35 +09:00
|
|
|
let serverInfo: any = $ref(null);
|
2022-06-30 22:02:08 +09:00
|
|
|
let topSubInstancesForPie: any = $ref(null);
|
|
|
|
let topPubInstancesForPie: any = $ref(null);
|
2022-06-26 01:45:33 +09:00
|
|
|
let federationPubActive = $ref<number | null>(null);
|
|
|
|
let federationPubActiveDiff = $ref<number | null>(null);
|
|
|
|
let federationSubActive = $ref<number | null>(null);
|
|
|
|
let federationSubActiveDiff = $ref<number | null>(null);
|
|
|
|
let newUsers = $ref(null);
|
2022-06-29 21:22:15 +09:00
|
|
|
let activeInstances = $shallowRef(null);
|
2022-05-25 16:37:35 +09:00
|
|
|
const queueStatsConnection = markRaw(stream.useChannel('queueStats'));
|
2022-06-25 23:01:40 +09:00
|
|
|
const now = new Date();
|
2022-06-26 13:28:47 +09:00
|
|
|
const filesPagination = {
|
|
|
|
endpoint: 'admin/drive/files' as const,
|
|
|
|
limit: 9,
|
|
|
|
noPaging: true,
|
|
|
|
};
|
2022-06-25 23:01:40 +09:00
|
|
|
|
2022-06-29 21:22:15 +09:00
|
|
|
function onInstanceClick(i) {
|
|
|
|
os.pageWindow(`/instance-info/${i.host}`);
|
|
|
|
}
|
|
|
|
|
2022-06-25 23:01:40 +09:00
|
|
|
onMounted(async () => {
|
|
|
|
/*
|
|
|
|
const magicGrid = new MagicGrid({
|
|
|
|
container: rootEl,
|
|
|
|
static: true,
|
|
|
|
animate: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
magicGrid.listen();
|
|
|
|
*/
|
|
|
|
|
2022-06-26 01:45:33 +09:00
|
|
|
os.apiGet('charts/federation', { limit: 2, span: 'day' }).then(chart => {
|
|
|
|
federationPubActive = chart.pubActive[0];
|
|
|
|
federationPubActiveDiff = chart.pubActive[0] - chart.pubActive[1];
|
|
|
|
federationSubActive = chart.subActive[0];
|
|
|
|
federationSubActiveDiff = chart.subActive[0] - chart.subActive[1];
|
|
|
|
});
|
|
|
|
|
2022-06-30 20:15:14 +09:00
|
|
|
os.apiGet('federation/stats', { limit: 10 }).then(res => {
|
2022-07-01 00:38:20 +09:00
|
|
|
topSubInstancesForPie = res.topSubInstances.map(x => ({
|
2022-06-30 22:02:08 +09:00
|
|
|
name: x.host,
|
|
|
|
color: x.themeColor,
|
|
|
|
value: x.followersCount,
|
|
|
|
onClick: () => {
|
|
|
|
os.pageWindow(`/instance-info/${x.host}`);
|
|
|
|
},
|
2022-07-01 00:38:20 +09:00
|
|
|
})).concat([{ name: '(other)', color: '#80808080', value: res.otherFollowersCount }]);
|
|
|
|
topPubInstancesForPie = res.topPubInstances.map(x => ({
|
2022-06-30 22:02:08 +09:00
|
|
|
name: x.host,
|
|
|
|
color: x.themeColor,
|
|
|
|
value: x.followingCount,
|
|
|
|
onClick: () => {
|
|
|
|
os.pageWindow(`/instance-info/${x.host}`);
|
|
|
|
},
|
2022-07-01 00:38:20 +09:00
|
|
|
})).concat([{ name: '(other)', color: '#80808080', value: res.otherFollowingCount }]);
|
2022-06-28 10:42:26 +09:00
|
|
|
});
|
|
|
|
|
2022-05-25 16:37:35 +09:00
|
|
|
os.api('admin/server-info').then(serverInfoResponse => {
|
|
|
|
serverInfo = serverInfoResponse;
|
|
|
|
});
|
2021-10-23 00:04:19 +09:00
|
|
|
|
2022-06-26 01:45:33 +09:00
|
|
|
os.api('admin/show-users', {
|
|
|
|
limit: 5,
|
|
|
|
sort: '+createdAt',
|
|
|
|
}).then(res => {
|
|
|
|
newUsers = res;
|
|
|
|
});
|
|
|
|
|
2022-06-29 21:22:15 +09:00
|
|
|
os.api('federation/instances', {
|
|
|
|
sort: '+lastCommunicatedAt',
|
|
|
|
limit: 25,
|
|
|
|
}).then(res => {
|
|
|
|
activeInstances = res;
|
|
|
|
});
|
|
|
|
|
2022-05-25 16:37:35 +09:00
|
|
|
nextTick(() => {
|
|
|
|
queueStatsConnection.send('requestLog', {
|
|
|
|
id: Math.random().toString().substr(2, 8),
|
2022-06-26 13:28:47 +09:00
|
|
|
length: 100,
|
2021-10-23 00:04:19 +09:00
|
|
|
});
|
2022-05-25 16:37:35 +09:00
|
|
|
});
|
|
|
|
});
|
2021-04-22 22:29:33 +09:00
|
|
|
|
2022-05-25 16:37:35 +09:00
|
|
|
onBeforeUnmount(() => {
|
|
|
|
queueStatsConnection.dispose();
|
|
|
|
});
|
2021-04-22 22:29:33 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.dashboard,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-dashboard',
|
2021-04-22 22:29:33 +09:00
|
|
|
});
|
|
|
|
</script>
|
2021-10-22 05:36:48 +09:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.edbbcaef {
|
2022-12-23 15:21:55 +09:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
|
|
|
|
grid-gap: 16px;
|
2021-10-22 05:36:48 +09:00
|
|
|
}
|
|
|
|
</style>
|