Title: [88381] trunk/Tools
Revision
88381
Author
commit-qu...@webkit.org
Date
2011-06-08 13:42:53 -0700 (Wed, 08 Jun 2011)

Log Message

2011-06-08  Tom Hudson  <tomhud...@google.com>

        Reviewed by Mihai Parparita.

        Allow sorting in RebaselineServer based on 'metric' field in unexpected_results.json
        https://bugs.webkit.org/show_bug.cgi?id=60964

        * Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html:
        Add 'Sort tests by metric' link.
        * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js:
        (disableSorting): Activate 'Sort tests by metric' link.
        (enableSorting): Deactivate 'Sort tests by metric' link.
        (selectDirectory): Call enableSorting()/disableSorting() depending
        on currently selected failure type, and sort tests if requested.
        * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css:
        New .disabled-control class for deactivated links.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (88380 => 88381)


--- trunk/Tools/ChangeLog	2011-06-08 20:29:12 UTC (rev 88380)
+++ trunk/Tools/ChangeLog	2011-06-08 20:42:53 UTC (rev 88381)
@@ -1,3 +1,20 @@
+2011-06-08  Tom Hudson  <tomhud...@google.com>
+
+        Reviewed by Mihai Parparita.
+
+        Allow sorting in RebaselineServer based on 'metric' field in unexpected_results.json
+        https://bugs.webkit.org/show_bug.cgi?id=60964
+
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html:
+        Add 'Sort tests by metric' link.
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js:
+        (disableSorting): Activate 'Sort tests by metric' link.
+        (enableSorting): Deactivate 'Sort tests by metric' link.
+        (selectDirectory): Call enableSorting()/disableSorting() depending
+        on currently selected failure type, and sort tests if requested.
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css:
+        New .disabled-control class for deactivated links.
+
 2011-06-08  Tom Sepez  <tse...@chromium.org>
 
         Reviewed by Adam Barth.

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html (88380 => 88381)


--- trunk/Tools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html	2011-06-08 20:29:12 UTC (rev 88380)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html	2011-06-08 20:42:53 UTC (rev 88381)
@@ -51,6 +51,8 @@
   <div id="controls">
     <!-- Add a dummy <select> node so that this lines up with the text on the left -->
     <select style="visibility: hidden"></select>
+    <span id="toggle-sort" class="link">Sort tests by metric</span>
+    <span class="divider">|</span>
     <span id="toggle-log" class="link">Log</span>
     <span class="divider">|</span>
     <a href=""

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css (88380 => 88381)


--- trunk/Tools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css	2011-06-08 20:29:12 UTC (rev 88380)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css	2011-06-08 20:42:53 UTC (rev 88381)
@@ -138,6 +138,10 @@
   float: right;
 }
 
+.disabled-control {
+  color: #888;
+}
+
 #test-output {
   border-spacing: 0;
   border-collapse: collapse;

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js (88380 => 88381)


--- trunk/Tools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js	2011-06-08 20:29:12 UTC (rev 88380)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js	2011-06-08 20:42:53 UTC (rev 88381)
@@ -46,6 +46,7 @@
 var selectedTests = [];
 var loupe;
 var queue;
+var shouldSortTestsByMetric = false;
 
 function main()
 {
@@ -56,6 +57,7 @@
     $('previous-test').addEventListener('click', previousTest);
 
     $('toggle-log').addEventListener('click', function() { toggle('log'); });
+    disableSorting();
 
     loupe = new Loupe();
     queue = new RebaselineQueue();
@@ -144,6 +146,23 @@
     document.body.className = '';
 }
 
+function enableSorting()
+{
+    $('toggle-sort')._onclick_ = function() {
+        shouldSortTestsByMetric = !shouldSortTestsByMetric;
+        // Regenerates the list of tests; this alphabetizes, and
+        // then re-sorts if we turned sorting on.
+        selectDirectory();
+    }
+    $('toggle-sort').classList.remove('disabled-control');
+}
+
+function disableSorting()
+{
+    $('toggle-sort')._onclick_ = function() { return false; }
+    $('toggle-sort').classList.add('disabled-control');
+}
+
 /**
  * For a given failure type, gets all the tests and groups them by directory
  * (populating the directory selector with them).
@@ -227,6 +246,21 @@
     var testSelector = $('test-selector');
     testSelector.innerHTML = '';
 
+    var selectedFailureType = getSelectValue('failure-type-selector');
+    var sampleSelectedTest = testsByFailureType[selectedFailureType][0];
+    var selectedTypeIsSortable = 'metric' in results.tests[sampleSelectedTest];
+    if (selectedTypeIsSortable) {
+        enableSorting();
+        if (shouldSortTestsByMetric) {
+            for (var state in testsByState) {
+                testsByState[state].sort(function(a, b) {
+                    return results.tests[b].metric - results.tests[a].metric
+                })
+            }
+        }
+    } else
+        disableSorting();
+
     for (var state in testsByState) {
         var stateOption = document.createElement('option');
         stateOption.textContent = STATE_TO_DISPLAY_STATE[state];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to