Commit b4b01526 authored by Andreas Fernandez's avatar Andreas Fernandez
Browse files

[BUGFIX] Allow to abort a selected upgrade wizard before execution

An administrator is now able to abort the confirmation of an selected
upgrade wizard without the need to close and re-open the modal.

Resolves: #94515
Releases: master, 10.4
Change-Id: I0c7d63a13a4f0f63844ee28be09dec203dd9c5ac
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69768


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.com>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 20ade491
......@@ -50,6 +50,7 @@ class UpgradeWizards extends AbstractInteractableModule {
private selectorWizardsInputTitle: string = '.t3js-upgradeWizards-input-title';
private selectorWizardsInputHtml: string = '.t3js-upgradeWizards-input-html';
private selectorWizardsInputPerform: string = '.t3js-upgradeWizards-input-perform';
private selectorWizardsInputAbort: string = '.t3js-upgradeWizards-input-abort';
private securityUtility: SecurityUtility;
private static removeLoadingMessage($container: JQuery): void {
......@@ -96,6 +97,12 @@ class UpgradeWizards extends AbstractInteractableModule {
currentModal.on('click', this.selectorWizardsInputPerform, (e: JQueryEventObject): void => {
this.wizardExecute((<HTMLElement>e.target).dataset.identifier, (<HTMLElement>e.target).dataset.title);
});
// Abort upgrade wizard
currentModal.on('click', this.selectorWizardsInputAbort, (e: JQueryEventObject): void => {
this.findInModal(this.selectorOutputWizardsContainer).empty();
this.wizardsList();
});
}
private getData(): Promise<any> {
......
......@@ -65,6 +65,9 @@
<button class="btn btn-warning t3js-upgradeWizards-input-perform" type="button">
Perform updates!
</button>
<button class="btn btn-default t3js-upgradeWizards-input-abort" type="button">
Abort
</button>
</form>
</div>
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","../AbstractInteractableModule","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Core/SecurityUtility","../../Renderable/FlashMessage","../../Renderable/InfoBox","../../Renderable/ProgressBar","../../Renderable/Severity","../../Router","bootstrap"],(function(e,t,s,r,a,i,o,n,d,l,c,h){"use strict";s=__importDefault(s);class p extends r.AbstractInteractableModule{constructor(){super(),this.selectorOutputWizardsContainer=".t3js-upgradeWizards-wizards-output",this.selectorOutputDoneContainer=".t3js-upgradeWizards-done-output",this.selectorWizardsBlockingAddsTemplate=".t3js-upgradeWizards-blocking-adds-template",this.selectorWizardsBlockingAddsRows=".t3js-upgradeWizards-blocking-adds-rows",this.selectorWizardsBlockingAddsExecute=".t3js-upgradeWizards-blocking-adds-execute",this.selectorWizardsBlockingCharsetTemplate=".t3js-upgradeWizards-blocking-charset-template",this.selectorWizardsBlockingCharsetFix=".t3js-upgradeWizards-blocking-charset-fix",this.selectorWizardsDoneBodyTemplate=".t3js-upgradeWizards-done-body-template",this.selectorWizardsDoneRows=".t3js-upgradeWizards-done-rows",this.selectorWizardsDoneRowTemplate=".t3js-upgradeWizards-done-row-template table tr",this.selectorWizardsDoneRowMarkUndone=".t3js-upgradeWizards-done-markUndone",this.selectorWizardsDoneRowTitle=".t3js-upgradeWizards-done-title",this.selectorWizardsListTemplate=".t3js-upgradeWizards-list-template",this.selectorWizardsListRows=".t3js-upgradeWizards-list-rows",this.selectorWizardsListRowTemplate=".t3js-upgradeWizards-list-row-template",this.selectorWizardsListRowTitle=".t3js-upgradeWizards-list-row-title",this.selectorWizardsListRowExplanation=".t3js-upgradeWizards-list-row-explanation",this.selectorWizardsListRowExecute=".t3js-upgradeWizards-list-row-execute",this.selectorWizardsInputTemplate=".t3js-upgradeWizards-input",this.selectorWizardsInputTitle=".t3js-upgradeWizards-input-title",this.selectorWizardsInputHtml=".t3js-upgradeWizards-input-html",this.selectorWizardsInputPerform=".t3js-upgradeWizards-input-perform",this.securityUtility=new o}static removeLoadingMessage(e){e.find(".alert-loading").remove()}static renderProgressBar(e){return l.render(c.loading,e,"")}initialize(e){this.currentModal=e,this.getData().done(()=>{this.doneUpgrades()}),e.on("click",this.selectorWizardsDoneRowMarkUndone,e=>{this.markUndone(e.target.dataset.identifier)}),e.on("click",this.selectorWizardsBlockingCharsetFix,()=>{this.blockingUpgradesDatabaseCharsetFix()}),e.on("click",this.selectorWizardsBlockingAddsExecute,()=>{this.blockingUpgradesDatabaseAddsExecute()}),e.on("click",this.selectorWizardsListRowExecute,e=>{this.wizardInput(e.target.dataset.identifier,e.target.dataset.title)}),e.on("click",this.selectorWizardsInputPerform,e=>{this.wizardExecute(e.target.dataset.identifier,e.target.dataset.title)})}getData(){const e=this.getModalBody();return new i(h.getUrl("upgradeWizardsGetData")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success?(e.empty().append(s.html),this.blockingUpgradesDatabaseCharsetTest()):a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e)})}blockingUpgradesDatabaseCharsetTest(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.empty().html(p.renderProgressBar("Checking database charset...")),new i(h.getUrl("upgradeWizardsBlockingDatabaseCharsetTest")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();p.removeLoadingMessage(t),!0===r.success&&(!0===r.needsUpdate?e.find(this.selectorOutputWizardsContainer).append(e.find(this.selectorWizardsBlockingCharsetTemplate)).clone():this.blockingUpgradesDatabaseAdds())},e=>{h.handleAjaxError(e,t)})}blockingUpgradesDatabaseCharsetFix(){const e=s.default(this.selectorOutputWizardsContainer);e.empty().html(p.renderProgressBar("Setting database charset to UTF-8...")),new i(h.getUrl("upgradeWizardsBlockingDatabaseCharsetFix")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();if(p.removeLoadingMessage(e),!0===s.success)Array.isArray(s.status)&&s.status.length>0&&s.status.forEach(t=>{const s=d.render(t.severity,t.title,t.message);e.append(s)});else{const t=n.render(c.error,"Something went wrong","");p.removeLoadingMessage(e),e.append(t)}},t=>{h.handleAjaxError(t,e)})}blockingUpgradesDatabaseAdds(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.empty().html(p.renderProgressBar("Check for missing mandatory database tables and fields...")),new i(h.getUrl("upgradeWizardsBlockingDatabaseAdds")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();if(p.removeLoadingMessage(t),!0===r.success)if(!0===r.needsUpdate){const t=e.find(this.selectorWizardsBlockingAddsTemplate).clone();"object"==typeof r.adds.tables&&r.adds.tables.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),"object"==typeof r.adds.columns&&r.adds.columns.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table)+", Field: "+this.securityUtility.encodeHtml(e.field);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),"object"==typeof r.adds.indexes&&r.adds.indexes.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table)+", Index: "+this.securityUtility.encodeHtml(e.index);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),e.find(this.selectorOutputWizardsContainer).append(t)}else this.wizardsList();else a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e)})}blockingUpgradesDatabaseAddsExecute(){const e=this.findInModal(this.selectorOutputWizardsContainer);e.empty().html(p.renderProgressBar("Adding database tables and fields...")),new i(h.getUrl("upgradeWizardsBlockingDatabaseExecute")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();if(p.removeLoadingMessage(e),!0===s.success)Array.isArray(s.status)&&s.status.length>0&&(s.status.forEach(t=>{const s=d.render(t.severity,t.title,t.message);e.append(s)}),this.wizardsList());else{const t=n.render(c.error,"Something went wrong","");p.removeLoadingMessage(e),e.append(t)}},t=>{h.handleAjaxError(t,e)})}wizardsList(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.append(p.renderProgressBar("Loading upgrade wizards...")),new i(h.getUrl("upgradeWizardsList")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();p.removeLoadingMessage(t);const i=e.find(this.selectorWizardsListTemplate).clone();if(i.removeClass("t3js-upgradeWizards-list-template"),!0===r.success){let t=0,s=0;Array.isArray(r.wizards)&&r.wizards.length>0&&(s=r.wizards.length,r.wizards.forEach(s=>{if(!0===s.shouldRenderWizard){const r=e.find(this.selectorWizardsListRowTemplate).clone();t+=1,r.removeClass("t3js-upgradeWizards-list-row-template"),r.find(this.selectorWizardsListRowTitle).empty().text(s.title),r.find(this.selectorWizardsListRowExplanation).empty().text(s.explanation),r.find(this.selectorWizardsListRowExecute).attr("data-identifier",s.identifier).attr("data-title",s.title),i.find(this.selectorWizardsListRows).append(r)}}),i.find(this.selectorWizardsListRows+" hr:last").remove());let a=100;const o=i.find(".progress-bar");t>0?a=Math.round((s-t)/r.wizards.length*100):o.removeClass("progress-bar-info").addClass("progress-bar-success"),o.removeClass("progress-bar-striped").css("width",a+"%").attr("aria-valuenow",a).find("span").text(a+"%"),e.find(this.selectorOutputWizardsContainer).append(i),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!1)}else a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e)})}wizardInput(e,t){const s=this.getModuleContent().data("upgrade-wizards-input-token"),r=this.getModalBody(),a=this.findInModal(this.selectorOutputWizardsContainer);a.empty().html(p.renderProgressBar('Loading "'+t+'"...')),r.animate({scrollTop:r.scrollTop()-Math.abs(r.find(".t3js-upgrade-status-section").position().top)},250),new i(h.getUrl("upgradeWizardsInput")).post({install:{action:"upgradeWizardsInput",token:s,identifier:e}}).then(async e=>{const t=await e.resolve();a.empty();const s=r.find(this.selectorWizardsInputTemplate).clone();s.removeClass("t3js-upgradeWizards-input"),!0===t.success&&(Array.isArray(t.status)&&t.status.forEach(e=>{const t=n.render(e.severity,e.title,e.message);a.append(t)}),t.userInput.wizardHtml.length>0&&s.find(this.selectorWizardsInputHtml).html(t.userInput.wizardHtml),s.find(this.selectorWizardsInputTitle).text(t.userInput.title),s.find(this.selectorWizardsInputPerform).attr("data-identifier",t.userInput.identifier).attr("data-title",t.userInput.title)),r.find(this.selectorOutputWizardsContainer).append(s)},e=>{h.handleAjaxError(e,a)})}wizardExecute(e,t){const r=this.getModuleContent().data("upgrade-wizards-execute-token"),o=this.getModalBody(),n={"install[action]":"upgradeWizardsExecute","install[token]":r,"install[identifier]":e};s.default(this.findInModal(this.selectorOutputWizardsContainer+" form").serializeArray()).each((e,t)=>{n[t.name]=t.value});const l=this.findInModal(this.selectorOutputWizardsContainer);l.empty().html(p.renderProgressBar('Executing "'+t+'"...')),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!0),new i(h.getUrl()).post(n).then(async e=>{const t=await e.resolve();l.empty(),!0===t.success?(Array.isArray(t.status)&&t.status.forEach(e=>{const t=d.render(e.severity,e.title,e.message);l.append(t)}),this.wizardsList(),o.find(this.selectorOutputDoneContainer).empty(),this.doneUpgrades()):a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e,l)})}doneUpgrades(){const e=this.getModalBody(),t=e.find(this.selectorOutputDoneContainer);t.empty().html(p.renderProgressBar("Loading executed upgrade wizards...")),new i(h.getUrl("upgradeWizardsDoneUpgrades")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();if(p.removeLoadingMessage(t),!0===r.success){Array.isArray(r.status)&&r.status.length>0&&r.status.forEach(e=>{const s=d.render(e.severity,e.title,e.message);t.append(s)});const s=e.find(this.selectorWizardsDoneBodyTemplate).clone(),a=s.find(this.selectorWizardsDoneRows);let i=!1;Array.isArray(r.wizardsDone)&&r.wizardsDone.length>0&&r.wizardsDone.forEach(t=>{i=!0;const s=e.find(this.selectorWizardsDoneRowTemplate).clone();s.find(this.selectorWizardsDoneRowMarkUndone).attr("data-identifier",t.identifier),s.find(this.selectorWizardsDoneRowTitle).text(t.title),a.append(s)}),Array.isArray(r.rowUpdatersDone)&&r.rowUpdatersDone.length>0&&r.rowUpdatersDone.forEach(t=>{i=!0;const s=e.find(this.selectorWizardsDoneRowTemplate).clone();s.find(this.selectorWizardsDoneRowMarkUndone).attr("data-identifier",t.identifier),s.find(this.selectorWizardsDoneRowTitle).text(t.title),a.append(s)}),i&&(e.find(this.selectorOutputDoneContainer).append(s),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!0))}else a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e,t)})}markUndone(e){const t=this.getModuleContent().data("upgrade-wizards-mark-undone-token"),s=this.getModalBody(),r=this.findInModal(this.selectorOutputDoneContainer);r.empty().html(p.renderProgressBar("Marking upgrade wizard as undone...")),new i(h.getUrl()).post({install:{action:"upgradeWizardsMarkUndone",token:t,identifier:e}}).then(async e=>{const t=await e.resolve();r.empty(),s.find(this.selectorOutputDoneContainer).empty(),!0===t.success&&Array.isArray(t.status)?t.status.forEach(e=>{a.success(e.title,e.message),this.doneUpgrades(),this.blockingUpgradesDatabaseCharsetTest()}):a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e,r)})}}return new p}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","../AbstractInteractableModule","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Core/SecurityUtility","../../Renderable/FlashMessage","../../Renderable/InfoBox","../../Renderable/ProgressBar","../../Renderable/Severity","../../Router","bootstrap"],(function(e,t,s,r,a,i,o,n,d,l,c,h){"use strict";s=__importDefault(s);class p extends r.AbstractInteractableModule{constructor(){super(),this.selectorOutputWizardsContainer=".t3js-upgradeWizards-wizards-output",this.selectorOutputDoneContainer=".t3js-upgradeWizards-done-output",this.selectorWizardsBlockingAddsTemplate=".t3js-upgradeWizards-blocking-adds-template",this.selectorWizardsBlockingAddsRows=".t3js-upgradeWizards-blocking-adds-rows",this.selectorWizardsBlockingAddsExecute=".t3js-upgradeWizards-blocking-adds-execute",this.selectorWizardsBlockingCharsetTemplate=".t3js-upgradeWizards-blocking-charset-template",this.selectorWizardsBlockingCharsetFix=".t3js-upgradeWizards-blocking-charset-fix",this.selectorWizardsDoneBodyTemplate=".t3js-upgradeWizards-done-body-template",this.selectorWizardsDoneRows=".t3js-upgradeWizards-done-rows",this.selectorWizardsDoneRowTemplate=".t3js-upgradeWizards-done-row-template table tr",this.selectorWizardsDoneRowMarkUndone=".t3js-upgradeWizards-done-markUndone",this.selectorWizardsDoneRowTitle=".t3js-upgradeWizards-done-title",this.selectorWizardsListTemplate=".t3js-upgradeWizards-list-template",this.selectorWizardsListRows=".t3js-upgradeWizards-list-rows",this.selectorWizardsListRowTemplate=".t3js-upgradeWizards-list-row-template",this.selectorWizardsListRowTitle=".t3js-upgradeWizards-list-row-title",this.selectorWizardsListRowExplanation=".t3js-upgradeWizards-list-row-explanation",this.selectorWizardsListRowExecute=".t3js-upgradeWizards-list-row-execute",this.selectorWizardsInputTemplate=".t3js-upgradeWizards-input",this.selectorWizardsInputTitle=".t3js-upgradeWizards-input-title",this.selectorWizardsInputHtml=".t3js-upgradeWizards-input-html",this.selectorWizardsInputPerform=".t3js-upgradeWizards-input-perform",this.selectorWizardsInputAbort=".t3js-upgradeWizards-input-abort",this.securityUtility=new o}static removeLoadingMessage(e){e.find(".alert-loading").remove()}static renderProgressBar(e){return l.render(c.loading,e,"")}initialize(e){this.currentModal=e,this.getData().done(()=>{this.doneUpgrades()}),e.on("click",this.selectorWizardsDoneRowMarkUndone,e=>{this.markUndone(e.target.dataset.identifier)}),e.on("click",this.selectorWizardsBlockingCharsetFix,()=>{this.blockingUpgradesDatabaseCharsetFix()}),e.on("click",this.selectorWizardsBlockingAddsExecute,()=>{this.blockingUpgradesDatabaseAddsExecute()}),e.on("click",this.selectorWizardsListRowExecute,e=>{this.wizardInput(e.target.dataset.identifier,e.target.dataset.title)}),e.on("click",this.selectorWizardsInputPerform,e=>{this.wizardExecute(e.target.dataset.identifier,e.target.dataset.title)}),e.on("click",this.selectorWizardsInputAbort,e=>{this.findInModal(this.selectorOutputWizardsContainer).empty(),this.wizardsList()})}getData(){const e=this.getModalBody();return new i(h.getUrl("upgradeWizardsGetData")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success?(e.empty().append(s.html),this.blockingUpgradesDatabaseCharsetTest()):a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e)})}blockingUpgradesDatabaseCharsetTest(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.empty().html(p.renderProgressBar("Checking database charset...")),new i(h.getUrl("upgradeWizardsBlockingDatabaseCharsetTest")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();p.removeLoadingMessage(t),!0===r.success&&(!0===r.needsUpdate?e.find(this.selectorOutputWizardsContainer).append(e.find(this.selectorWizardsBlockingCharsetTemplate)).clone():this.blockingUpgradesDatabaseAdds())},e=>{h.handleAjaxError(e,t)})}blockingUpgradesDatabaseCharsetFix(){const e=s.default(this.selectorOutputWizardsContainer);e.empty().html(p.renderProgressBar("Setting database charset to UTF-8...")),new i(h.getUrl("upgradeWizardsBlockingDatabaseCharsetFix")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();if(p.removeLoadingMessage(e),!0===s.success)Array.isArray(s.status)&&s.status.length>0&&s.status.forEach(t=>{const s=d.render(t.severity,t.title,t.message);e.append(s)});else{const t=n.render(c.error,"Something went wrong","");p.removeLoadingMessage(e),e.append(t)}},t=>{h.handleAjaxError(t,e)})}blockingUpgradesDatabaseAdds(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.empty().html(p.renderProgressBar("Check for missing mandatory database tables and fields...")),new i(h.getUrl("upgradeWizardsBlockingDatabaseAdds")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();if(p.removeLoadingMessage(t),!0===r.success)if(!0===r.needsUpdate){const t=e.find(this.selectorWizardsBlockingAddsTemplate).clone();"object"==typeof r.adds.tables&&r.adds.tables.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),"object"==typeof r.adds.columns&&r.adds.columns.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table)+", Field: "+this.securityUtility.encodeHtml(e.field);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),"object"==typeof r.adds.indexes&&r.adds.indexes.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table)+", Index: "+this.securityUtility.encodeHtml(e.index);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),e.find(this.selectorOutputWizardsContainer).append(t)}else this.wizardsList();else a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e)})}blockingUpgradesDatabaseAddsExecute(){const e=this.findInModal(this.selectorOutputWizardsContainer);e.empty().html(p.renderProgressBar("Adding database tables and fields...")),new i(h.getUrl("upgradeWizardsBlockingDatabaseExecute")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();if(p.removeLoadingMessage(e),!0===s.success)Array.isArray(s.status)&&s.status.length>0&&(s.status.forEach(t=>{const s=d.render(t.severity,t.title,t.message);e.append(s)}),this.wizardsList());else{const t=n.render(c.error,"Something went wrong","");p.removeLoadingMessage(e),e.append(t)}},t=>{h.handleAjaxError(t,e)})}wizardsList(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.append(p.renderProgressBar("Loading upgrade wizards...")),new i(h.getUrl("upgradeWizardsList")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();p.removeLoadingMessage(t);const i=e.find(this.selectorWizardsListTemplate).clone();if(i.removeClass("t3js-upgradeWizards-list-template"),!0===r.success){let t=0,s=0;Array.isArray(r.wizards)&&r.wizards.length>0&&(s=r.wizards.length,r.wizards.forEach(s=>{if(!0===s.shouldRenderWizard){const r=e.find(this.selectorWizardsListRowTemplate).clone();t+=1,r.removeClass("t3js-upgradeWizards-list-row-template"),r.find(this.selectorWizardsListRowTitle).empty().text(s.title),r.find(this.selectorWizardsListRowExplanation).empty().text(s.explanation),r.find(this.selectorWizardsListRowExecute).attr("data-identifier",s.identifier).attr("data-title",s.title),i.find(this.selectorWizardsListRows).append(r)}}),i.find(this.selectorWizardsListRows+" hr:last").remove());let a=100;const o=i.find(".progress-bar");t>0?a=Math.round((s-t)/r.wizards.length*100):o.removeClass("progress-bar-info").addClass("progress-bar-success"),o.removeClass("progress-bar-striped").css("width",a+"%").attr("aria-valuenow",a).find("span").text(a+"%"),e.find(this.selectorOutputWizardsContainer).append(i),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!1)}else a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e)})}wizardInput(e,t){const s=this.getModuleContent().data("upgrade-wizards-input-token"),r=this.getModalBody(),a=this.findInModal(this.selectorOutputWizardsContainer);a.empty().html(p.renderProgressBar('Loading "'+t+'"...')),r.animate({scrollTop:r.scrollTop()-Math.abs(r.find(".t3js-upgrade-status-section").position().top)},250),new i(h.getUrl("upgradeWizardsInput")).post({install:{action:"upgradeWizardsInput",token:s,identifier:e}}).then(async e=>{const t=await e.resolve();a.empty();const s=r.find(this.selectorWizardsInputTemplate).clone();s.removeClass("t3js-upgradeWizards-input"),!0===t.success&&(Array.isArray(t.status)&&t.status.forEach(e=>{const t=n.render(e.severity,e.title,e.message);a.append(t)}),t.userInput.wizardHtml.length>0&&s.find(this.selectorWizardsInputHtml).html(t.userInput.wizardHtml),s.find(this.selectorWizardsInputTitle).text(t.userInput.title),s.find(this.selectorWizardsInputPerform).attr("data-identifier",t.userInput.identifier).attr("data-title",t.userInput.title)),r.find(this.selectorOutputWizardsContainer).append(s)},e=>{h.handleAjaxError(e,a)})}wizardExecute(e,t){const r=this.getModuleContent().data("upgrade-wizards-execute-token"),o=this.getModalBody(),n={"install[action]":"upgradeWizardsExecute","install[token]":r,"install[identifier]":e};s.default(this.findInModal(this.selectorOutputWizardsContainer+" form").serializeArray()).each((e,t)=>{n[t.name]=t.value});const l=this.findInModal(this.selectorOutputWizardsContainer);l.empty().html(p.renderProgressBar('Executing "'+t+'"...')),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!0),new i(h.getUrl()).post(n).then(async e=>{const t=await e.resolve();l.empty(),!0===t.success?(Array.isArray(t.status)&&t.status.forEach(e=>{const t=d.render(e.severity,e.title,e.message);l.append(t)}),this.wizardsList(),o.find(this.selectorOutputDoneContainer).empty(),this.doneUpgrades()):a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e,l)})}doneUpgrades(){const e=this.getModalBody(),t=e.find(this.selectorOutputDoneContainer);t.empty().html(p.renderProgressBar("Loading executed upgrade wizards...")),new i(h.getUrl("upgradeWizardsDoneUpgrades")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();if(p.removeLoadingMessage(t),!0===r.success){Array.isArray(r.status)&&r.status.length>0&&r.status.forEach(e=>{const s=d.render(e.severity,e.title,e.message);t.append(s)});const s=e.find(this.selectorWizardsDoneBodyTemplate).clone(),a=s.find(this.selectorWizardsDoneRows);let i=!1;Array.isArray(r.wizardsDone)&&r.wizardsDone.length>0&&r.wizardsDone.forEach(t=>{i=!0;const s=e.find(this.selectorWizardsDoneRowTemplate).clone();s.find(this.selectorWizardsDoneRowMarkUndone).attr("data-identifier",t.identifier),s.find(this.selectorWizardsDoneRowTitle).text(t.title),a.append(s)}),Array.isArray(r.rowUpdatersDone)&&r.rowUpdatersDone.length>0&&r.rowUpdatersDone.forEach(t=>{i=!0;const s=e.find(this.selectorWizardsDoneRowTemplate).clone();s.find(this.selectorWizardsDoneRowMarkUndone).attr("data-identifier",t.identifier),s.find(this.selectorWizardsDoneRowTitle).text(t.title),a.append(s)}),i&&(e.find(this.selectorOutputDoneContainer).append(s),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!0))}else a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e,t)})}markUndone(e){const t=this.getModuleContent().data("upgrade-wizards-mark-undone-token"),s=this.getModalBody(),r=this.findInModal(this.selectorOutputDoneContainer);r.empty().html(p.renderProgressBar("Marking upgrade wizard as undone...")),new i(h.getUrl()).post({install:{action:"upgradeWizardsMarkUndone",token:t,identifier:e}}).then(async e=>{const t=await e.resolve();r.empty(),s.find(this.selectorOutputDoneContainer).empty(),!0===t.success&&Array.isArray(t.status)?t.status.forEach(e=>{a.success(e.title,e.message),this.doneUpgrades(),this.blockingUpgradesDatabaseCharsetTest()}):a.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{h.handleAjaxError(e,r)})}}return new p}));
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment