diff options
author | Ryan Campbell <ryanjcampbell@google.com> | 2017-06-20 09:47:37 -0700 |
---|---|---|
committer | Ryan Campbell <ryanjcampbell@google.com> | 2017-06-20 09:56:04 -0700 |
commit | 87ca458fa12b81ccbfd7d8aeb3bb5a677625b956 (patch) | |
tree | 3474b2bcfd168c99976caf7ac6a0534fe26e7850 | |
parent | 67c9a5397bd972a173cdf08aaccba44678f3aea0 (diff) | |
download | dashboard-87ca458fa12b81ccbfd7d8aeb3bb5a677625b956.tar.gz |
Various UI improvements.
Improve release UI links. Add a test plan run metadata UI element. Limit
size of test case results further.
Test: live on staging
Bug: 38283335
Change-Id: I2f4413a4f0bebcec78ef863411acf6896a843f1f
-rw-r--r-- | src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java | 2 | ||||
-rw-r--r-- | src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java | 45 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/jsp/show_plan_run.jsp | 61 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/jsp/show_table.jsp | 7 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/jsp/show_tree.jsp | 7 | ||||
-rw-r--r-- | src/main/webapp/css/plan_runs.css | 1 | ||||
-rw-r--r-- | src/main/webapp/css/show_test_runs_common.css | 20 | ||||
-rw-r--r-- | src/main/webapp/css/test_results.css | 2 | ||||
-rw-r--r-- | src/main/webapp/js/plan_runs.js | 11 |
9 files changed, 86 insertions, 70 deletions
diff --git a/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java b/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java index 4e88bcc..1b5ac2e 100644 --- a/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java +++ b/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java @@ -62,7 +62,7 @@ public class ShowPlanReleaseServlet extends BaseServlet { public List<Page> getBreadcrumbLinks(HttpServletRequest request) { List<Page> links = new ArrayList<>(); String planName = request.getParameter("plan"); - links.add(new Page(PageType.PLAN_RELEASE, planName.toUpperCase(), "?plan=" + planName)); + links.add(new Page(PageType.PLAN_RELEASE, planName, "?plan=" + planName)); return links; } diff --git a/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java b/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java index 32b3ec4..42313d4 100644 --- a/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java +++ b/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java @@ -31,11 +31,8 @@ import com.google.gson.Gson; import com.google.gson.JsonObject; import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.logging.Level; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; @@ -45,7 +42,6 @@ import javax.servlet.http.HttpServletResponse; /** Servlet for handling requests to load individual plan runs. */ public class ShowPlanRunServlet extends BaseServlet { private static final String PLAN_RUN_JSP = "WEB-INF/jsp/show_plan_run.jsp"; - private static final String PROFILING_DATA_ALERT = "No profiling data was found."; @Override public PageType getNavParentType() { @@ -56,7 +52,7 @@ public class ShowPlanRunServlet extends BaseServlet { public List<Page> getBreadcrumbLinks(HttpServletRequest request) { List<Page> links = new ArrayList<>(); String planName = request.getParameter("plan"); - links.add(new Page(PageType.PLAN_RELEASE, planName.toUpperCase(), "?plan=" + planName)); + links.add(new Page(PageType.PLAN_RELEASE, planName, "?plan=" + planName)); String time = request.getParameter("time"); links.add(new Page(PageType.PLAN_RUN, "?plan=" + planName + "&time=" + time)); @@ -66,19 +62,19 @@ public class ShowPlanRunServlet extends BaseServlet { @Override public void doGetHandler(HttpServletRequest request, HttpServletResponse response) throws IOException { - Long startTime = null; // time in microseconds + Long time = null; // time in microseconds DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); RequestDispatcher dispatcher = null; String plan = request.getParameter("plan"); if (request.getParameter("time") != null) { - String time = request.getParameter("time"); + String timeString = request.getParameter("time"); try { - startTime = Long.parseLong(time); - startTime = startTime > 0 ? startTime : null; + time = Long.parseLong(timeString); + time = time > 0 ? time : null; } catch (NumberFormatException e) { - startTime = null; + time = null; } } @@ -92,15 +88,23 @@ public class ShowPlanRunServlet extends BaseServlet { List<JsonObject> testRunObjects = new ArrayList<>(); Key planKey = KeyFactory.createKey(TestPlanEntity.KIND, plan); - Key planRunKey = KeyFactory.createKey(planKey, TestPlanRunEntity.KIND, startTime); + Key planRunKey = KeyFactory.createKey(planKey, TestPlanRunEntity.KIND, time); + String testBuildId = ""; int passCount = 0; int failCount = 0; + long startTime = 0; + long endTime = 0; + long moduleCount = 0; try { Entity testPlanRunEntity = datastore.get(planRunKey); TestPlanRunEntity testPlanRun = TestPlanRunEntity.fromEntity(testPlanRunEntity); Map<Key, Entity> testRuns = datastore.get(testPlanRun.testRuns); + testBuildId = testPlanRun.testBuildId; passCount = (int) testPlanRun.passCount; failCount = (int) testPlanRun.failCount; + startTime = testPlanRun.startTimestamp; + endTime = testPlanRun.endTimestamp; + moduleCount = testPlanRun.testRuns.size(); for (Key key : testPlanRun.testRuns) { if (!testRuns.containsKey(key)) @@ -118,28 +122,21 @@ public class ShowPlanRunServlet extends BaseServlet { } int[] topBuildResultCounts = new int[TestCaseResult.values().length]; - topBuildResultCounts = new int[TestCaseResult.values().length]; topBuildResultCounts[TestCaseResult.TEST_CASE_RESULT_PASS.getNumber()] = passCount; topBuildResultCounts[TestCaseResult.TEST_CASE_RESULT_FAIL.getNumber()] = failCount; - Set<String> profilingPoints = new HashSet<>(); - - String profilingDataAlert = ""; - if (profilingPoints.size() == 0) { - profilingDataAlert = PROFILING_DATA_ALERT; - } - List<String> profilingPointNames = new ArrayList<>(profilingPoints); - Collections.sort(profilingPointNames); - request.setAttribute("plan", request.getParameter("plan")); request.setAttribute("time", request.getParameter("time")); - request.setAttribute("error", profilingDataAlert); - - request.setAttribute("profilingPointNames", profilingPointNames); request.setAttribute("resultNames", resultNames); request.setAttribute("resultNamesJson", new Gson().toJson(resultNames)); request.setAttribute("testRuns", new Gson().toJson(testRunObjects)); + request.setAttribute("testBuildId", new Gson().toJson(testBuildId)); + request.setAttribute("startTime", new Gson().toJson(startTime)); + request.setAttribute("endTime", new Gson().toJson(endTime)); + request.setAttribute("moduleCount", new Gson().toJson(moduleCount)); + request.setAttribute("passingTestCaseCount", new Gson().toJson(passCount)); + request.setAttribute("failingTestCaseCount", new Gson().toJson(failCount)); // data for pie chart request.setAttribute("topBuildResultCounts", new Gson().toJson(topBuildResultCounts)); diff --git a/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp b/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp index 491703a..474cefa 100644 --- a/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp @@ -31,6 +31,7 @@ $(document).ready(function() { $('#test-results-container').showTests(${testRuns}, true); + drawSummary(); }); // to draw pie chart @@ -58,14 +59,35 @@ colors: colors, fontName: 'Roboto', fontSize: '14px', - legend: 'none', - tooltip: {showColorCode: true, ignoreBounds: true}, - chartArea: {height: '90%'} + legend: {position: 'bottom'}, + tooltip: {showColorCode: true, ignoreBounds: false}, + chartArea: {height: '80%', width: '90%'}, + pieHole: 0.4 }; var chart = new google.visualization.PieChart(document.getElementById('pie-chart-div')); chart.draw(data, options); } + + // Draw a test plan run summary box. + function drawSummary() { + var testBuildId = ${testBuildId}; + var startTime = ${startTime}; + var endTime = ${endTime}; + var moduleCount = ${moduleCount}; + var passingTestCaseCount = ${passingTestCaseCount}; + var failingTestCaseCount = ${failingTestCaseCount}; + var div = $('<div></div>'); + var details = $('<span></span>').appendTo(div); + details.append('<b>VTS Build: </b>' + testBuildId + '<br>'); + details.append('<b>Start Time: </b>' + moment().renderTime(startTime, true) + '<br>'); + details.append('<b>End Time: </b>' + moment().renderTime(endTime, true) + '<br>'); + details.append('<b>Duration: </b>' + moment().renderDuration(endTime - startTime) + '<br>'); + details.append('<b>Modules: </b>' + moduleCount + '<br>'); + details.append('<b>Passing Test Cases: </b>' + passingTestCaseCount + '<br>'); + details.append('<b>Non-Passing Test Cases: </b>' + failingTestCaseCount + '<br>'); + div.appendTo($('#summary-container')); + } </script> <body> @@ -84,35 +106,10 @@ </c:forEach> </div> </div> - <div id='profiling-container' class='col s12'> - <c:choose> - <c:when test='${empty profilingPointNames}'> - <div id='error-div' class='center-align card'><h5>${error}</h5></div> - </c:when> - <c:otherwise> - <ul id='profiling-body' class='collapsible' data-collapsible='accordion'> - <li> - <div class='collapsible-header'><i class='material-icons'>timeline</i>Profiling Graphs</div> - <div class='collapsible-body'> - <ul id='profiling-list' class='collection'> - <c:forEach items='${profilingPointNames}' var='pt'> - <c:set var='profPointArgs' value='testName=${testName}&profilingPoint=${pt}'/> - <c:set var='timeArgs' value='endTime=${endTime}'/> - <a href='/show_graph?${profPointArgs}&${timeArgs}' - class='collection-item profiling-point-name'>${pt} - </a> - </c:forEach> - </ul> - </div> - </li> - <li> - <a class='collapsible-link' href='/show_performance_digest?testName=${testName}'> - <div class='collapsible-header'><i class='material-icons'>toc</i>Performance Digest</div> - </a> - </li> - </ul> - </c:otherwise> - </c:choose> + <div id='summary-container' class='col s12 card'> + <span class='summary-header valign-wrapper'> + <i class='material-icons'>info_outline</i>Run Details + </span> </div> </div> <div class='col s5 valign-wrapper'> diff --git a/src/main/webapp/WEB-INF/jsp/show_table.jsp b/src/main/webapp/WEB-INF/jsp/show_table.jsp index be71ee8..c5f325e 100644 --- a/src/main/webapp/WEB-INF/jsp/show_table.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_table.jsp @@ -163,9 +163,10 @@ colors: colors, fontName: 'Roboto', fontSize: '14px', - legend: 'none', - tooltip: {showColorCode: true, ignoreBounds: true}, - chartArea: {height: '90%'} + legend: {position: 'bottom'}, + tooltip: {showColorCode: true, ignoreBounds: false}, + chartArea: {height: '80%', width: '90%'}, + pieHole: 0.4 }; var chart = new google.visualization.PieChart(document.getElementById('pie-chart-div')); diff --git a/src/main/webapp/WEB-INF/jsp/show_tree.jsp b/src/main/webapp/WEB-INF/jsp/show_tree.jsp index 8d237a3..4894e5e 100644 --- a/src/main/webapp/WEB-INF/jsp/show_tree.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_tree.jsp @@ -132,9 +132,10 @@ colors: colors, fontName: 'Roboto', fontSize: '14px', - legend: 'none', - tooltip: {showColorCode: true, ignoreBounds: true}, - chartArea: {height: '90%'} + legend: {position: 'bottom'}, + tooltip: {showColorCode: true, ignoreBounds: false}, + chartArea: {height: '80%', width: '90%'}, + pieHole: 0.4 }; var chart = new google.visualization.PieChart(document.getElementById('pie-chart-div')); diff --git a/src/main/webapp/css/plan_runs.css b/src/main/webapp/css/plan_runs.css index 3c9eeb9..e08eef9 100644 --- a/src/main/webapp/css/plan_runs.css +++ b/src/main/webapp/css/plan_runs.css @@ -15,6 +15,7 @@ .plan-run-metadata { display: inline-block; font-size: 13px; + color: black; line-height: 16px; padding: 10px; } diff --git a/src/main/webapp/css/show_test_runs_common.css b/src/main/webapp/css/show_test_runs_common.css index 63d5301..ff48b73 100644 --- a/src/main/webapp/css/show_test_runs_common.css +++ b/src/main/webapp/css/show_test_runs_common.css @@ -35,6 +35,26 @@ #profiling-container { padding: 0; } +#summary-container { + padding: 0; + line-height: 18px; + font-weight: 300; + color: rgb(97, 97, 97); +} +#summary-container .summary-header { + font-size: 18px; + font-weight: normal; + color: rgba(0, 0, 0, 0.87); + border-bottom: 1px solid rgb(221, 221, 221); + margin: 0; + padding: 10px 15px; +} +#summary-container .summary-header i { + margin-right: 10px; +} +#summary-container div { + margin: 15px; +} #error-div { padding: 30px 25px; } diff --git a/src/main/webapp/css/test_results.css b/src/main/webapp/css/test_results.css index f717e79..5be42da 100644 --- a/src/main/webapp/css/test_results.css +++ b/src/main/webapp/css/test_results.css @@ -43,7 +43,7 @@ li.test-run-container.active { background: white; padding: 10px; margin-bottom: 25px; - max-height: 80%; + max-height: 33%; overflow: auto; } .indicator { diff --git a/src/main/webapp/js/plan_runs.js b/src/main/webapp/js/plan_runs.js index 6898389..6f11083 100644 --- a/src/main/webapp/js/plan_runs.js +++ b/src/main/webapp/js/plan_runs.js @@ -22,7 +22,11 @@ * @param metadataList The list of metadata objects to render on the display. */ function renderCard(container, entry) { - var card = $('<div class="col s12 m6 l4"></div>'); + var card = $('<a class="col s12 m6 l4"></a>'); + var link = ( + '/show_plan_run?plan=' + entry.testPlanRun.testPlanName + + '&time=' + entry.testPlanRun.startTimestamp); + card.attr('href', link); card.appendTo(container); var div = $('<div class="hoverable card release-entry"></div>'); var startTime = entry.testPlanRun.startTimestamp; @@ -47,11 +51,6 @@ entry.testPlanRun.passCount + '/' + (entry.testPlanRun.passCount + entry.testPlanRun.failCount)); counter.appendTo(div); - div.click(function () { - window.location.href = ( - '/show_plan_run?plan=' + entry.testPlanRun.testPlanName + - '&time=' + entry.testPlanRun.startTimestamp); - }) } $.fn.showPlanRuns = function(data) { |