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

Allow custom adaptation actions to be added to the actions dropdown #99

Merged
merged 4 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cws-ui/src/main/webapp/js/adaptation-process-actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// override with js code file in your adaptation project for example like this
// cp your-cws-adaptation/src/main/resources/cws-ui/adaptation-process-actions.js common-workflow-service/cws-ui/src/web/main/webapp/js/adaptation-process-actions.js
function updateAdaptationActionList() {
return; // CWS core behavior is to do nothing here
}


// any other functions called by the actions added in your adaptation-process-actions.ftl file
12 changes: 12 additions & 0 deletions install/cws-ui/adaptation-process-actions.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- override with adaptation actions
For example to add one action to the dropdown create a
file adaptation-process-actions.ftl in your adaptation project with

<li id="action_retry_failed_error" class="disabled" role="presentation"><a role="menuitem" href="javascript:action_retry_failed_error();">Retry all selected failed rows (all rows selected must be 'fail')</a></li>

Add the javascript functions invoked by these actions [action_retry_failed_error() in the action above]
to the adaptation-process-actions.js file in your adaptation project
In your adaptation project override this file with
cp your-cws-adaptation/src/main/resources/cws-ui/adaptation-process-actions.ftl common-workflow-service/install/cws-ui/adaptation-process-actions.ftl
-->

6 changes: 6 additions & 0 deletions install/cws-ui/processes.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<script src="/${base}/js/jquery.min.js"></script>
<script src="/${base}/js/bootstrap.min.js"></script>
<script src="/${base}/js/bootstrap-datepicker.min.js"></script>
<!-- Custom js adaptation script; override this file from your adaptation project -->
<script src="/${base}/js/adaptation-process-actions.js"></script>
<link href="/${base}/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="/${base}/css/dashboard.css" rel="stylesheet">
Expand Down Expand Up @@ -148,6 +150,7 @@
<li id="action_retry_incident" class="disabled" role="presentation"><a role="menuitem" href="javascript:action_retry_incident_rows();">Retry all selected incident rows (all rows selected must be 'incident')</a></li>
<li id="action_retry_failed_to_start" class="disabled" role="presentation"><a role="menuitem" href="javascript:action_retry_failed_to_start();">Retry all selected failed to start rows (all rows selected must be 'failedToStart')</a></li>
<li id="action_mark_as_resolved" class="disabled" role="presentation"><a role="menuitem" href="javascript:action_mark_as_resolved();">Mark all selected failed rows as resolved (all rows selected must be 'fail')</a></li>
<#include "adaptation-process-actions.ftl">
</ul>
</div>
<div id="hide-subprocs-div">
Expand Down Expand Up @@ -555,6 +558,9 @@
else if (failed) {
$("#action_mark_as_resolved").removeClass("disabled");
}

// Execute adaptation actions if any
updateAdaptationActionList();
}


Expand Down