The new flakiness dashboard should sort builder and test names
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Oct 2013 22:01:17 +0000 (22:01 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Oct 2013 22:01:17 +0000 (22:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123363

Reviewed by Simon Fraser.

Sort builders and tests by their name in each pane.

* public/index.html:
(TestResultsView._populateTestPane): Lexicologically sort builders by their name.
(TestResultsView._sortObjectsByName): Added.
(TestResultsView._populateBuilderPane): Lexicologically sort builders by their name.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158056 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/test-results/ChangeLog
Websites/test-results/public/index.html

index 0a60bb4..baf426a 100644 (file)
@@ -1,5 +1,19 @@
 2013-10-25  Ryosuke Niwa  <rniwa@webkit.org>
 
+        The new flakiness dashboard should sort builder and test names
+        https://bugs.webkit.org/show_bug.cgi?id=123363
+
+        Reviewed by Simon Fraser.
+
+        Sort builders and tests by their name in each pane.
+
+        * public/index.html:
+        (TestResultsView._populateTestPane): Lexicologically sort builders by their name.
+        (TestResultsView._sortObjectsByName): Added.
+        (TestResultsView._populateBuilderPane): Lexicologically sort builders by their name.
+
+2013-10-25  Ryosuke Niwa  <rniwa@webkit.org>
+
         Merge revision columns in flakiness dashboard
         https://bugs.webkit.org/show_bug.cgi?id=123360
 
index a639ad6..4db3fc9 100644 (file)
@@ -184,16 +184,30 @@ TestResultsView._populateTestPane = function(testName, results, section) {
     table.appendChild(this._createTestResultHeader('Builder', repositories));
 
     var tbody = element('tbody');
-    for (var builderId in resultsByBuilder) {
-        var builder = this._builders[builderId];
-        // FIXME: Add a master name if there is more than one.
-        tbody.appendChild(this._createTestResultRow(builder.name, resultsByBuilder[builderId], builder, buildTimes, repositories));
-    }
+    var builders = [];
+    for (var builderId in resultsByBuilder)
+        builders.push(this._builders[builderId]);
+
+    var self = this;
+    this._sortObjectsByName(builders).forEach(function (builder) {
+        tbody.appendChild(self._createTestResultRow(builder.name, resultsByBuilder[builder.id], builder, buildTimes, repositories));        
+    })
+
     table.appendChild(tbody);
     section.appendChild(table);
     $(table).tablesorter();
 }
 
+TestResultsView._sortObjectsByName = function (list) {
+    return list.sort(function (a, b) {
+        if (a.name < b.name)
+            return -1;
+        if (a.name > b.name)
+            return 1;
+        return 0;
+    });
+}
+
 TestResultsView._urlFromTest = function (test) {
     var category = this._testCategories[test.category];
     if (!category)
@@ -366,24 +380,27 @@ TestResultsView._populateBuilderPane = function(builderName, failureType, result
 
     table.appendChild(this._createTestResultHeader('Test'));
 
+    var tests = [];
+    for (var testId in resultsByTests)
+        tests.push(this._availableTests[testId]);
+
     var tbody = element('tbody');
     var builder = this._builders[builderId];
     var self = this;
-    for (var testId in resultsByTests) {
-        var results = resultsByTests[testId];
+    this._sortObjectsByName(tests).forEach(function (test) {
+        var results = resultsByTests[test.id];
         if (!results.length)
-            continue;
-        this._createBuildsAndComputeSlownessOfResults(builderId, resultsByTests[testId]);
-        var test = this._availableTests[testId];
-        var externalTestLink = element('a', {'class': 'externalTestLink', 'href': this._urlFromTest(test)});
+            return;
+        self._createBuildsAndComputeSlownessOfResults(builderId, results);
+        var externalTestLink = element('a', {'class': 'externalTestLink', 'href': self._urlFromTest(test)});
         var testName = element('a', {'href':'#'}, [test.name]);
         testName.onclick = function (event) {
             self.fetchTests([this.textContent]);
             event.preventDefault();
             return false;
         }
-        tbody.appendChild(this._createTestResultRow(element('span', [testName, externalTestLink]), resultsByTests[testId], builder));
-    }
+        tbody.appendChild(self._createTestResultRow(element('span', [testName, externalTestLink]), results, builder));
+    });
 
     table.appendChild(tbody);
     section.appendChild(table);