0.12.0-14 Log Fix
This commit is contained in:
@@ -315,8 +315,7 @@ export default function PipelineStatusCard({
|
||||
onRetry,
|
||||
onDeleteJob,
|
||||
isQueued = false,
|
||||
busy,
|
||||
liveJobLog = ''
|
||||
busy
|
||||
}) {
|
||||
const state = pipeline?.state || 'IDLE';
|
||||
const stateLabel = getStatusLabel(state);
|
||||
@@ -331,6 +330,7 @@ export default function PipelineStatusCard({
|
||||
const reviewMode = String(mediaInfoReview?.mode || '').trim().toLowerCase();
|
||||
const isPreRipReview = reviewMode === 'pre_rip' || Boolean(mediaInfoReview?.preRip);
|
||||
const jobMediaProfile = resolvePipelineMediaProfile(pipeline, mediaInfoReview);
|
||||
const [liveJobLog, setLiveJobLog] = useState('');
|
||||
const [selectedEncodeTitleId, setSelectedEncodeTitleId] = useState(null);
|
||||
const [selectedPlaylistId, setSelectedPlaylistId] = useState(null);
|
||||
const [selectedHandBrakeTitleIdState, setSelectedHandBrakeTitleIdState] = useState(null);
|
||||
@@ -592,6 +592,30 @@ export default function PipelineStatusCard({
|
||||
pipeline?.context?.selectedPlaylist
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!running || !retryJobId) {
|
||||
setLiveJobLog('');
|
||||
return undefined;
|
||||
}
|
||||
let cancelled = false;
|
||||
const refresh = async () => {
|
||||
try {
|
||||
const response = await api.getJob(retryJobId, { includeLiveLog: true, lite: true });
|
||||
if (!cancelled) {
|
||||
setLiveJobLog(response?.job?.log || '');
|
||||
}
|
||||
} catch (_err) {
|
||||
// ignore transient polling errors
|
||||
}
|
||||
};
|
||||
void refresh();
|
||||
const interval = setInterval(refresh, 2500);
|
||||
return () => {
|
||||
cancelled = true;
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [running, retryJobId]);
|
||||
|
||||
const playlistDecisionRequiredBeforeStart = state === 'WAITING_FOR_USER_DECISION' && !handBrakeTitleDecisionRequired;
|
||||
const commandOutputPath = useMemo(
|
||||
() => buildOutputPathPreview(settingsMap, jobMediaProfile, selectedMetadata, retryJobId),
|
||||
|
||||
@@ -933,7 +933,6 @@ export default function DashboardPage({
|
||||
const [queueReorderBusy, setQueueReorderBusy] = useState(false);
|
||||
const [draggingQueueEntryId, setDraggingQueueEntryId] = useState(null);
|
||||
const [insertQueueDialog, setInsertQueueDialog] = useState({ visible: false, afterEntryId: null });
|
||||
const [liveJobLog, setLiveJobLog] = useState('');
|
||||
const [runtimeActivities, setRuntimeActivities] = useState(() => normalizeRuntimeActivitiesPayload(null));
|
||||
const [runtimeLoading, setRuntimeLoading] = useState(false);
|
||||
const [runtimeActionBusyKeys, setRuntimeActionBusyKeys] = useState(() => new Set());
|
||||
@@ -960,15 +959,6 @@ export default function DashboardPage({
|
||||
const state = String(pipeline?.state || 'IDLE').trim().toUpperCase();
|
||||
const currentPipelineJobId = normalizeJobId(pipeline?.activeJobId || pipeline?.context?.jobId);
|
||||
const isProcessing = processingStates.includes(state);
|
||||
// Always prefer the ENCODING job from dashboardJobs for the live log.
|
||||
// When a second job enters ANALYZING, isProcessing becomes true (ANALYZING is a processingState)
|
||||
// and currentPipelineJobId switches to job2 — but job1 is still ENCODING and its log must stay visible.
|
||||
const encodingJobId = useMemo(() => {
|
||||
const bg = dashboardJobs.find((job) => normalizeStatus(job?.status) === 'ENCODING');
|
||||
return bg ? normalizeJobId(bg.id) : null;
|
||||
}, [dashboardJobs]);
|
||||
const liveLogJobId = encodingJobId || currentPipelineJobId;
|
||||
const liveLogActive = isProcessing || Boolean(encodingJobId);
|
||||
const monitoringState = useMemo(
|
||||
() => normalizeHardwareMonitoringPayload(hardwareMonitoring),
|
||||
[hardwareMonitoring]
|
||||
@@ -1314,31 +1304,6 @@ export default function DashboardPage({
|
||||
return undefined;
|
||||
}, [audiobookUploadPhase]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!liveLogJobId || !liveLogActive) {
|
||||
setLiveJobLog('');
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let cancelled = false;
|
||||
const refreshLiveLog = async () => {
|
||||
try {
|
||||
const response = await api.getJob(liveLogJobId, { includeLiveLog: true, lite: true });
|
||||
if (!cancelled) {
|
||||
setLiveJobLog(response?.job?.log || '');
|
||||
}
|
||||
} catch (_error) {
|
||||
// ignore transient polling errors to avoid noisy toasts while background polling
|
||||
}
|
||||
};
|
||||
|
||||
void refreshLiveLog();
|
||||
const interval = setInterval(refreshLiveLog, 2500);
|
||||
return () => {
|
||||
cancelled = true;
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [liveLogJobId, liveLogActive]);
|
||||
|
||||
const pipelineByJobId = useMemo(() => {
|
||||
const map = new Map();
|
||||
@@ -2841,7 +2806,7 @@ export default function DashboardPage({
|
||||
const statusBadgeValue = getStatusLabel(job?.status, { queued: isQueued });
|
||||
const statusBadgeSeverity = getStatusSeverity(normalizedStatus, { queued: isQueued });
|
||||
const isExpanded = normalizeJobId(expandedJobId) === jobId;
|
||||
const isCurrentSession = liveLogJobId === jobId && (state !== 'IDLE' || liveLogActive);
|
||||
const isCurrentSession = jobId === currentPipelineJobId && state !== 'IDLE';
|
||||
const reviewConfirmed = Boolean(Number(job?.encode_review_confirmed || 0));
|
||||
const pipelineForJob = pipelineByJobId.get(jobId) || pipeline;
|
||||
const jobTitle = job?.title || job?.detected_title || `Job #${jobId}`;
|
||||
@@ -2981,7 +2946,6 @@ export default function DashboardPage({
|
||||
onRemoveFromQueue={handleRemoveQueuedJob}
|
||||
isQueued={isQueued}
|
||||
busy={busyJobIds.has(jobId)}
|
||||
liveJobLog={isCurrentSession ? liveJobLog : ''}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user