mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-26 00:36:31 +02:00
yet more upgrade flow fixes
This commit is contained in:
@@ -348,14 +348,13 @@ export default class SafeUpgrade {
|
||||
|
||||
this.buttons.start.prop('disabled', true);
|
||||
|
||||
this.stopPolling();
|
||||
this.beginPolling();
|
||||
|
||||
const body = {
|
||||
decisions: this.decisions
|
||||
};
|
||||
const body = { decisions: this.decisions };
|
||||
|
||||
request(this.urls.start, { method: 'post', body }, (response) => {
|
||||
if (!this.active) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.status === 'error') {
|
||||
this.stopPolling();
|
||||
this.renderProgress({
|
||||
@@ -392,6 +391,8 @@ export default class SafeUpgrade {
|
||||
manifest: data.manifest || null
|
||||
});
|
||||
});
|
||||
|
||||
this.beginPolling(800);
|
||||
}
|
||||
|
||||
beginPolling(delay = 1200) {
|
||||
@@ -409,9 +410,7 @@ export default class SafeUpgrade {
|
||||
return;
|
||||
}
|
||||
|
||||
this.pollTimer = setTimeout(() => {
|
||||
this.fetchStatus(true);
|
||||
}, delay);
|
||||
this.pollTimer = setTimeout(() => this.fetchStatus(true), delay);
|
||||
}
|
||||
|
||||
clearPollTimer() {
|
||||
@@ -431,7 +430,11 @@ export default class SafeUpgrade {
|
||||
|
||||
let shouldContinue = true;
|
||||
|
||||
console.debug('[SafeUpgrade] poll status');
|
||||
|
||||
this.statusRequest = request(this.urls.status, (response) => {
|
||||
console.debug('[SafeUpgrade] status response', response);
|
||||
|
||||
if (response.status === 'error') {
|
||||
if (!silent) {
|
||||
this.renderProgress({
|
||||
|
||||
30
themes/grav/js/admin.min.js
vendored
30
themes/grav/js/admin.min.js
vendored
@@ -4586,7 +4586,9 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
safe_upgrade_classCallCheck(this, SafeUpgrade);
|
||||
this.updates = updatesInstance;
|
||||
this.modalElement = external_jQuery_default()('[data-remodal-id="update-grav"]');
|
||||
this.modal = this.modalElement.remodal({ hashTracking: !1 });
|
||||
this.modal = this.modalElement.remodal({
|
||||
hashTracking: false
|
||||
});
|
||||
this.steps = {
|
||||
preflight: this.modalElement.find('[data-safe-upgrade-step="preflight"]'),
|
||||
progress: this.modalElement.find('[data-safe-upgrade-step="progress"]'),
|
||||
@@ -4601,7 +4603,7 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
this.decisions = {};
|
||||
this.pollTimer = null;
|
||||
this.statusRequest = null;
|
||||
this.isPolling = !1;
|
||||
this.isPolling = false;
|
||||
this.active = false;
|
||||
this.registerEvents();
|
||||
}
|
||||
@@ -4811,8 +4813,6 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
percent: 0
|
||||
});
|
||||
this.buttons.start.prop('disabled', true);
|
||||
this.stopPolling();
|
||||
this.beginPolling();
|
||||
var body = {
|
||||
decisions: this.decisions
|
||||
};
|
||||
@@ -4820,6 +4820,9 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
method: 'post',
|
||||
body: body
|
||||
}, function (response) {
|
||||
if (!_this4.active) {
|
||||
return;
|
||||
}
|
||||
if (response.status === 'error') {
|
||||
_this4.stopPolling();
|
||||
_this4.renderProgress({
|
||||
@@ -4854,6 +4857,7 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
manifest: data.manifest || null
|
||||
});
|
||||
});
|
||||
this.beginPolling(800);
|
||||
}
|
||||
}, {
|
||||
key: "beginPolling",
|
||||
@@ -4862,7 +4866,7 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
if (this.isPolling) {
|
||||
return;
|
||||
}
|
||||
this.isPolling = !0;
|
||||
this.isPolling = true;
|
||||
this.schedulePoll(delay);
|
||||
}
|
||||
}, {
|
||||
@@ -4875,7 +4879,7 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
return;
|
||||
}
|
||||
this.pollTimer = setTimeout(function () {
|
||||
_this5.fetchStatus(true);
|
||||
return _this5.fetchStatus(true);
|
||||
}, delay);
|
||||
}
|
||||
}, {
|
||||
@@ -4896,8 +4900,10 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
}
|
||||
this.pollTimer = null;
|
||||
var nextStage = null;
|
||||
var shouldContinue = !0;
|
||||
var shouldContinue = true;
|
||||
console.debug('[SafeUpgrade] poll status');
|
||||
this.statusRequest = utils_request(this.urls.status, function (response) {
|
||||
console.debug('[SafeUpgrade] status response', response);
|
||||
if (response.status === 'error') {
|
||||
if (!silent) {
|
||||
_this6.renderProgress({
|
||||
@@ -4913,7 +4919,7 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
nextStage = data.stage || null;
|
||||
_this6.renderProgress(data);
|
||||
if (nextStage === 'installing' || nextStage === 'finalizing' || nextStage === 'complete') {
|
||||
shouldContinue = !1;
|
||||
shouldContinue = false;
|
||||
}
|
||||
});
|
||||
var finalize = function finalize() {
|
||||
@@ -4986,15 +4992,15 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
}, {
|
||||
key: "switchStep",
|
||||
value: function switchStep(step) {
|
||||
var _this6 = this;
|
||||
var _this7 = this;
|
||||
Object.keys(this.steps).forEach(function (handle) {
|
||||
_this6.steps[handle].toggle(handle === step);
|
||||
_this7.steps[handle].toggle(handle === step);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "stopPolling",
|
||||
value: function stopPolling() {
|
||||
this.isPolling = !1;
|
||||
this.isPolling = false;
|
||||
this.clearPollTimer();
|
||||
}
|
||||
}]);
|
||||
@@ -14163,4 +14169,4 @@ external_jQuery_default()(__webpack_require__.g).on('sidebar_state._grav', funct
|
||||
/******/ Grav = __webpack_exports__;
|
||||
/******/
|
||||
/******/ })()
|
||||
;
|
||||
;
|
||||
Reference in New Issue
Block a user