Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent accidentical removal of whole folder instead of deleting selected assets / objects #390

Merged

Conversation

BlackbitDevs
Copy link
Contributor

@BlackbitDevs BlackbitDevs commented Jan 11, 2024

Theoretically the grid is easy:

  • there is a button in the toolbar to delete the whole folder
  • and there is the grid where you can select single items, right click and then click delete in the context menu to delete the selected items

In practice a lot of users accidentically remove the whole folder although they wanted to delete only some assets / objects. The reason is that they select some items in the grid with the checkboxes and then they click the Delete button in the toolbar. After confirming the deletion the whole folder is gone instead of the selected items.

With this PR, is some items are selected and the "Delete folder" button gets clicked, the same behaviour gets used as if the right-click contextmenu > Delete would have been used.
Screenshot 2024-01-11 at 13 09 56

In other words: Only if no items are selected in the grid, the button will delete the whole folder.

…they are removing if not removing current folder. Also added a counter and full path of removing items inside confirmation popup.
Copy link

github-actions bot commented Jan 11, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@dmytroderkachblackbit
Copy link
Contributor

I have read the CLA Document and I hereby sign the CLA

@BlackbitDevs BlackbitDevs changed the title Added checking if assets/dataobjects checked inside folder grid then … Prevent accidentical removal of whole folder instead of deleting single assets / objects Jan 11, 2024
@BlackbitDevs BlackbitDevs changed the title Prevent accidentical removal of whole folder instead of deleting single assets / objects Prevent accidentical removal of whole folder instead of deleting selected assets / objects Jan 11, 2024
@kingjia90 kingjia90 self-assigned this Jan 15, 2024
Copy link
Contributor

@kingjia90 kingjia90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM so far, found only some html improvement that could be done

public/js/pimcore/elementservice.js Outdated Show resolved Hide resolved
public/js/pimcore/elementservice.js Outdated Show resolved Hide resolved
@kingjia90
Copy link
Contributor

kingjia90 commented Jan 15, 2024

@fashxp wdty? this change makes this delete button more flexible. The popup message should be also clear enough to implicitly explain this dual functionality.

Alternatively, we should split in 2 separated buttons (one folder+bin icon eg. combination of 📁❌ and one as delete selection that appears only there's any selection, plus a "clear selection" shortcut )

BlackbitDevs and others added 2 commits January 17, 2024 12:47
Co-authored-by: JiaJia Ji <kingjia90@gmail.com>
Co-authored-by: JiaJia Ji <kingjia90@gmail.com>
@fashxp
Copy link
Member

fashxp commented Jan 22, 2024

@kingjia90 I like the idea. We need to make sure though, that the delete button also works if grid not loaded yet - e.g. when grid-tab not opened for assets, or when class selection necessary in objects grid.

Co-authored-by: JiaJia Ji <kingjia90@gmail.com>
Copy link

sonarcloud bot commented Mar 7, 2024

Quality Gate Passed Quality Gate passed

Issues
314 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
43.6% Duplication on New Code

See analysis details on SonarCloud

@kingjia90

This comment was marked as outdated.

@mattamon
Copy link
Contributor

@kingjia90 any update on this? can we continue here?

@kingjia90 kingjia90 added this to the 1.6.0 milestone Sep 11, 2024
@kingjia90
Copy link
Contributor

kingjia90 commented Sep 11, 2024

Thank you both for the changes and the reminder!
LGTM now, it would be just missing a CHANGELOG.md entry to announce this improvement, then we can merge it

@BlackbitDevs
Copy link
Contributor Author

@kingjia90 Changelog entry added.

Copy link

sonarcloud bot commented Sep 12, 2024

@kingjia90 kingjia90 merged commit d33a87c into pimcore:1.x Sep 12, 2024
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants