You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2018/10/09 18:12:55 UTC
[ignite-teamcity-bot] branch ignite-9800-2 updated: IGNITE-9800:
Expandable details section for each PR
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch ignite-9800-2
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/ignite-9800-2 by this push:
new 4438125 IGNITE-9800: Expandable details section for each PR
4438125 is described below
commit 44381257f236f7314a2806266ebaf1fefa112d9b
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Tue Oct 9 21:12:53 2018 +0300
IGNITE-9800: Expandable details section for each PR
---
.../ci/teamcity/ignited/TeamcityIgnitedImpl.java | 4 +-
.../src/main/webapp/css/style-1.5.css | 12 ++
ignite-tc-helper-web/src/main/webapp/js/prs-1.0.js | 180 +++++++++++++++++++++
ignite-tc-helper-web/src/main/webapp/prs.html | 103 +-----------
4 files changed, 198 insertions(+), 101 deletions(-)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
index a74b383..2b8c830 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
@@ -113,8 +113,8 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
totalChecked += tcData.size();
totalPages++;
- if (!fullReindex && totalPages >= 3)
- break; // 3 pages, 300 builds
+ if (!fullReindex && totalPages >= 7)
+ break; // 7 pages, 700 builds
}
return "Entries saved " + cntSaved + " Builds checked " + totalChecked;
diff --git a/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css b/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css
index ffc2770..e9106c8 100644
--- a/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css
+++ b/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css
@@ -224,3 +224,15 @@ form li:after
.compare tr:nth-child(4n-1) {
background-color: #fafaff;
}
+
+
+td.details-control {
+ //background: url('../resources/details_open.png') no-repeat center center;
+ cursor: pointer;
+ //content: "+➖";
+}
+tr.shown td.details-control {
+ //content: "➖";
+
+ //url('../resources/details_close.png') no-repeat center center;
+}
\ No newline at end of file
diff --git a/ignite-tc-helper-web/src/main/webapp/js/prs-1.0.js b/ignite-tc-helper-web/src/main/webapp/js/prs-1.0.js
new file mode 100644
index 0000000..787a7a3
--- /dev/null
+++ b/ignite-tc-helper-web/src/main/webapp/js/prs-1.0.js
@@ -0,0 +1,180 @@
+function drawTable(srvId, suiteId, element) {
+
+ element.append("<table id=\"serverContributions-" +
+ srvId + "\" class=\"ui-widget ui-widget-content\">\n" +
+ " <thead>\n" +
+ " <tr class=\"ui-widget-header \">\n" +
+ " <th>.</th>\n" +
+ " <th>...</th>\n" +
+ " <th>Loading</th>\n" +
+ " <th>...</th>\n" +
+ " <th>.</th>\n" +
+ " </tr>\n" +
+ " </thead>\n" +
+ " </table>\n");
+}
+
+function requestTableForServer(srvId, suiteId, element) {
+ // TODO multiple servers
+ if (srvId != "apache")
+ return;
+
+ drawTable(srvId, suiteId, element);
+
+ $.ajax({
+ url: "rest/visa/contributions?serverId=" + srvId,
+ success:
+ function (result) {
+ showContributionsTable(result, srvId, suiteId)
+ }
+ });
+}
+
+function showContributionsTable(result, srvId, suiteId) {
+ let tableId = 'serverContributions-' + srvId;
+ let tableForSrv = $('#' + tableId);
+
+ tableForSrv.dataTable().fnDestroy();
+
+ var table = tableForSrv.DataTable({
+ data: result,
+ "iDisplayLength": 100, //rows to be shown by default
+ //"dom": '<lf<t>ip>',
+ //"dom": '<"wrapper"flipt>',
+ columns: [
+ {
+ "className": 'details-control',
+ //"orderable": false,
+ "data": null,
+ "title": "",
+ "defaultContent": "",
+ "render": function (data, type, row, meta) {
+ if (type === 'display') {
+ return "<button>✔ Inspect</button>";
+ }
+ }
+ },
+ {
+ "data": "prHtmlUrl",
+ title: "PR Number",
+ "render": function (data, type, row, meta) {
+ if (type === 'display') {
+ data = "<a href='" + data + "'>#" + row.prNumber + "</a>";
+ }
+
+ return data;
+ }
+ }
+ , {
+ "data": "prTitle",
+ title: "Title"
+ },
+ {
+ "data": "prAuthor",
+ title: "Author",
+ "render": function (data, type, row, meta) {
+ if (type === 'display') {
+ data = "<img src='" + row.prAuthorAvatarUrl + "' width='20px' height='20px'> " + data + "";
+ }
+
+ return data;
+ }
+
+ },
+ {
+ "data": "prNumber",
+ title: "Existing RunAll",
+ "render": function (data, type, row, meta) {
+ let prId = data;
+ if (type === 'display') {
+ data = "<a id='link_" + prId + "' href='" +
+ prShowHref(srvId, suiteId, "pull%2F" + prId + "%2Fhead") +
+ "'>" +
+ "<button id='show_" + prId + "'>Open /" + data + "/head</button></a>";
+
+ // todo slow service
+ /*
+ $.ajax({
+ url: "rest/visa/findBranchForPr?serverId=" + srvId +
+ "&suiteId=" + suiteId +
+ "&prId=" + prId,
+ success:
+ function (result) {
+ console.log("Contribution " + prId + " bransh: " + result + " ");
+ if(isDefinedAndFilled(result.result)) {
+ $('#link_' + prId).attr('href', prShowHref(srvId, suiteId, result.result));
+
+ } else {
+ $('#show_' + prId).attr('class', 'disabledbtn');
+ }
+ }
+ });
+ */
+
+ }
+
+ return data;
+ }
+ }
+ ]
+ });
+
+ // Add event listener for opening and closing details, enable to only btn 'td.details-control'
+ $('#' + tableId + ' tbody').on('click', 'td', function () {
+ var tr = $(this).closest('tr');
+ var row = table.row(tr);
+
+ if (row.child.isShown()) {
+ // This row is already open - close it
+ row.child.hide();
+ tr.removeClass('shown');
+ }
+ else {
+ // Open this row
+ row.child(formatContributionDetails(row.data(), srvId, suiteId)).show();
+ tr.addClass('shown');
+ }
+ });
+}
+
+function showButtonForPr(srvId, suiteId, prId, branchName) {
+ var showRunRes = "<a id='link_" + prId + "' href='" +
+ prShowHref(srvId, suiteId, branchName) +
+ "'>" +
+ "<button id='show_" + prId + "'>Show " + branchName + " branch report</button></a>";
+
+}
+
+/* Formatting function for row details - modify as you need */
+function formatContributionDetails(rowData, srvId, suiteId) {
+ // `rowData` is the original data object for the row
+
+ let prId = rowData.prNumber;
+ let res = "<table cellpadding='5' cellspacing='0' border='0' style='padding-left:50px;'>\n" +
+ " <tr>\n" +
+ " <td>PR number:</td>\n" +
+ " <td>" + rowData.prNumber + "</td>\n" +
+ " </tr>" +
+ " <tr>\n" +
+ " <td>Show Run All Results:</td>\n" +
+ " <td id='branchFor_" + prId + "'>Loading builds...</td>\n" +
+ " </tr>\n" +
+ " </table>";
+ $.ajax({
+ url: "rest/visa/findBranchForPr?serverId=" + srvId +
+ "&suiteId=" + suiteId +
+ "&prId=" + prId,
+ success:
+ function (result) {
+ console.log("Contribution " + prId + " bransh: " + result + " ");
+ let branchName = result.result;
+ let tdForPr = $('#branchFor_' + prId);
+ if (isDefinedAndFilled(branchName)) {
+ tdForPr.html(showButtonForPr(srvId, suiteId, prId, branchName));
+ } else {
+ tdForPr.html("No builds");
+ }
+ }
+ });
+ return res;
+}
\ No newline at end of file
diff --git a/ignite-tc-helper-web/src/main/webapp/prs.html b/ignite-tc-helper-web/src/main/webapp/prs.html
index 8503675..dafc1ef 100644
--- a/ignite-tc-helper-web/src/main/webapp/prs.html
+++ b/ignite-tc-helper-web/src/main/webapp/prs.html
@@ -17,6 +17,7 @@
<script src="js/common-1.6.js"></script>
<script src="js/testfails-2.1.js"></script>
+ <script src="js/prs-1.0.js"></script>
<style>
@@ -64,6 +65,9 @@
showFormAndSuitesForPrCheck(result);
tryToFillAutocompleteLists();
showCommentJiraForm(result);
+
+ for (let chainAtServer of result)
+ requestTableForServer(chainAtServer.serverId, chainAtServer.suiteId, $("#contributionsToCheck"));
},
error: showErrInLoadStatus
});
@@ -73,27 +77,11 @@
success:
function (result) {
setupAutocompleteList(result);
- for (let srvId of result)
- requestTableForServer(srvId, "");
}
});
}
- function requestTableForServer(srvId) {
- // TODO multiple servers
- if (srvId != "apache")
- return;
- //todo customizable suite
- var suiteId = "IgniteTests24Java8_RunAll";
- $.ajax({
- url: "rest/visa/contributions?serverId="+srvId,
- success:
- function (result) {
- showTable(result, srvId, suiteId)
- }
- });
- }
function prShowHref(srvId, suiteId, branchName) {
return "/pr.html?serverId=" + srvId + "&" +
@@ -104,80 +92,7 @@
"&action=Latest";
}
- function showTable(result, srvId, suiteId) {
- let tableForSrv = $('#serverContributions-' + srvId);
-
- tableForSrv.dataTable().fnDestroy();
-
- tableForSrv.DataTable({
- data: result,
- "iDisplayLength": 100, //rows to be shown by default
- //"dom": '<lf<t>ip>',
- //"dom": '<"wrapper"flipt>',
- columns: [
- {
- "data": "prHtmlUrl",
- title: "PR Number",
- "render": function(data, type, row, meta){
- if(type === 'display'){
- data = "<a href='"+data+"'>#"+row.prNumber+"</a>";
- }
-
- return data;
- }
- }
- , {
- "data": "prTitle",
- title: "Title"
- },
- {
- "data": "prAuthor",
- title: "Author",
- "render": function(data, type, row, meta){
- if(type === 'display'){
- data = "<img src='"+row.prAuthorAvatarUrl+"' width='20px' height='20px'> "+data+"";
- }
-
- return data;
- }
-
- },
- {
- "data": "prNumber",
- title: "Existing RunAll",
- "render": function(data, type, row, meta){
- let prId = data;
- if(type === 'display') {
- data = "<a id='link_" + prId + "' href='" +
- prShowHref(srvId, suiteId, "pull%2F" + prId + "%2Fhead") +
- "'>" +
- "<button id='show_" + prId + "'>Open /" + data + "/head</button></a>";
-
- $.ajax({
- url: "rest/visa/findBranchForPr?serverId=" + srvId +
- "&suiteId=" + suiteId +
- "&prId=" + prId,
- success:
- function (result) {
- console.log("Contribution " + prId + " bransh: " + result + " ");
- if(isDefinedAndFilled(result.result)) {
- $('#link_' + prId).attr('href', prShowHref(srvId, suiteId, result.result));
-
- } else {
- $('#show_' + prId).attr('class', 'disabledbtn');
- }
- }
- });
-
- }
-
- return data;
- }
- }
- ]
- });
- }
function showSuitesForTeamCityRunData(result) {
var res = "";
@@ -316,16 +231,6 @@
<div id="mainaccordion" style="height: 500px">
<h3>Select PR</h3>
<div id="contributionsToCheck">
- <table id="serverContributions-apache" class="ui-widget ui-widget-content">
- <thead>
- <tr class="ui-widget-header ">
- <th>...</th>
- <th>Loading</th>
- <th>...</th>
- <th>.</th>
- </tr>
- </thead>
- </table>
</div>