Files
admin-web/src/modules/self-operated/components/TaskExecutionFacts.vue
T

21 lines
2.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { computed } from 'vue'
import type { Task } from '../types'
import { beijingTime, label, quantityText, unitText } from '../state'
const props = defineProps<{ task: Task; scopeLabel: string }>()
const quality = computed(() => props.task.progress)
const hasQuality = computed(() => [quality.value?.validationState, quality.value?.invalidCount, quality.value?.unknownCount, quality.value?.pendingReviewCount, quality.value?.summaryAsOf].some(value => value != null))
</script>
<template>
<div class="task-execution-facts" :aria-label="`${scopeLabel}执行信息`">
<p v-if="task.latestAttempt">尝试开始 {{ beijingTime(task.latestAttempt.startedAt) }};结束 {{ task.latestAttempt.finishedAt ? beijingTime(task.latestAttempt.finishedAt) : ['FETCHING', 'READY', 'VALIDATED', 'BUILDING'].includes(task.latestAttempt.status) ? '尚未结束' : '未记录' }};耗时 {{ quantityText(task.latestAttempt.elapsedSeconds) }} 秒;心跳 {{ beijingTime(task.latestAttempt.heartbeatAt) }} · {{ label(task.latestAttempt.executionHealth) }}。</p>
<p v-else-if="task.attemptCount === 0">{{ scopeLabel }}尚未开始执行尝试,开始、结束、耗时和心跳尚未产生。<template v-if="task.taskStatus === 'WAITING_SOURCE'">正在等待前面的数据准备任务完成。</template></p>
<p v-else>{{ scopeLabel }}尝试详情尚不可用,暂无法显示开始、结束、耗时和心跳。</p>
<p v-if="hasQuality">数据质量:{{ label(quality?.validationState) }};异常 {{ quantityText(quality?.invalidCount) }},未知 {{ quantityText(quality?.unknownCount) }},待核对 {{ quantityText(quality?.pendingReviewCount) }}({{ unitText(quality?.countUnit) }});摘要时间 {{ beijingTime(quality?.summaryAsOf) }}。未计算的数量不默认为零。</p>
<p v-else>数据质量:尚未生成校验摘要,异常、未知及待核对数量尚未计算。</p>
</div>
</template>
<style scoped>
p { margin: var(--admin-space-3) 0; overflow-wrap: anywhere; }
</style>