Dashboard cleanup: Make builder a real dashboardSpecificParameter.
authorjparent@chromium.org <jparent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2013 01:46:43 +0000 (01:46 +0000)
committerjparent@chromium.org <jparent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2013 01:46:43 +0000 (01:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108706

Reviewed by Dirk Pranke.

Add builder to g_defaultDashboardSpecificParameter maps for the
dashboards where it is used (flakiness, timeline, treemap).
Default it to null, and then update reads of it to check the
builder group's default if one is not set, rather than trying to
set and track this everywhere.
This allows us to remove tons of special-casing of builder parsing,
including where we used to add it to the query string even when the
user did not specify it.

* TestResultServer/static-dashboards/dashboard_base.js:
(parseParameters):
* TestResultServer/static-dashboards/flakiness_dashboard.js:
(generatePage):
(handleQueryParameterChange):
* TestResultServer/static-dashboards/loader.js:
(.):
* TestResultServer/static-dashboards/timeline_explorer.html:
* TestResultServer/static-dashboards/treemap.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141839 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/TestResultServer/static-dashboards/dashboard_base.js
Tools/TestResultServer/static-dashboards/flakiness_dashboard.js
Tools/TestResultServer/static-dashboards/loader.js
Tools/TestResultServer/static-dashboards/timeline_explorer.html
Tools/TestResultServer/static-dashboards/treemap.html

index 8be08b3..b04490b 100644 (file)
@@ -1,5 +1,31 @@
 2013-02-04  Julie Parent  <jparent@chromium.org>
 
+        Dashboard cleanup: Make builder a real dashboardSpecificParameter.
+        https://bugs.webkit.org/show_bug.cgi?id=108706
+
+        Reviewed by Dirk Pranke.
+        
+        Add builder to g_defaultDashboardSpecificParameter maps for the
+        dashboards where it is used (flakiness, timeline, treemap).
+        Default it to null, and then update reads of it to check the
+        builder group's default if one is not set, rather than trying to
+        set and track this everywhere.
+        This allows us to remove tons of special-casing of builder parsing,
+        including where we used to add it to the query string even when the
+        user did not specify it.
+
+        * TestResultServer/static-dashboards/dashboard_base.js:
+        (parseParameters):
+        * TestResultServer/static-dashboards/flakiness_dashboard.js:
+        (generatePage):
+        (handleQueryParameterChange):
+        * TestResultServer/static-dashboards/loader.js:
+        (.):
+        * TestResultServer/static-dashboards/timeline_explorer.html:
+        * TestResultServer/static-dashboards/treemap.html:
+
+2013-02-04  Julie Parent  <jparent@chromium.org>
+
         Setting tests on flakiness dashboard should invalidate builder.
         https://bugs.webkit.org/show_bug.cgi?id=108521
 
index 4349d3c..b9ac54f 100644 (file)
@@ -336,15 +336,10 @@ function parseParameters()
     }
 
     parseDashboardSpecificParameters();
-    parseParameter(queryHashAsMap(), 'builder');
-
     var dashboardSpecificDiffState = diffStates(oldDashboardSpecificState, g_currentState);
 
     fillMissingValues(g_currentState, g_defaultDashboardSpecificStateValues);
 
-    if (!g_crossDashboardState.useTestData)
-        fillMissingValues(g_currentState, {'builder': currentBuilderGroup().defaultBuilder()});
-
     // FIXME: dashboard_base shouldn't know anything about specific dashboard specific keys.
     if (dashboardSpecificDiffState.builder)
         delete g_currentState.tests;
index 2c41478..4f0795d 100644 (file)
@@ -142,7 +142,6 @@ function generatePage()
     if (g_crossDashboardState.useTestData)
         return;
 
-    updateDefaultBuilderState();
     document.body.innerHTML = '<div id="loading-ui">LOADING...</div>';
     showErrors();
 
@@ -153,7 +152,7 @@ function generatePage()
     else if (g_currentState.expectationsUpdate)
         generatePageForExpectationsUpdate();
     else
-        generatePageForBuilder(g_currentState.builder);
+        generatePageForBuilder(g_currentState.builder || currentBuilderGroup().defaultBuilder());
 
     for (var builder in currentBuilders())
         processTestResultsForBuilderAsync(builder);
@@ -188,6 +187,7 @@ function handleValidHashParameter(key, value)
             function() {
                 return value in currentBuilders();
             });
+
         return true;
 
     case 'sortColumn':
@@ -260,6 +260,7 @@ g_defaultDashboardSpecificStateValues = {
     revision: null,
     tests: '',
     result: '',
+    builder: null
 };
 
 DB_SPECIFIC_INVALIDATING_PARAMETERS = {
@@ -2490,14 +2491,6 @@ function isInvalidKeyForCrossBuilderView(key)
     return !(key in VALID_KEYS_FOR_CROSS_BUILDER_VIEW) && !(key in g_defaultCrossDashboardStateValues);
 }
 
-function updateDefaultBuilderState()
-{
-    if (isCrossBuilderView())
-        delete g_defaultDashboardSpecificStateValues.builder;
-    else
-        g_defaultDashboardSpecificStateValues.builder = currentBuilderGroup().defaultBuilder();
-}
-
 // Sets the page state to regenerate the page.
 // @param {Object} params New or modified query parameters as key: value.
 function handleQueryParameterChange(params)
@@ -2516,7 +2509,6 @@ function handleQueryParameterChange(params)
         }
     }
 
-    updateDefaultBuilderState();
     return true;
 }
 
index 1e2d646..2be9674 100644 (file)
@@ -180,17 +180,6 @@ loader.Loader.prototype = {
         // data that isn't there.
         delete currentBuilders()[builderName];
 
-        // Change the default builder name if it has been deleted.
-        if (g_defaultDashboardSpecificStateValues.builder == builderName) {
-            var defaultBuilderName = currentBuilderGroup().defaultBuilder();
-            g_defaultDashboardSpecificStateValues.builder = defaultBuilderName;
-            if (!defaultBuilderName) {
-                var error = 'No tests results found for ' + g_crossDashboardState.testType + '. Reload the page to try fetching it again.';
-                console.error(error);
-                addError(error);
-            }
-       }
-
         // Proceed as if the resource had loaded.
         this._handleResourceLoad();
     },
index 0007a93..a02043b 100644 (file)
@@ -113,7 +113,7 @@ var g_currentBuilderTestResults;
 function generatePage()
 {
     g_buildIndicesByTimestamp = {};
-    var results = g_resultsByBuilder[g_currentState.builder];
+    var results = g_resultsByBuilder[g_currentState.builder || currentBuilderGroup().defaultBuilder()];
 
     for (var i = 0; i < results[FIXABLE_COUNTS_KEY].length; i++) {
         var buildDate = new Date(results[TIMESTAMPS_KEY][i] * 1000);
@@ -145,7 +145,7 @@ function generatePage()
 function initCurrentBuilderTestResults()
 {
     var startTime = Date.now();
-    g_currentBuilderTestResults = decompressResults(g_resultsByBuilder[g_currentState.builder]);
+    g_currentBuilderTestResults = decompressResults(g_resultsByBuilder[g_currentState.builder || currentBuilderGroup().defaultBuilder()]);
     console.log( 'Time to get test results by build: ' + (Date.now() - startTime));
 }
 
@@ -168,6 +168,7 @@ function handleValidHashParameter(key, value)
 }
 
 g_defaultDashboardSpecificStateValues = {
+    builder: null,
     buildTimestamp: -1,
     ignoreFlakyTests: true
 };
@@ -184,7 +185,7 @@ function shouldShowWebKitRevisionsOnly()
 
 function updateTimelineForBuilder()
 {
-    var builder = g_currentState.builder;
+    var builder = g_currentState.builder || currentBuilderGroup().defaultBuilder();
     var results = g_resultsByBuilder[builder];
     var graphData = [];
 
@@ -438,18 +439,19 @@ document.addEventListener('keydown', function(e) {
     if (g_currentBuildIndex == -1)
         return;
 
+    var builder = g_currentState.builder || currentBuilderGroup().defaultBuilder();
     switch (e.keyIdentifier) {
     case 'Left':
         selectBuild(
-            g_resultsByBuilder[g_currentState.builder],
-            g_currentState.builder,
+            g_resultsByBuilder[builder],
+            builder,
             g_dygraph,
             g_currentBuildIndex + 1);
         break;
     case 'Right':
         selectBuild(
-            g_resultsByBuilder[g_currentState.builder],
-            g_currentState.builder,
+            g_resultsByBuilder[builder],
+            builder,
             g_dygraph,
             g_currentBuildIndex - 1);
         break;
index e26323a..4ea11f9 100644 (file)
@@ -233,7 +233,7 @@ function generatePage()
 
     g_isGeneratingPage = true;
 
-    var rawTree = g_resultsByBuilder[g_currentState.builder];
+    var rawTree = g_resultsByBuilder[g_currentState.builder || currentBuilderGroup().defaultBuilder()];
     g_webTree = convertToWebTreemapFormat('LayoutTests', rawTree);
     appendTreemap($('map'), g_webTree);
 
@@ -292,6 +292,7 @@ function handleValidHashParameter(key, value)
 }
 
 g_defaultDashboardSpecificStateValues = {
+    builder: null,
     treemapfocus: '',
 };