From 02a0c079354ef2b5631908d0d7ec50bfe7c54a12 Mon Sep 17 00:00:00 2001 From: Elena Shorohova <92329687+jsorohova@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:21:23 +0100 Subject: [PATCH] Fixed multiple media files deletion (#2434) --- src/admin/help/helpModal.tsx | 2 +- src/admin/media/mediaModal.tsx | 7 +++-- .../components/deleteConfirmationOverlay.tsx | 26 ++++++++++++++++--- src/themes/designer/styles/admin.scss | 10 +++++++ 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/admin/help/helpModal.tsx b/src/admin/help/helpModal.tsx index eed9dd7cf..f0d11eddb 100644 --- a/src/admin/help/helpModal.tsx +++ b/src/admin/help/helpModal.tsx @@ -69,7 +69,7 @@ export class HelpModal extends React.Component { Give feedback diff --git a/src/admin/media/mediaModal.tsx b/src/admin/media/mediaModal.tsx index a7b69de32..06c95bd77 100644 --- a/src/admin/media/mediaModal.tsx +++ b/src/admin/media/mediaModal.tsx @@ -105,8 +105,10 @@ export class MediaModal extends React.Component => { - await Promise.all(this.state.selectedFiles.map(async file => await this.mediaService.deleteMedia(file))); - + for (const file of this.state.selectedFiles) { + await this.mediaService.deleteMedia(file); + } + this.setState({ selectedFiles: [], showDeleteConfirmation: false }); this.eventManager.dispatchEvent('onSaveChanges'); this.searchMedia(); @@ -183,6 +185,7 @@ export class MediaModal extends React.Component this.renameMedia(mediaItem)} + disabled={this.state.fileNewName === ''} /> void, onDismiss: () => void } -export class DeleteConfirmationOverlay extends React.Component { +export class DeleteConfirmationOverlay extends React.Component { + constructor(props: DeleteConfirmationProps) { + super(props); + + this.state = { + isLoading: false + } + } + render(): JSX.Element { return <> @@ -41,9 +53,17 @@ export class DeleteConfirmationOverlay extends React.Component
+ {this.state.isLoading && }

Are you sure you want to delete {this.props.deleteItemTitle}?

- Yes + { + this.setState({ isLoading: true }); + this.props.onConfirm(); + }} + > + Yes + No
diff --git a/src/themes/designer/styles/admin.scss b/src/themes/designer/styles/admin.scss index 55b5bff42..ae90496c8 100644 --- a/src/themes/designer/styles/admin.scss +++ b/src/themes/designer/styles/admin.scss @@ -317,6 +317,16 @@ font-weight: 600; } +.spinner-modal { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + background-color: rgba(0, 0, 0, 0.4); + z-index: 10; +} + // CHECK THIS!!!!! // .toolbox-position-right-top { // display: none !important;