(item, status, pct, message)
| 412 | } |
| 413 | |
| 414 | function setItemStatus(item, status, pct, message) { |
| 415 | const refs = ensureRow(item); |
| 416 | item.status = status; |
| 417 | item.progress = Math.max(0, Math.min(100, Math.round(Number(pct || 0)))); |
| 418 | refs.progressFill.style.width = item.progress + '%'; |
| 419 | |
| 420 | if (status === 'uploading') { |
| 421 | refs.row.classList.remove('is-error', 'is-done'); |
| 422 | refs.statusEl.textContent = message || tx('share_uploading_progress', { pct: item.progress }, 'Uploading ' + item.progress + '%'); |
| 423 | return; |
| 424 | } |
| 425 | if (status === 'done') { |
| 426 | refs.row.classList.remove('is-error'); |
| 427 | refs.row.classList.add('is-done'); |
| 428 | refs.statusEl.textContent = message || tx('share_drop_status_uploaded', null, 'Uploaded'); |
| 429 | refs.progressFill.style.width = '100%'; |
| 430 | return; |
| 431 | } |
| 432 | if (status === 'error') { |
| 433 | refs.row.classList.add('is-error'); |
| 434 | refs.row.classList.remove('is-done'); |
| 435 | refs.statusEl.textContent = message || tx('share_drop_status_failed', null, 'Failed'); |
| 436 | return; |
| 437 | } |
| 438 | refs.statusEl.textContent = message || tx('share_drop_status_queued', null, 'Queued'); |
| 439 | } |
| 440 | |
| 441 | function validateQueueItem(item) { |
| 442 | if (!item || !isFileLike(item.file)) { |
no test coverage detected