summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkChart.vue
diff options
context:
space:
mode:
authorzyoshoka <107108195+zyoshoka@users.noreply.github.com>2024-06-08 18:00:54 +0900
committerGitHub <noreply@github.com>2024-06-08 18:00:54 +0900
commit9849aab40283cbde2184e74d4795aec8ef8ccba3 (patch)
tree913efa935d00b01f9936794e74e410283ba1dbc5 /packages/frontend/src/components/MkChart.vue
parentfeat: 通報を受けた際にメールまたはWebhookで通知を送出出... (diff)
downloadmisskey-9849aab40283cbde2184e74d4795aec8ef8ccba3.tar.gz
misskey-9849aab40283cbde2184e74d4795aec8ef8ccba3.tar.bz2
misskey-9849aab40283cbde2184e74d4795aec8ef8ccba3.zip
test(#10336): add `components/MkC.*` stories (#13830)
* test(storybook): add `components/MkC.*` stories * test(storybook): add some tests * test: add sleep * test: comment-out flaky test * test(storybook): add test for `MkChannelFollowButton` * chore(storybook): tweak sleep duration in `MkChannelFollowButton` story test * fix(chromatic): add delay to `MkChannelList` * chore: replace `mswDecorator` with `mswLoader` * fix(storybook): tweak some parameters * chore: serve static files * fix(chromatic): add delay to `MkCwButton` * chore: delete logging for debug * fix: add right click in `MkContextMenu` play * refactor: remove unused imports
Diffstat (limited to 'packages/frontend/src/components/MkChart.vue')
-rw-r--r--packages/frontend/src/components/MkChart.vue90
1 files changed, 51 insertions, 39 deletions
diff --git a/packages/frontend/src/components/MkChart.vue b/packages/frontend/src/components/MkChart.vue
index 04b6d2f29c..a823a0ec4b 100644
--- a/packages/frontend/src/components/MkChart.vue
+++ b/packages/frontend/src/components/MkChart.vue
@@ -19,8 +19,9 @@ SPDX-License-Identifier: AGPL-3.0-only
id-denylist violation when setting it. This is causing about 60+ lint issues.
As this is part of Chart.js's API it makes sense to disable the check here.
*/
-import { onMounted, ref, shallowRef, watch, PropType } from 'vue';
+import { onMounted, ref, shallowRef, watch } from 'vue';
import { Chart } from 'chart.js';
+import * as Misskey from 'misskey-js';
import { misskeyApiGet } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
@@ -34,44 +35,55 @@ import MkChartLegend from '@/components/MkChartLegend.vue';
initChart();
-const props = defineProps({
- src: {
- type: String,
- required: true,
- },
- args: {
- type: Object,
- required: false,
- },
- limit: {
- type: Number,
- required: false,
- default: 90,
- },
- span: {
- type: String as PropType<'hour' | 'day'>,
- required: true,
- },
- detailed: {
- type: Boolean,
- required: false,
- default: false,
- },
- stacked: {
- type: Boolean,
- required: false,
- default: false,
- },
- bar: {
- type: Boolean,
- required: false,
- default: false,
- },
- aspectRatio: {
- type: Number,
- required: false,
- default: null,
- },
+type ChartSrc =
+ | 'federation'
+ | 'ap-request'
+ | 'users'
+ | 'users-total'
+ | 'active-users'
+ | 'notes'
+ | 'local-notes'
+ | 'remote-notes'
+ | 'notes-total'
+ | 'drive'
+ | 'drive-files'
+ | 'instance-requests'
+ | 'instance-users'
+ | 'instance-users-total'
+ | 'instance-notes'
+ | 'instance-notes-total'
+ | 'instance-ff'
+ | 'instance-ff-total'
+ | 'instance-drive-usage'
+ | 'instance-drive-usage-total'
+ | 'instance-drive-files'
+ | 'instance-drive-files-total'
+ | 'per-user-notes'
+ | 'per-user-pv'
+ | 'per-user-following'
+ | 'per-user-followers'
+ | 'per-user-drive'
+
+const props = withDefaults(defineProps<{
+ src: ChartSrc;
+ args?: {
+ host?: string;
+ user?: Misskey.entities.UserLite;
+ withoutAll?: boolean;
+ };
+ limit?: number;
+ span: 'hour' | 'day';
+ detailed?: boolean;
+ stacked?: boolean;
+ bar?: boolean;
+ aspectRatio?: number | null;
+}>(), {
+ args: undefined,
+ limit: 90,
+ detailed: false,
+ stacked: false,
+ bar: false,
+ aspectRatio: null,
});
const legendEl = shallowRef<InstanceType<typeof MkChartLegend>>();