mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
ジョブの数を一覧できるように
This commit is contained in:
parent
4ebaf529eb
commit
f82fffeb58
3 changed files with 59 additions and 3 deletions
|
@ -2,6 +2,34 @@
|
|||
<div>
|
||||
<ui-card>
|
||||
<template #title>{{ $t('operation') }}</template>
|
||||
<section>
|
||||
<header>Deliver</header>
|
||||
<ui-horizon-group inputs v-if="stats">
|
||||
<ui-input :value="stats.deliver.waiting | number" type="text" readonly>
|
||||
<span>Waiting</span>
|
||||
</ui-input>
|
||||
<ui-input :value="stats.deliver.active | number" type="text" readonly>
|
||||
<span>Active</span>
|
||||
</ui-input>
|
||||
<ui-input :value="stats.deliver.delayed | number" type="text" readonly>
|
||||
<span>Delayed</span>
|
||||
</ui-input>
|
||||
</ui-horizon-group>
|
||||
</section>
|
||||
<section>
|
||||
<header>Inbox</header>
|
||||
<ui-horizon-group inputs v-if="stats">
|
||||
<ui-input :value="stats.inbox.waiting | number" type="text" readonly>
|
||||
<span>Waiting</span>
|
||||
</ui-input>
|
||||
<ui-input :value="stats.inbox.active | number" type="text" readonly>
|
||||
<span>Active</span>
|
||||
</ui-input>
|
||||
<ui-input :value="stats.inbox.delayed | number" type="text" readonly>
|
||||
<span>Delayed</span>
|
||||
</ui-input>
|
||||
</ui-horizon-group>
|
||||
</section>
|
||||
<section>
|
||||
<ui-button @click="removeAllJobs">{{ $t('remove-all-jobs') }}</ui-button>
|
||||
</section>
|
||||
|
@ -18,9 +46,16 @@ export default Vue.extend({
|
|||
|
||||
data() {
|
||||
return {
|
||||
stats: null
|
||||
};
|
||||
},
|
||||
|
||||
created() {
|
||||
this.$root.api('admin/queue/stats').then(stats => {
|
||||
this.stats = stats;
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
async removeAllJobs() {
|
||||
const process = async () => {
|
||||
|
|
|
@ -21,9 +21,9 @@ function initializeQueue(name: string) {
|
|||
} : null);
|
||||
}
|
||||
|
||||
const deliverQueue = initializeQueue('deliver');
|
||||
const inboxQueue = initializeQueue('inbox');
|
||||
const dbQueue = initializeQueue('db');
|
||||
export const deliverQueue = initializeQueue('deliver');
|
||||
export const inboxQueue = initializeQueue('inbox');
|
||||
export const dbQueue = initializeQueue('db');
|
||||
|
||||
export function deliver(user: ILocalUser, content: any, to: any) {
|
||||
if (content == null) return null;
|
||||
|
|
21
src/server/api/endpoints/admin/queue/stats.ts
Normal file
21
src/server/api/endpoints/admin/queue/stats.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import define from '../../../define';
|
||||
import { deliverQueue } from '../../../../../queue';
|
||||
|
||||
export const meta = {
|
||||
tags: ['admin'],
|
||||
|
||||
requireCredential: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {}
|
||||
};
|
||||
|
||||
export default define(meta, async (ps) => {
|
||||
const deliverJobCounts = await deliverQueue.getJobCounts();
|
||||
const inboxJobCounts = await deliverQueue.getJobCounts();
|
||||
|
||||
return {
|
||||
deliver: deliverJobCounts,
|
||||
inbox: inboxJobCounts
|
||||
};
|
||||
});
|
Loading…
Reference in a new issue