Title: [93758] trunk/Tools
Revision
93758
Author
[email protected]
Date
2011-08-24 20:35:43 -0700 (Wed, 24 Aug 2011)

Log 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:

Modified Paths

Diff

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


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js	2011-08-25 02:38:07 UTC (rev 93757)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js	2011-08-25 03:35:43 UTC (rev 93758)
@@ -34,10 +34,16 @@
         this._resultsByTest = resultsByTest;
 
         this._view.setTestList(Object.keys(this._resultsByTest));
+
+        this._view.addAction(new ui.actions.Rebaseline().makeDefault());
+        this._view.addAction(new ui.actions.Previous());
+        this._view.addAction(new ui.actions.Next());
+        this._view.addAction(new ui.actions.Close());
+
         $(this._view).bind('testselected', this.onTestSelected.bind(this));
         $(this._view).bind('builderselected', this.onBuilderSelected.bind(this));
         $(this._view).bind('rebaseline', this.onRebaseline.bind(this));
-        // FIXME: Bind the next/previous events.
+        $(this._view).bind('close', this.onClose.bind(this));
     },
     _failureInfoForTestAndBuilder: function(testName, builderName)
     {
@@ -57,12 +63,13 @@
         this._view.setBuilderList(builderNameList)
         this._view.showResults(this._failureInfoForTestAndBuilder(testName, builderNameList[0]));
     },
-    onTestSelected: function(event, testName)
+    onTestSelected: function()
     {
-        this.showTest(testName)
+        this.showTest(this._view.currentTestName());
     },
     onBuilderSelected: function() {
-        this._view.showResults(this._failureInfoForTestAndBuilder(this._view.currentTestName(), this._view.currentBuilderName()));
+        this._view.showResults(this._failureInfoForTestAndBuilder(this._view.currentTestName(),
+                                                                  this._view.currentBuilderName()));
     },
     onRebaseline: function() {
         var testName = this._view.currentTestName();
@@ -71,6 +78,9 @@
             'testName': testName,
             'builderName': builderName
         });
+    },
+    onClose: function() {
+        this.dismiss();
     }
 });
 

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js (93757 => 93758)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js	2011-08-25 02:38:07 UTC (rev 93757)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js	2011-08-25 03:35:43 UTC (rev 93758)
@@ -63,6 +63,13 @@
     }
 });
 
+ui.actions.Close = base.extends(Action, {
+    init: function() {
+        this.textContent = 'Close';
+        this._eventName = 'close';
+    }
+});
+
 ui.actions.Next = base.extends(Action, {
     init: function() {
         this.innerHTML = '&#9654;';
@@ -82,11 +89,15 @@
 ui.actions.List = base.extends('ul', {
     init: function(actions) {
         this.className = 'actions';
-        $(this).append(actions.map(function(action) {
-            var item = document.createElement('li');
-            item.appendChild(action);
-            return item;
-        }));
+        if (!actions)
+            return;
+        actions.forEach(this.add.bind(this));
+    },
+    add: function(action)
+    {
+        var item = document.createElement('li');
+        item.appendChild(action);
+        $(this).append(item);
     }
 });
 

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js (93757 => 93758)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js	2011-08-25 02:38:07 UTC (rev 93757)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js	2011-08-25 03:35:43 UTC (rev 93758)
@@ -69,8 +69,8 @@
     ]);
     equal(list.innerHTML,
         '<li><button>Rebaseline</button></li>' +
-        '<li><button class="previous">◀</button></li>' +
-        '<li><button class="next">▶</button></li>');
+        '<li><button class="previous">\u25C0</button></li>' +
+        '<li><button class="next">\u25B6</button></li>');
 });
 
 }());

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


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js	2011-08-25 02:38:07 UTC (rev 93757)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js	2011-08-25 03:35:43 UTC (rev 93758)
@@ -151,62 +151,78 @@
     },
 });
 
-ui.results.TestSelector = base.extends('input', {
+var Selector = base.extends('select', {
     init: function()
     {
-        this.className = 'test-selector';
-        this.type = 'text';
-        this.placeholder = 'Test name';
-    },
-    setTestList: function(testNameList)
-    {
-        $(this).autocomplete({
-            source: testNameList,
-            select: function(event, selected) {
-                $(this).trigger('testselected', [selected.item.value]);
-            }.bind(this)
-        });
-    }
-});
-
-ui.results.BuilderSelector = base.extends('select', {
-    init: function()
-    {
-        this.className = 'builder-selector';
-        $(this).hide();
+        this._eventName = null;
         $(this).change(function() {
-            $(this).trigger('builderselected');
+            if (this._eventName)
+                $(this).trigger(this._eventName);
         }.bind(this));
     },
-    show: function(builderNameList) {
+    setItemList: function(itemList)
+    {
         $(this).empty();
+        itemList.forEach(function(item) {
+            var element = document.createElement('option');
+            element.textContent = item.displayName;
+            element.value = item.name;
+            this.appendChild(element);
+        }.bind(this));
         $(this).show();
-        builderNameList.forEach(function(builderName) {
-            var builderElement = document.createElement('option');
-            builderElement.textContent = ui.displayNameForBuilder(builderName);
-            builderElement.value = builderName;
-            this.appendChild(builderElement);
-        }.bind(this));
     },
-    select: function(builderName) {
-        var builderIndex = -1;
+    select: function(itemName) {
+        var index = -1;
         for (var i = 0; i < this.options.length; ++i) {
-            if (this.options[i].value == builderName) {
-                builderIndex = i;
+            if (this.options[i].value == itemName) {
+                index = i;
                 break;
             }
         }
-        if (builderIndex == -1)
+        if (index == -1)
             return;
-        this.selectedIndex = builderIndex;
+        this.selectedIndex = index;
     },
-    selectedBuilder: function() {
+    selectedItem: function() {
         if (this.selectedIndex == -1)
             return;
         return this.options[this.selectedIndex].value;
     }
 });
 
+ui.results.TestSelector = base.extends(Selector, {
+    init: function()
+    {
+        this.className = 'test-selector';
+        this._eventName = 'testselected';
+    },
+    setTestList: function(testNameList)
+    {
+        this.setItemList(testNameList.map(function(testName) {
+            return {
+                'displayName': testName,
+                'name': testName
+            };
+        }));
+    }
+});
+
+ui.results.BuilderSelector = base.extends(Selector, {
+    init: function()
+    {
+        this.className = 'builder-selector';
+        this._eventName = 'builderselected';
+    },
+    setBuilderList: function(builderNameList) {
+        this.setItemList(builderNameList.map(function(builderName) {
+            return {
+                'displayName': ui.displayNameForBuilder(builderName),
+                'name': builderName
+            };
+        }));
+    }
+});
+
 ui.results.View = base.extends('div', {
     init: function(delegate)
     {
@@ -216,34 +232,35 @@
         this._testSelector = new ui.results.TestSelector();
         this._builderSelector = new ui.results.BuilderSelector();
         this._resultsDetails = new ui.results.ResultsDetails(delegate);
+        this._actionList = new ui.actions.List();
 
-        $('.toolbar', this).prepend(new ui.actions.List([
-            new ui.actions.Rebaseline().makeDefault(),
-            new ui.actions.Previous(),
-            new ui.actions.Next(),
-        ]));
+        $('.toolbar', this).prepend(this._actionList);
         $('.selector', this).append(this._testSelector).append(this._builderSelector);
         $('.content', this).append(this._resultsDetails);
     },
+    addAction: function(action)
+    {
+        this._actionList.add(action);
+    },
     setTestList: function(testNameList)
     {
         this._testSelector.setTestList(testNameList);
     },
+    setBuilderList: function(buildNameList)
+    {
+        this._builderSelector.setBuilderList(buildNameList);
+    },
     currentTestName: function()
     {
-        return this._testSelector.value;
+        return this._testSelector.selectedItem();
     },
     currentBuilderName: function()
     {
-        return this._builderSelector.selectedBuilder();
+        return this._builderSelector.selectedItem();
     },
-    setBuilderList: function(buildNameList)
-    {
-        this._builderSelector.show(buildNameList);
-    },
     showResults: function(failureInfo)
     {
-        this._testSelector.value = failureInfo.testName;
+        this._testSelector.select(failureInfo.testName);
         this._builderSelector.select(failureInfo.builderName);
         this._resultsDetails.show(failureInfo);
     }

Modified: trunk/Tools/ChangeLog (93757 => 93758)


--- trunk/Tools/ChangeLog	2011-08-25 02:38:07 UTC (rev 93757)
+++ trunk/Tools/ChangeLog	2011-08-25 03:35:43 UTC (rev 93758)
@@ -1,3 +1,19 @@
+2011-08-24  Adam Barth  <[email protected]>
+
+        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:
+
 2011-08-24  James Robinson  <[email protected]>
 
         [chromium] Stacktrace not in test output when a test crashes
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to