From 35707068892d614d836a9b8d8a166d0d0b87b4b8 Mon Sep 17 00:00:00 2001 From: Young Gyu Park Date: Mon, 16 Jul 2018 15:56:21 +0900 Subject: Rest API for coverage API and API coverage entity Test: go/vts-web-staging Bug: 111481322 Change-Id: Iff17ba3906a9127189bb58891d1d5e3e0d82c41b --- src/main/webapp/WEB-INF/appengine-web.xml | 4 - src/main/webapp/WEB-INF/jsp/show_coverage.jsp | 2 +- src/main/webapp/WEB-INF/jsp/show_plan_run.jsp | 110 +++++++++++++++++++++++++- src/main/webapp/WEB-INF/jsp/show_release.jsp | 6 +- src/main/webapp/WEB-INF/queue.xml | 6 ++ src/main/webapp/css/common.css | 4 +- src/main/webapp/css/navbar.css | 1 - src/main/webapp/js/test_results.js | 20 ++++- 8 files changed, 137 insertions(+), 16 deletions(-) (limited to 'src/main') diff --git a/src/main/webapp/WEB-INF/appengine-web.xml b/src/main/webapp/WEB-INF/appengine-web.xml index d019e5c..714aa54 100644 --- a/src/main/webapp/WEB-INF/appengine-web.xml +++ b/src/main/webapp/WEB-INF/appengine-web.xml @@ -18,10 +18,6 @@ java8 F4_1G - - true - - diff --git a/src/main/webapp/WEB-INF/jsp/show_coverage.jsp b/src/main/webapp/WEB-INF/jsp/show_coverage.jsp index a1a38f5..0d1e5ce 100644 --- a/src/main/webapp/WEB-INF/jsp/show_coverage.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_coverage.jsp @@ -47,7 +47,7 @@ var cmd = $(evt.target).text(); var testRunId = $(evt.target).data("id"); var postData = { coverageId: testRunId, testName: "${testName}", testRunId: "${startTime}", cmd: cmd}; - $.post("/api/coverage", postData, function() { + $.post("/api/coverage/data", postData, function() { // success console.log("success"); var detachedLi = $(evt.target).parent().parent().detach(); 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 474cefa..bec4c76 100644 --- a/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_plan_run.jsp @@ -32,8 +32,73 @@ $(document).ready(function() { $('#test-results-container').showTests(${testRuns}, true); drawSummary(); + + $('#apiCoverageModal').modal({ + width: '75%', + dismissible: true, // Modal can be dismissed by clicking outside of the modal + opacity: .5, // Opacity of modal background + inDuration: 300, // Transition in duration + outDuration: 200, // Transition out duration + startingTop: '4%', // Starting top style attribute + endingTop: '10%', // Ending top style attribute + ready: function(modal, trigger) { // Callback for Modal open. Modal and trigger parameters available. + var urlSafeKeyList = modal.data('urlSafeKeyList'); + var halApiInfoList = []; + var getAjaxList = $.map( urlSafeKeyList, function( urlSafeKey ) { + return $.get( "/api/coverage/api/data?key=" + urlSafeKey, function(data) { + halApiInfoList.push(data); + }) + .fail(function() { + alert( "Error : can't bring API coverage data from the server" ); + }); + }); + + $.when.apply($, getAjaxList).then(function() { + $.each(halApiInfoList, function( index, data ) { + $("#halApiList").append(halApiListTemplate()); + var version = data.halMajorVersion + '.' + data.halMinorVersion; + var defaultInfo = data.halPackageName + '@' + version + '::' + data.halInterfaceName; + $("#halApiList > li:last > div.collapsible-header").html( + 'report HAL API Information : ' + defaultInfo + ); + /* + $("#halApiList > li:last > div.collapsible-body > ul.collection.with-header").append( + '
  • ' + + '
  • ' + ); + */ + + $("#halApiList > li:last > div.collapsible-body > ul.collection.with-header").append( + $.map( data.halApi, function( apiName, idx ) { + var colorClass = data.coveredHalApi.indexOf(apiName) > -1 ? "green" : "red" + return '
  • ' + apiName + '
  • '; + }).join("") + ); + $("#halApiList").collapsible('open', index); + }); + $('#dataTableLoading').hide("slow"); + }); + }, + complete: function() { + $("#halApiList").empty(); + $('#dataTableLoading').show("slow"); + } // Callback for Modal close + } + ); }); + function halApiListTemplate() { + return '
  • ' + + '
    ' + + 'report API Information' + + '
    ' + + '
    ' + + '
      ' + + '
    ' + + '
    ' + + '
  • '; + } + // to draw pie chart function drawPieChart() { var topBuildResultCounts = ${topBuildResultCounts}; @@ -86,6 +151,12 @@ details.append('Modules: ' + moduleCount + '
    '); details.append('Passing Test Cases: ' + passingTestCaseCount + '
    '); details.append('Non-Passing Test Cases: ' + failingTestCaseCount + '
    '); + + + details.append('Total API :
    '); + details.append('Total Covered API :
    '); +
    + div.appendTo($('#summary-container')); } @@ -120,9 +191,46 @@ -
    +
    +
    + + + + <%@ include file="footer.jsp" %> diff --git a/src/main/webapp/WEB-INF/jsp/show_release.jsp b/src/main/webapp/WEB-INF/jsp/show_release.jsp index 40a072f..9e8c2eb 100644 --- a/src/main/webapp/WEB-INF/jsp/show_release.jsp +++ b/src/main/webapp/WEB-INF/jsp/show_release.jsp @@ -34,7 +34,7 @@
    -
      +
        @@ -51,14 +51,14 @@ -
        + -
        + diff --git a/src/main/webapp/WEB-INF/queue.xml b/src/main/webapp/WEB-INF/queue.xml index 8900015..3a116f2 100644 --- a/src/main/webapp/WEB-INF/queue.xml +++ b/src/main/webapp/WEB-INF/queue.xml @@ -26,4 +26,10 @@ Copyright (C) 2017 The Android Open Source Project 40 10 + + coverageApiQueue + 20/s + 100 + 10 + \ No newline at end of file diff --git a/src/main/webapp/css/common.css b/src/main/webapp/css/common.css index 2b43210..3e0a1c9 100644 --- a/src/main/webapp/css/common.css +++ b/src/main/webapp/css/common.css @@ -13,13 +13,11 @@ limitations under the License. */ -.container { - min-height: 80%; -} @media only screen and (min-width: 993px) { .wide.container { width: 80%; max-width: 1600px; + min-height: 80vh; } } .TEST_CASE_RESULT_PASS { diff --git a/src/main/webapp/css/navbar.css b/src/main/webapp/css/navbar.css index 9395d1b..cf16f60 100644 --- a/src/main/webapp/css/navbar.css +++ b/src/main/webapp/css/navbar.css @@ -13,7 +13,6 @@ limitations under the License. */ nav#navbar { - height: auto; margin-bottom: 30px; user-select: none; } diff --git a/src/main/webapp/js/test_results.js b/src/main/webapp/js/test_results.js index a7be803..e00d6ac 100644 --- a/src/main/webapp/js/test_results.js +++ b/src/main/webapp/js/test_results.js @@ -243,9 +243,9 @@ metadata.testRun.totalLineCount != undefined) { var url = ( '/show_coverage?testName=' + test + '&startTime=' + startTime); - covered = metadata.testRun.coveredLineCount; - total = metadata.testRun.totalLineCount; - covPct = Math.round(covered / total * 1000) / 10; + var covered = metadata.testRun.coveredLineCount; + var total = metadata.testRun.totalLineCount; + var covPct = Math.round(covered / total * 1000) / 10; var color = 'red'; if (covPct > 20 && covPct < 70) { color = 'orange'; @@ -258,6 +258,20 @@ div, coverage, color, function () { window.location.href = url; return false; }); } + if (metadata.testRun.coveredApiCount != undefined && + metadata.testRun.totalApiCount != undefined) { + var covered = metadata.testRun.coveredApiCount; + var total = metadata.testRun.totalApiCount; + var apiCoverage = ('API Coverage: ' + covered + '/' + total); + createClickableIndicator( + div, apiCoverage, 'yellow grey-text', + function (evt) { + $('#apiCoverageModal').data("urlSafeKeyList", metadata.testRun.apiCoverageKeyList); + $('#apiCoverageModal').modal('open'); + return false; + } + ); + } if (metadata.testRun.logLinks != undefined) { createClickableIndicator( div, 'Links', 'grey lighten-1', -- cgit v1.2.3