Skip to content

Commit

Permalink
[TASK] Show modal before re-import of static data
Browse files Browse the repository at this point in the history
Extensions can provide static data using the file
"ext_tables_static+adt.sql".
If this file exists, a button is automatically created
in the Extension Manager.
As soon as you click the button, the static SQL data
will be imported. Existing data will be dropped.

A new modal now warns the user before executing the file,
with buttons to start or abort the task.

Resolves: #100118
Releases: main, 12.4
Change-Id: Ie33a89d6957428f390edeaa2700639bc13ac8b7d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80362
Tested-by: core-ci <typo3@b13.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
  • Loading branch information
sebkln authored and andreaskienast committed Aug 5, 2023
1 parent 21355fe commit e77fe92
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
28 changes: 28 additions & 0 deletions Build/Sources/TypeScript/extensionmanager/main.ts
Expand Up @@ -93,6 +93,34 @@ class ExtensionManager {
],
);
}).delegateTo(extensionList, '.removeExtension');

new RegularEvent('click', (e: Event, target: HTMLAnchorElement): void => {
e.preventDefault();

Modal.confirm(
TYPO3.lang['extensionList.databaseReload.title'],
TYPO3.lang['extensionList.databaseReload.message'],
Severity.warning,
[
{
text: TYPO3.lang['button.cancel'],
active: true,
btnClass: 'btn-default',
trigger: (): void => {
Modal.dismiss();
},
}, {
text: TYPO3.lang['button.reimport'],
btnClass: 'btn-warning',
trigger: (): void => {
window.location.href = target.href;
Modal.dismiss();
},
},
],
);
}).delegateTo(extensionList, '.reloadSqlData');

}
$(document).on('click', '.onClickMaskExtensionManager', (): void => {
NProgress.start();
Expand Down
Expand Up @@ -42,6 +42,9 @@
<trans-unit id="button.remove" resname="button.remove">
<source>Remove extension</source>
</trans-unit>
<trans-unit id="button.reimport" resname="button.reimport">
<source>Re-import data</source>
</trans-unit>
<trans-unit id="button.updateExtension" resname="button.updateExtension">
<source>Update extension</source>
</trans-unit>
Expand Down Expand Up @@ -230,6 +233,12 @@
<trans-unit id="extensionList.databaseReload" resname="extensionList.databaseReload">
<source>Nothing has changed since last import. You might want to reload static database data.</source>
</trans-unit>
<trans-unit id="extensionList.databaseReload.title" resname="extensionList.databaseReload.title">
<source>Re-import of static database data</source>
</trans-unit>
<trans-unit id="extensionList.databaseReload.message" resname="extensionList.databaseReload.message">
<source>This re-import will overwrite any existing static data in the database.</source>
</trans-unit>
<trans-unit id="extensionList.updateConfirmation.questionVersionComments" resname="extensionList.updateConfirmation.questionVersionComments">
<source>Version Comments</source>
</trans-unit>
Expand Down
Expand Up @@ -145,7 +145,7 @@ <h1><f:translate key="installedExtensions" /></h1>
<core:icon identifier="actions-system-extension-download" />
</f:link.action>
</f:if>
<em:reloadSqlData class="btn btn-default" extension="{extension}" />
<em:reloadSqlData class="reloadSqlData btn btn-default" extension="{extension}" />
<f:if condition="{extension.terObject.documentationLink}">
<f:then>
<a href="{extension.terObject.documentationLink}" target="_blank" rel="noopener noreferrer" class="btn btn-default">
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e77fe92

Please sign in to comment.