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