Update queue.chart.vue

This commit is contained in:
syuilo 2023-01-09 09:42:11 +09:00
parent e633c3b84b
commit 2817ca03f5

View File

@ -1,12 +1,10 @@
<template> <template>
<div class="pumxzjhg"> <div class="pumxzjhg _gaps">
<div class="_table status"> <div :class="$style.status">
<div class="_row"> <div class="item _panel"><div class="label">Process</div>{{ number(activeSincePrevTick) }}</div>
<div class="_cell"><div class="_label">Process</div>{{ number(activeSincePrevTick) }}</div> <div class="item _panel"><div class="label">Active</div>{{ number(active) }}</div>
<div class="_cell"><div class="_label">Active</div>{{ number(active) }}</div> <div class="item _panel"><div class="label">Waiting</div>{{ number(waiting) }}</div>
<div class="_cell"><div class="_label">Waiting</div>{{ number(waiting) }}</div> <div class="item _panel"><div class="label">Delayed</div>{{ number(delayed) }}</div>
<div class="_cell"><div class="_label">Delayed</div>{{ number(delayed) }}</div>
</div>
</div> </div>
<div class="charts"> <div class="charts">
<div class="chart"> <div class="chart">
@ -26,15 +24,21 @@
<XChart ref="chartWaiting" type="waiting"/> <XChart ref="chartWaiting" type="waiting"/>
</div> </div>
</div> </div>
<div class="jobs"> <MkFolder :default-open="true" :max-height="250">
<div v-if="jobs.length > 0"> <template #icon><i class="ti ti-alert-triangle"></i></template>
<div v-for="job in jobs" :key="job[0]"> <template #label>Errored instances</template>
<span>{{ job[0] }}</span> <template #suffix>({{ number(jobs.reduce((a, b) => a + b[1], 0)) }} jobs)</template>
<span style="margin-left: 8px; opacity: 0.7;">({{ number(job[1]) }} jobs)</span>
<div :class="$style.jobs">
<div v-if="jobs.length > 0">
<div v-for="job in jobs" :key="job[0]">
<MkA :to="`/instance-info/${job[0]}`" behavior="window">{{ job[0] }}</MkA>
<span style="margin-left: 8px; opacity: 0.7;">({{ number(job[1]) }} jobs)</span>
</div>
</div> </div>
<span v-else style="opacity: 0.5;">{{ i18n.ts.noJobs }}</span>
</div> </div>
<span v-else style="opacity: 0.5;">{{ i18n.ts.noJobs }}</span> </MkFolder>
</div>
</div> </div>
</template> </template>
@ -45,6 +49,7 @@ import number from '@/filters/number';
import * as os from '@/os'; import * as os from '@/os';
import { stream } from '@/stream'; import { stream } from '@/stream';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import MkFolder from '@/components/MkFolder.vue';
const connection = markRaw(stream.useChannel('queueStats')); const connection = markRaw(stream.useChannel('queueStats'));
@ -115,14 +120,10 @@ onUnmounted(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.pumxzjhg { .pumxzjhg {
> .status {
padding: 16px;
}
> .charts { > .charts {
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
gap: 16px; gap: 10px;
> .chart { > .chart {
min-width: 0; min-width: 0;
@ -135,15 +136,27 @@ onUnmounted(() => {
} }
} }
} }
}
> .jobs { </style>
margin-top: 16px;
padding: 16px; <style lang="scss" module>
max-height: 180px; .status {
overflow: auto; display: grid;
background: var(--panel); grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
border-radius: var(--radius); grid-gap: 10px;
}
&:global {
> .item {
padding: 12px 16px;
> .label {
font-size: 80%;
opacity: 0.6;
}
}
}
}
.jobs {
} }
</style> </style>