[DOCU-2367] Configuring delete action Created: 13/Jan/22  Updated: 19/Jan/22  Resolved: 14/Jan/22

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Michiel Meeuwissen Assignee: Martin Drápela
Resolution: Done Votes: 0
Labels: external
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Documentation page URL: https://docs.magnolia-cms.com/product-docs/6.2/Apps/App-configuration/Action-definition.html

 Description   

I just was tryting to make a 'delete' action. The documentation is very unhelpful..

It seems that this is what I'm having to be satisified with:

'deleteNodesConfirmationActionDefinition

deleteNodesConfirmationAction

Opens a dialog to confirm deleting an item.
'

Confirming is nice, but actually I find in more important that the thing gets deleted. Which is doesn't.

It seems that there must be defined an 'successname'.

  if (getDefinition().getSuccessActionName() != null) {
                                actionExecutionService.executeAction(getDefinition().getSuccessActionName(), valueContext.current().nullableValue());
                            }

I don't know how to accomplish that.

'deleteNodesConfirmationActionDefinition' is clickable, but goes to nexus, which doesn't help at all.



 Comments   
Comment by Martin Drápela [ 14/Jan/22 ]

Dear mihxil , please find below two real-life definitions (snippets) showcasing the Delete action and its associated action confirmation dialog in two Magnolia apps:

  • Stories app, where the action is defined using the $type alias property.
  • Magnolia Assets subapp, where the action is defined using the class property.

Hopefully these snippets will make it clearer how to configure the Delete action.

 /stories-app/apps/stories.yaml

...
  actions:
...
    delete:
      icon: icon-delete
      $type: markAsDeletedAction
      availability: &notDeletedAvailability
        rules:
          notDeleted: *notDeleted
...
    confirmDeleteStory:
      successActionName: delete
      icon: icon-delete
      $type: confirmationAction
      availability:
        multiple: true
        writePermissionRequired: true
        rules:
          notDeleted: *notDeleted
...

 

/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml

...
  actions:
...
    delete:
      class: info.magnolia.ui.contentapp.action.MarkAsDeletedCommandActionDefinition
      command: markAsDeleted
      availability:
        root: false
        writePermissionRequired: true
...
    confirmDeletion:
      icon: icon-delete
      $type: confirmationAction
      successActionName: delete
      availability:
        multiple: true
        writePermissionRequired: true
        rules: &notDeletedRule
          notDeleted: &notDeleted
            $type: jcrIsDeletedRule
            negate: true
...
Comment by Michiel Meeuwissen [ 18/Jan/22 ]

I figured it out in the mean time. The bug was actually a documentation bug, may be it should be possible to figure these things out with the documentation.

Generated at Mon Feb 12 01:26:30 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.