Keep the UI attached to background jobs across navigation

Jobs already run on the server — leaving the page or closing the tab does
not stop them — but the SPA lost its link to them because the task id
lived in component state. The online detail page now looks up the newest
task for the post: an active one resumes the progress bar and cancel
button, and a finished one shows "your last download for this post
finished — J-xx". The downloads list accepts a post_id filter for that
lookup.

The footer's Active Workers count is also a link to the staff stats
dashboard, which is the global view of running jobs.
This commit is contained in:
2026-09-17 21:45:24 -05:00
parent 27cbfd882c
commit 487d14c617
4 changed files with 87 additions and 19 deletions
+3
View File
@@ -420,6 +420,9 @@ class DownloadTaskViewSet(
def get_queryset(self):
reap_stale_downloads()
queryset = DownloadTask.objects.select_related("library_item")
post_id = self.request.query_params.get("post_id", "").strip()
if post_id.isdigit():
queryset = queryset.filter(post_id=int(post_id))
user = self.request.user
if not (user.is_staff or user.is_superuser):
queryset = queryset.filter(user=user)