asfgit closed pull request #41: IGNITE-9940 [TC Bot] Sort pull requests by update time URL: https://github.com/apache/ignite-teamcity-bot/pull/41
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java index 959e3a1..1763274 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java @@ -57,6 +57,12 @@ @SerializedName("base") private GitHubBranch base; + /** + * @return Pull Request time update. + */ + public String getTimeUpdate() { + return updatedAt; + } /** * @return Pull Request number. diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java index a19e3ca..cd265d3 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java @@ -40,4 +40,7 @@ /** JIRA issue without server URL, but with project name */ public String jiraIssueId; + + /** Pr time update. */ + public String prTimeUpdate; } diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java index e4c957e..6d8f0cf 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java @@ -219,6 +219,7 @@ public SimpleResult commentJiraEx( check.prNumber = pr.getNumber(); check.prTitle = pr.getTitle(); check.prHtmlUrl = pr.htmlUrl(); + check.prTimeUpdate = pr.getTimeUpdate(); GitHubUser user = pr.gitHubUser(); if (user != null) { 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 index df63efd..b9729ab 100644 --- 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 @@ -5,6 +5,7 @@ function drawTable(srvId, suiteId, element) { " <thead>\n" + " <tr class=\"ui-widget-header \">\n" + " <th>.</th>\n" + + " <th>.</th>\n" + " <th>...</th>\n" + " <th>Loading</th>\n" + " <th>...</th>\n" + @@ -31,6 +32,10 @@ function requestTableForServer(srvId, suiteId, element) { }); } +function normalizeDateNum(num) { + return num < 10 ? '0' + num : num; +} + function showContributionsTable(result, srvId, suiteId) { let tableId = 'serverContributions-' + srvId; let tableForSrv = $('#' + tableId); @@ -38,11 +43,18 @@ function showContributionsTable(result, srvId, suiteId) { tableForSrv.dataTable().fnDestroy(); var table = tableForSrv.DataTable({ + order: [[1, 'desc']], data: result, "iDisplayLength": 30, //rows to be shown by default //"dom": '<lf<t>ip>', //"dom": '<"wrapper"flipt>', stateSave: true, + columnDefs: [ + { + targets: 1, + className: 'dt-body-center' + } + ], columns: [ { "className": 'details-control', @@ -56,6 +68,21 @@ function showContributionsTable(result, srvId, suiteId) { } } }, + { + "data": "prTimeUpdate", + title: "Update Time", + "render": function (data, type, row, meta) { + if (type === 'display') { + let date = new Date(data); + + data = normalizeDateNum(date.getFullYear()) + '-' + normalizeDateNum(date.getMonth()) + + '-' + normalizeDateNum(date.getDate()) + "<br>" + normalizeDateNum(date.getHours()) + + ':' + normalizeDateNum(date.getMinutes()) + ":" + normalizeDateNum(date.getSeconds()); + } + + return data; + } + }, { "data": "prHtmlUrl", title: "PR Number", ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services