Skip to content

A full-featured download manager.

fix(downloads): refine progress and prevent duplicate pause requests (#2525)

Dr_rOot8e12a8d0d84f
diff --git a/e2e/downloads-visibility.spec.ts b/e2e/downloads-visibility.spec.ts
index 86d890c1..dbd40e0a 100644
--- a/e2e/downloads-visibility.spec.ts
+++ b/e2e/downloads-visibility.spec.ts
@@ -154,14 +154,14 @@ test('media task progress follows segments, then the processing stage, until the
)
task.mediaProgress = { ...task.mediaProgress, muxProgress: 0.42 }
await publish(electronApp, [task])
- await expect(row.getByText('Merging 42%', { exact: true })).toBeVisible()
+ await expect(row.getByText('Merging 42.0%', { exact: true })).toBeVisible()
await row.dblclick()
const inspector = mainWindow.getByRole('dialog', { name: 'Task Inspector' })
await expect(
inspector.getByText('Download progress', { exact: true })
).toBeVisible()
- await expect(inspector.getByText('100%', { exact: true })).toBeVisible()
- await expect(inspector.getByText('42%', { exact: true })).toBeVisible()
+ await expect(inspector.getByText('100.0%', { exact: true })).toBeVisible()
+ await expect(inspector.getByText('42.0%', { exact: true })).toBeVisible()
await expect(
inspector.getByText('1000 / 1000 segments', { exact: true })
).toBeVisible()
@@ -252,8 +252,8 @@ test('media file list shows every segment through virtual scrolling and stays re
await inspector.getByRole('tab', { name: 'Files', exact: true }).click()
const list = inspector.getByTestId('virtual-list-container')
await expect(list.getByText('video/init.mp4', { exact: true })).toBeVisible()
- await expect(list.getByText('100%', { exact: true })).toBeVisible()
- await expect(list.getByText('50%', { exact: true })).toBeVisible()
+ await expect(list.getByText('100.0%', { exact: true })).toBeVisible()
+ await expect(list.getByText('50.0%', { exact: true })).toBeVisible()
expect(await list.getByRole('checkbox').count()).toBeLessThan(50)
await expect(list.getByRole('checkbox').first()).toHaveAttribute(
'aria-disabled',
@@ -283,6 +283,134 @@ test('media file list shows every segment through virtual scrolling and stays re
})
})
+test('download progress advances between rounded percentage labels', async ({
+ electronApp,
+ mainWindow,
+}, testInfo) => {
+ await waitForEngineReady(mainWindow)
+ await mainWindow.getByRole('link', { name: 'Downloads', exact: true }).click()
+ await expect(mainWindow.getByTestId('downloads-loading')).toHaveCount(0)
+ const task = makeDownloadTask({
+ id: 'fractional-progress',
+ name: 'Fractional progress.bin',
+ status: TaskStatus.Downloading,
+ progress: 0.350625,
+ })
+ await publish(electronApp, [task])
+ const row = mainWindow.locator('[data-task-id="fractional-progress"]')
+ const bar = row.getByRole('progressbar')
+ await expect(row.getByText('35.1%', { exact: true })).toBeVisible()
+ await expect(bar).toHaveAttribute('aria-valuenow', '35.0625')
+ const width = () =>
+ bar.evaluate(
+ (element) =>
+ element.firstElementChild?.firstElementChild?.getBoundingClientRect()
+ .width ?? 0
+ )
+ await expect.poll(width).toBeGreaterThan(0)
+ // Wait for the existing transition before comparing the next fractional update.
+ await bar.evaluate(async (element) => {
+ await Promise.all(
+ element
+ .getAnimations({ subtree: true })
+ .map((animation) => animation.finished)
+ )
+ })
+ const before = await width()
+ await publish(electronApp, [{ ...task, progress: 0.3514 }])
+ await expect(bar).toHaveAttribute('aria-valuenow', '35.14')
+ await expect(row.getByText('35.1%', { exact: true })).toBeVisible()
+ await expect.poll(width).toBeGreaterThan(before)
+ await mainWindow.screenshot({
+ path: testInfo.outputPath('fractional-progress.png'),
+ })
+})
+
+test('pause stays disabled across controls until a delayed BT request settles', async ({
+ electronApp,
+ mainWindow,
+}, testInfo) => {
+ await waitForEngineReady(mainWindow)
+ await electronApp.evaluate(({ ipcMain }, channel) => {
+ const probe = {
+ calls: [] as string[][],
+ resolve: null as null | ((value: unknown) => void),
+ }
+ Object.assign(globalThis, { pauseProbe: probe })
+ ipcMain.removeHandler(channel)
+ ipcMain.handle(channel, (_event, ids: string[]) => {
+ probe.calls.push(ids)
+ return new Promise((resolve) => {
+ probe.resolve = resolve
+ })
+ })
+ }, Commands.PauseTasks)
+ const task = makeDownloadTask({
+ id: 'pause-pending',
+ name: 'Slow pause.torrent',
+ type: TaskType.Bt,
+ status: TaskStatus.Downloading,
+ progress: 0.5,
+ })
+ await mainWindow.getByRole('link', { name: 'Downloads', exact: true }).click()
+ await expect(mainWindow.getByTestId('downloads-loading')).toHaveCount(0)
+ await publish(electronApp, [task])
+ const row = mainWindow.locator('[data-task-id="pause-pending"]')
+ await row.dblclick()
+ const drawer = mainWindow.getByRole('dialog', { name: 'Task Inspector' })
+ const pause = drawer.getByRole('button', { name: /^(Pause|Pausing…)$/ })
+ await pause.click()
+ await expect(pause).toBeDisabled()
+ await expect(pause).toHaveText('Pausing…')
+ await pause.evaluate((button: HTMLButtonElement) => button.click())
+ await row.click({ button: 'right' })
+ await expect(
+ mainWindow.getByRole('menuitem', { name: 'Pausing…', exact: true })
+ ).toBeDisabled()
+ await mainWindow.keyboard.press('Escape')
+ const calls = () =>
+ electronApp.evaluate(
+ () =>
+ (globalThis as unknown as { pauseProbe: { calls: string[][] } })
+ .pauseProbe.calls
+ )
+ expect(await calls()).toEqual([['pause-pending']])
+ await mainWindow.screenshot({
+ path: testInfo.outputPath('bt-pause-pending.png'),
+ })
+ await electronApp.evaluate(
+ (_electron, response) => {
+ ;(
+ globalThis as unknown as {
+ pauseProbe: { resolve: (value: unknown) => void }
+ }
+ ).pauseProbe.resolve(response)
+ },
+ makeProtocolSuccess({
+ succeeded: [],
+ failed: [{ taskId: task.id, reason: 'test pause failure' }],
+ })
+ )
+ await expect(pause).toBeEnabled()
+ await pause.click()
+ await expect(pause).toBeDisabled()
+ await expect.poll(calls).toEqual([['pause-pending'], ['pause-pending']])
+ await publish(electronApp, [{ ...task, status: TaskStatus.Paused }])
+ await electronApp.evaluate(
+ (_electron, response) => {
+ ;(
+ globalThis as unknown as {
+ pauseProbe: { resolve: (value: unknown) => void }
+ }
+ ).pauseProbe.resolve(response)
+ },
+ makeProtocolSuccess({ succeeded: [task.id], failed: [] })
+ )
+ await expect(
+ drawer.getByRole('button', { name: 'Resume', exact: true })
+ ).toBeEnabled()
+})
+
test('default columns keep the download speed fully visible at minimum window size', async ({
electronApp,
mainWindow,
@@ -723,7 +851,7 @@ for (const { count, width, height, zoom } of [
name: new RegExp(`Active tail ${count - 1}\\.bin`),
})
await expectUsable(tail)
- await expect(tail).toContainText('99%')
+ await expect(tail).toContainText('99.5%')
await tail.click({ position: { x: 120, y: 18 } })
const listBox = await list.boundingBox()
await mainWindow
diff --git a/src/core/engine/aria2/polling-scheduler.test.ts b/src/core/engine/aria2/polling-scheduler.test.ts
index aaac1090..bd5f2b09 100644
--- a/src/core/engine/aria2/polling-scheduler.test.ts
+++ b/src/core/engine/aria2/polling-scheduler.test.ts
@@ -251,7 +251,9 @@ describe('PollingScheduler', () => {
expect(scheduler.getMode()).toBe('active')
expect(emitted).toEqual([true])
- await vi.advanceTimersByTimeAsync(1_000)
+ await vi.advanceTimersByTimeAsync(499)
+ expect(rpc.multicall).toHaveBeenCalledTimes(1)
+ await vi.advanceTimersByTimeAsync(1)
expect(rpc.multicall).toHaveBeenCalledTimes(2)
})
@@ -275,8 +277,8 @@ describe('PollingScheduler', () => {
// Should switch to active mode and emit event
expect(emitted).toEqual([true])
- // Active mode polls at 1s
- await vi.advanceTimersByTimeAsync(1_000)
+ // Active mode polls at 500ms
+ await vi.advanceTimersByTimeAsync(500)
expect(rpc.multicall).toHaveBeenCalledTimes(3)
expect(onTasksUpdate).toHaveBeenCalled()
})
@@ -295,7 +297,7 @@ describe('PollingScheduler', () => {
scheduler.handleNotification('aria2.onDownloadStart', {
gid: 'gid1',
})
- await vi.advanceTimersByTimeAsync(1_000)
+ await vi.advanceTimersByTimeAsync(500)
const emitted: boolean[] = []
eventBus.on(Events.EngineActiveChanged, (active) => {
@@ -326,7 +328,7 @@ describe('PollingScheduler', () => {
scheduler.handleNotification('aria2.onDownloadStart', {
gid: 'gid1',
})
- await vi.advanceTimersByTimeAsync(1_000)
+ await vi.advanceTimersByTimeAsync(500)
const emitted: boolean[] = []
eventBus.on(Events.EngineActiveChanged, (active) => {
@@ -386,7 +388,7 @@ describe('PollingScheduler', () => {
gid: 'gid1',
})
- await vi.advanceTimersByTimeAsync(1_000)
+ await vi.advanceTimersByTimeAsync(500)
expect(rpc.multicall).toHaveBeenCalledTimes(3)
expect(onStats).toHaveBeenCalledWith(ACTIVE_STATS_TRANSLATED)
diff --git a/src/core/engine/aria2/polling-scheduler.ts b/src/core/engine/aria2/polling-scheduler.ts
index 44dc3c65..85c75be5 100644
--- a/src/core/engine/aria2/polling-scheduler.ts
+++ b/src/core/engine/aria2/polling-scheduler.ts
@@ -10,7 +10,7 @@ import type { Aria2RawStatus, Aria2TaskStatus } from './types'
const log = getLogger('polling-scheduler')
-const ACTIVE_INTERVAL = 1_000
+const ACTIVE_INTERVAL = 500
const IDLE_INTERVAL = 10_000
// Notifications that indicate a download has started or resumed.
@@ -218,7 +218,7 @@ export class PollingScheduler {
}
// Both modes share the same RPC shape: get stats + active + waiting in
- // one multicall round-trip. Only the cadence differs (1s vs 10s). Idle
+ // one multicall round-trip. Only the cadence differs (500ms vs 10s). Idle
// still polls the task list because BT magnet metadata-fetch never emits
// aria2.onDownloadStart, leaving freshly added tasks stuck at the
// renderer's initial Queued placeholder until polling reconciles.
diff --git a/src/core/task/actions/pause-task.test.ts b/src/core/task/actions/pause-task.test.ts
index 751a927c..adf0e0dc 100644
--- a/src/core/task/actions/pause-task.test.ts
+++ b/src/core/task/actions/pause-task.test.ts
@@ -57,6 +57,42 @@ function makeDeps(
}
describe('pauseTask', () => {
+ it('shares one in-flight pause across callers and releases it on failure', async () => {
+ const deps = makeDeps()
+ let reject!: (error: Error) => void
+ vi.mocked(deps.adapter.pauseTask).mockReturnValueOnce(
+ new Promise((_resolve, fail) => {
+ reject = fail
+ })
+ )
+ const first = pauseTask('t1', deps)
+ const onPauseRequested = vi.fn()
+ const second = pauseTask('t1', { ...deps, onPauseRequested })
+ expect(onPauseRequested).toHaveBeenCalledWith('t1')
+ const results = Promise.allSettled([first, second])
+ await Promise.resolve()
+ expect(deps.adapter.pauseTask).toHaveBeenCalledTimes(1)
+ reject(new Error('pause failed'))
+ expect((await results).map((result) => result.status)).toEqual([
+ 'rejected',
+ 'rejected',
+ ])
+ await pauseTask('t1', deps)
+ expect(deps.adapter.pauseTask).toHaveBeenCalledTimes(2)
+ })
+
+ it('treats a repeated pause of an already paused task as a no-op', async () => {
+ const deps = {
+ ...makeDeps({
+ task: { id: 't1', engineTaskId: 'gid-1', status: TaskStatus.Paused },
+ }),
+ onPauseRequested: vi.fn(),
+ }
+ await pauseTask('t1', deps)
+ expect(deps.onPauseRequested).toHaveBeenCalledWith('t1')
+ expect(deps.adapter.pauseTask).not.toHaveBeenCalled()
+ })
+
it('looks up engineTaskId and calls adapter.pauseTask with gid', async () => {
const deps = makeDeps()
await pauseTask('t1', deps)
diff --git a/src/core/task/actions/pause-task.ts b/src/core/task/actions/pause-task.ts
index 2d49dce7..cbf41748 100644
--- a/src/core/task/actions/pause-task.ts
+++ b/src/core/task/actions/pause-task.ts
@@ -1,5 +1,6 @@
import { assertLegacyTaskNotActivated } from '@core/legacy-import/legacy-task-policy'
import { TaskStatus } from '@shared/types/task'
+import type { EngineAdapter } from '../../engine/engine-adapter'
import {
commitTaskUpdate,
getTaskOrWarn,
@@ -7,6 +8,43 @@ import {
type TaskActionDeps,
} from './shared'
+const pendingPauses = new WeakMap<EngineAdapter, Map<string, Promise<void>>>()
+const recordedPauses = new WeakSet<Promise<void>>()
+
+/** Share the engine request, allowing each caller to commit under its own lease. */
+function pauseEngineTask(gid: string, adapter: EngineAdapter): Promise<void> {
+ let pending = pendingPauses.get(adapter)
+ if (!pending) {
+ pending = new Map()
+ pendingPauses.set(adapter, pending)
+ }
+ const existing = pending.get(gid)
+ if (existing) return existing
+ const operation = Promise.resolve()
+ .then(() => adapter.pauseTask(gid))
+ .finally(() => pending.delete(gid))
+ pending.set(gid, operation)
+ return operation
+}
+
+/** Concurrent callers publish independently but record one exact pause transition. */
+function withPauseTransition(
+ requests: readonly Promise<void>[],
+ deps: TaskActionDeps
+): TaskActionDeps {
+ const recordTransition = deps.recordTransition
+ if (!recordTransition) return deps
+ return {
+ ...deps,
+ recordTransition: (input) => {
+ if (input.nextStatus !== TaskStatus.Paused) return recordTransition(input)
+ if (requests.some((request) => recordedPauses.has(request))) return
+ for (const request of requests) recordedPauses.add(request)
+ return recordTransition(input)
+ },
+ }
+}
+
/**
* Pause a task by its domain taskId.
* Domain → engine translation happens exactly once, on the adapter call.
@@ -25,6 +63,7 @@ export async function pauseTask(
if (!task) return
assertLegacyTaskNotActivated(task)
deps.onPauseRequested?.(taskId)
+ if (task.status === TaskStatus.Paused) return
const optimistic = {
...task,
status: TaskStatus.Paused,
@@ -49,18 +88,24 @@ export async function pauseTask(
}
// A paused segment fires no onComplete, so the coordinator's run() simply
// waits; resume lets the segment finish and the pipeline continues.
- await Promise.all(gids.map((gid) => deps.adapter.pauseTask(gid)))
- await commitTaskUpdate(task, optimistic, deps)
+ const requests = gids.map((gid) => pauseEngineTask(gid, deps.adapter))
+ await Promise.all(requests)
+ await commitTaskUpdate(
+ task,
+ optimistic,
+ withPauseTransition(requests, deps)
+ )
return
}
+ const request = pauseEngineTask(task.engineTaskId, deps.adapter)
try {
- await deps.adapter.pauseTask(task.engineTaskId)
+ await request
} catch (err) {
await reconcileTask(task, deps, { emitFallback: false })
throw err
}
- await reconcileTask(optimistic, deps, {
+ await reconcileTask(optimistic, withPauseTransition([request], deps), {
accuracy: 'exact',
transitionFromStatus: task.status,
})
diff --git a/src/core/task/actions/task-mutation-race.test.ts b/src/core/task/actions/task-mutation-race.test.ts
index 52385949..1a5e43a6 100644
--- a/src/core/task/actions/task-mutation-race.test.ts
+++ b/src/core/task/actions/task-mutation-race.test.ts
@@ -265,6 +265,39 @@ describe('canonical task mutation serialization', () => {
expect(taskManager.getById(initial.id)).toBeUndefined()
})
+ it('shares the engine pause without joining a caller holding the mutation lease', async () => {
+ const gate = deferred()
+ const started = deferred()
+ const leaseEntered = deferred()
+ const taskManager = new TaskManager()
+ const initial = task(TaskStatus.Downloading)
+ taskManager.add(initial)
+ const durable = new Map([[initial.id, structuredClone(initial)]])
+ const eventBus = new EventBus()
+ const store = activityStore()
+ const runtime = new TaskInspectorActivityRuntime(store, eventBus)
+ const adapter = {
+ pauseTask: vi.fn(async () => {
+ started.resolve()
+ await gate.promise
+ }),
+ getTaskStatus: vi.fn(async () => null),
+ } as unknown as EngineAdapter
+ const deps = actionDeps(taskManager, eventBus, runtime, adapter, durable)
+ const userPause = pauseTask(initial.id, deps)
+ await started.promise
+ const trackerPause = runtime.runTaskMutation([initial.id], async () => {
+ leaseEntered.resolve()
+ await pauseTask(initial.id, deps)
+ })
+ await leaseEntered.promise
+ gate.resolve()
+ await Promise.all([userPause, trackerPause])
+ expect(adapter.pauseTask).toHaveBeenCalledTimes(1)
+ expect(store.recordTransition).toHaveBeenCalledTimes(1)
+ expect(taskManager.getById(initial.id)?.status).toBe(TaskStatus.Paused)
+ })
+
it('does not resurrect a task when a deferred pause loses to remove', async () => {
const pauseGate = deferred()
const pauseStarted = deferred()
diff --git a/src/core/task/task-update-publisher.ts b/src/core/task/task-update-publisher.ts
index cb2d1bc6..15373949 100644
--- a/src/core/task/task-update-publisher.ts
+++ b/src/core/task/task-update-publisher.ts
@@ -6,7 +6,7 @@ import type { TaskManager } from './task-manager'
* Trailing coalescing window for TaskUpdated broadcasts. One bulk action
* commits hundreds of tasks within a few milliseconds; every commit inside
* this window collapses into a single snapshot emit at its end. 16 ms is
- * below one animation frame and two orders of magnitude below the 1 Hz poll
+ * below one animation frame and well below the 500 ms active poll
* cadence; measured against 2 ms-latency engine RPCs it already collapses a
* 200-task burst into one emit (see
* docs/superpowers/specs/2026-08-07-task-updated-emit-coalescing-design.md).
diff --git a/src/renderer/features/application-menu/task-context.ts b/src/renderer/features/application-menu/task-context.ts
index 73502d8a..dba8d16e 100644
--- a/src/renderer/features/application-menu/task-context.ts
+++ b/src/renderer/features/application-menu/task-context.ts
@@ -7,6 +7,7 @@ import {
useOperatorSession,
} from '@renderer/lib/operator-auth'
import { transport } from '@renderer/lib/transport'
+import { useTaskPauseStore } from '@renderer/routes/downloads/inspector/task-pause-store'
import { useDownloadsSelection } from '@renderer/routes/downloads/store'
import { PRODUCT_MENU_ITEMS } from '@shared/application-menu-catalog'
import { type CommandId, CommandIds } from '@shared/commands-catalog'
@@ -120,8 +121,11 @@ export function menuActionEnabled(
if (id === CommandIds.TaskClearStopped)
return tasks.some((task) => isStoppedTaskStatus(task.status))
const selected = selectedMenuTasks(intent)
- if (id === CommandIds.TaskPause) return selected.some(canPause)
- if (id === CommandIds.TaskResume) return selected.some(canResume)
+ const available = selected.filter(
+ (task) => !useTaskPauseStore.getState().pending.has(task.id)
+ )
+ if (id === CommandIds.TaskPause) return available.some(canPause)
+ if (id === CommandIds.TaskResume) return available.some(canResume)
if (id === CommandIds.TaskDelete) return selected.some(canRemove)
if (id === CommandIds.TaskMoveUp || id === CommandIds.TaskMoveDown)
return selected.some(canMoveInQueue)
@@ -133,11 +137,13 @@ export function subscribeMenuContext(listener: () => void): () => void {
const detachTasks = subscribeTaskList(listener)
const detachSelection = useDownloadsSelection.subscribe(listener)
const detachAuth = useOperatorSession.subscribe(listener)
+ const detachPauses = useTaskPauseStore.subscribe(listener)
listeners.add(listener)
return () => {
detachTasks()
detachSelection()
detachAuth()
+ detachPauses()
listeners.delete(listener)
}
}
diff --git a/src/renderer/lib/format.test.ts b/src/renderer/lib/format.test.ts
index 7d1182dd..92809ef8 100644
--- a/src/renderer/lib/format.test.ts
+++ b/src/renderer/lib/format.test.ts
@@ -97,6 +97,12 @@ describe('formatProgressPercent', () => {
'does not report 100%% while progress is %s',
(progress) => expect(formatProgressPercent(progress)).toBe(99)
)
+ it('supports one decimal without rounding unfinished progress to completion', () => {
+ expect(formatProgressPercent(0.35125, 1)).toBe(35.1)
+ expect(formatProgressPercent(0.995, 1)).toBe(99.5)
+ expect(formatProgressPercent(0.99999, 1)).toBe(99.9)
+ expect(formatProgressPercent(1, 1)).toBe(100)
+ })
it('reports full byte completion and handles invalid snapshots', () => {
expect(formatProgressPercent(1)).toBe(100)
expect(formatProgressPercent(1.01)).toBe(100)
diff --git a/src/renderer/lib/format.ts b/src/renderer/lib/format.ts
index 03ce345d..050e93f5 100644
--- a/src/renderer/lib/format.ts
+++ b/src/renderer/lib/format.ts
@@ -51,7 +51,13 @@ export function formatDurationHMS(seconds: number): string {
}
/** Round display percentages without claiming completion while bytes remain. */
-export function formatProgressPercent(progress: number): number {
+export function formatProgressPercent(
+ progress: number,
+ fractionDigits: 0 | 1 = 0
+): number {
if (!Number.isFinite(progress) || progress <= 0) return 0
- return progress >= 1 ? 100 : Math.min(99, Math.round(progress * 100))
+ const scale = 10 ** fractionDigits
+ return progress >= 1
+ ? 100
+ : Math.min(100 - 1 / scale, Math.round(progress * 100 * scale) / scale)
}
diff --git a/src/renderer/routes/dashboard/tiles/tasks-tile.tsx b/src/renderer/routes/dashboard/tiles/tasks-tile.tsx
index 69f11d8b..c5c7e327 100644
--- a/src/renderer/routes/dashboard/tiles/tasks-tile.tsx
+++ b/src/renderer/routes/dashboard/tiles/tasks-tile.tsx
@@ -117,13 +117,21 @@ function TaskQuickAction({
const actions = useTaskActions(selected)
const [pending, setPending] = useState(false)
const pendingRef = useRef(false)
- const action = actions.pauseCount
- ? { label: t('panel.downloads.action.pause'), run: actions.onPause }
- : actions.resumeCount
- ? { label: t('panel.downloads.action.resume'), run: actions.onResume }
- : actions.retryCount
- ? { label: t('panel.downloads.action.retry'), run: actions.onRetry }
- : null
+ const action =
+ actions.pauseCount || actions.pausing
+ ? {
+ label: t(
+ actions.pausing
+ ? 'panel.downloads.action.pausing'
+ : 'panel.downloads.action.pause'
+ ),
+ run: actions.onPause,
+ }
+ : actions.resumeCount
+ ? { label: t('panel.downloads.action.resume'), run: actions.onResume }
+ : actions.retryCount
+ ? { label: t('panel.downloads.action.retry'), run: actions.onRetry }
+ : null
if (!action) return null
@@ -144,9 +152,9 @@ function TaskQuickAction({
type="button"
variant="ghost"
size="xs"
- disabled={!enabled || pending}
+ disabled={!enabled || pending || actions.pausing}
aria-label={`${action.label}: ${task.name}`}
- aria-busy={pending || undefined}
+ aria-busy={pending || actions.pausing || undefined}
onClick={() => void run()}
className="relative z-20 col-start-2 row-start-1 me-1 h-7 min-w-11 px-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground motion-reduce:transition-none"
>
diff --git a/src/renderer/routes/downloads/inspector/files-tab.test.tsx b/src/renderer/routes/downloads/inspector/files-tab.test.tsx
index 6d1e1408..c44766c5 100644
--- a/src/renderer/routes/downloads/inspector/files-tab.test.tsx
+++ b/src/renderer/routes/downloads/inspector/files-tab.test.tsx
@@ -132,7 +132,7 @@ describe('FilesTab', () => {
/>
)
expect(screen.getByText('video/000001-first.ts')).toBeInTheDocument()
- expect(screen.getByText('100%')).toBeInTheDocument()
+ expect(screen.getByText('100.0%')).toBeInTheDocument()
expect(screen.queryByText('25%')).not.toBeInTheDocument()
expect(screen.getByText('—')).toBeInTheDocument()
expect(screen.getByRole('checkbox')).toHaveAttribute(
@@ -236,7 +236,7 @@ describe('FilesTab', () => {
/>
)
- expect(screen.getByText('53%')).toBeInTheDocument()
+ expect(screen.getByText('53.0%')).toBeInTheDocument()
expect(useTaskFiles).toHaveBeenCalledWith('t1', true, 'gid1')
})
diff --git a/src/renderer/routes/downloads/inspector/files-tab.tsx b/src/renderer/routes/downloads/inspector/files-tab.tsx
index 1c1fafec..94f53917 100644
--- a/src/renderer/routes/downloads/inspector/files-tab.tsx
+++ b/src/renderer/routes/downloads/inspector/files-tab.tsx
@@ -7,7 +7,6 @@ import { transport } from '@renderer/lib/transport'
import { Commands } from '@shared/protocol/commands'
import type { DownloadTask, TaskFile } from '@shared/types/task'
import { TaskKind, TaskStatus, TaskType } from '@shared/types/task'
-import { mediaProgressPercent } from '@shared/utils/media-progress'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -85,12 +84,13 @@ export function FilesTab({ task }: { task: DownloadTask }) {
isActive || isMedia
? (f) => (
<span className="shrink-0 text-xs tabular-nums text-muted-foreground">
- {(isMedia ? mediaProgressPercent : formatProgressPercent)(
+ {formatProgressPercent(
f.progress ??
(files.length === 1 && !isMedia
? task.progress
- : f.completedBytes / Math.max(f.size, 1))
- )}
+ : f.completedBytes / Math.max(f.size, 1)),
+ 1
+ ).toFixed(1)}
%
</span>
)
diff --git a/src/renderer/routes/downloads/inspector/multi-selection-summary.test.tsx b/src/renderer/routes/downloads/inspector/multi-selection-summary.test.tsx
index db827a6f..26bf8add 100644
--- a/src/renderer/routes/downloads/inspector/multi-selection-summary.test.tsx
+++ b/src/renderer/routes/downloads/inspector/multi-selection-summary.test.tsx
@@ -90,7 +90,7 @@ it('averages download fractions while counting post-processing separately', () =
]}
/>
)
- expect(screen.getByText('75%')).toBeInTheDocument()
+ expect(screen.getByText('75.0%')).toBeInTheDocument()
expect(screen.getByText('Processing').parentElement).toHaveTextContent('1')
expect(screen.getByText('Total size').parentElement).toHaveTextContent('—')
rerender(
diff --git a/src/renderer/routes/downloads/inspector/multi-selection-summary.tsx b/src/renderer/routes/downloads/inspector/multi-selection-summary.tsx
index 5c9d8d67..7f8a1ab7 100644
--- a/src/renderer/routes/downloads/inspector/multi-selection-summary.tsx
+++ b/src/renderer/routes/downloads/inspector/multi-selection-summary.tsx
@@ -115,7 +115,7 @@ export function MultiSelectionSummary({
value={
agg.avgProgress === null
? '—'
- : `${agg.hasMedia ? mediaProgressPercent(agg.avgProgress) : formatProgressPercent(agg.avgProgress)}%`
+ : `${(agg.hasMedia ? mediaProgressPercent(agg.avgProgress) : formatProgressPercent(agg.avgProgress, 1)).toFixed(1)}%`
}
/>
</Card>
diff --git a/src/renderer/routes/downloads/inspector/overview-tab.test.tsx b/src/renderer/routes/downloads/inspector/overview-tab.test.tsx
index bd5d3737..f267becc 100644
--- a/src/renderer/routes/downloads/inspector/overview-tab.test.tsx
+++ b/src/renderer/routes/downloads/inspector/overview-tab.test.tsx
@@ -316,8 +316,8 @@ it('separates completed segment downloads from active mux progress and unknown o
muxProgress: 0.42,
}),
})
- expect(screen.getByText('100%')).toBeInTheDocument()
- expect(screen.getByText('42%')).toBeInTheDocument()
+ expect(screen.getByText('100.0%')).toBeInTheDocument()
+ expect(screen.getByText('42.0%')).toBeInTheDocument()
expect(screen.getByText('1000 / 1000 segments')).toBeInTheDocument()
expect(screen.getByText('Merging')).toBeInTheDocument()
expect(screen.getByText('Output size').parentElement).toHaveTextContent('—')
diff --git a/src/renderer/routes/downloads/inspector/overview-tab.tsx b/src/renderer/routes/downloads/inspector/overview-tab.tsx
index f354c097..9c431090 100644
--- a/src/renderer/routes/downloads/inspector/overview-tab.tsx
+++ b/src/renderer/routes/downloads/inspector/overview-tab.tsx
@@ -215,7 +215,7 @@ export function OverviewTab({
value={
muxProgress === null
? '—'
- : `${mediaProgressPercent(muxProgress)}%`
+ : `${mediaProgressPercent(muxProgress).toFixed(1)}%`
}
/>
)}
@@ -257,7 +257,7 @@ export function OverviewTab({
value={
progress === null
? '—'
- : `${media ? mediaProgressPercent(progress) : formatProgressPercent(progress)}%`
+ : `${(media ? mediaProgressPercent(progress) : formatProgressPercent(progress, 1)).toFixed(1)}%`
}
/>
<Row
diff --git a/src/renderer/routes/downloads/inspector/task-inspector-action-bar.test.tsx b/src/renderer/routes/downloads/inspector/task-inspector-action-bar.test.tsx
index 49dc9379..ef34de94 100644
--- a/src/renderer/routes/downloads/inspector/task-inspector-action-bar.test.tsx
+++ b/src/renderer/routes/downloads/inspector/task-inspector-action-bar.test.tsx
@@ -66,6 +66,89 @@ function makeTask(overrides: Partial<DownloadTask> = {}): DownloadTask {
}
describe('TaskInspectorActionBar', () => {
+ it('counts only the paused subset while keeping unrelated mixed-state actions available', async () => {
+ vi.mocked(transport.invoke).mockClear()
+ let finish!: (result: unknown) => void
+ vi.mocked(transport.invoke).mockReturnValueOnce(
+ new Promise((resolve) => {
+ finish = resolve
+ })
+ )
+ const selected = [
+ makeTask({ id: 'active-a', type: TaskType.Bt }),
+ makeTask({ id: 'active-b', type: TaskType.Bt }),
+ makeTask({ id: 'already-paused', status: TaskStatus.Paused }),
+ makeTask({ id: 'completed', status: TaskStatus.Completed }),
+ makeTask({ id: 'failed', status: TaskStatus.Error }),
+ ]
+ const view = render(
+ <TaskInspectorActionBar selected={selected} onClose={vi.fn()} />
+ )
+ fireEvent.click(screen.getByRole('button', { name: /^Pause\s*\(2\)$/ }))
+ expect(
+ screen.getByRole('button', { name: /^Pausing…\s*\(2\)$/ })
+ ).toHaveProperty('disabled', true)
+ expect(transport.invoke).toHaveBeenCalledWith(Commands.PauseTasks, [
+ 'active-a',
+ 'active-b',
+ ])
+ // An early snapshot for one member must not unlock its Resume button.
+ const updated = selected.map((task) =>
+ task.id === 'active-a' ? { ...task, status: TaskStatus.Paused } : task
+ )
+ view.rerender(
+ <TaskInspectorActionBar selected={updated} onClose={vi.fn()} />
+ )
+ const resume = screen.getByRole('button', { name: /^Resume\s*\(1\)$/ })
+ expect(resume).toHaveProperty('disabled', false)
+ fireEvent.click(resume)
+ await waitFor(() =>
+ expect(transport.invoke).toHaveBeenCalledWith(Commands.ResumeTasks, [
+ 'already-paused',
+ ])
+ )
+ finish({
+ succeeded: ['active-a'],
+ failed: [{ taskId: 'active-b', reason: 'test pause failed' }],
+ })
+ await waitFor(() =>
+ expect(
+ screen.getByRole('button', { name: /^Pause\s*\(1\)$/ })
+ ).toHaveProperty('disabled', false)
+ )
+ expect(
+ screen.getByRole('button', { name: /^Resume\s*\(2\)$/ })
+ ).toHaveProperty('disabled', false)
+ })
+
+ it('disables pause immediately and permits a retry after a failed request', async () => {
+ vi.mocked(transport.invoke).mockClear()
+ let reject!: (error: Error) => void
+ vi.mocked(transport.invoke).mockReturnValueOnce(
+ new Promise((_resolve, fail) => {
+ reject = fail
+ })
+ )
+ render(
+ <TaskInspectorActionBar
+ selected={[makeTask({ type: TaskType.Bt })]}
+ onClose={vi.fn()}
+ />
+ )
+ const button = screen.getByRole('button', { name: 'Pause' })
+ fireEvent.click(button)
+ expect(button).toHaveProperty('disabled', true)
+ expect(button.textContent).toContain('Pausing…')
+ fireEvent.click(button)
+ expect(transport.invoke).toHaveBeenCalledTimes(1)
+ expect(transport.invoke).toHaveBeenCalledWith(Commands.PauseTasks, ['t1'])
+ reject(new Error('connection lost'))
+ await waitFor(() => expect(button).toHaveProperty('disabled', false))
+ expect(button.textContent).toContain('Pause')
+ fireEvent.click(button)
+ await waitFor(() => expect(transport.invoke).toHaveBeenCalledTimes(2))
+ })
+
it('opens a completed file from the inspector and allows retry after failure', async () => {
vi.mocked(transport.invoke).mockClear()
let reject!: (error: Error) => void
diff --git a/src/renderer/routes/downloads/inspector/task-inspector-action-bar.tsx b/src/renderer/routes/downloads/inspector/task-inspector-action-bar.tsx
index ea31dbe3..053fc774 100644
--- a/src/renderer/routes/downloads/inspector/task-inspector-action-bar.tsx
+++ b/src/renderer/routes/downloads/inspector/task-inspector-action-bar.tsx
@@ -215,17 +215,30 @@ export function TaskInspectorActionBar({
return (
<div className="flex shrink-0 items-center gap-2 border-b border-border/50 px-4 py-2">
- {actions.pauseCount > 0 && (
+ {(actions.pauseCount > 0 || actions.pausing) && (
<CountedButton
- label={t('panel.downloads.action.pause')}
+ label={t(
+ actions.pausing
+ ? 'panel.downloads.action.pausing'
+ : 'panel.downloads.action.pause'
+ )}
total={actions.total}
- count={actions.pauseCount}
- tooltipSingle={t('panel.downloads.action.pause')}
- tooltipBatch={t('panel.downloads.action.pauseTooltipBatch', {
- n: actions.pauseCount,
- total: actions.total,
- })}
+ count={actions.pausing ? actions.pausingCount : actions.pauseCount}
+ tooltipSingle={t(
+ actions.pausing
+ ? 'panel.downloads.action.pausing'
+ : 'panel.downloads.action.pause'
+ )}
+ tooltipBatch={
+ actions.pausing
+ ? t('panel.downloads.action.pausing')
+ : t('panel.downloads.action.pauseTooltipBatch', {
+ n: actions.pauseCount,
+ total: actions.total,
+ })
+ }
icon={<PauseIcon />}
+ disabled={actions.pausing}
onClick={() => void actions.onPause()}
/>
)}
diff --git a/src/renderer/routes/downloads/inspector/task-pause-store.ts b/src/renderer/routes/downloads/inspector/task-pause-store.ts
new file mode 100644
index 00000000..bf8616d1
--- /dev/null
+++ b/src/renderer/routes/downloads/inspector/task-pause-store.ts
@@ -0,0 +1,26 @@
+import { create } from 'zustand'
+
+/** Pause requests are shared by the inspector, task menus and dashboard. */
+export const useTaskPauseStore = create<{ pending: ReadonlySet<string> }>(
+ () => ({
+ pending: new Set(),
+ })
+)
+
+export function beginTaskPauses(ids: readonly string[]): string[] {
+ const pending = new Set(useTaskPauseStore.getState().pending)
+ const acquired: string[] = []
+ for (const id of ids) {
+ if (pending.has(id)) continue
+ pending.add(id)
+ acquired.push(id)
+ }
+ if (acquired.length) useTaskPauseStore.setState({ pending })
+ return acquired
+}
+
+export function finishTaskPauses(ids: readonly string[]): void {
+ const pending = new Set(useTaskPauseStore.getState().pending)
+ for (const id of ids) pending.delete(id)
+ useTaskPauseStore.setState({ pending })
+}
diff --git a/src/renderer/routes/downloads/inspector/use-task-actions.test.ts b/src/renderer/routes/downloads/inspector/use-task-actions.test.ts
index 8a3aefb3..693f299d 100644
--- a/src/renderer/routes/downloads/inspector/use-task-actions.test.ts
+++ b/src/renderer/routes/downloads/inspector/use-task-actions.test.ts
@@ -7,7 +7,7 @@ import {
TransitionPhase,
} from '@shared/types/task'
import { makeDownloadTask } from '@test-utils/task'
-import { renderHook } from '@testing-library/react'
+import { act, renderHook } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
vi.mock('@renderer/lib/transport', () => ({
@@ -143,6 +143,37 @@ describe('useTaskActions', () => {
expect(transport.invoke).toHaveBeenCalledWith(Commands.PauseTasks, ['a'])
})
+ it('shares pending pauses between mounted controls and clears them after failure', async () => {
+ const tasks = [makeTask({ id: 'pending-bt', type: TaskType.Bt })]
+ let reject!: (error: Error) => void
+ vi.mocked(transport.invoke).mockReturnValueOnce(
+ new Promise((_resolve, fail) => {
+ reject = fail
+ })
+ )
+ const first = renderHook(() => useTaskActions(tasks))
+ const second = renderHook(() => useTaskActions(tasks))
+ let pending!: Promise<void>
+ await act(async () => {
+ pending = first.result.current.onPause()
+ await second.result.current.onPause()
+ })
+ expect(transport.invoke).toHaveBeenCalledTimes(1)
+ expect(first.result.current.pausing).toBe(true)
+ expect(second.result.current.pausing).toBe(true)
+ expect(first.result.current.pauseCount).toBe(1)
+ await act(async () => {
+ reject(new Error('connection lost'))
+ await pending
+ })
+ expect(first.result.current.pausing).toBe(false)
+ expect(second.result.current.pausing).toBe(false)
+ await act(async () => {
+ await second.result.current.onPause()
+ })
+ expect(transport.invoke).toHaveBeenCalledTimes(2)
+ })
+
it('reports per-task failures from the plural command result', async () => {
const tasks = [
makeTask({ id: 'a', status: TaskStatus.Downloading }),
diff --git a/src/renderer/routes/downloads/inspector/use-task-actions.ts b/src/renderer/routes/downloads/inspector/use-task-actions.ts
index a144f3eb..1ca430f8 100644
--- a/src/renderer/routes/downloads/inspector/use-task-actions.ts
+++ b/src/renderer/routes/downloads/inspector/use-task-actions.ts
@@ -39,6 +39,11 @@ import { useTranslation } from 'react-i18next'
import { useRedownloadOverwriteStore } from './redownload-overwrite-store'
import { useRemoveTasksStore } from './remove-tasks-store'
import { useRetryParametersStore } from './retry-parameters-store'
+import {
+ beginTaskPauses,
+ finishTaskPauses,
+ useTaskPauseStore,
+} from './task-pause-store'
export interface RemoveDialogState {
open: boolean
@@ -154,6 +159,8 @@ export interface TaskActionsState {
moving: boolean
onMove: (direction: MoveTasksPayload['direction']) => Promise<void>
pauseCount: number
+ pausing: boolean
+ pausingCount: number
resumeCount: number
stopSeedingCount: number
reseedCount: number
@@ -190,6 +197,11 @@ export function useTaskActions(
): TaskActionsState {
const { t } = useTranslation()
const [moving, setMoving] = useState(false)
+ const pendingPauses = useTaskPauseStore((state) => state.pending)
+ const pausingCount = selected.filter((task) =>
+ pendingPauses.has(task.id)
+ ).length
+ const pausing = pausingCount > 0
const removeDialog = useRemoveTasksStore()
const removeTargets = removeDialog.targets
@@ -203,7 +215,7 @@ export function useTaskActions(
let removeCount = 0
for (const task of selected) {
if (canPause(task)) pauseCount++
- if (canResume(task)) resumeCount++
+ if (canResume(task) && !pendingPauses.has(task.id)) resumeCount++
if (canStopSeeding(task)) stopSeedingCount++
if (canReseed(task)) reseedCount++
if (canOfferRetry(task)) retryCount++
@@ -221,7 +233,7 @@ export function useTaskActions(
removeCount,
total: selected.length,
}
- }, [selected])
+ }, [selected, pendingPauses])
const reportPartial = useCallback(
(results: ActionResult[]) => {
@@ -259,7 +271,12 @@ export function useTaskActions(
const dispatchSubset = useCallback(
async (cmd: CommandChannel, predicate: (task: DownloadTask) => boolean) => {
if (!readyToWrite()) return
- const targets = resolveLatest(selected).filter(predicate)
+ const targets = resolveLatest(selected).filter(
+ (task) =>
+ predicate(task) &&
+ (cmd !== Commands.ResumeTasks ||
+ !useTaskPauseStore.getState().pending.has(task.id))
+ )
if (targets.length === 0) return
const results = await invokeBulk(
cmd,
@@ -271,10 +288,24 @@ export function useTaskActions(
[selected, reportPartial, readyToWrite]
)
- const onPause = useCallback(
- () => dispatchSubset(Commands.PauseTasks, canPause),
- [dispatchSubset]
- )
+ const onPause = useCallback(async () => {
+ if (!readyToWrite()) return
+ const targets = resolveLatest(selected).filter(canPause)
+ const ids = beginTaskPauses(targets.map((task) => task.id))
+ if (!ids.length) return
+ const acquired = new Set(ids)
+ try {
+ reportPartial(
+ await invokeBulk(
+ Commands.PauseTasks,
+ targets.filter((task) => acquired.has(task.id)),
+ ids
+ )
+ )
+ } finally {
+ finishTaskPauses(ids)
+ }
+ }, [selected, readyToWrite, reportPartial])
const onResume = useCallback(
() => dispatchSubset(Commands.ResumeTasks, canResume),
@@ -631,6 +662,8 @@ export function useTaskActions(
return {
...counts,
moving,
+ pausing,
+ pausingCount,
onMove,
removeDialog,
removeTargets,
diff --git a/src/renderer/routes/downloads/task-actions-menu.tsx b/src/renderer/routes/downloads/task-actions-menu.tsx
index 001b58b5..2ccd9fe0 100644
--- a/src/renderer/routes/downloads/task-actions-menu.tsx
+++ b/src/renderer/routes/downloads/task-actions-menu.tsx
@@ -142,6 +142,7 @@ export function TaskActionsMenu({
const single = selected.length === 1 ? selected[0] : null
const canChooseFiles = single && canSelectTaskFiles(single)
const hasTransferActions =
+ actions.pausing ||
actions.pauseCount +
actions.resumeCount +
actions.retryCount +
@@ -332,9 +333,19 @@ export function TaskActionsMenu({
visible: hasTransferActions,
content: (
<>
- {actions.pauseCount > 0 && (
- <DropdownMenuItem onClick={() => void actions.onPause()}>
- {t('panel.downloads.action.pause')}
+ {(actions.pauseCount > 0 || actions.pausing) && (
+ <DropdownMenuItem
+ disabled={actions.pausing}
+ onClick={() => void actions.onPause()}
+ >
+ {t(
+ actions.pausing
+ ? 'panel.downloads.action.pausing'
+ : 'panel.downloads.action.pause'
+ )}
+ {actions.pausing &&
+ actions.total > 1 &&
+ ` (${actions.pausingCount})`}
</DropdownMenuItem>
)}
{actions.resumeCount > 0 && (
diff --git a/src/renderer/routes/downloads/task-progress.tsx b/src/renderer/routes/downloads/task-progress.tsx
index 3a023f7a..0ae46ed3 100644
--- a/src/renderer/routes/downloads/task-progress.tsx
+++ b/src/renderer/routes/downloads/task-progress.tsx
@@ -4,6 +4,7 @@ import { getProgressBarTone } from '@renderer/lib/task-status-ui'
import { cn } from '@renderer/lib/utils'
import type { DownloadTask } from '@shared/types/task'
import {
+ finiteProgress,
getMediaPhaseLabel,
getStageProgress,
isMediaTask,
@@ -19,15 +20,18 @@ export function TaskProgress({ task }: { task: DownloadTask }) {
? null
: isMediaTask(task)
? mediaProgressPercent(progress)
- : formatProgressPercent(progress)
+ : formatProgressPercent(progress, 1)
const phase = getMediaPhaseLabel(task)
- const label = [phase ? t(phase) : null, pct === null ? '—' : `${pct}%`]
+ const label = [
+ phase ? t(phase) : null,
+ pct === null ? '—' : `${pct.toFixed(1)}%`,
+ ]
.filter(Boolean)
.join(' ')
return (
<div className="flex items-center gap-2" title={label}>
<Progress
- value={pct ?? undefined}
+ value={progress === null ? undefined : finiteProgress(progress) * 100}
indicatorClassName={cn(
getProgressBarTone(task.status),
pct === null && !phase && 'w-0 animate-none'
diff --git a/src/renderer/routes/downloads/task-row.test.tsx b/src/renderer/routes/downloads/task-row.test.tsx
index 6d4ec6cd..6fb6966b 100644
--- a/src/renderer/routes/downloads/task-row.test.tsx
+++ b/src/renderer/routes/downloads/task-row.test.tsx
@@ -67,6 +67,24 @@ function getEtaCell(container: HTMLElement): Element {
}
describe('TaskRow', () => {
+ it('advances the bar within the same rounded display percentage', () => {
+ const task = fake({ progress: 0.350625 })
+ const { rerender } = render(<TaskRow task={task} rowProps={rowProps} />)
+ expect(screen.getByText('35.1%')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toHaveAttribute(
+ 'aria-valuenow',
+ '35.0625'
+ )
+ rerender(
+ <TaskRow task={{ ...task, progress: 0.3514 }} rowProps={rowProps} />
+ )
+ expect(screen.getByText('35.1%')).toBeInTheDocument()
+ expect(screen.getByRole('progressbar')).toHaveAttribute(
+ 'aria-valuenow',
+ '35.14'
+ )
+ })
+
it('shows media stages even with the status column hidden and exposes indeterminate progress', () => {
const task = fake({
kind: TaskKind.Hls,
@@ -113,7 +131,7 @@ describe('TaskRow', () => {
columns={[{ id: 'progress', width: 160, visible: true }]}
/>
)
- expect(screen.getByText('Merging 42%')).toBeInTheDocument()
+ expect(screen.getByText('Merging 42.0%')).toBeInTheDocument()
expect(screen.getByRole('progressbar')).toHaveAttribute(
'aria-valuenow',
'42'
@@ -123,15 +141,15 @@ describe('TaskRow', () => {
it('keeps a slow unfinished tail below 100% until bytes finish', () => {
const task = fake({ progress: 0.995, downloadSpeed: 102400 })
const { rerender } = render(<TaskRow task={task} rowProps={rowProps} />)
- expect(screen.getByText('99%')).toBeInTheDocument()
- expect(screen.queryByText('100%')).not.toBeInTheDocument()
+ expect(screen.getByText('99.5%')).toBeInTheDocument()
+ expect(screen.queryByText('100.0%')).not.toBeInTheDocument()
rerender(
<TaskRow
task={{ ...task, progress: 1, status: TaskStatus.Finalizing }}
rowProps={rowProps}
/>
)
- expect(screen.getByText('100%')).toBeInTheDocument()
+ expect(screen.getByText('100.0%')).toBeInTheDocument()
expect(screen.getByText('Finalizing')).toBeInTheDocument()
expect(screen.queryByText('100 KB/s')).not.toBeInTheDocument()
})
@@ -394,7 +412,7 @@ describe('TaskRow', () => {
/>
)
expect(screen.getByText('Fetching')).toBeInTheDocument()
- expect(screen.getByText('0%')).toBeInTheDocument()
+ expect(screen.getByText('0.0%')).toBeInTheDocument()
})
describe('Error status', () => {
diff --git a/src/shared/locales/ar.json b/src/shared/locales/ar.json
index 3bddba32..4489e154 100644
--- a/src/shared/locales/ar.json
+++ b/src/shared/locales/ar.json
@@ -879,6 +879,7 @@
"openFileFailedHint": "تأكد من أن الملف لا يزال موجودًا وأن لديك إذنًا بفتحه.",
"openFolder": "فتح المجلد",
"pause": "إيقاف مؤقت",
+ "pausing": "جارٍ الإيقاف المؤقت…",
"pauseTooltipBatch": "إيقاف مؤقت: {{n}} من المهام المحددة ({{total}})",
"queueBoundary": "التحديد موجود بالفعل عند طرف قائمة الانتظار",
"queueMoveFailed": "تعذّر تحديث قائمة الانتظار.",
diff --git a/src/shared/locales/bg.json b/src/shared/locales/bg.json
index 5d9e5608..0d4ab1de 100644
--- a/src/shared/locales/bg.json
+++ b/src/shared/locales/bg.json
@@ -867,6 +867,7 @@
"openFileFailedHint": "Проверете дали файлът все още съществува и дали имате разрешение да го отворите.",
"openFolder": "Отваряне на папката",
"pause": "Пауза",
+ "pausing": "Поставяне на пауза…",
"pauseTooltipBatch": "Пауза на {{n}} от {{total}} избрани задачи",
"queueBoundary": "Изборът вече е на границата на опашката",
"queueMoveFailed": "Опашката с чакащи задачи не можа да бъде обновена.",
diff --git a/src/shared/locales/ca.json b/src/shared/locales/ca.json
index fae06184..af53a0df 100644
--- a/src/shared/locales/ca.json
+++ b/src/shared/locales/ca.json
@@ -870,6 +870,7 @@
"openFileFailedHint": "Comproveu que el fitxer encara existeixi i que tingueu permís per obrir-lo.",
"openFolder": "Obrir la carpeta",
"pause": "Pausar",
+ "pausing": "S’està posant en pausa…",
"pauseTooltipBatch": "Pausar {{n}} de {{total}} tasques seleccionades",
"queueBoundary": "La selecció ja és al límit de la cua",
"queueMoveFailed": "No s'ha pogut actualitzar la cua d'espera.",
diff --git a/src/shared/locales/de.json b/src/shared/locales/de.json
index ef7af237..cf8ec9f1 100644
--- a/src/shared/locales/de.json
+++ b/src/shared/locales/de.json
@@ -885,6 +885,7 @@
},
"action": {
"pause": "Pausieren",
+ "pausing": "Wird pausiert…",
"queueMoveFailed": "Die Warteschlange konnte nicht aktualisiert werden.",
"queueTaskStarted": "Die Aufgabe befindet sich nicht mehr in der Warteschlange.",
"queueMoveHint": "Die Position in der Warteschlange bestimmt, welcher wartende Download als Nächstes startet. Die Spaltensortierung wird separat gespeichert.",
diff --git a/src/shared/locales/el.json b/src/shared/locales/el.json
index a336090b..ff912d90 100644
--- a/src/shared/locales/el.json
+++ b/src/shared/locales/el.json
@@ -867,6 +867,7 @@
"openFileFailedHint": "Βεβαιωθείτε ότι το αρχείο υπάρχει ακόμη και ότι έχετε δικαίωμα να το ανοίξετε.",
"openFolder": "Άνοιγμα φακέλου",
"pause": "Παύση",
+ "pausing": "Γίνεται παύση…",
"pauseTooltipBatch": "Παύση — επιλεγμένες εργασίες: {{n}} / {{total}}",
"queueBoundary": "Η επιλογή βρίσκεται ήδη στο όριο της ουράς",
"queueMoveFailed": "Δεν ήταν δυνατή η ενημέρωση της ουράς αναμονής.",
diff --git a/src/shared/locales/en-US.json b/src/shared/locales/en-US.json
index b1f30048..87d0844d 100644
--- a/src/shared/locales/en-US.json
+++ b/src/shared/locales/en-US.json
@@ -885,6 +885,7 @@
},
"action": {
"pause": "Pause",
+ "pausing": "Pausing…",
"queueMoveFailed": "Could not update the waiting queue.",
"queueTaskStarted": "The task is no longer in the waiting queue.",
"queueMoveHint": "Queue position determines which waiting download starts next. Column sorting is saved separately.",
diff --git a/src/shared/locales/es.json b/src/shared/locales/es.json
index e7eb37a9..e5db91b8 100644
--- a/src/shared/locales/es.json
+++ b/src/shared/locales/es.json
@@ -897,6 +897,7 @@
},
"action": {
"pause": "Pausar",
+ "pausing": "Pausando…",
"queueMoveFailed": "No se pudo actualizar la cola de espera.",
"queueTaskStarted": "La tarea ya no está en la cola de espera.",
"queueMoveHint": "La posición en la cola determina qué descarga en espera comienza a continuación. El orden de las columnas se guarda por separado.",
diff --git a/src/shared/locales/fa.json b/src/shared/locales/fa.json
index 168eb30c..c4d77e51 100644
--- a/src/shared/locales/fa.json
+++ b/src/shared/locales/fa.json
@@ -867,6 +867,7 @@
"openFileFailedHint": "بررسی کنید که فایل همچنان وجود داشته باشد و اجازهٔ باز کردن آن را داشته باشید.",
"openFolder": "باز کردن پوشه",
"pause": "مکث",
+ "pausing": "در حال مکث…",
"pauseTooltipBatch": "مکث {{n}} مورد از {{total}} مورد انتخاب‌شده",
"queueBoundary": "انتخاب از قبل در مرز صف است",
"queueMoveFailed": "به‌روزرسانی صف انتظار ممکن نشد.",
diff --git a/src/shared/locales/fr.json b/src/shared/locales/fr.json
index b413d169..7be9ee4e 100644
--- a/src/shared/locales/fr.json
+++ b/src/shared/locales/fr.json
@@ -870,6 +870,7 @@
"openFileFailedHint": "Vérifiez que le fichier existe toujours et que vous avez l’autorisation de l’ouvrir.",
"openFolder": "Ouvrir le dossier",
"pause": "Mettre en pause",
+ "pausing": "Mise en pause…",
"pauseTooltipBatch": "Mettre en pause {{n}} des {{total}} tâches sélectionnées",
"queueBoundary": "La sélection est déjà à l’extrémité de la file",
"queueMoveFailed": "Impossible de modifier la file d’attente.",
diff --git a/src/shared/locales/hu.json b/src/shared/locales/hu.json
index 3fb03dae..75becaed 100644
--- a/src/shared/locales/hu.json
+++ b/src/shared/locales/hu.json
@@ -885,6 +885,7 @@
},
"action": {
"pause": "Szüneteltetés",
+ "pausing": "Szüneteltetés…",
"queueMoveFailed": "Nem sikerült frissíteni a várakozási sort.",
"queueTaskStarted": "A feladat már nincs a várakozási sorban.",
"queueMoveHint": "A várakozási sorban elfoglalt hely határozza meg, melyik letöltés indul el következőként. Az oszlopok rendezése ettől függetlenül kerül mentésre.",
diff --git a/src/shared/locales/id.json b/src/shared/locales/id.json
index 70cb3f65..b1e5cd2a 100644
--- a/src/shared/locales/id.json
+++ b/src/shared/locales/id.json
@@ -873,6 +873,7 @@
},
"action": {
"pause": "Jeda",
+ "pausing": "Menjeda…",
"queueMoveFailed": "Antrean tunggu tidak dapat diperbarui.",
"queueTaskStarted": "Tugas sudah tidak ada dalam antrean tunggu.",
"queueMoveHint": "Posisi dalam antrean menentukan unduhan mana yang dimulai berikutnya. Pengurutan kolom disimpan secara terpisah.",
diff --git a/src/shared/locales/it.json b/src/shared/locales/it.json
index fa0f0d93..bd342c81 100644
--- a/src/shared/locales/it.json
+++ b/src/shared/locales/it.json
@@ -897,6 +897,7 @@
},
"action": {
"pause": "Metti in pausa",
+ "pausing": "Messa in pausa…",
"queueMoveFailed": "Impossibile aggiornare la coda di attesa.",
"queueTaskStarted": "L’attività non è più nella coda di attesa.",
"queueMoveHint": "La posizione in coda determina quale download in attesa partirà per primo. L’ordinamento delle colonne viene salvato separatamente.",
diff --git a/src/shared/locales/ja.json b/src/shared/locales/ja.json
index 67567476..580ffe19 100644
--- a/src/shared/locales/ja.json
+++ b/src/shared/locales/ja.json
@@ -873,6 +873,7 @@
},
"action": {
"pause": "一時停止",
+ "pausing": "一時停止中…",
"queueMoveFailed": "待機キューを更新できませんでした。",
"queueTaskStarted": "このタスクは待機キューにありません。",
"queueMoveHint": "待機キュー内の位置によって、次に開始するダウンロードが決まります。列による並べ替えは別に保存されます。",
diff --git a/src/shared/locales/ko.json b/src/shared/locales/ko.json
index db82400a..89089696 100644
--- a/src/shared/locales/ko.json
+++ b/src/shared/locales/ko.json
@@ -873,6 +873,7 @@
},
"action": {
"pause": "일시 정지",
+ "pausing": "일시 중지 중…",
"queueMoveFailed": "대기열을 업데이트하지 못했습니다.",
"queueTaskStarted": "이 작업은 더 이상 대기열에 없습니다.",
"queueMoveHint": "대기열 순서는 다음에 시작할 다운로드를 결정합니다. 열 정렬 순서는 별도로 저장됩니다.",
diff --git a/src/shared/locales/nb.json b/src/shared/locales/nb.json
index 79ac81e4..0890c382 100644
--- a/src/shared/locales/nb.json
+++ b/src/shared/locales/nb.json
@@ -867,6 +867,7 @@
"openFileFailedHint": "Kontroller at filen fortsatt finnes, og at du har tillatelse til å åpne den.",
"openFolder": "Åpne mappe",
"pause": "Sett på pause",
+ "pausing": "Setter på pause…",
"pauseTooltipBatch": "Sett på pause: {{n}} / {{total}} i utvalget",
"queueBoundary": "Utvalget kan ikke flyttes lenger i denne retningen",
"queueMoveFailed": "Kunne ikke oppdatere ventekøen.",
diff --git a/src/shared/locales/nl.json b/src/shared/locales/nl.json
index cf592b06..cf39babb 100644
--- a/src/shared/locales/nl.json
+++ b/src/shared/locales/nl.json
@@ -867,6 +867,7 @@
"openFileFailedHint": "Controleer of het bestand nog bestaat en of je toestemming hebt om het te openen.",
"openFolder": "Map openen",
"pause": "Pauzeren",
+ "pausing": "Pauzeren…",
"pauseTooltipBatch": "{{n}} van de {{total}} geselecteerde taken pauzeren",
"queueBoundary": "De selectie staat al aan het begin of einde van de wachtrij",
"queueMoveFailed": "De wachtrij kon niet worden bijgewerkt.",
diff --git a/src/shared/locales/pl.json b/src/shared/locales/pl.json
index ffd534ad..82e05f8c 100644
--- a/src/shared/locales/pl.json
+++ b/src/shared/locales/pl.json
@@ -909,6 +909,7 @@
},
"action": {
"pause": "Wstrzymaj",
+ "pausing": "Wstrzymywanie…",
"queueMoveFailed": "Nie udało się zaktualizować kolejki oczekujących.",
"queueTaskStarted": "Zadanie nie znajduje się już w kolejce oczekujących.",
"queueMoveHint": "Pozycja w kolejce określa, które oczekujące pobieranie rozpocznie się jako następne. Sortowanie kolumn jest zapisywane osobno.",
diff --git a/src/shared/locales/pt-BR.json b/src/shared/locales/pt-BR.json
index da43781a..3f338bcf 100644
--- a/src/shared/locales/pt-BR.json
+++ b/src/shared/locales/pt-BR.json
@@ -897,6 +897,7 @@
},
"action": {
"pause": "Pausar",
+ "pausing": "Pausando…",
"queueMoveFailed": "Não foi possível atualizar a fila de espera.",
"queueTaskStarted": "A tarefa não está mais na fila de espera.",
"queueMoveHint": "A posição na fila determina qual download em espera será iniciado a seguir. A ordenação das colunas é salva separadamente.",
diff --git a/src/shared/locales/ro.json b/src/shared/locales/ro.json
index 62b12005..e8092ea5 100644
--- a/src/shared/locales/ro.json
+++ b/src/shared/locales/ro.json
@@ -870,6 +870,7 @@
"openFileFailedHint": "Verifică dacă fișierul mai există și dacă ai permisiunea să îl deschizi.",
"openFolder": "Deschide dosarul",
"pause": "Pune pe pauză",
+ "pausing": "Se pune pe pauză…",
"pauseTooltipBatch": "Pune pe pauză: {{n}} din selecția totală de {{total}}",
"queueBoundary": "Selecția este deja la începutul sau la sfârșitul cozii",
"queueMoveFailed": "Coada de așteptare nu a putut fi actualizată.",
diff --git a/src/shared/locales/ru.json b/src/shared/locales/ru.json
index 68eb2ebd..d07b1124 100644
--- a/src/shared/locales/ru.json
+++ b/src/shared/locales/ru.json
@@ -909,6 +909,7 @@
},
"action": {
"pause": "Приостановить",
+ "pausing": "Приостановка…",
"queueMoveFailed": "Не удалось обновить очередь ожидания.",
"queueTaskStarted": "Задача больше не находится в очереди ожидания.",
"queueMoveHint": "Позиция в очереди определяет, какая ожидающая загрузка начнётся следующей. Сортировка столбцов сохраняется отдельно.",
diff --git a/src/shared/locales/th.json b/src/shared/locales/th.json
index 8108a296..10644acd 100644
--- a/src/shared/locales/th.json
+++ b/src/shared/locales/th.json
@@ -864,6 +864,7 @@
"openFileFailedHint": "โปรดตรวจสอบว่าไฟล์ยังอยู่และคุณมีสิทธิ์เปิดไฟล์",
"openFolder": "เปิดโฟลเดอร์",
"pause": "พัก",
+ "pausing": "กำลังหยุดชั่วคราว…",
"pauseTooltipBatch": "พัก {{n}} จาก {{total}} งานที่เลือก",
"queueBoundary": "รายการที่เลือกอยู่ต้นหรือท้ายคิวแล้ว",
"queueMoveFailed": "อัปเดตคิวรอไม่ได้",
diff --git a/src/shared/locales/tr.json b/src/shared/locales/tr.json
index 10b56e26..30deddd6 100644
--- a/src/shared/locales/tr.json
+++ b/src/shared/locales/tr.json
@@ -885,6 +885,7 @@
},
"action": {
"pause": "Duraklat",
+ "pausing": "Duraklatılıyor…",
"queueMoveFailed": "Bekleme kuyruğu güncellenemedi.",
"queueTaskStarted": "Görev artık bekleme kuyruğunda değil.",
"queueMoveHint": "Kuyruk konumu, bekleyen indirmelerden hangisinin önce başlayacağını belirler. Sütun sıralaması ayrıca kaydedilir.",
diff --git a/src/shared/locales/uk.json b/src/shared/locales/uk.json
index 96522f71..d45dcc56 100644
--- a/src/shared/locales/uk.json
+++ b/src/shared/locales/uk.json
@@ -873,6 +873,7 @@
"openFileFailedHint": "Перевірте, чи файл досі існує і чи маєте ви дозвіл на його відкриття.",
"openFolder": "Відкрити теку",
"pause": "Призупинити",
+ "pausing": "Призупинення…",
"pauseTooltipBatch": "Призупинити {{n}} з {{total}} вибраних",
"queueBoundary": "Вибрані завдання вже на краю черги",
"queueMoveFailed": "Не вдалося оновити чергу очікування.",
diff --git a/src/shared/locales/vi.json b/src/shared/locales/vi.json
index d0caac69..8bdae0cc 100644
--- a/src/shared/locales/vi.json
+++ b/src/shared/locales/vi.json
@@ -873,6 +873,7 @@
},
"action": {
"pause": "Tạm dừng",
+ "pausing": "Đang tạm dừng…",
"queueMoveFailed": "Không thể cập nhật hàng đợi.",
"queueTaskStarted": "Tác vụ không còn trong hàng đợi.",
"queueMoveHint": "Vị trí trong hàng đợi quyết định lượt tải xuống đang chờ nào sẽ bắt đầu tiếp theo. Cách sắp xếp theo cột được lưu riêng.",
diff --git a/src/shared/locales/zh-CN.json b/src/shared/locales/zh-CN.json
index 80305b95..cce27a55 100644
--- a/src/shared/locales/zh-CN.json
+++ b/src/shared/locales/zh-CN.json
@@ -873,6 +873,7 @@
},
"action": {
"pause": "暂停",
+ "pausing": "暂停中…",
"queueMoveFailed": "无法调整等待队列。",
"queueTaskStarted": "任务已不在等待队列中。",
"queueMoveHint": "队列位置决定等待任务的启动顺序,列排序单独保存。",
diff --git a/src/shared/locales/zh-TW.json b/src/shared/locales/zh-TW.json
index f3a16850..756afdf2 100644
--- a/src/shared/locales/zh-TW.json
+++ b/src/shared/locales/zh-TW.json
@@ -873,6 +873,7 @@
},
"action": {
"pause": "暫停",
+ "pausing": "暫停中…",
"queueMoveFailed": "無法調整等待佇列。",
"queueTaskStarted": "任務已不在等待佇列中。",
"queueMoveHint": "佇列位置決定等待任務的啟動順序,欄位排序另行儲存。",