mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 17:03:09 +02:00
ジョブの数を一覧できるように
This commit is contained in:
parent
03cfb4fc8d
commit
78a8293520
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