From fe460c022c9839861c53a0664625c67b57003cb6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 28 Jun 2022 10:42:26 +0900 Subject: [PATCH] feat(client): add instances doughnuts charts for dashboard --- .../client/src/pages/admin/overview.pie.vue | 102 ++++++++++++++++++ packages/client/src/pages/admin/overview.vue | 58 +++++++++- 2 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 packages/client/src/pages/admin/overview.pie.vue diff --git a/packages/client/src/pages/admin/overview.pie.vue b/packages/client/src/pages/admin/overview.pie.vue new file mode 100644 index 0000000000..d14b3cc6db --- /dev/null +++ b/packages/client/src/pages/admin/overview.pie.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/packages/client/src/pages/admin/overview.vue b/packages/client/src/pages/admin/overview.vue index 382169f723..61e3174c67 100644 --- a/packages/client/src/pages/admin/overview.vue +++ b/packages/client/src/pages/admin/overview.vue @@ -43,7 +43,12 @@ - +
+
Recent files
+
+ +
+
Enviroment
@@ -103,10 +108,18 @@
-
-
Recent files
+
- +
+
Sub
+ +
Top 10
+
+
+
Pub
+ +
Top 10
+
@@ -140,6 +153,7 @@ import XMetrics from './metrics.vue'; import XFederation from './overview.federation.vue'; import XQueueChart from './overview.queue-chart.vue'; import XUser from './overview.user.vue'; +import XPie from './overview.pie.vue'; import MkInstanceStats from '@/components/instance-stats.vue'; import MkNumberDiff from '@/components/number-diff.vue'; import { version, url } from '@/config'; @@ -175,6 +189,7 @@ const rootEl = $ref(); const chartEl = $ref(null); let stats: any = $ref(null); let serverInfo: any = $ref(null); +let fedStats: any = $ref(null); let usersComparedToThePrevDay: any = $ref(null); let notesComparedToThePrevDay: any = $ref(null); let federationPubActive = $ref(null); @@ -257,7 +272,7 @@ async function renderChart() { layout: { padding: { left: 0, - right: 8, + right: 0, top: 0, bottom: 0, }, @@ -380,6 +395,10 @@ onMounted(async () => { federationSubActiveDiff = chart.subActive[0] - chart.subActive[1]; }); + os.apiGet('federation/stats').then(res => { + fedStats = res; + }); + os.api('admin/server-info').then(serverInfoResponse => { serverInfo = serverInfoResponse; }); @@ -529,6 +548,35 @@ definePageMetadata({ } } } + + &.federationPies { + > .body { + display: grid; + grid-gap: 16px; + grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); + + > .chart { + position: relative; + padding: 20px; + background: var(--panel); + border-radius: var(--radius); + + > .title { + position: absolute; + top: 20px; + left: 20px; + font-size: 90%; + } + + > .subTitle { + position: absolute; + bottom: 20px; + right: 20px; + font-size: 85%; + } + } + } + } } }