Changeset 93758 in webkit


Ignore:
Timestamp:
Aug 24, 2011 8:35:43 PM (13 years ago)
Author:
abarth@webkit.org
Message:

The user can't close the details view in garden-o-matic
https://bugs.webkit.org/show_bug.cgi?id=66911

Reviewed by Dimitri Glazkov.

In addition to adding a close button, this patch changes the test
selector to use a <select> element and refactors the test selector to
share code with the builder selector.

  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js:
  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js:
  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js:
  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js:
Location:
trunk/Tools
Files:
5 edited

Legend:

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

    r93738 r93758  
    3535
    3636        this._view.setTestList(Object.keys(this._resultsByTest));
     37
     38        this._view.addAction(new ui.actions.Rebaseline().makeDefault());
     39        this._view.addAction(new ui.actions.Previous());
     40        this._view.addAction(new ui.actions.Next());
     41        this._view.addAction(new ui.actions.Close());
     42
    3743        $(this._view).bind('testselected', this.onTestSelected.bind(this));
    3844        $(this._view).bind('builderselected', this.onBuilderSelected.bind(this));
    3945        $(this._view).bind('rebaseline', this.onRebaseline.bind(this));
    40         // FIXME: Bind the next/previous events.
     46        $(this._view).bind('close', this.onClose.bind(this));
    4147    },
    4248    _failureInfoForTestAndBuilder: function(testName, builderName)
     
    5864        this._view.showResults(this._failureInfoForTestAndBuilder(testName, builderNameList[0]));
    5965    },
    60     onTestSelected: function(event, testName)
     66    onTestSelected: function()
    6167    {
    62         this.showTest(testName)
     68        this.showTest(this._view.currentTestName());
    6369    },
    6470    onBuilderSelected: function() {
    65         this._view.showResults(this._failureInfoForTestAndBuilder(this._view.currentTestName(), this._view.currentBuilderName()));
     71        this._view.showResults(this._failureInfoForTestAndBuilder(this._view.currentTestName(),
     72                                                                  this._view.currentBuilderName()));
    6673    },
    6774    onRebaseline: function() {
     
    7279            'builderName': builderName
    7380        });
     81    },
     82    onClose: function() {
     83        this.dismiss();
    7484    }
    7585});
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js

    r93738 r93758  
    6464});
    6565
     66ui.actions.Close = base.extends(Action, {
     67    init: function() {
     68        this.textContent = 'Close';
     69        this._eventName = 'close';
     70    }
     71});
     72
    6673ui.actions.Next = base.extends(Action, {
    6774    init: function() {
     
    8390    init: function(actions) {
    8491        this.className = 'actions';
    85         $(this).append(actions.map(function(action) {
    86             var item = document.createElement('li');
    87             item.appendChild(action);
    88             return item;
    89         }));
     92        if (!actions)
     93            return;
     94        actions.forEach(this.add.bind(this));
     95    },
     96    add: function(action)
     97    {
     98        var item = document.createElement('li');
     99        item.appendChild(action);
     100        $(this).append(item);
    90101    }
    91102});
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js

    r93738 r93758  
    7070    equal(list.innerHTML,
    7171        '<li><button>Rebaseline</button></li>' +
    72         '<li><button class="previous"></button></li>' +
    73         '<li><button class="next"></button></li>');
     72        '<li><button class="previous">\u25C0</button></li>' +
     73        '<li><button class="next">\u25B6</button></li>');
    7474});
    7575
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js

    r93483 r93758  
    152152});
    153153
    154 ui.results.TestSelector = base.extends('input', {
    155     init: function()
    156     {
    157         this.className = 'test-selector';
    158         this.type = 'text';
    159         this.placeholder = 'Test name';
    160     },
    161     setTestList: function(testNameList)
    162     {
    163         $(this).autocomplete({
    164             source: testNameList,
    165             select: function(event, selected) {
    166                 $(this).trigger('testselected', [selected.item.value]);
    167             }.bind(this)
    168         });
    169     }
    170 });
    171 
    172 ui.results.BuilderSelector = base.extends('select', {
    173     init: function()
    174     {
    175         this.className = 'builder-selector';
    176         $(this).hide();
     154var Selector = base.extends('select', {
     155    init: function()
     156    {
     157        this._eventName = null;
    177158        $(this).change(function() {
    178             $(this).trigger('builderselected');
    179         }.bind(this));
    180     },
    181     show: function(builderNameList) {
     159            if (this._eventName)
     160                $(this).trigger(this._eventName);
     161        }.bind(this));
     162    },
     163    setItemList: function(itemList)
     164    {
    182165        $(this).empty();
     166        itemList.forEach(function(item) {
     167            var element = document.createElement('option');
     168            element.textContent = item.displayName;
     169            element.value = item.name;
     170            this.appendChild(element);
     171        }.bind(this));
    183172        $(this).show();
    184         builderNameList.forEach(function(builderName) {
    185             var builderElement = document.createElement('option');
    186             builderElement.textContent = ui.displayNameForBuilder(builderName);
    187             builderElement.value = builderName;
    188             this.appendChild(builderElement);
    189         }.bind(this));
    190     },
    191     select: function(builderName) {
    192         var builderIndex = -1;
     173    },
     174    select: function(itemName) {
     175        var index = -1;
    193176        for (var i = 0; i < this.options.length; ++i) {
    194             if (this.options[i].value == builderName) {
    195                 builderIndex = i;
     177            if (this.options[i].value == itemName) {
     178                index = i;
    196179                break;
    197180            }
    198181        }
    199         if (builderIndex == -1)
     182        if (index == -1)
    200183            return;
    201         this.selectedIndex = builderIndex;
    202     },
    203     selectedBuilder: function() {
     184        this.selectedIndex = index;
     185    },
     186    selectedItem: function() {
    204187        if (this.selectedIndex == -1)
    205188            return;
     
    208191});
    209192
     193ui.results.TestSelector = base.extends(Selector, {
     194    init: function()
     195    {
     196        this.className = 'test-selector';
     197        this._eventName = 'testselected';
     198    },
     199    setTestList: function(testNameList)
     200    {
     201        this.setItemList(testNameList.map(function(testName) {
     202            return {
     203                'displayName': testName,
     204                'name': testName
     205            };
     206        }));
     207    }
     208});
     209
     210ui.results.BuilderSelector = base.extends(Selector, {
     211    init: function()
     212    {
     213        this.className = 'builder-selector';
     214        this._eventName = 'builderselected';
     215    },
     216    setBuilderList: function(builderNameList) {
     217        this.setItemList(builderNameList.map(function(builderName) {
     218            return {
     219                'displayName': ui.displayNameForBuilder(builderName),
     220                'name': builderName
     221            };
     222        }));
     223    }
     224});
     225
    210226ui.results.View = base.extends('div', {
    211227    init: function(delegate)
     
    217233        this._builderSelector = new ui.results.BuilderSelector();
    218234        this._resultsDetails = new ui.results.ResultsDetails(delegate);
    219 
    220         $('.toolbar', this).prepend(new ui.actions.List([
    221             new ui.actions.Rebaseline().makeDefault(),
    222             new ui.actions.Previous(),
    223             new ui.actions.Next(),
    224         ]));
     235        this._actionList = new ui.actions.List();
     236
     237        $('.toolbar', this).prepend(this._actionList);
    225238        $('.selector', this).append(this._testSelector).append(this._builderSelector);
    226239        $('.content', this).append(this._resultsDetails);
    227240    },
     241    addAction: function(action)
     242    {
     243        this._actionList.add(action);
     244    },
    228245    setTestList: function(testNameList)
    229246    {
    230247        this._testSelector.setTestList(testNameList);
    231248    },
     249    setBuilderList: function(buildNameList)
     250    {
     251        this._builderSelector.setBuilderList(buildNameList);
     252    },
    232253    currentTestName: function()
    233254    {
    234         return this._testSelector.value;
     255        return this._testSelector.selectedItem();
    235256    },
    236257    currentBuilderName: function()
    237258    {
    238         return this._builderSelector.selectedBuilder();
    239     },
    240     setBuilderList: function(buildNameList)
    241     {
    242         this._builderSelector.show(buildNameList);
     259        return this._builderSelector.selectedItem();
    243260    },
    244261    showResults: function(failureInfo)
    245262    {
    246         this._testSelector.value = failureInfo.testName;
     263        this._testSelector.select(failureInfo.testName);
    247264        this._builderSelector.select(failureInfo.builderName);
    248265        this._resultsDetails.show(failureInfo);
  • trunk/Tools/ChangeLog

    r93751 r93758  
     12011-08-24  Adam Barth  <abarth@webkit.org>
     2
     3        The user can't close the details view in garden-o-matic
     4        https://bugs.webkit.org/show_bug.cgi?id=66911
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        In addition to adding a close button, this patch changes the test
     9        selector to use a <select> element and refactors the test selector to
     10        share code with the builder selector.
     11
     12        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js:
     13        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js:
     14        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js:
     15        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js:
     16
    1172011-08-24  James Robinson  <jamesr@chromium.org>
    218
Note: See TracChangeset for help on using the changeset viewer.