replace screenshot pipeline and update admin
This commit is contained in:
@@ -25,6 +25,7 @@ const refreshStats = inject('refreshStats', null)
|
||||
const adminStats = inject('adminStats', null)
|
||||
|
||||
const loading = ref(false)
|
||||
const refreshing = ref(false)
|
||||
const lastUpdatedAt = ref('')
|
||||
|
||||
const taskStats = ref(null)
|
||||
@@ -181,9 +182,13 @@ const runningCountsLabel = computed(() => {
|
||||
return `运行中 ${runningCount} / 排队 ${queuingCount} / 并发上限 ${maxGlobal || maxConcurrentGlobal.value || '-'}`
|
||||
})
|
||||
|
||||
async function refreshAll() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
async function refreshAll(options = {}) {
|
||||
const showLoading = options.showLoading ?? true
|
||||
if (refreshing.value) return
|
||||
refreshing.value = true
|
||||
if (showLoading) {
|
||||
loading.value = true
|
||||
}
|
||||
try {
|
||||
const [
|
||||
taskResult,
|
||||
@@ -217,15 +222,22 @@ async function refreshAll() {
|
||||
await refreshStats?.()
|
||||
recordUpdatedAt()
|
||||
} finally {
|
||||
loading.value = false
|
||||
refreshing.value = false
|
||||
if (showLoading) {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let refreshTimer = null
|
||||
|
||||
function manualRefresh() {
|
||||
return refreshAll({ showLoading: true })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
refreshAll()
|
||||
refreshTimer = setInterval(refreshAll, 1000)
|
||||
refreshAll({ showLoading: false })
|
||||
refreshTimer = setInterval(() => refreshAll({ showLoading: false }), 1000)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
@@ -252,7 +264,7 @@ onUnmounted(() => {
|
||||
</div>
|
||||
|
||||
<div class="hero-actions">
|
||||
<el-button type="primary" plain :loading="loading" @click="refreshAll">刷新</el-button>
|
||||
<el-button type="primary" plain :loading="loading" @click="manualRefresh">刷新</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -593,9 +605,9 @@ onUnmounted(() => {
|
||||
<div class="panel-head">
|
||||
<div class="head-left">
|
||||
<div class="head-text">
|
||||
<div class="panel-title">浏览器池</div>
|
||||
<div class="panel-title">截图线程池</div>
|
||||
<div class="panel-sub app-muted">
|
||||
活跃(有浏览器){{ browserPoolActiveWorkers }} · 忙碌 {{ browserPoolBusyWorkers }} · 队列 {{ browserPoolQueueSize }}
|
||||
活跃(有执行环境){{ browserPoolActiveWorkers }} · 忙碌 {{ browserPoolBusyWorkers }} · 队列 {{ browserPoolQueueSize }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -609,7 +621,7 @@ onUnmounted(() => {
|
||||
</div>
|
||||
<div class="tile">
|
||||
<div class="tile-v ok">{{ browserPoolActiveWorkers }}</div>
|
||||
<div class="tile-k app-muted">活跃(有浏览器)</div>
|
||||
<div class="tile-k app-muted">活跃(有执行环境)</div>
|
||||
</div>
|
||||
<div class="tile">
|
||||
<div class="tile-v">{{ browserPoolIdleWorkers }}</div>
|
||||
@@ -645,7 +657,7 @@ onUnmounted(() => {
|
||||
</el-table-column>
|
||||
<el-table-column prop="browser_use_count" label="复用" width="90" />
|
||||
<el-table-column prop="last_active_at" label="最近活跃" min-width="160" />
|
||||
<el-table-column prop="browser_created_at" label="浏览器创建" min-width="160" />
|
||||
<el-table-column prop="browser_created_at" label="环境创建" min-width="160" />
|
||||
</el-table>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
Reference in New Issue
Block a user