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

Edit Content: Investigate how the Assign and Comment option in a Workflow Action works #26903

Closed
Tracked by #25445
jcastro-dotcms opened this issue Dec 6, 2023 · 5 comments

Comments

@jcastro-dotcms
Copy link
Contributor

jcastro-dotcms commented Dec 6, 2023

Parent Issue

#25445

Task

We need to do some research on how the Assign and Comment option in a Workflow Action works as we move to the new Contentlet Edit mode built 100% on Angular. The existing code must be analyzed in order to determine whether new endpoints must be created or not.

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

Acceptance Criteria

No response

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

@fmontes
Copy link
Member

fmontes commented Dec 6, 2023

@jcastro-dotcms Let's timebox this to 2-3h and see where we can get.

@fmontes fmontes changed the title [Workflows] : Investigate how the Assign and Comment option in a Workflow Action works Edit Content: Investigate how the Assign and Comment option in a Workflow Action works Dec 7, 2023
@jcastro-dotcms
Copy link
Contributor Author

How the pop-up dialog works

Every action in a Workflow is looped and displayed to the user in the following code:

https://github.com/dotCMS/core/blob/master/dotCMS/src/main/webapp/html/portlet/ext/contentlet/contentlet_actions_inc.jsp#L233

Clicking a button -- i.e., Workflow Action -- has the option to display a second dialog based on the criteria defined in this line:

https://github.com/dotCMS/core/blob/master/dotCMS/src/main/webapp/html/portlet/ext/contentlet/contentlet_actions_inc.jsp#L241

Which means that, if at least one condition is met, such a dialog will show up if the Workflow Action:

  • Has a Push Publishing Actionlet.
  • Is assignable.
  • Is commentable.
  • Has a Move Actionlet BUT the destination path is not set yet.
  • There's custom code set in the Actionlet.

The method that will be called is located here:

https://github.com/dotCMS/core/blob/master/dotCMS/src/main/webapp/html/portlet/ext/contentlet/edit_contentlet_js_inc.jsp#L823

And, if the Workflow Action is "popupable", then the PushHandler.js file will take care of displaying the dialog:

https://github.com/dotCMS/core/blob/master/dotCMS/src/main/webapp/html/portlet/ext/contentlet/edit_contentlet_js_inc.jsp#L842

Where information such as the Push Publishing environments and the Role Read Store is retrieved:

https://github.com/dotCMS/core/blob/master/dotCMS/src/main/webapp/html/js/dotcms/dojo/push/PushHandler.js#L192

Finally, it calls the show method in this file:

https://github.com/dotCMS/core/blob/master/dotCMS/src/main/webapp/html/js/dotcms/dijit/RemotePublisherDialog.js#L25

And dispatches an Angular Dialog event which takes care of accepting user input:

https://github.com/dotCMS/core/blob/master/dotCMS/src/main/webapp/html/js/dotcms/dijit/RemotePublisherDialog.js#L154

@jdotcms
Copy link
Contributor

jdotcms commented Dec 12, 2023

How to do a comment

On the Action
Screenshot 2023-12-12 at 12 02 59 PM

As a Json:
Screenshot 2023-12-12 at 12 03 14 PM

How to call it

curl --location --request PUT 'https://demo.dotcms.com/api/v1/workflow/actions/2766135b-f003-4738-8e94-e7b69f41f9d4/fire' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW5AZG90Y21zLmNvbTphZG1pbg==' \
--data '{
    "comments":"This is a Test title comment test",
    "contentlet" : {
        "contentType":"webPageContent",
        "contentHost":"demo.dotcms.com",
        "title":"Test Title",
        "body":"Test Body"
    }
}'

Will looks such as this as a result on Task Porlet
Screenshot 2023-12-12 at 12 14 27 PM

@jdotcms
Copy link
Contributor

jdotcms commented Dec 12, 2023

If you want to do assign, simple version
Screenshot 2023-12-12 at 12 25 19 PM

The json looks like
Screenshot 2023-12-12 at 12 25 56 PM

The call will looks ike

curl --location --request PUT 'https://demo.dotcms.com/api/v1/workflow/actions/2766135b-f003-4738-8e94-e7b69f41f9d4/fire' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW5AZG90Y21zLmNvbTphZG1pbg==' \
--data '{
    "assign":"1cad5929-b42d-4049-b76e-3ce39e042574",
    "contentlet" : {
        "contentType":"webPageContent",
        "contentHost":"demo.dotcms.com",
        "title":"Test Title3",
        "body":"Test Body"
    }
}'

And finally the result will be

Screenshot 2023-12-12 at 12 20 54 PM

@jdotcms
Copy link
Contributor

jdotcms commented Dec 12, 2023

if you select a role instead of an user
Screenshot 2023-12-12 at 12 51 55 PM

the json looks like

Uploading Screenshot 2023-12-12 at 12.54.08 PM.png…

the rest is similar to the previous example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants