mirror of
https://github.com/nimbold/Firelink.git
synced 2026-09-02 22:17:56 +00:00
fix(ui): fence stale allocation status
- keep paused and completed rows authoritative over transient allocation state - preserve allocation feedback for failed-download retries - expose the table allocation phase as an accessible indeterminate progressbar
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
canonicalizeDownloadFileName,
|
||||
categoryForDownload,
|
||||
categoryForFileName,
|
||||
isAllocationPhaseVisible,
|
||||
isValidTorrentExcludeTrackerList,
|
||||
isValidTorrentTrackerList,
|
||||
normalizeTorrentEncryptionPolicy,
|
||||
@@ -107,6 +108,16 @@ describe('download persistence progress snapshots', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('allocation phase visibility', () => {
|
||||
it('does not override paused or completed statuses', () => {
|
||||
expect(isAllocationPhaseVisible(true, 'ready')).toBe(true);
|
||||
expect(isAllocationPhaseVisible(true, 'failed')).toBe(true);
|
||||
expect(isAllocationPhaseVisible(true, 'paused')).toBe(false);
|
||||
expect(isAllocationPhaseVisible(true, 'completed')).toBe(false);
|
||||
expect(isAllocationPhaseVisible(false, 'downloading')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Torrent tracker input validation', () => {
|
||||
it('accepts supported trackers separated by lines or commas', () => {
|
||||
expect(isValidTorrentTrackerList(
|
||||
|
||||
@@ -45,6 +45,16 @@ export const isActiveDownloadStatus = (status: DownloadStatus): boolean =>
|
||||
export const isTransferActiveStatus = (status: DownloadStatus): boolean =>
|
||||
status === 'downloading' || status === 'processing' || status === 'verifying' || status === 'seeding' || status === 'retrying';
|
||||
|
||||
/**
|
||||
* A transient allocation flag must never replace a terminal or user-paused
|
||||
* status in the UI. Failed rows remain eligible because retry admission can
|
||||
* begin from the failed state before the backend accepts the new lifecycle.
|
||||
*/
|
||||
export const isAllocationPhaseVisible = (
|
||||
allocationPending: boolean,
|
||||
status: DownloadStatus,
|
||||
): boolean => allocationPending && status !== 'completed' && status !== 'paused';
|
||||
|
||||
export const DOWNLOAD_CONNECTIONS_MIN = 1;
|
||||
export const DOWNLOAD_CONNECTIONS_MAX = 16;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user