Repository navigation
Control downloads and show history in the web interface - #23
Merged
Merged
Conversation
Queue.Cancel deletes a job only while it is queued or downloading. A download that finishes as someone cancels it then stays in history for Sonarr or Radarr to import, instead of disappearing with its folder left behind. HistoryRetention is exported so the web interface can say how long finished jobs are kept.
The queue page can now pause and resume the whole queue or a single job, and remove a job after asking first. A new history page lists finished and failed downloads, newest first. Removing one from history can also delete its folder, and the confirmation shows which folder that is. The queue refreshes every second and history every five seconds. Every control is a plain form. htmx swaps in the page's new state at once, and without JavaScript the form returns to the page. Confirmations use the Popover API, which needs no script and keeps its open state, and a ticked box, through each refresh. A dialog's open attribute would be cleared by the morph instead. An action cancels a refresh already under way, so a refresh can't bring back the old state. If saving fails, a notice appears outside the refreshing part of the page, so the next refresh doesn't erase it. A download being paused is shown in the list at once rather than as still running. Removing from the queue uses Queue.Cancel, so a download that finishes at that moment stays in history to be imported.
htmx focuses the first autofocus element after every swap, so the first confirmation on the page pulled focus back to Keep every second. A keyboard user who tabbed to Remove could then dismiss the confirmation instead. The confirmations no longer autofocus: focus stays on the remove button, and Tab moves into the confirmation. A failed removal showed its notice at the bottom of the page. On phones, the open confirmation covered it. The notice now appears inside the confirmation, and refreshes leave it there until the confirmation is closed. Actions no longer cancel each other or a refresh under way. The bundled htmx frees its request queue when a cancelled request ends, even though the request that replaced it is still running, so later requests could overlap and land out of order. Actions now wait in the same queue as the refreshes, so responses arrive in the order they were requested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds download controls to the queue page and a new History page.
Queue.Cancelremoves only unfinished jobs, so a download that finishes as it is removed stays for import.Controls are plain forms: htmx swaps in the new state, and without JavaScript they redirect back. Confirmations use the Popover API, which needs no script and stays open through the morphing refresh. Actions queue behind refreshes instead of cancelling them: the bundled htmx releases its queue when a cancelled request ends. Resumed downloads still restart from the beginning.
Tested:
make test; Playwright screenshots of every state in light and dark at desktop and phone widths, with an axe audit; browser checks of each action, refreshes with a confirmation open, file deletion, API pauses, no-JavaScript forms, failure notices and request order on a slow link; the real binary with a job added throughmode=addfile; Codex review.