Skip to content

Commit

Permalink
UI - Update Processes with new selection features (#154)
Browse files Browse the repository at this point in the history
* Add download as JSON, working on CSV

* Implement CSV, fix JSON exports

* Update GUI - radio button to select file type

* Update button, fix "Show All" for long stdouts

* Add DataTables js utility & use on history page

* update DT, refine history page, finish deployments

* Update css for datatables

* remove unnecessary info below table

* add DataTable to processes table

* update history to fix loading issue

* Fix sorting on history page

* Fix history not displaying all log rows

* Removing paging for test suite support

* Update processes page to fix select feature

* Fixed double sorting icon

* Add moment.js and DataTables integration -  filter

* Update where table is drawn to speed up page load

* Update REST to return all processes

* Defer renderings

* Update processes page to only load 5000 at first

* Increase search delay to increase performance

* Attempt at fixing snippets test

* Update xpath for new filter button

* Update sleep timer

* Update sleep, change from id to xpath

* Update to "waitForElementXPath"

* Copy from Selenium IDE, add sleep

* wait even longer

* Wait for process page to load

* Revert, increase waiting

* Change how we wait for add button

* Update xpath for elements

* Add wait for ajax spinner to dissappear

* Fix duration

* Need to wait even longer

* Try using search bar instead of builder

* Try to get console output

* Fix qstring missing ?

* Update to get # of procs loaded

* reduce sleep, fix merge error

* FINALLY fixed test errors - updating rest of them

* Missed where process page is loaded indirectly

* Add open selected in new tab, copy selected URL

* Add process duration to end time field

* Fix "hide subproc button" never showing subproc

* Add ability to download selected rows' logs (JSON)

* FIx deployments state

* Update message about loading more rows

* Remove unused CSV code

* Add worker IP to processes table

* Added download as CSV

* Get logs from failed test

* Remove extra logging, fix worker ip field

* Add ability to download list view of proc page
  • Loading branch information
wcgunter authored Jun 29, 2023
1 parent 194427e commit d3a0b72
Show file tree
Hide file tree
Showing 4 changed files with 762 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
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 @@ -94,6 +99,7 @@ && 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 @@ -202,6 +202,7 @@ public void runHelloWorldTest() {
// Wait for Finish
sleep(90000);


if(findOnPage("completed")) {
goToProcesses();
sleep(1000);
Expand Down
43 changes: 39 additions & 4 deletions install/cws-ui/deployments.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
.dataTables_wrapper .mylength .dataTables_length{float:right}
</style>
<script>
//STATE PERSISTANCE CONSTS
const username = "username"; //temporary, hardcoded value for now
const lastNumHoursVar = "CWS_DASH_DEPLOY_LAST_NUM_HOURS-" + username;
const refreshRateVar = "CWS_DASH_DEPLOY_REFRESH_RATE-" + username;
const hideSuspendedProcVar = "CWS_DASH_DEPLOY_HIDE_SUS-" + username;
var statsVal = {};
var statsTotalVal = {};
Expand Down Expand Up @@ -249,9 +256,12 @@
if (refreshing) return;
refreshing = true;
//grab the value here so we don't have to do it multiple times
var statsCookieValue = parseInt(localStorage.getItem(lastNumHoursVar));
$.ajax({
url: "/${base}/rest/stats/processInstanceStatsJSON",
data: lastNumHours ? "lastNumHours=" + lastNumHours : "",
data: statsCookieValue ? "lastNumHours=" + statsCookieValue : "",
success: function( data ) {
statsTotalVal.pending = 0;
Expand Down Expand Up @@ -337,6 +347,18 @@
}
}
// State persistance for refresh rate and show stats for last x hours
if (localStorage.getItem(refreshRateVar) !== null) {
$("#refresh-rate").val(localStorage.getItem(refreshRateVar)/1000);
} else {
$("#refresh-rate").val("5");
}
if (localStorage.getItem(lastNumHoursVar) !== null) {
$("#stats-last-num-hours").val(localStorage.getItem(lastNumHoursVar));
} else {
$("#stats-last-num-hours").val(24);
}
$("#process-table").DataTable({
columnDefs: [
{ orderable: false, targets: 5 },
Expand All @@ -349,7 +371,7 @@
});
refreshStats();
pageRefId = setInterval(pageRefresh, refreshRate);
pageRefId = setInterval(pageRefresh, parseInt(localStorage.getItem(refreshRateVar)));
idleTimer = setInterval(idleMode, idleInterval);
$("#resume-refresh").click(function(){
Expand Down Expand Up @@ -899,14 +921,25 @@
$("#hide-sus-btn").click(function(){
if($(this).prop("checked")){
$("#process-table tr.disabled").hide(100);
localStorage.setItem(hideSuspendedProcVar, "1");
hideall=true;
}
else{
$("#process-table tr.disabled").show(100);
localStorage.setItem(hideSuspendedProcVar, "0");
hideall=true;
}
});
$( "#hide-sus-btn" ).click(); // check by default
if(parseInt(localStorage.getItem(hideSuspendedProcVar)) == 0) {
$("#hide-sus-btn").prop("checked", false);
$("#process-table tr.disabled").show(100);
hideall==true;
}
else {
$("#hide-sus-btn").prop("checked", true);
$("#process-table tr.disabled").hide(100);
}
function listWorkersInModal(dataProcKey){
$.get("/${base}/rest/worker/"+dataProcKey+"/getWorkersForProc", function(data){
Expand Down Expand Up @@ -965,15 +998,17 @@
$("#refresh-rate").on('change',function(){
refreshRate = parseInt($(this).val()) * 1000;
localStorage.setItem(refreshRateVar, refreshRate.toString());
clearInterval(pageRefId);
if(refreshRate == 0)
return;
refreshStats();
pageRefId = setInterval(pageRefresh, refreshRate);
pageRefId = setInterval(pageRefresh, parseInt(localStorage.getItem(refreshRateVar)));
});
$("#stats-last-num-hours").on('change',function(){
lastNumHours = parseInt($(this).val()) | null;
localStorage.setItem(lastNumHoursVar, lastNumHours.toString());
refreshStats();
});
Expand Down
Loading

0 comments on commit d3a0b72

Please sign in to comment.