Changeset 94631 in webkit


Ignore:
Timestamp:
Sep 6, 2011, 8:41:52 PM (14 years ago)
Author:
abarth@webkit.org
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:
Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js

    r94580 r94631  
    3434        this._resultsByTest = resultsByTest;
    3535        this._view.setResultsByTest(resultsByTest);
    36         // FIXME: Wire up some actions.
     36
     37        $(this._view).bind('next', this.onNext.bind(this));
     38        $(this._view).bind('previous', this.onPrevious.bind(this));
    3739    },
     40    onNext: function()
     41    {
     42        this._view.nextResult();
     43    },
     44    onPrevious: function()
     45    {
     46        this._view.previousResult();
     47    }
    3848});
    3949
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js

    r94580 r94631  
    154154            var resultsGrid = new ui.results.ResultsGrid();
    155155            resultsGrid.addResults(resultsURLs);
    156             $(this).empty().append(resultsGrid);
     156            $(this).empty().append(
     157                new ui.actions.List([
     158                    new ui.actions.Rebaseline().makeDefault(),
     159                    new ui.actions.Previous(),
     160                    new ui.actions.Next()
     161                ])).append(resultsGrid);
    157162        }.bind(this));
    158163    },
     
    164169        this.className = 'test-selector';
    165170        this._delegate = delegate;
     171        this._length = 0;
    166172
    167173        Object.keys(resultsByTest).forEach(function (testName) {
     
    170176            this.appendChild(document.createElement('h3')).appendChild(link);
    171177            this.appendChild(this._delegate.contentForTest(testName));
     178            ++this._length; // There doesn't seem to be any good way to get this information from accordion.
    172179        }, this);
    173180
     
    176183            autoHeight: false,
    177184        });
    178         $(this).accordion("activate", false);
     185        $(this).accordion('activate', false);
     186    },
     187    nextResult: function()
     188    {
     189        var activeIndex = $(this).accordion('option', 'active');
     190        if ($('.builder-selector', this)[activeIndex].nextResult())
     191            return true;
     192        return this.nextTest();
     193    },
     194    previousResult: function()
     195    {
     196        var activeIndex = $(this).accordion('option', 'active');
     197        if ($('.builder-selector', this)[activeIndex].previousResult())
     198            return true;
     199        return this.previousTest();
     200    },
     201    nextTest: function()
     202    {
     203        var nextIndex = $(this).accordion('option', 'active') + 1;
     204        if (nextIndex >= this._length) {
     205            $(this).accordion('option', 'active', false);
     206            return false;
     207        }
     208        $(this).accordion('option', 'active', nextIndex);
     209        $('.builder-selector', this)[nextIndex].firstResult();
     210        return true;
     211    },
     212    previousTest: function()
     213    {
     214        var previousIndex = $(this).accordion('option', 'active') - 1;
     215        if (previousIndex < 0) {
     216            $(this).accordion('option', 'active', false);
     217            return false;
     218        }
     219        $(this).accordion('option', 'active', previousIndex);
     220        $('.builder-selector', this)[previousIndex].lastResult();
     221        return true;
     222    },
     223    firstResult: function()
     224    {
     225        $(this).accordion('option', 'active', 0);
     226        $('.builder-selector', this)[0].firstResult();
    179227    }
    180228});
     
    201249
    202250        $(this).tabs();
     251    },
     252    nextResult: function()
     253    {
     254        var nextIndex = $(this).tabs('option', 'selected') + 1;
     255        if (nextIndex >= $(this).tabs('length'))
     256            return false
     257        $(this).tabs('option', 'selected', nextIndex);
     258        return true;
     259    },
     260    previousResult: function()
     261    {
     262        var previousIndex = $(this).tabs('option', 'selected') - 1;
     263        if (previousIndex < 0)
     264            return false;
     265        $(this).tabs('option', 'selected', previousIndex);
     266        return true;
     267    },
     268    firstResult: function()
     269    {
     270        $(this).tabs('option', 'selected', 0);
     271    },
     272    lastResult: function()
     273    {
     274        $(this).tabs('option', 'selected', $(this).tabs('length') - 1);
    203275    }
    204276});
     
    228300        $(this).empty();
    229301        this._resultsByTest = resultsByTest;
    230 
    231         var testSelector = new ui.results.TestSelector(this, resultsByTest);
    232         $(testSelector).bind("accordionchangestart", function(event, ui) {
     302        this._testSelector = new ui.results.TestSelector(this, resultsByTest);
     303        $(this._testSelector).bind("accordionchangestart", function(event, ui) {
    233304            // Prefetch the first results from the network.
    234305            var resultsDetails = $('.results-detail', ui.newContent);
     
    242313            }, kResultsPrefetchDelayMS);
    243314        });
    244         this.appendChild(testSelector);
     315        this.appendChild(this._testSelector);
    245316    },
    246317    fetchResultsURLs: function(failureInfo, callback)
    247318    {
    248319        this._delegate.fetchResultsURLs(failureInfo, callback)
     320    },
     321    nextResult: function()
     322    {
     323        return this._testSelector.nextResult();
     324    },
     325    previousResult: function()
     326    {
     327        return this._testSelector.previousResult();
     328    },
     329    firstResult: function()
     330    {
     331        this._testSelector.firstResult()
    249332    }
    250333});
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js

    r94580 r94631  
    4747}
    4848
    49 // FIXME: Add some unit tests.
     49test('View', 6, function() {
     50    var delegate = {
     51        fetchResultsURLs: function(failureInfo, callback) { return;}
     52    };
     53
     54    var view = new ui.results.View(delegate);
     55    view.setResultsByTest(kExampleResultsByTest);
     56    view.firstResult();
     57
     58    view.nextResult();
     59    equals($('.test-selector', view).accordion('option', 'active'), 0);
     60    equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 1);
     61    view.nextResult();
     62    equals($('.test-selector', view).accordion('option', 'active'), 1);
     63    equals($($('.builder-selector', view)[1]).tabs('option', 'selected'), 0);
     64    view.previousResult();
     65    equals($('.test-selector', view).accordion('option', 'active'), 0);
     66    equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 1);
     67});
    5068
    5169})();
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/results.css

    r94580 r94631  
    2424 */
    2525
    26 .results-view>.toolbar {
    27     padding-bottom: 15px;
     26.results-view ul.actions {
     27    float: right;
     28    margin: 0;
     29    padding: 5px 0px;
     30    list-style: none;
     31    display: inline-block;
    2832}
    2933
    30     .results-view>.toolbar ul.actions {
    31         float: right;
    32         margin: 0;
    33         padding: 0;
    34         list-style: none;
    35         display: inline-block;
    36     }
     34.results-view ul.actions li {
     35    display: inline-block;
     36}
    3737
    38     .results-view>.toolbar ul.actions li {
    39         display: inline-block;
    40     }
     38.ui-tabs .ui-tabs-panel.results-detail {
     39    padding: 0px;
     40}
    4141
    4242.results-grid table {
     
    5353.results-grid table th {
    5454    padding: 3px;
    55     border-bottom: 1px solid #AAA;
     55    border-top: 1px solid #DDD;
     56    border-bottom: 1px solid #DDD;
    5657}
    5758
  • trunk/Tools/ChangeLog

    r94618 r94631  
     12011-09-06  Adam Barth  <abarth@webkit.org>
     2
     3        garden-o-matic details view should having working rebaseline and next/previous buttons
     4        https://bugs.webkit.org/show_bug.cgi?id=67659
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        This patch wires up basic back/forward buttons that let you traverse
     9        through the results we're examining in the details view.  This ended up
     10        being more code than I expected, but I wanted to keep all the state
     11        information in the DOM itself.
     12
     13        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js:
     14        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js:
     15        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/results.css:
     16
    1172011-09-01  Dirk Pranke  <dpranke@chromium.org>
    218
Note: See TracChangeset for help on using the changeset viewer.