2020-01-29 12:37:25 -07:00
|
|
|
<template>
|
2022-06-25 08:01:40 -06:00
|
|
|
<div class="pumxzjhg">
|
|
|
|
<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>
|
|
|
|
</div>
|
|
|
|
<div class="charts">
|
|
|
|
<div class="chart">
|
|
|
|
<div class="title">Process</div>
|
|
|
|
<XChart ref="chartProcess" type="process"/>
|
2020-08-09 00:51:02 -06:00
|
|
|
</div>
|
2022-06-25 08:01:40 -06:00
|
|
|
<div class="chart">
|
|
|
|
<div class="title">Active</div>
|
|
|
|
<XChart ref="chartActive" type="active"/>
|
2021-04-22 07:29:33 -06:00
|
|
|
</div>
|
2022-06-25 08:01:40 -06:00
|
|
|
<div class="chart">
|
|
|
|
<div class="title">Delayed</div>
|
|
|
|
<XChart ref="chartDelayed" type="delayed"/>
|
|
|
|
</div>
|
|
|
|
<div class="chart">
|
|
|
|
<div class="title">Waiting</div>
|
|
|
|
<XChart ref="chartWaiting" type="waiting"/>
|
|
|
|
</div>
|
|
|
|
</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>
|
2020-01-29 12:37:25 -07:00
|
|
|
</div>
|
2020-03-20 09:21:33 -06:00
|
|
|
</div>
|
2022-07-20 07:24:26 -06:00
|
|
|
<span v-else style="opacity: 0.5;">{{ i18n.ts.noJobs }}</span>
|
2020-01-29 12:37:25 -07:00
|
|
|
</div>
|
2021-04-22 07:29:33 -06:00
|
|
|
</div>
|
2020-01-29 12:37:25 -07:00
|
|
|
</template>
|
|
|
|
|
2022-05-17 10:31:04 -06:00
|
|
|
<script lang="ts" setup>
|
2022-06-25 08:01:40 -06:00
|
|
|
import { markRaw, onMounted, onUnmounted, ref } from 'vue';
|
|
|
|
import XChart from './queue.chart.chart.vue';
|
2021-11-11 10:02:25 -07:00
|
|
|
import number from '@/filters/number';
|
|
|
|
import * as os from '@/os';
|
2022-06-25 08:01:40 -06:00
|
|
|
import { stream } from '@/stream';
|
2022-07-20 07:24:26 -06:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-25 08:01:40 -06:00
|
|
|
|
|
|
|
const connection = markRaw(stream.useChannel('queueStats'));
|
2020-01-29 12:37:25 -07:00
|
|
|
|
2022-05-17 10:31:04 -06:00
|
|
|
const activeSincePrevTick = ref(0);
|
|
|
|
const active = ref(0);
|
|
|
|
const delayed = ref(0);
|
2022-06-25 08:01:40 -06:00
|
|
|
const waiting = ref(0);
|
2022-05-17 10:31:04 -06:00
|
|
|
const jobs = ref([]);
|
2022-06-25 08:01:40 -06:00
|
|
|
let chartProcess = $ref<InstanceType<typeof XChart>>();
|
|
|
|
let chartActive = $ref<InstanceType<typeof XChart>>();
|
|
|
|
let chartDelayed = $ref<InstanceType<typeof XChart>>();
|
|
|
|
let chartWaiting = $ref<InstanceType<typeof XChart>>();
|
2021-10-22 08:46:47 -06:00
|
|
|
|
2022-05-17 10:31:04 -06:00
|
|
|
const props = defineProps<{
|
2022-06-25 08:01:40 -06:00
|
|
|
domain: string;
|
2022-05-17 10:31:04 -06:00
|
|
|
}>();
|
2020-01-29 12:37:25 -07:00
|
|
|
|
2022-06-25 08:01:40 -06:00
|
|
|
const onStats = (stats) => {
|
|
|
|
activeSincePrevTick.value = stats[props.domain].activeSincePrevTick;
|
|
|
|
active.value = stats[props.domain].active;
|
|
|
|
delayed.value = stats[props.domain].delayed;
|
|
|
|
waiting.value = stats[props.domain].waiting;
|
|
|
|
|
|
|
|
chartProcess.pushData(stats[props.domain].activeSincePrevTick);
|
|
|
|
chartActive.pushData(stats[props.domain].active);
|
|
|
|
chartDelayed.pushData(stats[props.domain].delayed);
|
|
|
|
chartWaiting.pushData(stats[props.domain].waiting);
|
|
|
|
};
|
|
|
|
|
|
|
|
const onStatsLog = (statsLog) => {
|
|
|
|
const dataProcess = [];
|
|
|
|
const dataActive = [];
|
|
|
|
const dataDelayed = [];
|
|
|
|
const dataWaiting = [];
|
|
|
|
|
|
|
|
for (const stats of [...statsLog].reverse()) {
|
|
|
|
dataProcess.push(stats[props.domain].activeSincePrevTick);
|
|
|
|
dataActive.push(stats[props.domain].active);
|
|
|
|
dataDelayed.push(stats[props.domain].delayed);
|
|
|
|
dataWaiting.push(stats[props.domain].waiting);
|
|
|
|
}
|
|
|
|
|
|
|
|
chartProcess.setData(dataProcess);
|
|
|
|
chartActive.setData(dataActive);
|
|
|
|
chartDelayed.setData(dataDelayed);
|
|
|
|
chartWaiting.setData(dataWaiting);
|
|
|
|
};
|
|
|
|
|
2022-05-17 10:31:04 -06:00
|
|
|
onMounted(() => {
|
|
|
|
os.api(props.domain === 'inbox' ? 'admin/queue/inbox-delayed' : props.domain === 'deliver' ? 'admin/queue/deliver-delayed' : null, {}).then(result => {
|
|
|
|
jobs.value = result;
|
|
|
|
});
|
2020-01-29 12:37:25 -07:00
|
|
|
|
2022-06-25 08:01:40 -06:00
|
|
|
connection.on('stats', onStats);
|
|
|
|
connection.on('statsLog', onStatsLog);
|
|
|
|
connection.send('requestLog', {
|
|
|
|
id: Math.random().toString().substr(2, 8),
|
|
|
|
length: 200,
|
2022-05-17 10:31:04 -06:00
|
|
|
});
|
2020-01-29 12:37:25 -07:00
|
|
|
});
|
2022-06-25 08:01:40 -06:00
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
connection.off('stats', onStats);
|
|
|
|
connection.off('statsLog', onStatsLog);
|
|
|
|
connection.dispose();
|
|
|
|
});
|
2020-01-29 12:37:25 -07:00
|
|
|
</script>
|
2021-04-22 07:29:33 -06:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.pumxzjhg {
|
|
|
|
> .status {
|
|
|
|
padding: 16px;
|
2022-06-25 08:01:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
> .charts {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
gap: 16px;
|
|
|
|
|
|
|
|
> .chart {
|
|
|
|
min-width: 0;
|
|
|
|
padding: 16px;
|
|
|
|
background: var(--panel);
|
|
|
|
border-radius: var(--radius);
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
|
|
|
}
|
2021-04-22 07:29:33 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
> .jobs {
|
2022-06-25 08:01:40 -06:00
|
|
|
margin-top: 16px;
|
2021-04-22 07:29:33 -06:00
|
|
|
padding: 16px;
|
|
|
|
max-height: 180px;
|
|
|
|
overflow: auto;
|
2022-06-25 08:01:40 -06:00
|
|
|
background: var(--panel);
|
|
|
|
border-radius: var(--radius);
|
2021-04-22 07:29:33 -06:00
|
|
|
}
|
2022-06-25 08:01:40 -06:00
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
}
|
|
|
|
</style>
|