Skip to content

Commit

Permalink
UI - Add and implement data tables (#153)
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 process page loading indirectly

* Update completed element ID path

* Update css selector

* add screenshots for debugging

* Remove reference to "complete" button
  • Loading branch information
wcgunter authored Jun 26, 2023
1 parent 9f4f682 commit 194427e
Show file tree
Hide file tree
Showing 315 changed files with 288,505 additions and 510 deletions.
12 changes: 2 additions & 10 deletions cws-core/src/main/java/jpl/cws/core/db/SchedulerDbService.java
Original file line number Diff line number Diff line change
Expand Up @@ -914,12 +914,6 @@ public List<Map<String,Object>> getFilteredProcessInstances(
if (procDefKey != null) { whereObjs.add(procDefKey); }
if (minDate != null) { whereObjs.add(minDate); }
if (maxDate != null) { whereObjs.add(maxDate); }

Integer offset = page*PROCESSES_PAGE_SIZE;
Integer size = PROCESSES_PAGE_SIZE;

whereObjs.add(offset);
whereObjs.add(size);

String pattern = PENDING + "|" + DISABLED + "|" + FAILED_TO_START + "|" + FAILED_TO_SCHEDULE + "|"
+ CLAIMED_BY_WORKER + "|" + RUNNING + "|" + COMPLETE + "|" + RESOLVED + "|" + FAIL + "|" + INCIDENT;
Expand All @@ -942,8 +936,7 @@ public List<Map<String,Object>> getFilteredProcessInstances(
(maxDate != null ? "created_time <= ? AND " : "") +
(statusList != null ? "status IN "+statusClause+" AND " : "") +
" proc_inst_id IS NULL " + // don't get any started processes
"ORDER BY created_time " + dateOrderBy + " " +
"LIMIT ?,?";
"ORDER BY created_time " + dateOrderBy + " ";

List<Map<String,Object>> cwsRows = jdbcTemplate.queryForList(cwsQuery, whereObjs.toArray());

Expand Down Expand Up @@ -975,8 +968,7 @@ public List<Map<String,Object>> getFilteredProcessInstances(
(minDate != null ? "PI.start_time >= ? AND " : "") +
(maxDate != null ? "PI.start_time <= ? AND " : "") +
" 1=1 " +
"ORDER BY PI.start_time " + dateOrderBy + " " +
"LIMIT ?,?";
"ORDER BY PI.start_time " + dateOrderBy + " ";

List<Map<String,Object>> camundaRows = jdbcTemplate.queryForList(camundaQuery, whereObjs.toArray());

Expand Down
12 changes: 9 additions & 3 deletions cws-service/src/main/java/jpl/cws/controller/RestService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1139,9 +1139,10 @@ public GsonUTCDateAdapter() {
) {

List<CwsProcessInstance> instances = null;
int recordsToReturn = 0;
Integer pageNum = Integer.parseInt(page);
try {
Integer pageNum = Integer.parseInt(page);


dateOrderBy = dateOrderBy.toUpperCase();
if (!dateOrderBy.equals("DESC") && !dateOrderBy.equals("ASC")) {
log.error("Invalid dateOrderBy of " + dateOrderBy + "! Forcing to be 'DESC'");
Expand All @@ -1156,13 +1157,18 @@ public GsonUTCDateAdapter() {

instances = cwsConsoleService.getFilteredProcessInstancesCamunda(
superProcInstId, procInstId, procDefKey, status, minDate, maxDate, dateOrderBy, pageNum);
if (pageNum > instances.size()) {
recordsToReturn = instances.size();
} else {
recordsToReturn = pageNum;
}
}
catch (Exception e) {
log.error("Problem getting process instance information!", e);
// return an empty set
return new GsonBuilder().setPrettyPrinting().create().toJson(new ArrayList<CwsProcessInstance>());
}
return new GsonBuilder().setPrettyPrinting().create().toJson(instances);
return new GsonBuilder().setPrettyPrinting().create().toJson(instances.subList(0,recordsToReturn));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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.support.ui.Select;
import org.slf4j.Logger;
Expand Down Expand Up @@ -63,15 +64,11 @@ public void runResultsTest() throws IOException {
goToPage("processes");

log.info("Filtering Test History Page results.");
waitForElementID("pd-select");
Select select = new Select(findElById("pd-select"));
select.selectByVisibleText("Test History Page");
waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");

waitForElementID("filter-submit-btn");

log.info("Clicking 'Submit' button.");
WebElement filterSubmit = findElById("filter-submit-btn");
filterSubmit.click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys("test_history_page");
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys(Keys.ENTER);

waitForElementID("processes-table");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ public void runVariableProcTest() throws IOException {
goToPage("processes");

log.info("Filtering results for Test Initiators Page test.");
waitForElementID("pd-select");
Select select = new Select(findElById("pd-select"));
select.selectByVisibleText("Test Initiators Page");
waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");

waitForElementID("filter-submit-btn");

WebElement filterSubmit = findElById("filter-submit-btn");
filterSubmit.click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys("test_initiators_page");
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys(Keys.ENTER);

waitForElementID("processes-table");

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

import java.io.IOException;
import java.time.Duration;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;

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.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -106,16 +116,13 @@ public void runSnippetsModelTest() throws IOException {
startProcDef("test_snippets_page", "Test Snippets Page", 90000);

goToPage("processes");
sleep(8000);

waitForElementID("pd-select");
log.info("Filter for Test Snippets Page results.");
Select select = new Select(findElById("pd-select"));
select.selectByVisibleText("Test Snippets Page");
waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");

waitForElementID("filter-submit-btn");

WebElement filterSubmit = findElById("filter-submit-btn");
filterSubmit.click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys("test_snippets_page");
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys(Keys.ENTER);

waitForElementID("processes-table");

Expand Down
Loading

0 comments on commit 194427e

Please sign in to comment.