From 31d16f4ade4e5ad6539237430dc9c021b4172e4c Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Wed, 2 Aug 2023 13:32:31 -0700 Subject: [PATCH 01/13] Add error handling if mimetype is not set. --- .../jpl/cws/service/CwsConsoleService.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/cws-service/src/main/java/jpl/cws/service/CwsConsoleService.java b/cws-service/src/main/java/jpl/cws/service/CwsConsoleService.java index f0824545..14ea1a97 100644 --- a/cws-service/src/main/java/jpl/cws/service/CwsConsoleService.java +++ b/cws-service/src/main/java/jpl/cws/service/CwsConsoleService.java @@ -675,18 +675,23 @@ public Map getOutputVariablesForProcess(String processInstanceId FileValue fileValue = (FileValue) typedValue; String fileName = fileValue.getFilename(); String mimeType = fileValue.getMimeType(); - if (mimeType.contains("image")) { - InputStream fileInputStream = fileValue.getValue(); - String encodedString = "data:" + mimeType + ";base64, "; - try { - byte[] sourceBytes = IOUtils.toByteArray(fileInputStream); - encodedString += Base64.getEncoder().encodeToString(sourceBytes); - } catch (IOException e) { - throw new RuntimeException(e); + if (mimeType != null) { + if (mimeType.contains("image")) { + InputStream fileInputStream = fileValue.getValue(); + String encodedString = "data:" + mimeType + ";base64, "; + try { + byte[] sourceBytes = IOUtils.toByteArray(fileInputStream); + encodedString += Base64.getEncoder().encodeToString(sourceBytes); + } catch (IOException e) { + throw new RuntimeException(e); + } + outputVarMap.put(varName + " (" + varType + ", " + mimeType + ")", encodedString); + } else { + outputVarMap.put(varName + " (" + varType + ")", fileName); } - outputVarMap.put(varName + " (" + varType + ", " + mimeType + ")", encodedString); } else { - outputVarMap.put(varName + " (" + varType + ")", fileName); + log.error("PROCESSES PAGE: Encountered an error when trying to detect the mime type of an image. Did you add a mimeType to the file when creating it?"); + outputVarMap.put(varName + "(" + varType + ")", "ERROR: File does not have a mime type."); } } } From 1be8eabeb46a7adb6a47f10f2d9fed512f9b806b Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Wed, 2 Aug 2023 13:35:07 -0700 Subject: [PATCH 02/13] Add column for "edit" and "delete" buttons --- cws-ui/src/main/webapp/css/deployments.css | 18 ++++++--- install/cws-ui/deployments.ftl | 47 ++++++++++++++-------- 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/cws-ui/src/main/webapp/css/deployments.css b/cws-ui/src/main/webapp/css/deployments.css index 9891bb67..5b4a0fbf 100644 --- a/cws-ui/src/main/webapp/css/deployments.css +++ b/cws-ui/src/main/webapp/css/deployments.css @@ -108,23 +108,22 @@ #process-table tr td { vertical-align: middle; padding: 4px 8px; - min-width: 70px; } -#process-table tr td:nth-child(1) { +#process-table tr td:nth-child(2) { min-width: 200px; overflow: hidden; text-wrap: none } #process-table tr td:nth-child(3) { - text-align: center; - width: 70px; + overflow-wrap: break-word; + max-width: 200px; } #process-table tr td:nth-child(4) { text-align: center; - width: 70px; + max-width: 50px; } #process-table tr td:nth-child(5) { @@ -132,6 +131,15 @@ width: 70px; } +#process-table tr td:nth-child(6) { + text-align: center; + width: 70px; +} + +#process-table tr td:nth-child(7) { + min-width: 400px; +} + .progress { margin: 0px; } diff --git a/install/cws-ui/deployments.ftl b/install/cws-ui/deployments.ftl index 1e1ed7dc..a83653ce 100644 --- a/install/cws-ui/deployments.ftl +++ b/install/cws-ui/deployments.ftl @@ -371,17 +371,27 @@ $("#process-table").DataTable({ columns: [ { - data: { name: "name", id: "id", key: "key" }, - render: function (data, type) { + data: { id: "id", key: "key" }, + render: function(data, type) { if (type !== 'display') { - return data.name; + return ""; } else { - var html = `
` + return `
` + `` + `` + `` - + `
`; + + `
`; + } + } + }, + { + data: { name: "name", id: "id", key: "key" }, + render: function (data, type) { + if (type !== 'display') { + return data.name; + } else { + var html = `
` + data.name + `
`; return html; } } @@ -501,9 +511,11 @@ } ], columnDefs: [ - { orderable: false, targets: 5 }, - { orderable: false, targets: 3 } + { orderable: false, targets: 0}, + { orderable: false, targets: 6 }, + { orderable: false, targets: 4 }, ], + order: [[1, "asc"]], "paging": false, //filter is top left, length is top right, info is bottom left, pagination is bottom right dom: "<'above-table-div'<'above-table-buttons'>f>" @@ -525,21 +537,21 @@ $("#hide-sus-btn").click(function () { if ($(this).prop("checked")) { - $("#process-table").DataTable().column(4).search("Active", false, true).draw(); + $("#process-table").DataTable().column(5).search("Active", false, true).draw(); localStorage.setItem(hideSuspendedProcVar, "1"); } else { - $("#process-table").DataTable().column(4).search("").draw(); + $("#process-table").DataTable().column(5).search("").draw(); } }); if (parseInt(localStorage.getItem(hideSuspendedProcVar)) == 0) { $("#hide-sus-btn").prop("checked", false); - $("#process-table").DataTable().column(4).search("").draw(); + $("#process-table").DataTable().column(5).search("").draw(); } else { $("#hide-sus-btn").prop("checked", true); - $("#process-table").DataTable().column(4).search("Active", false, true).draw(); + $("#process-table").DataTable().column(5).search("Active", false, true).draw(); } refreshStats(); @@ -822,14 +834,15 @@
- +
- - - - - + + + + + + From 2c1713bf8a8060e8ff676d5e84b0a059e5d83fee Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Wed, 2 Aug 2023 13:36:17 -0700 Subject: [PATCH 03/13] Change "Delete" to "Stop Running" --- install/cws-ui/processes.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/cws-ui/processes.ftl b/install/cws-ui/processes.ftl index 8d0e0975..9c1f45da 100644 --- a/install/cws-ui/processes.ftl +++ b/install/cws-ui/processes.ftl @@ -874,7 +874,7 @@ + `` + `` + '' - + `` + + `` + `` + `` + `` From 3b4972055bed307b58af6ecb418753b7129e7a4c Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Wed, 2 Aug 2023 14:05:45 -0700 Subject: [PATCH 04/13] Update Output Table. Move to top table. --- cws-ui/src/main/webapp/css/history.css | 3 +- install/cws-ui/history.ftl | 119 ++++++++----------------- 2 files changed, 40 insertions(+), 82 deletions(-) diff --git a/cws-ui/src/main/webapp/css/history.css b/cws-ui/src/main/webapp/css/history.css index 71e7be2a..419bad9d 100644 --- a/cws-ui/src/main/webapp/css/history.css +++ b/cws-ui/src/main/webapp/css/history.css @@ -6,7 +6,8 @@ summary { width: 100px; } .historyLimitSize { - max-height: 150px; + max-height: 200px; + max-width: 200px; } .thumbnail { margin-top: 5px !important; diff --git a/install/cws-ui/history.ftl b/install/cws-ui/history.ftl index f58de63d..2c1fb68b 100644 --- a/install/cws-ui/history.ftl +++ b/install/cws-ui/history.ftl @@ -535,42 +535,25 @@ $("#inputVariables").html("None"); } else { var output = ""; - var before = ""; - var after = ""; - var putAllAfter = 0; - var count = 0; - for (const [key, value] of Object.entries(data)) { - var temp = ""; - var tempVal = value; - var tempKey = key; - if (tempKey === "workerId") { - continue; - } - if (count > 3) { - putAllAfter = 1; - } - if (key.includes("(file, image")) { - temp = `
` + tempKey + `:

`; - } else if (checkForURL(tempVal)) { - temp = `
` + tempKey + `: ` + tempVal + `

`; - } else { - temp = `
` + tempKey + `: ` + tempVal + `

`; - } - if (tempKey === "startedOnWorkerId") { - after = after + temp; - putAllAfter = 1; - } else if (putAllAfter === 0) { - before = before + temp; - } else { - after = after + temp; + console.log(data); + for (const [key, value] of Object.entries(data).reverse()) { + var temp = ""; + var tempVal = value; + var tempKey = key; + if (key.includes("(file, image")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `:
`; + } else if (checkForURL(tempVal)) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `: ` + tempVal + `
`; + } else { + if (key.includes("(string)")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + } + temp = `
` + tempKey + `: ` + tempVal + `
`; + } + output = output + temp; } - count++; - } - if (after.length == 0) { - output = before; - } else { - output = before + "
Show All" + after + "
"; - } } $("#inputVariables").html(output); } @@ -580,45 +563,26 @@ $("#outputVariables").html("None"); } else { var output = ""; - var before = ""; - var after = ""; - var putAllAfter = 0; - var count = 0; - for (const [key, value] of Object.entries(data)) { - var temp = ""; - var tempVal = value; - var tempKey = key.substring(7); - if (tempKey === "workerId") { - continue; - } - if (count > 3) { - putAllAfter = 1; - } - if (key.includes("(file, image")) { - tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = `
` + tempKey + `:

`; - } else if (checkForURL(tempVal)) { - tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = `
` + tempKey + `: ` + tempVal + `

`; - } else { - tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = `
` + tempKey + `: ` + tempVal + `

`; - } - if (tempKey === "startedOnWorkerId") { - after = after + temp; - putAllAfter = 1; - } else if (putAllAfter === 0) { - before = before + temp; - } else { - after = after + temp; + + console.log(data); + for (const [key, value] of Object.entries(data).reverse()) { + var temp = ""; + var tempVal = value; + var tempKey = key.substring(7); + if (key.includes("(file, image")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `:
`; + } else if (checkForURL(tempVal)) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `: ` + tempVal + `
`; + } else { + if (key.includes("(string)")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + } + temp = `
` + tempKey + `: ` + tempVal + `
`; + } + output = output + temp; } - count++; - } - if (after.length == 0) { - output = before; - } else { - output = before + "
Show All" + after + "
"; - } } $("#outputVariables").html(output); } @@ -939,15 +903,8 @@ function convertMillis(millis) {
-
NameKeyVersion WorkersStatus NameKeyVersionWorkersStatus Instance Statistics
Input Variables
- -
- - - - - +
Output Variables
Output Variables
From 7f1cabf4f0201c08e92a6dce813dbd0f2aef2c80 Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Wed, 2 Aug 2023 14:19:19 -0700 Subject: [PATCH 05/13] Add warning for output vars, move style into css --- cws-ui/src/main/webapp/css/history.css | 15 +++++++++++++++ install/cws-ui/history.ftl | 14 +++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/cws-ui/src/main/webapp/css/history.css b/cws-ui/src/main/webapp/css/history.css index 419bad9d..4fa41c4b 100644 --- a/cws-ui/src/main/webapp/css/history.css +++ b/cws-ui/src/main/webapp/css/history.css @@ -58,4 +58,19 @@ summary { } summary { display: list-item; +} + +.proc-var-flex-main { + margin-bottom: 10px; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + align-items: center; +} + +.proc-var-flex-btn { + align-self: start; + margin-top: auto; + margin-bottom: auto; } \ No newline at end of file diff --git a/install/cws-ui/history.ftl b/install/cws-ui/history.ftl index 2c1fb68b..cdd44bbc 100644 --- a/install/cws-ui/history.ftl +++ b/install/cws-ui/history.ftl @@ -542,15 +542,15 @@ var tempKey = key; if (key.includes("(file, image")) { tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = `
` + tempKey + `:
`; + temp = `
` + tempKey + `:
`; } else if (checkForURL(tempVal)) { tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = `
` + tempKey + `: ` + tempVal + `
`; + temp = `
` + tempKey + `: ` + tempVal + `
`; } else { if (key.includes("(string)")) { tempKey = tempKey.substring(0, tempKey.indexOf(" (")); } - temp = `
` + tempKey + `: ` + tempVal + `
`; + temp = `
` + tempKey + `: ` + tempVal + `
`; } output = output + temp; } @@ -571,15 +571,15 @@ var tempKey = key.substring(7); if (key.includes("(file, image")) { tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = `
` + tempKey + `:
`; + temp = `
` + tempKey + `:
`; } else if (checkForURL(tempVal)) { tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = `
` + tempKey + `: ` + tempVal + `
`; + temp = `
` + tempKey + `: ` + tempVal + `
`; } else { if (key.includes("(string)")) { tempKey = tempKey.substring(0, tempKey.indexOf(" (")); } - temp = `
` + tempKey + `: ` + tempVal + `
`; + temp = `
` + tempKey + `: ` + tempVal + `
`; } output = output + temp; } @@ -904,7 +904,7 @@ function convertMillis(millis) { Input Variables - Output Variables + Output Variables
All output variables start with "output_" From ad7e9fc5b1bcdd0cef68a98ded8ae4b96a551b15 Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Wed, 2 Aug 2023 15:39:44 -0700 Subject: [PATCH 06/13] Implement output_display_order support --- install/cws-ui/history.ftl | 93 +++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 17 deletions(-) diff --git a/install/cws-ui/history.ftl b/install/cws-ui/history.ftl index cdd44bbc..31bd88fc 100644 --- a/install/cws-ui/history.ftl +++ b/install/cws-ui/history.ftl @@ -535,7 +535,6 @@ $("#inputVariables").html("None"); } else { var output = ""; - console.log(data); for (const [key, value] of Object.entries(data).reverse()) { var temp = ""; var tempVal = value; @@ -562,26 +561,86 @@ if (jQuery.isEmptyObject(data)) { $("#outputVariables").html("None"); } else { + console.log("we have atleast one output variable"); var output = ""; - - console.log(data); - for (const [key, value] of Object.entries(data).reverse()) { - var temp = ""; - var tempVal = value; - var tempKey = key.substring(7); - if (key.includes("(file, image")) { - tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = `
` + tempKey + `:
`; - } else if (checkForURL(tempVal)) { - tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = `
` + tempKey + `: ` + tempVal + `
`; - } else { - if (key.includes("(string)")) { + if (Object.keys(data).includes("output_display_order (object)")) { + //we have an order array + console.log("we have an order array"); + var orderTruncated = data["output_display_order (object)"].substring(1, data["output_display_order (object)"].length - 1).split(", "); + var fullKeys = Object.keys(data); + var fullKeysInOrder = []; + for (var i = 0; i < Object.keys(orderTruncated).length; i++) { + var result =fullKeys.findIndex(element => element.includes(orderTruncated[i])); + if (result > -1) { + fullKeysInOrder.push(fullKeys[result]); + } + } + console.log("Full keys in order: " + fullKeysInOrder); + //the orderTruncated array now contains the full keys in the order they should be displayed + for (key in fullKeysInOrder) { + console.log("Adding key: " + fullKeysInOrder[key]); + var temp = ""; + var tempVal = data[fullKeysInOrder[key]]; + var tempKey = fullKeysInOrder[key].substring(7); + if (fullKeysInOrder[key].includes("(file, image")) { tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `:
`; + } else if (checkForURL(tempVal)) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `: ` + tempVal + `
`; + } else { + if (key.includes("(string)")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + } + temp = `
` + tempKey + `: ` + tempVal + `
`; } - temp = `
` + tempKey + `: ` + tempVal + `
`; + output = output + temp; + } + //now we need to add any keys that were not in the fullKeysInOrder array + //first, determine which keys were not in the fullKeysInOrder array + var keysNotInOrder = fullKeys.filter(x => !fullKeysInOrder.includes(x)); + console.log("Keys not in order: " + keysNotInOrder); + //now add the keys that were not in the fullKeysInOrder array + for (key in keysNotInOrder) { + console.log("Adding key: " + fullKeysInOrder[key]); + var temp = ""; + var tempVal = data[keysNotInOrder[key]]; + var tempKey = keysNotInOrder[key].substring(7); + if (keysNotInOrder[key].includes("(file, image")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `:
`; + } else if (checkForURL(tempVal)) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `: ` + tempVal + `
`; + } else { + if (key.includes("(string)")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + } + temp = `
` + tempKey + `: ` + tempVal + `
`; + } + output = output + temp; + } + + } else { + //behavior for if variable "output_display_order" is not set + for (const [key, value] of Object.entries(data).reverse()) { + var temp = ""; + var tempVal = value; + var tempKey = key.substring(7); + if (key.includes("(file, image")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `:
`; + } else if (checkForURL(tempVal)) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = `
` + tempKey + `: ` + tempVal + `
`; + } else { + if (key.includes("(string)")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + } + temp = `
` + tempKey + `: ` + tempVal + `
`; + } + output = output + temp; } - output = output + temp; } } $("#outputVariables").html(output); From d733e6b06edeaff1b621aa23d0695a9e0b8fcf0e Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Wed, 2 Aug 2023 15:41:30 -0700 Subject: [PATCH 07/13] Don't display output_display_order --- install/cws-ui/history.ftl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install/cws-ui/history.ftl b/install/cws-ui/history.ftl index 31bd88fc..631c04b2 100644 --- a/install/cws-ui/history.ftl +++ b/install/cws-ui/history.ftl @@ -602,7 +602,10 @@ console.log("Keys not in order: " + keysNotInOrder); //now add the keys that were not in the fullKeysInOrder array for (key in keysNotInOrder) { - console.log("Adding key: " + fullKeysInOrder[key]); + if (keysNotInOrder[key] == "output_display_order (object)") { + continue; + } + console.log("Adding key: " + keysNotInOrder[key]); var temp = ""; var tempVal = data[keysNotInOrder[key]]; var tempKey = keysNotInOrder[key].substring(7); From 58d3a6874072721d1787dd4b20c9642dc7a67b45 Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Wed, 2 Aug 2023 16:07:45 -0700 Subject: [PATCH 08/13] Update processes page to consider order output var --- install/cws-ui/processes.ftl | 168 +++++++++++++++++++++-------------- 1 file changed, 103 insertions(+), 65 deletions(-) diff --git a/install/cws-ui/processes.ftl b/install/cws-ui/processes.ftl index 9c1f45da..8b067aaf 100644 --- a/install/cws-ui/processes.ftl +++ b/install/cws-ui/processes.ftl @@ -560,13 +560,6 @@ + "" + "" + "
"; - if (putAllAfter === 0) { - putAllAfter = 1; - after = before + after; - before = temp; - count++; - continue; - } } else if (checkForURL(tempVal)) { tempKey = tempKey.substring(0, tempKey.indexOf(" (")); temp = "
" + tempKey + ": " + "" + tempVal + "" + "
" @@ -651,75 +644,120 @@ return ""; } if (type === 'display') { + console.log("we have atleast one output variable"); var output = ""; var before = ""; var after = ""; - var putAllAfter = 0; var count = 0; - for (const [key, value] of Object.entries(data)) { - var temp = ""; - var tempVal = value; - var tempKey = key.substring(7); - if (tempKey === "workerId") { - continue; + if (Object.keys(data).includes("output_display_order (object)")) { + //we have an order array + console.log("we have an order array"); + var orderTruncated = data["output_display_order (object)"].substring(1, data["output_display_order (object)"].length - 1).split(", "); + var fullKeys = Object.keys(data); + var fullKeysInOrder = []; + for (var i = 0; i < Object.keys(orderTruncated).length; i++) { + var result =fullKeys.findIndex(element => element.includes(orderTruncated[i])); + if (result > -1) { + fullKeysInOrder.push(fullKeys[result]); + } } - if (count > 3) { - putAllAfter = 1; + console.log("Full keys in order: " + fullKeysInOrder); + //the orderTruncated array now contains the full keys in the order they should be displayed + for (key in fullKeysInOrder) { + var temp = ""; + var tempVal = data[fullKeysInOrder[key]]; + var tempKey = fullKeysInOrder[key].substring(7); + if (fullKeysInOrder[key].includes("(file, image")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = "
" + tempKey + ": " + + '
' + + "
" + + "" + + "" + + "

"; + } else if (checkForURL(tempVal)) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = "
" + tempKey + ": " + "" + tempVal + "" + "
" + + "" + + "" + + "

"; + } else { + if (tempKey.toUpperCase().includes("(STRING)")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + } + temp = "
" + tempKey + ": " + tempVal + "
" + + "" + + "" + + "

"; + } + if (count > 2) { + after += temp; + } else { + before += temp; + } + count++; } - if (key.includes("(file, image")) { - tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = "
" + tempKey + ": " - + '
' - + "
" - + "" - + "" - + "

"; - if (key.toUpperCase().includes("THUMBNAIL")) { - putAllAfter = 1; - after = before + after; - before = temp; - count++; + if (after !== "") { + output = before + '
Show All' + after + "
"; + } else { + output = before; + } + } else { + for (const [key, value] of Object.entries(data)) { + var temp = ""; + var tempVal = value; + var tempKey = key.substring(7); + if (tempKey === "workerId") { continue; - } else if (putAllAfter === 0) { - putAllAfter = 1; - after = before + after; - before = temp; + } + if (key.includes("(file, image")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = "
" + tempKey + ": " + + '
' + + "
" + + "" + + "" + + "

"; + if (key.toUpperCase().includes("THUMBNAIL")) { + after = before + after; + before = temp; + count += 2; + continue; + } + } else if (checkForURL(tempVal)) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = "
" + tempKey + ": " + "" + tempVal + "" + "
" + + "" + + "" + + "

"; + } else if (tempKey.toUpperCase().includes("SUMMARY")){ + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + temp = "
" + tempKey + ": " + tempVal + "
" + + "" + + "" + + "

"; + before = before + temp; count++; continue; + } else { + if (tempKey.toUpperCase().includes("(STRING)")) { + tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + } + temp = "
" + tempKey + ": " + tempVal + "
" + + "" + + "" + + "

"; } - } else if (checkForURL(tempVal)) { - tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = "
" + tempKey + ": " + "" + tempVal + "" + "
" - + "" - + "" - + "

"; - } else if (tempKey.toUpperCase().includes("SUMMARY")){ - tempKey = tempKey.substring(0, tempKey.indexOf(" (")); - temp = "
" + tempKey + ": " + tempVal + "
" - + "" - + "" - + "

"; - before = before + temp; - count++; - continue; - } else { - if (tempKey.toUpperCase().includes("(STRING)")) { - tempKey = tempKey.substring(0, tempKey.indexOf(" (")); + if (tempKey === "startedOnWorkerId") { + after = after + temp; + count += 2; + } else if (count < 2) { + before = before + temp; + } else { + after = after + temp; } - temp = "
" + tempKey + ": " + tempVal + "
" - + "" - + "" - + "

"; - } - if (tempKey === "startedOnWorkerId") { - after = after + temp; - putAllAfter = 1; - } else if (putAllAfter === 0) { - before = before + temp; - } else { - after = after + temp; + count++; } - count++; } if (after.length == 0) { output = before; @@ -776,7 +814,7 @@ width: "200px" }, { - targets: [2], + targets: [1, 2], responsivePriority: 1 }, { From 15ddc457acce6e4e76ab5f4650253bda1aa206bc Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Thu, 3 Aug 2023 08:37:25 -0700 Subject: [PATCH 09/13] Add test model --- install/cws-ui/logs.ftl | 72 +++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/install/cws-ui/logs.ftl b/install/cws-ui/logs.ftl index 59cd61f7..b8a91fc9 100644 --- a/install/cws-ui/logs.ftl +++ b/install/cws-ui/logs.ftl @@ -64,9 +64,6 @@ } }, "sort":{ - "@timestamp":{ - "order":"desc" - } } }; @@ -133,7 +130,7 @@ $(document).ready(function(){ //show ajax spinner - $("#log-div .ajax-spinner").show(); + $(".ajax-spinner").show(); document.addEventListener("click", function (e) { closeAllLists(e.target); @@ -173,11 +170,9 @@ serverSide: true, searchDelay: 250, dom: 'Bfrtip', - ordering: false, - "initComplete": function(settings, json) { //hide ajax spinner - $("#log-div .ajax-spinner").hide(); + $(".ajax-spinner").hide(); if ($("#logData_info").text().includes(" of 10,000 entries")) { $("#warning-msg").show(); } else { @@ -191,6 +186,7 @@ } }); }, + order: [[0, 'desc']], columnDefs: [ { targets: [1,2,5,6], @@ -198,7 +194,7 @@ }, { targets: [0], - width: "215px" + width: "215px", }, { targets: [1], @@ -211,7 +207,7 @@ { targets: [4], width: "150px" - } + }, ], buttons: [ { @@ -248,14 +244,61 @@ //we need to change the esReq to return the requested number of elements mainEsReq.size = data.length; - var returnData; - var fetchError = ""; + //we need to support sorting + //get the column # and direction we are sorting + var sortCol = data.order[0].column; + console.log("sortCol: " + sortCol); + var sortDir = data.order[0].dir; + + //get the column name + //NOTE: ES does not support sorting on all data types (especially text) + //However, since ES 5, text fields have a keyword subfield that can be used for sorting + var sortColName = ""; + switch (sortCol) { + case 0: + sortColName = "@timestamp"; + break; + case 1: + sortColName = "cwsHost.keyword"; + break; + case 2: + sortColName = "cwsWorkerId.keyword"; + break; + case 3: + sortColName = "logLevel.keyword"; + break; + case 4: + sortColName = "threadName.keyword"; + break; + case 5: + sortColName = "procDefKey.keyword"; + break; + case 6: + sortColName = "procInstId.keyword"; + break; + case 7: + sortColName = "msgBody.keyword"; + break; + default: + sortColName = "@timestamp"; + break; + } + //update the esreq + mainEsReq.sort = {}; + mainEsReq.sort = { + [sortColName]: { + "order": sortDir + } + }; + var returnData; + var fetchError = ""; //console.log("STRINGIFIED: " + JSON.stringify(esReq)); //console.log("ENCODED: " + encodeURIComponent(JSON.stringify(esReq))); var local_esReq = JSON.stringify(mainEsReq); + console.log("STRINGIFIED: " + local_esReq); local_esReq = encodeURIComponent(local_esReq); //sometimes double quotes get left here? replace double quotes with url encoded local_esReq = local_esReq.replace(/"/g, "%22"); @@ -267,6 +310,7 @@ async: false, success: function (ajaxData) { returnData = ajaxData; + console.log(returnData); //we should have our data now. We need to format it for the table var formattedData = []; for (hit in returnData.hits.hits) { @@ -546,7 +590,7 @@ }); function refreshLogs(){ - $("#log-div .ajax-spinner").show(); + $(".ajax-spinner").show(); //update timestamp to grab new logs var oldNow = now; now=moment().format("YYYY-MM-DDTHH:mm:ss.SSSSSSZ"); @@ -565,7 +609,7 @@ } $("#logData").DataTable().ajax.reload(function(){ - $("#log-div .ajax-spinner").hide(); + $(".ajax-spinner").hide(); },false); } @@ -635,7 +679,7 @@
- Warning: Only the most recent 10,000 entries are displayed. Please narrow your search criteria. + Warning: Only the first 10,000 entries are displayed. Please narrow your search criteria. Filter
From 29d9dcee6d080dbdc2f182c0f9313254f1f182a4 Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Thu, 3 Aug 2023 08:37:42 -0700 Subject: [PATCH 10/13] Update logs css --- cws-ui/src/main/webapp/css/logs.css | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cws-ui/src/main/webapp/css/logs.css b/cws-ui/src/main/webapp/css/logs.css index 63426580..90861120 100644 --- a/cws-ui/src/main/webapp/css/logs.css +++ b/cws-ui/src/main/webapp/css/logs.css @@ -183,4 +183,14 @@ div.dts tbody th, div.dts tbody td { #logData_info.dataTables_info { padding-top: 0px; -} \ No newline at end of file +} + +.ajax-spinner{ + height: 100%; + width:100%; + position: absolute; + z-index: 10; + background: #fff url('../images/ajax-spin.gif') no-repeat center; + opacity: 0.8; + display: none; + } \ No newline at end of file From a7d50262dfe832d66b5e98fd61e443d3abaf0b5a Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Thu, 3 Aug 2023 08:40:42 -0700 Subject: [PATCH 11/13] Add model --- install/bpmn/test_model_outputs.bpmn | 77 ++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 install/bpmn/test_model_outputs.bpmn diff --git a/install/bpmn/test_model_outputs.bpmn b/install/bpmn/test_model_outputs.bpmn new file mode 100644 index 00000000..2f5e7927 --- /dev/null +++ b/install/bpmn/test_model_outputs.bpmn @@ -0,0 +1,77 @@ + + + + + Flow_1q8gfr0 + + + + Flow_1q8gfr0 + Flow_03wb2sk + var int_type = 13; +execution.setVariable("output_int_var", int_type); + +var float_type = 15.4; +execution.setVariable("output_float_var", float_type); + +var string_type = "this is my output summary" +execution.setVariable("output_summary", string_type); + +var bool_type = true; +execution.setVariable("output_bool_var", bool_type); + +// Set display order +var display_order = new java.util.ArrayList(); +display_order.add("output_bool_var"); +display_order.add("output_summary"); +display_order.add("output_int_var"); +display_order.add("output_thumbnail"); + +execution.setVariable("output_display_order", display_order); + + + + Flow_0nh4lr9 + + + + + Flow_03wb2sk + Flow_0nh4lr9 + var typedFileValue = org.camunda.bpm.engine.variable.Variables.fileValue("robin.jpeg").file(new java.io.File("/Users/jwood/Pictures/robin.jpeg")).mimeType("image/jpeg").encoding("UTF-8").create(); + +execution.setVariable("output_thumbnail", typedFileValue); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ecf3aefc60c0c3d3d5aec2d1e01de841c4efe83a Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Thu, 3 Aug 2023 10:23:18 -0700 Subject: [PATCH 12/13] Update test --- .../test/java/jpl/cws/test/integration/ui/ProcessesTestIT.java | 1 + 1 file changed, 1 insertion(+) diff --git a/cws-test/src/test/java/jpl/cws/test/integration/ui/ProcessesTestIT.java b/cws-test/src/test/java/jpl/cws/test/integration/ui/ProcessesTestIT.java index 14f4d18a..c8354e4f 100644 --- a/cws-test/src/test/java/jpl/cws/test/integration/ui/ProcessesTestIT.java +++ b/cws-test/src/test/java/jpl/cws/test/integration/ui/ProcessesTestIT.java @@ -64,6 +64,7 @@ public void runStatusCompleteTest() throws IOException { log.info("------ START ProcessesTestIT:runStatusCompleteTest ------"); goToPage("processes"); + sleep(20000); log.info("Getting info from table..."); wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.tagName("table"))); From 9112f15c1e5d805c5ce2b45c72d85643cb809ee5 Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Thu, 3 Aug 2023 10:36:40 -0700 Subject: [PATCH 13/13] Move model to correct folder --- install/{ => dev}/bpmn/test_model_outputs.bpmn | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename install/{ => dev}/bpmn/test_model_outputs.bpmn (100%) diff --git a/install/bpmn/test_model_outputs.bpmn b/install/dev/bpmn/test_model_outputs.bpmn similarity index 100% rename from install/bpmn/test_model_outputs.bpmn rename to install/dev/bpmn/test_model_outputs.bpmn