summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkChart.stories.impl.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-08-02 12:25:58 +0100
committerdakkar <dakkar@thenautilus.net>2024-08-02 12:25:58 +0100
commitcfa9b852df9e0293865b3acbd67d59265962e552 (patch)
treea408ad670956a45c4e162e4ecc97a3624e2b0f20 /packages/frontend/src/components/MkChart.stories.impl.ts
parentmerge: rate limit all password checks - fixes #540 (!568) (diff)
parentMerge pull request #14233 from misskey-dev/develop (diff)
downloadsharkey-cfa9b852df9e0293865b3acbd67d59265962e552.tar.gz
sharkey-cfa9b852df9e0293865b3acbd67d59265962e552.tar.bz2
sharkey-cfa9b852df9e0293865b3acbd67d59265962e552.zip
Merge remote-tracking branch 'misskey/master' into feature/misskey-2024.07
Diffstat (limited to 'packages/frontend/src/components/MkChart.stories.impl.ts')
-rw-r--r--packages/frontend/src/components/MkChart.stories.impl.ts80
1 files changed, 80 insertions, 0 deletions
diff --git a/packages/frontend/src/components/MkChart.stories.impl.ts b/packages/frontend/src/components/MkChart.stories.impl.ts
new file mode 100644
index 0000000000..1bcb9c30d8
--- /dev/null
+++ b/packages/frontend/src/components/MkChart.stories.impl.ts
@@ -0,0 +1,80 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+/* eslint-disable @typescript-eslint/explicit-function-return-type */
+/* eslint-disable import/no-default-export */
+import { StoryObj } from '@storybook/vue3';
+import { http } from 'msw';
+import { commonHandlers } from '../../.storybook/mocks.js';
+import { getChartResolver } from '../../.storybook/charts.js';
+import MkChart from './MkChart.vue';
+
+const Base = {
+ render(args) {
+ return {
+ components: {
+ MkChart,
+ },
+ setup() {
+ return {
+ args,
+ };
+ },
+ computed: {
+ props() {
+ return {
+ ...this.args,
+ };
+ },
+ },
+ template: '<MkChart v-bind="props" />',
+ };
+ },
+ args: {
+ src: 'federation',
+ span: 'hour',
+ nowForChromatic: 1716263640000,
+ },
+ parameters: {
+ layout: 'centered',
+ msw: {
+ handlers: [
+ ...commonHandlers,
+ http.get('/api/charts/federation', getChartResolver(
+ ['deliveredInstances', 'inboxInstances', 'stalled', 'sub', 'pub', 'pubsub', 'subActive', 'pubActive'],
+ )),
+ http.get('/api/charts/notes', getChartResolver(
+ ['local.total', 'remote.total'],
+ { accumulate: true },
+ )),
+ http.get('/api/charts/drive', getChartResolver(
+ ['local.incSize', 'local.decSize', 'remote.incSize', 'remote.decSize'],
+ { mulMap: { 'local.incSize': 1e7, 'local.decSize': 5e6, 'remote.incSize': 1e6, 'remote.decSize': 5e5 } },
+ )),
+ ],
+ },
+ },
+} satisfies StoryObj<typeof MkChart>;
+export const FederationChart = {
+ ...Base,
+ args: {
+ ...Base.args,
+ src: 'federation',
+ },
+} satisfies StoryObj<typeof MkChart>;
+export const NotesTotalChart = {
+ ...Base,
+ args: {
+ ...Base.args,
+ src: 'notes-total',
+ },
+} satisfies StoryObj<typeof MkChart>;
+export const DriveChart = {
+ ...Base,
+ args: {
+ ...Base.args,
+ src: 'drive',
+ },
+} satisfies StoryObj<typeof MkChart>;