Skip to content

Commit

Permalink
Merge branch 'develop' into ui-detailed-status-history-page
Browse files Browse the repository at this point in the history
  • Loading branch information
wcgunter authored Jul 6, 2023
2 parents 1da9b2f + 93192d8 commit a1c4cd1
Show file tree
Hide file tree
Showing 10 changed files with 342 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class CwsProcessInstance {

private Timestamp procStartTime; // from Camunda ACT_HI_PROCINST_ table
private Timestamp procEndTime; // from Camunda ACT_HI_PROCINST_ table

private String inputVariables;

public CwsProcessInstance(
String uuid,
Expand All @@ -34,7 +36,8 @@ public CwsProcessInstance(
String claimedByWorker,
String startedByWorker,
Timestamp procStartTime,
Timestamp procEndTime) {
Timestamp procEndTime,
String inputVariables) {
super();
this.uuid = uuid;
this.procDefKey = procDefKey;
Expand All @@ -48,6 +51,7 @@ public CwsProcessInstance(
this.startedByWorker = startedByWorker;
this.procStartTime = procStartTime;
this.procEndTime = procEndTime;
this.inputVariables = inputVariables;
}

public String getUuid() {
Expand Down Expand Up @@ -82,6 +86,13 @@ public String getStatus() {
public void setStatus(String status) {
this.status = status;
}
public void setInputVariables(String input) {
this.inputVariables = input;
}

public String getInputVariables() {
return inputVariables;
}

public String getInitiationKey() {
return initiationKey;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package jpl.cws.scheduler;

import java.util.Date;

public class InputVariableDetail {

public String varName;
public String varValue;

public InputVariableDetail(String name, String value) {
this.varName = name;
this.varValue = value;
}
}
55 changes: 54 additions & 1 deletion cws-service/src/main/java/jpl/cws/service/CwsConsoleService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.Console;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
Expand Down Expand Up @@ -72,6 +73,7 @@
import jpl.cws.scheduler.CwsProcessInstance;
import jpl.cws.scheduler.ExternalWorker;
import jpl.cws.scheduler.HistoryDetail;
import jpl.cws.scheduler.InputVariableDetail;
import jpl.cws.scheduler.LogHistory;
import jpl.cws.scheduler.SchedulerQueueUtils;
import jpl.cws.scheduler.Worker;
Expand Down Expand Up @@ -610,6 +612,52 @@ public LogHistory getHistoryForProcess(String processInstanceId) {
return history;
}

public String getInputVariablesForProcess(String processInstanceId) {
List<HistoryDetail> historyDetails = new ArrayList<HistoryDetail>();
getHistoryVarDetails(historyDetails, processInstanceId);

String output = "";
String before = "";
String after = "";
int putAllAfter = 0;
int count = 0;

for (HistoryDetail historyDetail : historyDetails) {
if (historyDetail.type.equals("VarUpdate") && historyDetail.activity.equals(processInstanceId)) {
if (count > 3) {
putAllAfter = 1;
}
String message = historyDetail.message;
String varType = message.substring(message.indexOf("("), message.indexOf(")")+1);
String varName = message.substring(message.indexOf(")")+2);
varName = varName.substring(0, varName.indexOf("=")-1) + " " + varType;
String varValue = message.substring(message.indexOf("=")+2);
String temp = "<div><div style=\"width: 85%; min-height: 25px; float:left; overflow-wrap: break-word;\"><b>" + varName + ":</b> " + varValue + "</div><div style=\"width: 15%; float:right\">"
+ "<button class=\"copy\" onClick='copyInput(\"" + varValue + "\")'>"
+ "<span data-text-end=\"Copied!\" data-text-initial=\"Copy to clipboard\" class=\"tooltip\"></span>"
+ "<img src=\"images/copy.svg\" class=\"copy-icon clipboard\">"
+ "</button></div></div><br>";
if (varName.contains("workerId")) {
after = after + temp;
} else if (varName.contains("startedOnWorkerId")) {
after = after + temp;
putAllAfter = 1;
} else if (putAllAfter == 0) {
before = before + temp;
} else {
after = after + temp;
}
count++;
}
}
if (after.isEmpty()) {
output = before;
} else {
output = before + "<details><summary><b>Show All</b></summary>" + after + "</details>";
}
return output;
}

public List<ExternalWorker> getExternalWorkersUiDTO() {
List<ExternalWorker> workers = new ArrayList<ExternalWorker>();

Expand Down Expand Up @@ -1033,6 +1081,10 @@ public List<CwsProcessInstance> getFilteredProcessInstancesCamunda(String superP
String startedByWorker = (String) row.get("started_by_worker");
Timestamp procStartTime = (Timestamp) row.get("proc_start_time");
Timestamp procEndTime = (Timestamp) row.get("proc_end_time");
String inputVars = "";
if (procInstIdObj != null) {
inputVars = getInputVariablesForProcess(procInstIdObj.toString());
}
CwsProcessInstance instance = new CwsProcessInstance(uuidObj == null ? null : uuidObj.toString(),
procDefKeyObj == null ? null : procDefKeyObj.toString(),
procInstIdObj == null ? null : procInstIdObj.toString(),
Expand All @@ -1042,7 +1094,8 @@ public List<CwsProcessInstance> getFilteredProcessInstancesCamunda(String superP
createdTimestampObj == null ? null : createdTimestampObj,
updatedTimestampObj == null ? null : updatedTimestampObj,
claimedByWorker == null ? null : claimedByWorker, startedByWorker == null ? null : startedByWorker,
procStartTime == null ? null : procStartTime, procEndTime == null ? null : procEndTime);
procStartTime == null ? null : procStartTime, procEndTime == null ? null : procEndTime,
inputVars);
instances.add(instance);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.util.List;
import java.util.Set;

import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogEntry;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.support.ui.Select;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -99,7 +94,6 @@ && findOnPage("Command 'rmdir Test' exit code: 0")) {
System.out.println(e.toString());
scriptPass = false;
}

screenShot("HistoryTestIT-runResultsTest");
assertTrue("Deployments Page Test reported unexpected success value (scriptPass="+scriptPass+")", scriptPass);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void runStatusCompleteTest() throws IOException {
List<WebElement> myRows = myTable.findElements(By.tagName("tr"));

sleep(8000);

log.info("Locating Test Processes Page from table rows and verifying that it completed.");
waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ public void runHelloWorldTest() {
// Wait for Finish
sleep(90000);


if(findOnPage("completed")) {
goToProcesses();
sleep(1000);
Expand Down
108 changes: 107 additions & 1 deletion cws-ui/src/main/webapp/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,110 @@ div[class*="bar-"]{
}
#logData th:nth-child(1){width: 100px}
#logData th:nth-child(3){width: 100px}
.no-results{text-align: center; color:red; text-transform: uppercase;}
.no-results{text-align: center; color:red; text-transform: uppercase;}

.clipboard {
height: 15px;
width: auto;
opacity: 0.5;
transition: 0.3s;
}

.clipboard:hover {
opacity: 1;
}

.svgHolder {
float: right;
}

.copy {
/* button */
--button-bg: #ffffff00;
--button-hover-bg: #ffffff00;
--button-text-color: #ffffff00;
--button-hover-text-color: #ffffff00;
--button-border-radius: px;
--button-diameter: 25px;
--button-outline-width: 1px;
--button-outline-color: rgb(141, 141, 141);
/* tooltip */
--tooltip-bg: #f4f3f3;
--toolptip-border-radius: 4px;
--tooltip-font-family: Menlo, Roboto Mono, monospace;
--tooltip-font-size: 12px;
--tootip-text-color: rgb(50, 50, 50);
--tooltip-padding-x: 7px;
--tooltip-padding-y: 7px;
--tooltip-offset: 8px;
--tooltip-transition-duration: 0.3s;
}

.copy {
box-sizing: border-box;
width: var(--button-diameter);
height: var(--button-diameter);
border-radius: var(--button-border-radius);
background-color: var(--button-bg);
color: var(--button-text-color);
border: none;
cursor: pointer;
position: relative;
outline: none;
float: right;
}

.tooltip {
position: absolute;
opacity: 0;
visibility: 0;
top: 0;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
color: var(--tootip-text-color);
background: var(--tooltip-bg);
padding: var(--tooltip-padding-y) var(--tooltip-padding-x);
border-radius: var(--toolptip-border-radius);
pointer-events: none;
transition: all var(--tooltip-transition-duration) cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.tooltip::before {
content: attr(data-text-initial);
}

.tooltip::after {
content: "";
position: absolute;
bottom: calc(var(--tooltip-padding-y) / 2 * -1);
width: var(--tooltip-padding-y);
height: var(--tooltip-padding-y);
background: inherit;
left: 50%;
transform: translateX(-50%) rotate(45deg);
z-index: -999;
pointer-events: none;
}

.copy svg {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}


/* actions */

.copy:hover .tooltip,
.copy:focus:not(:focus-visible) .tooltip {
opacity: 1;
visibility: visible;
top: calc((100% + var(--tooltip-offset)) * -1);
}

.copy:focus:not(:focus-visible) .tooltip::before {
content: attr(data-text-end);
}

17 changes: 17 additions & 0 deletions cws-ui/src/main/webapp/images/copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a1c4cd1

Please sign in to comment.