fixes for restore

This commit is contained in:
Andy Miller
2025-10-18 17:54:29 -06:00
parent 84cf62bc7b
commit 1e14c47d28
4 changed files with 57 additions and 5 deletions

View File

@@ -2228,9 +2228,15 @@ var STAGE_TITLES = {
downloading: function downloading() {
return t('SAFE_UPGRADE_STAGE_DOWNLOADING', 'Downloading update');
},
snapshot: function snapshot() {
return t('SAFE_UPGRADE_STAGE_SNAPSHOT', 'Creating backup snapshot');
},
installing: function installing() {
return t('SAFE_UPGRADE_STAGE_INSTALLING', 'Installing update');
},
rollback: function rollback() {
return t('SAFE_UPGRADE_STAGE_ROLLBACK', 'Restoring snapshot');
},
finalizing: function finalizing() {
return t('SAFE_UPGRADE_STAGE_FINALIZING', 'Finalizing changes');
},
@@ -2861,9 +2867,15 @@ var SafeUpgrade = /*#__PURE__*/function () {
}
return 12;
}
if (stage === 'snapshot') {
return _this7.computeSmoothPercent(20, 45, 8, percent);
}
if (stage === 'installing') {
return _this7.computeSmoothPercent(20, 90, 28, percent);
}
if (stage === 'rollback') {
return _this7.computeSmoothPercent(40, 95, 20, percent);
}
if (stage === 'finalizing') {
return _this7.computeSmoothPercent(90, 99, 6, percent);
}
@@ -2878,10 +2890,17 @@ var SafeUpgrade = /*#__PURE__*/function () {
percent = scaledPercent();
var displayPercent = percent !== null ? Math.round(percent) : null;
var percentLabel = displayPercent !== null ? "".concat(displayPercent, "%") : '';
var message = typeof data.message === 'string' ? data.message : '';
var normalize = function normalize(value) {
return value.replace(/\u2026/g, '...').replace(/\.+$/, '').trim().toLowerCase();
};
var normalizedTitle = normalize(title || '');
var normalizedMessage = normalize(message || '');
var shouldShowMessage = stage === 'error' ? message.trim().length > 0 : message && stage !== 'installing' && stage !== 'finalizing' && normalizedMessage !== '' && normalizedMessage !== normalizedTitle;
var statusLine = job && job.status ? "<p class=\"safe-upgrade-status\">".concat(t('SAFE_UPGRADE_JOB_STATUS', 'Status'), ": <strong>").concat(job.status.toUpperCase(), "</strong>").concat(job.error ? " &mdash; ".concat(job.error) : '', "</p>") : '';
var animateBar = stage !== 'complete' && stage !== 'error' && percent !== null;
var barClass = "safe-upgrade-progress-bar".concat(animateBar ? ' is-active' : '');
var detailMessage = stage === 'error' ? "<p>".concat(data.message || '', "</p>") : data.message && stage !== 'installing' && stage !== 'finalizing' ? "<p>".concat(data.message, "</p>") : '';
var detailMessage = shouldShowMessage ? "<p>".concat(message, "</p>") : '';
this.steps.progress.html("\n <div class=\"safe-upgrade-progress\">\n <h3>".concat(title, "</h3>\n ").concat(detailMessage, "\n ").concat(statusLine, "\n ").concat(percentLabel ? "<div class=\"".concat(barClass, "\"><span style=\"width:").concat(percent, "%\"></span></div><div class=\"progress-value\">").concat(percentLabel, "</div>") : '', "\n </div>\n "));
this.switchStep('progress');
if (stage === 'complete') {