2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2021-09-29 15:50:45 +00:00
|
|
|
<div class="_debobigegoItem">
|
|
|
|
<div class="_debobigegoLabel"><slot name="title"></slot></div>
|
|
|
|
<div class="_debobigegoPanel pumxzjhg">
|
2021-04-22 13:29:33 +00:00
|
|
|
<div class="_table status">
|
|
|
|
<div class="_row">
|
|
|
|
<div class="_cell"><div class="_label">Process</div>{{ number(activeSincePrevTick) }}</div>
|
|
|
|
<div class="_cell"><div class="_label">Active</div>{{ number(active) }}</div>
|
|
|
|
<div class="_cell"><div class="_label">Waiting</div>{{ number(waiting) }}</div>
|
|
|
|
<div class="_cell"><div class="_label">Delayed</div>{{ number(delayed) }}</div>
|
|
|
|
</div>
|
2020-08-09 06:51:02 +00:00
|
|
|
</div>
|
2021-04-22 13:29:33 +00:00
|
|
|
<div class="">
|
2021-10-22 14:46:47 +00:00
|
|
|
<MkQueueChart :domain="domain" :connection="connection"/>
|
2021-04-22 13:29:33 +00:00
|
|
|
</div>
|
|
|
|
<div class="jobs">
|
|
|
|
<div v-if="jobs.length > 0">
|
|
|
|
<div v-for="job in jobs" :key="job[0]">
|
|
|
|
<span>{{ job[0] }}</span>
|
|
|
|
<span style="margin-left: 8px; opacity: 0.7;">({{ number(job[1]) }} jobs)</span>
|
|
|
|
</div>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
2021-04-22 13:29:33 +00:00
|
|
|
<span v-else style="opacity: 0.5;">{{ $ts.noJobs }}</span>
|
2020-03-20 15:21:33 +00:00
|
|
|
</div>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
2021-04-22 13:29:33 +00:00
|
|
|
</div>
|
2020-01-29 19:37:25 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-10-22 14:46:47 +00:00
|
|
|
import { defineComponent, markRaw, onMounted, onUnmounted, ref } from 'vue';
|
2021-08-05 07:34:18 +00:00
|
|
|
import number from '@client/filters/number';
|
2021-10-22 14:46:47 +00:00
|
|
|
import MkQueueChart from '@client/components/queue-chart.vue';
|
2021-03-23 08:30:14 +00:00
|
|
|
import * as os from '@client/os';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
export default defineComponent({
|
2021-10-22 14:46:47 +00:00
|
|
|
components: {
|
|
|
|
MkQueueChart
|
|
|
|
},
|
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
props: {
|
|
|
|
domain: {
|
2021-10-22 14:46:47 +00:00
|
|
|
type: String,
|
|
|
|
required: true,
|
2020-01-29 19:37:25 +00:00
|
|
|
},
|
|
|
|
connection: {
|
2021-10-22 14:46:47 +00:00
|
|
|
required: true,
|
2020-01-29 19:37:25 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2021-10-22 14:46:47 +00:00
|
|
|
setup(props) {
|
|
|
|
const activeSincePrevTick = ref(0);
|
|
|
|
const active = ref(0);
|
|
|
|
const waiting = ref(0);
|
|
|
|
const delayed = ref(0);
|
|
|
|
const jobs = ref([]);
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-10-22 14:46:47 +00:00
|
|
|
onMounted(() => {
|
2021-11-05 02:55:00 +00:00
|
|
|
os.api(props.domain === 'inbox' ? 'admin/queue/inbox-delayed' : props.domain === 'deliver' ? 'admin/queue/deliver-delayed' : null, {}).then(result => {
|
|
|
|
jobs.value = result;
|
2021-10-22 14:46:47 +00:00
|
|
|
});
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-10-22 14:46:47 +00:00
|
|
|
const onStats = (stats) => {
|
|
|
|
activeSincePrevTick.value = stats[props.domain].activeSincePrevTick;
|
|
|
|
active.value = stats[props.domain].active;
|
|
|
|
waiting.value = stats[props.domain].waiting;
|
|
|
|
delayed.value = stats[props.domain].delayed;
|
|
|
|
};
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-10-22 14:46:47 +00:00
|
|
|
props.connection.on('stats', onStats);
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-10-22 14:46:47 +00:00
|
|
|
onUnmounted(() => {
|
|
|
|
props.connection.off('stats', onStats);
|
2020-01-29 19:37:25 +00:00
|
|
|
});
|
2021-10-22 14:46:47 +00:00
|
|
|
});
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2021-10-22 14:46:47 +00:00
|
|
|
return {
|
|
|
|
jobs,
|
|
|
|
activeSincePrevTick,
|
|
|
|
active,
|
|
|
|
waiting,
|
|
|
|
delayed,
|
|
|
|
number,
|
|
|
|
};
|
|
|
|
},
|
2020-01-29 19:37:25 +00:00
|
|
|
});
|
|
|
|
</script>
|
2021-04-22 13:29:33 +00:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.pumxzjhg {
|
|
|
|
> .status {
|
|
|
|
padding: 16px;
|
|
|
|
border-bottom: solid 0.5px var(--divider);
|
|
|
|
}
|
|
|
|
|
|
|
|
> .jobs {
|
|
|
|
padding: 16px;
|
|
|
|
border-top: solid 0.5px var(--divider);
|
|
|
|
max-height: 180px;
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|