Template
Harden one-click ingestion workflow
This commit is contained in:
@@ -114,7 +114,7 @@
|
||||
<!-- 消息提示 -->
|
||||
<div v-if="progress.message" class="message-section">
|
||||
<el-alert
|
||||
:type="progress.completed ? (progress.failed > 0 ? 'warning' : 'success') : 'info'"
|
||||
:type="alertType"
|
||||
:closable="false"
|
||||
show-icon
|
||||
>
|
||||
@@ -136,7 +136,7 @@ import { ElMessage } from 'element-plus';
|
||||
import { Upload, VideoPlay, Refresh, DataLine, FolderOpened, Document } from '@element-plus/icons-vue';
|
||||
import { getConfig } from '../api/config';
|
||||
import type { ConfigResponse } from '../api/config';
|
||||
import { startIngest as apiStartIngest, getIngestStatus } from '../api/ingest';
|
||||
import { startIngest as apiStartIngest, getIngestStatus, getIngestCurrentStatus } from '../api/ingest';
|
||||
import type { IngestStatusResponse } from '../api/ingest';
|
||||
import { useWebSocket } from '../composables/useWebSocket';
|
||||
import type { ProgressMessage } from '../composables/useWebSocket';
|
||||
@@ -192,6 +192,29 @@ const progressStats = computed((): StatItem[] => {
|
||||
];
|
||||
});
|
||||
|
||||
/** 所有被拒绝类别之和(不含已入库) */
|
||||
const totalRejected = computed(() =>
|
||||
(progress.duplicateFiles ?? 0)
|
||||
+ (progress.missingMetadataFiles ?? 0)
|
||||
+ (progress.unreadableFiles ?? 0)
|
||||
+ (progress.conversionFailedFiles ?? 0)
|
||||
+ (progress.otherRejectedFiles ?? 0)
|
||||
);
|
||||
|
||||
/** 是否为致命/内部错误 */
|
||||
const isFatalError = computed(() => {
|
||||
const msg = progress.message || '';
|
||||
return msg.startsWith('导入任务失败') || msg.startsWith('任务内部错误') || msg.includes('异常终止');
|
||||
});
|
||||
|
||||
/** 任务完成后的提醒类型 */
|
||||
const alertType = computed(() => {
|
||||
if (!progress.completed) return 'info';
|
||||
if (isFatalError.value) return 'error';
|
||||
if (totalRejected.value > 0) return 'warning';
|
||||
return 'success';
|
||||
});
|
||||
|
||||
function formatProgress() {
|
||||
if (progress.completed) return '完成';
|
||||
return `${progress.processed ?? 0} / ${progress.total ?? 0}`;
|
||||
@@ -286,7 +309,6 @@ async function startIngest() {
|
||||
// 页面挂载恢复:查询是否存在正在运行或最近完成的任务
|
||||
async function resumeFromCurrentTask() {
|
||||
try {
|
||||
const { getIngestCurrentStatus } = await import('../api/ingest');
|
||||
let resp: IngestStatusResponse | null = null;
|
||||
try {
|
||||
resp = await getIngestCurrentStatus();
|
||||
|
||||
Reference in New Issue
Block a user