From e90d83f4eb06ceab62367f2059b5344351229eec Mon Sep 17 00:00:00 2001 From: Torben Hansen <derhansen@gmail.com> Date: Mon, 8 May 2023 20:05:07 +0200 Subject: [PATCH] [BUGFIX] Re-enable button after save in ext:install After saving the state of the feature toggles in ext:install, the save button remains disabled. This change fixes the problem. Resolves: #100839 Releases: main, 12.4 Signed-off-by: Torben Hansen <derhansen@gmail.com> Change-Id: I12607ada13646c8eb54df107cef6082d43cb5b9c Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78972 Tested-by: core-ci <typo3@b13.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Benni Mack <benni@typo3.org> --- Build/Sources/TypeScript/install/module/settings/features.ts | 4 +++- .../Resources/Public/JavaScript/module/settings/features.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Build/Sources/TypeScript/install/module/settings/features.ts b/Build/Sources/TypeScript/install/module/settings/features.ts index d16603d4c582..7fa062358aa9 100644 --- a/Build/Sources/TypeScript/install/module/settings/features.ts +++ b/Build/Sources/TypeScript/install/module/settings/features.ts @@ -83,7 +83,9 @@ class Features extends AbstractInteractableModule { (error: AjaxResponse): void => { Router.handleAjaxError(error, modalContent); } - ); + ).finally((): void => { + this.setModalButtonsState(true); + }); } } diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/settings/features.js b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/features.js index d199a8f648ab..d8983b5e836a 100644 --- a/typo3/sysext/install/Resources/Public/JavaScript/module/settings/features.js +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/features.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";class Features extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorSaveTrigger=".t3js-features-save"}initialize(e){this.currentModal=e,this.getContent(),e.on("click",this.selectorSaveTrigger,(e=>{e.preventDefault(),this.save()}))}getContent(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("featuresGetContent")).get({cache:"no-cache"}).then((async t=>{const o=await t.resolve();!0===o.success&&"undefined"!==o.html&&o.html.length>0?(e.empty().append(o.html),Modal.setButtons(o.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")}),(t=>{Router.handleAjaxError(t,e)}))}save(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModuleContent().data("features-save-token"),o={};for(const e of this.findInModal("form").serializeArray())o[e.name]=e.value;o["install[action]"]="featuresSave",o["install[token]"]=t,new AjaxRequest(Router.getUrl()).post(o).then((async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?(t.status.forEach((e=>{Notification.showMessage(e.title,e.message,e.severity)})),this.getContent()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")}),(t=>{Router.handleAjaxError(t,e)}))}}export default new Features; \ No newline at end of file +import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";class Features extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorSaveTrigger=".t3js-features-save"}initialize(e){this.currentModal=e,this.getContent(),e.on("click",this.selectorSaveTrigger,(e=>{e.preventDefault(),this.save()}))}getContent(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("featuresGetContent")).get({cache:"no-cache"}).then((async t=>{const s=await t.resolve();!0===s.success&&"undefined"!==s.html&&s.html.length>0?(e.empty().append(s.html),Modal.setButtons(s.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")}),(t=>{Router.handleAjaxError(t,e)}))}save(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModuleContent().data("features-save-token"),s={};for(const e of this.findInModal("form").serializeArray())s[e.name]=e.value;s["install[action]"]="featuresSave",s["install[token]"]=t,new AjaxRequest(Router.getUrl()).post(s).then((async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?(t.status.forEach((e=>{Notification.showMessage(e.title,e.message,e.severity)})),this.getContent()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")}),(t=>{Router.handleAjaxError(t,e)})).finally((()=>{this.setModalButtonsState(!0)}))}}export default new Features; \ No newline at end of file -- GitLab