more improvements to safe upgrade

This commit is contained in:
Andy Miller
2025-10-17 10:02:22 -06:00
parent 78fc74a77e
commit 654c2bb9c4
4 changed files with 146 additions and 20 deletions

View File

@@ -4610,6 +4610,7 @@ var SafeUpgrade = /*#__PURE__*/function () {
this.active = false;
this.jobId = null;
this.statusFailures = 0;
this.statusContext = null;
this.directStatusUrl = this.resolveDirectStatusUrl();
this.preferDirectStatus = !!this.directStatusUrl;
this.registerEvents();
@@ -4676,6 +4677,7 @@ var SafeUpgrade = /*#__PURE__*/function () {
this.decisions = {};
this.statusFailures = 0;
this.preferDirectStatus = !!this.directStatusUrl;
this.statusContext = null;
this.renderLoading();
this.modal.open();
this.fetchPreflight();
@@ -4882,6 +4884,7 @@ var SafeUpgrade = /*#__PURE__*/function () {
}
_this4.statusFailures = 0;
_this4.preferDirectStatus = !!_this4.directStatusUrl;
_this4.statusContext = data.context || null;
_this4.beginPolling(1200);
} else {
_this4.renderResult(data);
@@ -4921,8 +4924,15 @@ var SafeUpgrade = /*#__PURE__*/function () {
value: function resolveStatusEndpoint() {
var useDirect = this.directStatusUrl && this.preferDirectStatus;
var url = useDirect ? this.directStatusUrl : this.urls.status;
var params = [];
if (this.jobId) {
url += (url.indexOf('?') !== -1 ? '&' : '?') + "job=".concat(encodeURIComponent(this.jobId));
params.push("job=".concat(encodeURIComponent(this.jobId)));
}
if (this.statusContext) {
params.push("context=".concat(encodeURIComponent(this.statusContext)));
}
if (params.length) {
url += (url.indexOf('?') !== -1 ? '&' : '?') + params.join('&');
}
return {
url: url,
@@ -5002,6 +5012,9 @@ var SafeUpgrade = /*#__PURE__*/function () {
return;
}
var payload = response.data || {};
if (Object.prototype.hasOwnProperty.call(payload, 'context')) {
_this6.statusContext = payload.context || null;
}
var job = payload.job || {};
var data = payload.progress || payload;
nextStage = data.stage || null;