0.12.0-16 misc fixes

This commit is contained in:
2026-03-30 14:37:23 +00:00
parent 76b020d5c0
commit 5284dd2a43
30 changed files with 6955 additions and 896 deletions
+41 -3
View File
@@ -412,6 +412,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
const [metadataDialogVisible, setMetadataDialogVisible] = useState(false);
const [metadataDialogContext, setMetadataDialogContext] = useState(null);
const [omdbAssignBusy, setOmdbAssignBusy] = useState(false);
const [pendingRestartRow, setPendingRestartRow] = useState(null);
const [cdMetadataDialogVisible, setCdMetadataDialogVisible] = useState(false);
const [cdMetadataDialogContext, setCdMetadataDialogContext] = useState(null);
const [cdMetadataAssignBusy, setCdMetadataAssignBusy] = useState(false);
@@ -589,6 +590,25 @@ export default function HistoryPage({ refreshToken = 0 }) {
setSelectedJob(response.job);
};
const refreshDetailAfterReplacement = async (sourceJobId, replacementJobId = null) => {
if (!detailVisible) {
return;
}
const sourceId = Number(sourceJobId || 0);
const replacementId = Number(replacementJobId || 0);
const selectedId = Number(selectedJob?.id || 0);
const hasReplacement = replacementId > 0 && replacementId !== sourceId;
if (hasReplacement && selectedId === sourceId) {
const response = await api.getJob(replacementId, { includeLogs: false, forceRefresh: true });
setSelectedJob(response.job);
return;
}
await refreshDetailIfOpen(hasReplacement ? replacementId : sourceId);
};
// ── Conflict Modal Helpers ─────────────────────────────────────────────────
const mergeOutputFoldersForJob = (job, folders = []) => {
@@ -681,13 +701,14 @@ export default function HistoryPage({ refreshToken = 0 }) {
try {
const response = await api.restartEncodeWithLastSettings(job.id, options);
const result = getQueueActionResult(response);
const replacementJobId = normalizeJobId(result?.jobId);
if (result.queued) {
toastRef.current?.show({ severity: 'info', summary: 'Encode-Neustart in Queue', detail: result.queuePosition > 0 ? `Position ${result.queuePosition}` : 'In der Warteschlange eingeplant.', life: 3500 });
} else {
toastRef.current?.show({ severity: 'success', summary: 'Encode-Neustart gestartet', detail: 'Letzte bestätigte Einstellungen werden verwendet.', life: 3500 });
}
await load();
await refreshDetailIfOpen(job.id);
await refreshDetailAfterReplacement(job.id, replacementJobId);
} catch (error) {
toastRef.current?.show({ severity: 'error', summary: 'Encode-Neustart fehlgeschlagen', detail: error.message, life: 4500 });
} finally {
@@ -703,7 +724,9 @@ export default function HistoryPage({ refreshToken = 0 }) {
}
setActionBusy(true);
try {
await api.restartReviewFromRaw(job.id, options);
const response = await api.restartReviewFromRaw(job.id, options);
const result = getQueueActionResult(response);
const replacementJobId = normalizeJobId(result?.jobId);
toastRef.current?.show({
severity: 'success',
summary: 'Review-Neustart',
@@ -711,7 +734,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
life: 3500
});
await load();
await refreshDetailIfOpen(job.id);
await refreshDetailAfterReplacement(job.id, replacementJobId);
} catch (error) {
toastRef.current?.show({ severity: 'error', summary: 'Review-Neustart fehlgeschlagen', detail: error.message, life: 4500 });
} finally {
@@ -938,6 +961,12 @@ export default function HistoryPage({ refreshToken = 0 }) {
};
const handleReencode = async (row) => {
const mediaType = resolveMediaType(row);
if (mediaType === 'bluray' || mediaType === 'dvd') {
setPendingRestartRow(row);
handleAssignOmdb(row);
return;
}
if (await maybeOpenOutputConflictModal(row, 'reencode')) {
return;
}
@@ -1044,6 +1073,14 @@ export default function HistoryPage({ refreshToken = 0 }) {
setMetadataDialogContext(null);
await load();
await refreshDetailIfOpen(payload.jobId);
const rowToRestart = pendingRestartRow;
if (rowToRestart && Number(rowToRestart.id) === Number(payload.jobId)) {
setPendingRestartRow(null);
if (!(await maybeOpenOutputConflictModal(rowToRestart, 'reencode'))) {
await executeHistoryAction(rowToRestart, 'reencode');
}
}
} catch (error) {
toastRef.current?.show({ severity: 'error', summary: 'OMDB-Zuweisung fehlgeschlagen', detail: error.message });
} finally {
@@ -1769,6 +1806,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
onHide={() => {
setMetadataDialogVisible(false);
setMetadataDialogContext(null);
setPendingRestartRow(null);
}}
onSubmit={handleOmdbSubmit}
onSearch={handleOmdbSearch}