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 2019/05/07 19:36:00 UTC

[ignite-teamcity-bot] branch srv-selector updated: Selection of service code - one select box instead

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

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


The following commit(s) were added to refs/heads/srv-selector by this push:
     new e850b3c  Selection of service code - one select box instead
e850b3c is described below

commit e850b3c3abd190b563e3d35fa7a7cc4607672d13
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Tue May 7 22:35:55 2019 +0300

    Selection of service code - one select box instead
---
 .../src/main/webapp/comparison.html                | 70 ++++++++--------------
 1 file changed, 25 insertions(+), 45 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/webapp/comparison.html b/ignite-tc-helper-web/src/main/webapp/comparison.html
index f7d7fda..f4f79c5 100644
--- a/ignite-tc-helper-web/src/main/webapp/comparison.html
+++ b/ignite-tc-helper-web/src/main/webapp/comparison.html
@@ -189,6 +189,9 @@
         testsTrigger = false,
         error = $('#loadStatus');
 
+    /** Key-value map. Key - Full suite text. Value - {@link org.apache.ignite.ci.tcbot.conf.ChainAtServer} object. */
+    var suiteFullNameToChain = new Map();
+
     function refreshTests() {
         printTests(generateTestsResultsComparison(mergedTestsResults));
     }
@@ -556,28 +559,9 @@
         $('.' + cssClass + '.data.' + num).prop('title', title);
     }
 
-    function loadServers() {
-        $.ajax({
-            url: "rest/branches/getServerIds",
-            success: function(result) {
-                if (!isDefinedAndFilled(result)) {
-                    error.html("Result from " + this.url + " is undefined!");
-
-                    return;
-                }
-
-                printServers(result);
-
-                loadTrackedSuites();
-            },
-            error: showErrInLoadStatus
-        });
-    }
-
     function loadTrackedSuites() {
-        let server = $('#selectServer').val();
         $.ajax({
-            url: "rest/branches/suites" + (isDefinedAndFilled(server) ? "?server=" + server + "" : ""),
+            url: "rest/branches/suites",
             success: function (result) {
                 if (!isDefinedAndFilled(result)) {
                     error.html("Result from " + this.url + " is undefined!");
@@ -593,11 +577,20 @@
         });
     }
 
-     function printSuites(result) {
+    /**
+     *
+     * @param result list of {@link org.apache.ignite.ci.tcbot.conf.ChainAtServer} objects as JSON.
+     */
+    function printSuites(result) {
         let selectHtml = "<select id='selectSuite'>";
 
-        for (let i = 0; i < result.length; i++)
-            selectHtml += getHtmlOption(result[i].suiteId, false, false, result[i].suiteId);
+        for (let i = 0; i < result.length; i++) {
+            let suite = result[i];
+            let text = suite.suiteId + " (" + suite.serverId + ")";
+
+            suiteFullNameToChain.set(text, suite);
+            selectHtml += getHtmlOption(text, false, false, text);
+        }
 
         selectHtml += "</select>";
 
@@ -606,39 +599,26 @@
         $('#selectSuite').change(function () { reloadAll(); });
     }
 
-    // @param array of strings
-    function printServers(result) {
-        let selectHtml = "<select id='selectServer'>";
-
-        for (let i = 0; i < result.length; i++)
-            selectHtml += getHtmlOption(result[i], false, false, result[i]);
-
-        selectHtml += "</select>";
-
-        $('#choiceServer').html(selectHtml);
-
-        $('#selectServer').change(function () { loadTrackedSuites(); });
-    }
-
-
     function loadData(num, sinceDate, untilDate, testsTrigger) {
         loadGif(num);
 
-        let suiteId = $('#selectSuite').val();
+        let suiteIdFull = $('#selectSuite').val();
+
 
         mergedTestsResults[num] = {};
 
-        if ((!isDefinedAndFilled(suiteId)) || (suiteId === "")) {
+        if ((!isDefinedAndFilled(suiteIdFull)) || (suiteIdFull === "")) {
             error.html("Suite is " + (isDefinedAndFilled(suiteId) ? "empty" : "undefined") + "!");
 
             return;
         }
 
+        let chainAtServer = suiteFullNameToChain.get(suiteIdFull);
 
-        let server = $('#selectServer').val();
-
-        let url = 'rest/build/history?server='+server+'&buildType=' + suiteId + '&sinceDate=' +
-            sinceDate.format("DDMMYYYY") + '000001&untilDate=' + untilDate.format("DDMMYYYY") + '235959';
+        let url = 'rest/build/history?server=' + chainAtServer.serverId
+            + '&buildType=' + chainAtServer.suiteId
+            + '&sinceDate=' + sinceDate.format("DDMMYYYY") + '000001'
+            + '&untilDate=' + untilDate.format("DDMMYYYY") + '235959';
 
         if (!testsTrigger)
             url = url + '&' + SKIP_TESTS;
@@ -699,7 +679,7 @@
     }
 
     $(document).ready(function() {
-        loadServers();
+        loadTrackedSuites();
 
         $.ajax({ url: "rest/branches/version",  success: showVersionInfo, error: showErrInLoadStatus });
     });