Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

DAM admin delete button functionality customization

Avatar

Level 2

Hi everyone,

                     i am trying to customize delete button functionality. I copied  /libs/cq/ui/widgets/source/widgets/wcm/DamAdmin.Actions.js to /apps folder.

I have to call custom servlet, when delete button is hit for any asset/node deletion. It still calls out of the box delete logic internally. I could not find where exactly i have to call my servlet when delete button is clicked. Could anyone suggest me?

Thanks & Regards,

Radhakrishna

1 Accepted Solution

Avatar

Correct answer by
Level 10

File /libs/cq/ui/widgets/source/widgets/wcm/DamAdmin.Actions.js

For deleting a asset,  this method gets called

CQ.wcm.DamAdmin.deleteAsset which further calls CQ.wcm.DamAdmin.internalDeleteAsset

LIne 162 is the success callback once these assets are deleted

View solution in original post

0 Replies

Avatar

Correct answer by
Level 10

File /libs/cq/ui/widgets/source/widgets/wcm/DamAdmin.Actions.js

For deleting a asset,  this method gets called

CQ.wcm.DamAdmin.deleteAsset which further calls CQ.wcm.DamAdmin.internalDeleteAsset

LIne 162 is the success callback once these assets are deleted

Avatar

Level 2

Hi Edubey,

                    sorry for posting unnecessary script of the JS file.

i appreciate your quick help here. Yes, you are correct. It executes deleteAsset method. I could not see the control coming to (/libs/cq/ui/widgets/source/widgets/wcm/DamAdmin.Actions.js) file. I have cleaned up the connect from this js and deleted asset. Asset is getting deleted even when there is nothing to handle in the JS file. Please let me know, if i forgot anything here.

Thanks &  Regards,

Radhakrishna.

Avatar

Level 10

Just tried, I am able to see added console logs in browser

1401418_pastedImage_0.png

1401456_pastedImage_1.png

These are huge clientlibs and gets cached at browser as well as /var/clientlibs in AEM.

What you can try is to invalidate these files under /var AEM


Use this link to invalidate existing generated clientlibs http://localhost:4502/libs/granite/ui/content/dumplibs.rebuild.html

Avatar

Level 2

Hi Edubey,

                   thanks for such an explanation. I have added some console logs and have invalidated cache and rebuilt libraries. I don't see any console log printed in the console. Then i have removed JS (/libs/cq/ui/widgets/source/widgets/wcm/DamAdmin.Actions.js) content and clientlibs from var folder. I have clicked delete button for one asset and it has been deleted. I am still not sure how is getting deleted.

Thanks & Regards,

Radhakrishna.

Avatar

Level 10

Above mentioned file by you is used in Classic UI

1401969_pastedImage_0.png

Are you using touch UI?

Avatar

Level 2

Hi Edubey,

                  yes, you are correct. We don't use this classic UI at all. We use Touch UI only.

Thanks & Regards,

Radhakrishna.

Avatar

Level 10

Got it, then you are looking at wrong file.

Used by Classic UI

/libs/cq/ui/widgets/source/widgets/wcm/DamAdmin.Actions.js

Used by Touch UI (line 106)

/libs/dam/gui/coral/components/admin/clientlibs/actions/js/delete.js

Avatar

Level 2

Hi Edubey,

                    many thanks for your quick help. I have got the location where this delete location function deleteResources(force, type) in /libs/dam/gui/coral/components/admin/clientlibs/actions/js/delete.js  to do it in Touch UI. I could take it from here for my customization.

Thanks & Regards,

Radhakrishna.

Avatar

Level 3

Hi edubey​,

We have a similar usecase to customize the delete functionality to move the assets to a trash can(another location in DAM) before the assets are deleted. We could handle the assets deleted from touch/classic UI by overlaying these JS files and calling our custom servlets.

But I wanted to check how could we handle the assets deleted by the users using the Desktop App? Do we have to overlay the actual delete servlet itself? Any pointers are greatly appreciated.

Thanks in advance!

Ramya

Avatar

Level 3

Hello Radhakrishna,

     I need more help on this to override the delete action button.

I have done overlay of /app/dam/gui/coral/components/admin/clientlibs/actions/js/delete.js and trying to calling the delete action on asset selection button as /apps/dam/gui/content/assets/jcr:content/actions/selection/myaction

it  calling default "Delete Asset" dialog successfully.

But I want to handle some action on "Delete" button can you help me more on this. The properties of myaction button as below

1571388_pastedImage_8.png

Thanks

Qamar

" many thanks for your quick help. I have got the location where this delete location function deleteResources(force, type) in /libs/dam/gui/coral/components/admin/clientlibs/actions/js/delete.js  to do it in Touch UI. I could take it from here for my customization."