Skip to content

Commit

Permalink
Fixes to Processes and Deployments pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrodjpl committed Nov 4, 2024
1 parent e46e622 commit 83f7219
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
31 changes: 24 additions & 7 deletions install/cws-ui/deployments.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
if (type !== 'display') {
return "";
} else {
var html = `<button type="button" id="pv-` + data + `" class="btn btn-sm worker-view-btn"`
var html = `<button type="button" id="pv-` + data + `" class="btn btn-sm worker-view-btn btn-outline-dark"`
+ `data-proc-key="` + data + `">view</button>`;
return html;
}
Expand Down Expand Up @@ -794,7 +794,21 @@
$("#btn-suspend-" + procDefKey).attr("onclick", "suspendProcDef('" + procDefId + "', '" + procDefKey + "')");
$("#status-txt-" + procDefKey).html("Active");
$("#" + procDefKey).removeClass("disabled");
$("#pv-" + procDefKey).removeClass("disabled").removeClass("btn-outline-dark").addClass("btn").text("enable");
$.get("/${base}/rest/processes/getProcDefWorkerCount", function(data) {
var rows = JSON.parse(data);
var hasWorker = false;
for (i in rows) {
if (rows[i].pdk === procDefKey && rows[i].workers > 0) {
hasWorker = true;
break;
}
}
if (hasWorker) {
$("#pv-" + procDefKey).removeClass("disabled btn-danger").addClass("btn-outline-dark").text("view");
} else {
$("#pv-" + procDefKey).removeClass("disabled btn-outline-dark").addClass("btn-danger").text("enable");
}
});
},
error: function (data) {
console.log("error activating");
Expand Down Expand Up @@ -1227,12 +1241,15 @@
$.get("/${base}/rest/processes/getProcDefWorkerCount", function (data) {
var rows = JSON.parse(data)
for (i in rows) {
if (rows[i].workers == 0) {
$("#pv-" + rows[i].pdk).removeClass("btn-default").addClass("btn-danger");
$("#pv-" + rows[i].pdk).text("enable");
const table = $("#process-table").DataTable();
const rowData = table.row("#" + rows[i].pdk).data();
if (rowData && rowData.suspended === "true") {
$("#pv-" + rows[i].pdk).removeClass("btn-danger").addClass("btn-outline-dark").text("view");
} else if (rows[i].workers == 0) {
$("#pv-" + rows[i].pdk).removeClass("btn-default").addClass("btn-danger").text("enable").removeClass("btn-outline-dark");
} else {
$("#pv-" + rows[i].pdk).removeClass("btn-danger").addClass("btn-outline-dark");
$("#pv-" + rows[i].pdk).text("view");
$("#pv-" + rows[i].pdk).removeClass("btn-danger").addClass("btn-outline-dark").text("view").addClass("btn-outline-dark");
}
}
});
Expand Down
7 changes: 2 additions & 5 deletions install/cws-ui/processes.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1554,11 +1554,8 @@
contentType: "application/json",
data: JSON.stringify(procInstIds),
success: function (msg) {
//clear table
table.clear().draw();
//reload table
fetchAndDisplayProcesses();
}
fetchAndDisplayProcesses();
}
})
.fail(function (xhr, err) {
console.error(xhr.responseTextmsg);
Expand Down

0 comments on commit 83f7219

Please sign in to comment.