fix(backend): use prefixItems
in admin/queue/*-delayed
endpoint schema (#14468)
* fix(backend): represent tuples with `prefixItems` * refactor(frontend): fix type errors * fix(backend): add `prefixItems` in `SchemaType` * fix(backend): add `unevaluatedItems: false` to disallow extra items * refactor(frontend): consolidate `'deliver' | 'queue'` type def into `queue.vue` * fix(backend): add `unevaluatedItems` in `SchemaType`
This commit is contained in:
@@ -36,7 +36,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { markRaw, onMounted, onUnmounted, ref, shallowRef } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import XChart from './overview.queue.chart.vue';
|
||||
import type { ApQueueDomain } from '@/pages/admin/queue.vue';
|
||||
import number from '@/filters/number.js';
|
||||
import { useStream } from '@/stream.js';
|
||||
|
||||
@@ -52,10 +54,10 @@ const chartDelayed = shallowRef<InstanceType<typeof XChart>>();
|
||||
const chartWaiting = shallowRef<InstanceType<typeof XChart>>();
|
||||
|
||||
const props = defineProps<{
|
||||
domain: string;
|
||||
domain: ApQueueDomain;
|
||||
}>();
|
||||
|
||||
const onStats = (stats) => {
|
||||
function onStats(stats: Misskey.entities.QueueStats) {
|
||||
activeSincePrevTick.value = stats[props.domain].activeSincePrevTick;
|
||||
active.value = stats[props.domain].active;
|
||||
delayed.value = stats[props.domain].delayed;
|
||||
@@ -65,13 +67,13 @@ const onStats = (stats) => {
|
||||
chartActive.value.pushData(stats[props.domain].active);
|
||||
chartDelayed.value.pushData(stats[props.domain].delayed);
|
||||
chartWaiting.value.pushData(stats[props.domain].waiting);
|
||||
};
|
||||
}
|
||||
|
||||
const onStatsLog = (statsLog) => {
|
||||
const dataProcess = [];
|
||||
const dataActive = [];
|
||||
const dataDelayed = [];
|
||||
const dataWaiting = [];
|
||||
function onStatsLog(statsLog: Misskey.entities.QueueStatsLog) {
|
||||
const dataProcess: Misskey.entities.QueueStats[ApQueueDomain]['activeSincePrevTick'][] = [];
|
||||
const dataActive: Misskey.entities.QueueStats[ApQueueDomain]['active'][] = [];
|
||||
const dataDelayed: Misskey.entities.QueueStats[ApQueueDomain]['delayed'][] = [];
|
||||
const dataWaiting: Misskey.entities.QueueStats[ApQueueDomain]['waiting'][] = [];
|
||||
|
||||
for (const stats of [...statsLog].reverse()) {
|
||||
dataProcess.push(stats[props.domain].activeSincePrevTick);
|
||||
@@ -84,7 +86,7 @@ const onStatsLog = (statsLog) => {
|
||||
chartActive.value.setData(dataActive);
|
||||
chartDelayed.value.setData(dataDelayed);
|
||||
chartWaiting.value.setData(dataWaiting);
|
||||
};
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
connection.on('stats', onStats);
|
||||
|
Reference in New Issue
Block a user