1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-23 22:56:49 +09:00

ジョブの数を一覧できるように

This commit is contained in:
syuilo 2019-03-08 13:03:38 +09:00
parent 03cfb4fc8d
commit 78a8293520
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
3 changed files with 59 additions and 3 deletions

View File

@ -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 () => {

View File

@ -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;

View 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
};
});