Title: [94631] trunk/Tools
Revision
94631
Author
[email protected]
Date
2011-09-06 20:41:52 -0700 (Tue, 06 Sep 2011)

Log Message

garden-o-matic details view should having working rebaseline and next/previous buttons
https://bugs.webkit.org/show_bug.cgi?id=67659

Reviewed by Dimitri Glazkov.

This patch wires up basic back/forward buttons that let you traverse
through the results we're examining in the details view.  This ended up
being more code than I expected, but I wanted to keep all the state
information in the DOM itself.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/results.css:

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js (94630 => 94631)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js	2011-09-07 03:00:55 UTC (rev 94630)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js	2011-09-07 03:41:52 UTC (rev 94631)
@@ -33,8 +33,18 @@
         this._view = view;
         this._resultsByTest = resultsByTest;
         this._view.setResultsByTest(resultsByTest);
-        // FIXME: Wire up some actions.
+
+        $(this._view).bind('next', this.onNext.bind(this));
+        $(this._view).bind('previous', this.onPrevious.bind(this));
     },
+    onNext: function()
+    {
+        this._view.nextResult();
+    },
+    onPrevious: function()
+    {
+        this._view.previousResult();
+    }
 });
 
 var FailureStreamController = base.extends(Object, {

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js (94630 => 94631)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js	2011-09-07 03:00:55 UTC (rev 94630)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js	2011-09-07 03:41:52 UTC (rev 94631)
@@ -153,7 +153,12 @@
         this._delegate.fetchResultsURLs(this._failureInfo, function(resultsURLs) {
             var resultsGrid = new ui.results.ResultsGrid();
             resultsGrid.addResults(resultsURLs);
-            $(this).empty().append(resultsGrid);
+            $(this).empty().append(
+                new ui.actions.List([
+                    new ui.actions.Rebaseline().makeDefault(),
+                    new ui.actions.Previous(),
+                    new ui.actions.Next()
+                ])).append(resultsGrid);
         }.bind(this));
     },
 });
@@ -163,19 +168,62 @@
     {
         this.className = 'test-selector';
         this._delegate = delegate;
+        this._length = 0;
 
         Object.keys(resultsByTest).forEach(function (testName) {
             var link = document.createElement('a');
             $(link).attr('href', '#').text(testName);
             this.appendChild(document.createElement('h3')).appendChild(link);
             this.appendChild(this._delegate.contentForTest(testName));
+            ++this._length; // There doesn't seem to be any good way to get this information from accordion.
         }, this);
 
         $(this).accordion({
             collapsible: true,
             autoHeight: false,
         });
-        $(this).accordion("activate", false);
+        $(this).accordion('activate', false);
+    },
+    nextResult: function()
+    {
+        var activeIndex = $(this).accordion('option', 'active');
+        if ($('.builder-selector', this)[activeIndex].nextResult())
+            return true;
+        return this.nextTest();
+    },
+    previousResult: function()
+    {
+        var activeIndex = $(this).accordion('option', 'active');
+        if ($('.builder-selector', this)[activeIndex].previousResult())
+            return true;
+        return this.previousTest();
+    },
+    nextTest: function()
+    {
+        var nextIndex = $(this).accordion('option', 'active') + 1;
+        if (nextIndex >= this._length) {
+            $(this).accordion('option', 'active', false);
+            return false;
+        }
+        $(this).accordion('option', 'active', nextIndex);
+        $('.builder-selector', this)[nextIndex].firstResult();
+        return true;
+    },
+    previousTest: function()
+    {
+        var previousIndex = $(this).accordion('option', 'active') - 1;
+        if (previousIndex < 0) {
+            $(this).accordion('option', 'active', false);
+            return false;
+        }
+        $(this).accordion('option', 'active', previousIndex);
+        $('.builder-selector', this)[previousIndex].lastResult();
+        return true;
+    },
+    firstResult: function()
+    {
+        $(this).accordion('option', 'active', 0);
+        $('.builder-selector', this)[0].firstResult();
     }
 });
 
@@ -200,6 +248,30 @@
         }, this);
 
         $(this).tabs();
+    },
+    nextResult: function()
+    {
+        var nextIndex = $(this).tabs('option', 'selected') + 1;
+        if (nextIndex >= $(this).tabs('length'))
+            return false
+        $(this).tabs('option', 'selected', nextIndex);
+        return true;
+    },
+    previousResult: function()
+    {
+        var previousIndex = $(this).tabs('option', 'selected') - 1;
+        if (previousIndex < 0)
+            return false;
+        $(this).tabs('option', 'selected', previousIndex);
+        return true;
+    },
+    firstResult: function()
+    {
+        $(this).tabs('option', 'selected', 0);
+    },
+    lastResult: function()
+    {
+        $(this).tabs('option', 'selected', $(this).tabs('length') - 1);
     }
 });
 
@@ -227,9 +299,8 @@
     {
         $(this).empty();
         this._resultsByTest = resultsByTest;
-
-        var testSelector = new ui.results.TestSelector(this, resultsByTest);
-        $(testSelector).bind("accordionchangestart", function(event, ui) {
+        this._testSelector = new ui.results.TestSelector(this, resultsByTest);
+        $(this._testSelector).bind("accordionchangestart", function(event, ui) {
             // Prefetch the first results from the network.
             var resultsDetails = $('.results-detail', ui.newContent);
             if (resultsDetails.length)
@@ -241,11 +312,23 @@
                 });
             }, kResultsPrefetchDelayMS);
         });
-        this.appendChild(testSelector);
+        this.appendChild(this._testSelector);
     },
     fetchResultsURLs: function(failureInfo, callback)
     {
         this._delegate.fetchResultsURLs(failureInfo, callback)
+    },
+    nextResult: function()
+    {
+        return this._testSelector.nextResult();
+    },
+    previousResult: function()
+    {
+        return this._testSelector.previousResult();
+    },
+    firstResult: function()
+    {
+        this._testSelector.firstResult()
     }
 });
 

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js (94630 => 94631)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js	2011-09-07 03:00:55 UTC (rev 94630)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js	2011-09-07 03:41:52 UTC (rev 94631)
@@ -46,6 +46,24 @@
     }
 }
 
-// FIXME: Add some unit tests.
+test('View', 6, function() {
+    var delegate = {
+        fetchResultsURLs: function(failureInfo, callback) { return;}
+    };
 
+    var view = new ui.results.View(delegate);
+    view.setResultsByTest(kExampleResultsByTest);
+    view.firstResult();
+
+    view.nextResult();
+    equals($('.test-selector', view).accordion('option', 'active'), 0);
+    equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 1);
+    view.nextResult();
+    equals($('.test-selector', view).accordion('option', 'active'), 1);
+    equals($($('.builder-selector', view)[1]).tabs('option', 'selected'), 0);
+    view.previousResult();
+    equals($('.test-selector', view).accordion('option', 'active'), 0);
+    equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 1);
+});
+
 })();

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/results.css (94630 => 94631)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/results.css	2011-09-07 03:00:55 UTC (rev 94630)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/results.css	2011-09-07 03:41:52 UTC (rev 94631)
@@ -23,21 +23,21 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-.results-view>.toolbar {
-    padding-bottom: 15px;
+.results-view ul.actions {
+    float: right;
+    margin: 0;
+    padding: 5px 0px;
+    list-style: none;
+    display: inline-block;
 }
 
-    .results-view>.toolbar ul.actions {
-        float: right;
-        margin: 0;
-        padding: 0;
-        list-style: none;
-        display: inline-block;
-    }
+.results-view ul.actions li {
+    display: inline-block;
+}
 
-    .results-view>.toolbar ul.actions li {
-        display: inline-block;
-    }
+.ui-tabs .ui-tabs-panel.results-detail {
+    padding: 0px;
+}
 
 .results-grid table {
     table-layout: fixed;
@@ -52,7 +52,8 @@
 
 .results-grid table th {
     padding: 3px;
-    border-bottom: 1px solid #AAA;
+    border-top: 1px solid #DDD;
+    border-bottom: 1px solid #DDD;
 }
 
 .results-grid .text-result {

Modified: trunk/Tools/ChangeLog (94630 => 94631)


--- trunk/Tools/ChangeLog	2011-09-07 03:00:55 UTC (rev 94630)
+++ trunk/Tools/ChangeLog	2011-09-07 03:41:52 UTC (rev 94631)
@@ -1,3 +1,19 @@
+2011-09-06  Adam Barth  <[email protected]>
+
+        garden-o-matic details view should having working rebaseline and next/previous buttons
+        https://bugs.webkit.org/show_bug.cgi?id=67659
+
+        Reviewed by Dimitri Glazkov.
+
+        This patch wires up basic back/forward buttons that let you traverse
+        through the results we're examining in the details view.  This ended up
+        being more code than I expected, but I wanted to keep all the state
+        information in the DOM itself.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/results.css:
+
 2011-09-01  Dirk Pranke  <[email protected]>
 
         fix MockFileSystem.glob(), refactor filesystem tests
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to