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/24 15:48:14 UTC

[ignite-teamcity-bot] branch master updated: IGNITE-9940 Sort pull requests by update time - Fixes #41.

This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f01f8e  IGNITE-9940 Sort pull requests by update time - Fixes #41.
9f01f8e is described below

commit 9f01f8e9d0bcd66dfc58e5a6444b7beb44ac17da
Author: ololo3000 <pm...@gmail.com>
AuthorDate: Wed Oct 24 18:48:01 2018 +0300

    IGNITE-9940 Sort pull requests by update time - Fixes #41.
    
    Signed-off-by: Dmitriy Pavlov <dp...@apache.org>
---
 .../org/apache/ignite/ci/github/PullRequest.java   |  6 +++++
 .../ignite/ci/tcbot/visa/ContributionToCheck.java  |  3 +++
 .../tcbot/visa/TcBotTriggerAndSignOffService.java  |  1 +
 ignite-tc-helper-web/src/main/webapp/js/prs-1.0.js | 27 ++++++++++++++++++++++
 4 files changed, 37 insertions(+)

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 @@ public class PullRequest implements IVersionedEntity {
 
     @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 @@ package org.apache.ignite.ci.tcbot.visa;
 
     /** 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 26680ce..ecc4267 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
@@ -232,6 +232,7 @@ public class TcBotTriggerAndSignOffService {
             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',
@@ -57,6 +69,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",
                 "render": function (data, type, row, meta) {