-
Notifications
You must be signed in to change notification settings - Fork 91
#1390 Add related content information to the delete asset warning #1401
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, could you please take a look at my review comments ?
* @return string | ||
*/ | ||
getContentMessage: function(recordPath, recordRelatedContentCount) { | ||
return $.mage.__('This image is used in '+ recordRelatedContentCount +' page(s). Are you sure you want to delete "' + recordPath + '" image?'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Image also can be used in blocks and products as well, i think we should create a proper message for all cases like in 1 page-pages block-blocks product-products.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nazar65 could i use message like: "This image is used in 2 cms_page(s) or (cms_block, catalog_category, etc)" ? Just to use entity_type
field from media_content_asset
table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be the same behaviour, as like this displayed in view details page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nazar65 created message for all cases. For example:
@magento run all test |
@magento run all tests |
@magento run all tests |
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ProkopovVitaliy, thanks for the pull request, it looks good!
I would suggest using the media_gallery/image/details
endpoint to fetch details about the image when the delete button is triggered (similar to what we are doing on the Image Details button), that endpoint already has the information that we need to display the information on the modal. Using this approach we don't need to change the DataProvider and just use javascript to handle the messaging.
Please let me know if you have any questions, we can discuss it on further details.
The base branch was changed from 2.0.0-stabilization to 2.0-develop as this PR is targeting the next release |
@gabrieldagama Thank you for recommendation. As i can see If i should to use |
Hi @ProkopovVitaliy, thanks for your reply! Yes, you are right, the We could implement a new endpoint to handle just the used in data, but I think the performance benefit over the already implemented controller will be small, what do you think? |
@gabrieldagama I thinks new endpoint will be better. Yes performance benefit will be small but it could make functional more decoupled. On the other hand, if we want to use |
Good point! I believe we can extract the |
@gabrieldagama This is cool idea. Thanks!
to
As result we get an object with identifiable elements. It will be much easier to work with them in the future and now we will be able to get what we specifically need. |
Hi @ProkopovVitaliy, Those numbers on the XML are used to define the array order that gets returned on the endpoint and used on the frontend, if you click on the context menu (...) besides the image, you have the I agree that string keys are more straight forward and clear, but since this is attached to another functionality I would suggest on this PR to use the numbers as key for now and we can look into refactoring that functionality later, it would require us to find another way to sort the endpoint response, or the frontend to know what order is correct. For now, maybe we can just wrap the fetch of the Thanks! |
… replaced to endpoint using
@magento run all test |
@magento run all tests |
@gabrieldagama Hi. Fixed QA remarks. Since the image can be deleted from different files, I decided to create an action and implement the functionality in it. This was done in order not to make dependencies between Thanks. |
@magento run all tests |
@magento run Static Tests |
1 similar comment
@magento run Static Tests |
@magento run all tests |
@magento run all tests |
@magento run Functional Tests B2B |
@gabrieldagama Hi. I fixed found bugs, could you please approve my changes ? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates @ProkopovVitaliy! It looks great!
✔️ QA Passed |
Hi @ProkopovVitaliy, thank you for your contribution! |
Description (*)
This PR adds related content information to the delete asset warning
Fixed Issues (if relevant)
Manual testing scenarios (*)
Expected result
The warning message appears with the information that the image is used in the content