feat: show update download telemetry
Calculate download throughput and remaining time from verified installer bytes and display downloaded size, total size, speed, and ETA beneath the progress track while retaining the last values after cancellation.
This commit is contained in:
@@ -7497,6 +7497,7 @@ function showUpdateBanner(info) {
|
||||
installButton.textContent = 'Jetzt installieren';
|
||||
}
|
||||
_setUpdateProgress(0, 'Bereit zum Download', 'ready');
|
||||
_setUpdateProgressDetails(null);
|
||||
_setUpdateDialogBusy(false);
|
||||
_syncHeaderUpdateState();
|
||||
_setUpdateDialogVisible(true);
|
||||
@@ -7517,6 +7518,7 @@ function handleUpdateProgress(data) {
|
||||
_updateInstallBusy = true;
|
||||
_setUpdateDialogBusy(true, true);
|
||||
_setUpdateProgress(percent, `Download ${percent}%`, 'downloading');
|
||||
_setUpdateProgressDetails(progress);
|
||||
if (button) button.textContent = `Download ${percent}%`;
|
||||
} else if (progress.stage === 'verifying') {
|
||||
_updateInstallBusy = true;
|
||||
@@ -7708,6 +7710,22 @@ function _setUpdateProgress(percent, text, state = 'ready') {
|
||||
}
|
||||
}
|
||||
|
||||
function _setUpdateProgressDetails(progress) {
|
||||
const details = document.getElementById('updateProgressDetails');
|
||||
if (!details) return;
|
||||
const downloaded = Math.max(0, Number(progress?.bytesDownloaded) || 0);
|
||||
const total = Math.max(0, Number(progress?.bytesTotal) || 0);
|
||||
if (total <= 0) {
|
||||
details.textContent = '';
|
||||
details.hidden = true;
|
||||
return;
|
||||
}
|
||||
const bytesPerSecond = Math.max(0, Number(progress?.bytesPerSecond) || 0);
|
||||
const etaSeconds = Number.isFinite(Number(progress?.etaSeconds)) ? Math.max(0, Number(progress.etaSeconds)) : 0;
|
||||
details.textContent = `${formatSize(downloaded)} / ${formatSize(total)} · ${formatSize(bytesPerSecond)}/s · ETA ${formatTime(etaSeconds)}`;
|
||||
details.hidden = false;
|
||||
}
|
||||
|
||||
async function installKnownUpdate() {
|
||||
if (_updateInstallBusy) return;
|
||||
if (!_knownUpdateInfo || !_knownUpdateInfo.available) {
|
||||
@@ -7717,6 +7735,7 @@ async function installKnownUpdate() {
|
||||
_updateInstallBusy = true;
|
||||
_setUpdateDialogBusy(true, true);
|
||||
_setUpdateProgress(0, 'Download 0%', 'downloading');
|
||||
_setUpdateProgressDetails(null);
|
||||
const message = document.getElementById('updateMessage');
|
||||
const button = document.getElementById('installUpdateBtn');
|
||||
if (message) message.hidden = true;
|
||||
|
||||
+4
-1
@@ -161,7 +161,10 @@
|
||||
</div>
|
||||
<div class="update-progress" aria-live="polite">
|
||||
<div class="update-progress-track"><span id="updateProgressBar" role="progressbar" aria-label="Update-Fortschritt" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-valuetext="0%"></span></div>
|
||||
<span id="updateProgressText"></span>
|
||||
<div class="update-progress-footer">
|
||||
<span id="updateProgressDetails" hidden></span>
|
||||
<span id="updateProgressText"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="update-dialog-actions">
|
||||
<button class="btn btn-secondary" id="dismissUpdateBtn">Abbrechen</button>
|
||||
|
||||
+20
-1
@@ -2515,10 +2515,29 @@ select.hs-input { max-width: none; width: auto; min-width: 140px; }
|
||||
background: var(--danger);
|
||||
}
|
||||
|
||||
.update-progress-footer {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
#updateProgressDetails {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: var(--text-dim);
|
||||
font-size: 11px;
|
||||
line-height: 1.35;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#updateProgressText {
|
||||
min-width: 34px;
|
||||
max-width: 100%;
|
||||
justify-self: end;
|
||||
margin-left: auto;
|
||||
flex: 0 0 auto;
|
||||
color: var(--text-dim);
|
||||
font-size: 11px;
|
||||
line-height: 1.35;
|
||||
|
||||
Reference in New Issue
Block a user