0.12.0-1 Plugins und diverses
This commit is contained in:
1 parent
0a9cf6969f
commit
24955a956d
33 files changed
+3978
-479
No files matched your search
@@ -120,6 +120,47 @@ function App() {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const globalToastRef = useRef(null);
|
||||
const prevCdDrivesRef = useRef({});
|
||||
|
||||
// When a virtual CD drive is removed (CD encode/rip finished or failed),
|
||||
// or when a CD drive transitions away from an active job, force both
|
||||
// Dashboard and History to re-fetch so jobs leave the live list reliably.
|
||||
useEffect(() => {
|
||||
const current = pipeline?.cdDrives || {};
|
||||
const prev = prevCdDrivesRef.current;
|
||||
const normalizeState = (value) => String(value || '').trim().toUpperCase();
|
||||
const ACTIVE_CD_STATES = new Set(['CD_ANALYZING', 'CD_METADATA_SELECTION', 'CD_READY_TO_RIP', 'CD_RIPPING', 'CD_ENCODING']);
|
||||
const TERMINAL_CD_STATES = new Set(['FINISHED', 'ERROR', 'CANCELLED']);
|
||||
let shouldRefresh = false;
|
||||
|
||||
for (const [devicePath, previousDrive] of Object.entries(prev)) {
|
||||
const previousJobId = normalizeJobId(previousDrive?.jobId);
|
||||
if (!previousJobId) {
|
||||
continue;
|
||||
}
|
||||
const previousState = normalizeState(previousDrive?.state);
|
||||
const currentDrive = current?.[devicePath] || null;
|
||||
const currentJobId = normalizeJobId(currentDrive?.jobId);
|
||||
const currentState = normalizeState(currentDrive?.state);
|
||||
const driveRemoved = !currentDrive;
|
||||
const jobChanged = currentJobId !== previousJobId;
|
||||
const movedToTerminal = currentJobId === previousJobId
|
||||
&& TERMINAL_CD_STATES.has(currentState)
|
||||
&& currentState !== previousState;
|
||||
const leftActiveLifecycle = ACTIVE_CD_STATES.has(previousState)
|
||||
&& (driveRemoved || jobChanged || !ACTIVE_CD_STATES.has(currentState));
|
||||
if (movedToTerminal || leftActiveLifecycle) {
|
||||
shouldRefresh = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldRefresh) {
|
||||
setDashboardJobsRefreshToken((t) => t + 1);
|
||||
setHistoryJobsRefreshToken((t) => t + 1);
|
||||
}
|
||||
prevCdDrivesRef.current = current;
|
||||
}, [pipeline?.cdDrives]);
|
||||
|
||||
const refreshPipeline = async () => {
|
||||
const response = await api.getPipelineState();
|
||||
|
||||
Reference in new issue
Block a user