diff --git a/frontend/src/views/host/file-management/process/index.vue b/frontend/src/views/host/file-management/process/index.vue index 1f94defa7..ac5e07448 100644 --- a/frontend/src/views/host/file-management/process/index.vue +++ b/frontend/src/views/host/file-management/process/index.vue @@ -49,7 +49,7 @@ /> {}; const getStatus = (value: DownloadProcess) => value.status || (value.percent === 100 ? 'Success' : 'Downloading'); const isActive = (value: DownloadProcess) => ['Downloading', 'Retrying'].includes(getStatus(value)); +const getProgressPercent = (value: DownloadProcess) => { + if (getStatus(value) === 'Success') return 100; + if (!Number.isFinite(value.percent)) return 0; + const maximum = isActive(value) ? 99.99 : 100; + return Number(Math.min(maximum, Math.max(0, value.percent)).toFixed(2)); +}; const getStatusText = (value: DownloadProcess) => { switch (getStatus(value)) { case 'Success':