Title: [176497] trunk/Websites/perf.webkit.org
Revision
176497
Author
rn...@webkit.org
Date
2014-11-21 19:42:26 -0800 (Fri, 21 Nov 2014)

Log Message

The dashboard on new perf monitor should be configurable
https://bugs.webkit.org/show_bug.cgi?id=138994

Reviewed by Benjamin Poulain.

For now, make it configurable via config.json. We should eventually make it configurable via
an administrative page but this will do for now.

* config.json: Added the empty dashboard configuration.

* public/include/manifest.php: Include the dashboard configuration in the manifest file.

* public/v2/app.js:
(App.IndexController): Removed defaultTable since this is now dynamically obtained via App.Manifest.
(App.IndexController.gridChanged): Use App.Dashboard to parse the dashboard configuration.
Also obtain the default configuration from App.Manifest.
(App.IndexController._normalizeTable): Moved to App.Dashboard.

* public/v2/manifest.js:
(App.Repository.urlForRevision): Fixed the position of the open curly bracket.
(App.Repository.urlForRevisionRange): Ditto.
(App.Dashboard): Added.
(App.Dashboard.table): Extracted from App.IndexController.gridChanged.
(App.Dashboard.rows): Ditto.
(App.Dashboard.headerColumns): Ditto.
(App.Dashboard._normalizeTable): Moved from App.IndexController._normalizeTable.
(App.MetricSerializer.normalizePayload): Synthesize a dashboard record from the configuration.
Since there is exactly one dashboard object per app, it's okay to hard code an id here.
(App.Manifest._fetchedManifest): Set defaultDashboard to the one and only one dashboard we have.

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (176496 => 176497)


--- trunk/Websites/perf.webkit.org/ChangeLog	2014-11-22 03:29:58 UTC (rev 176496)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2014-11-22 03:42:26 UTC (rev 176497)
@@ -1,5 +1,37 @@
 2014-11-21  Ryosuke Niwa  <rn...@webkit.org>
 
+        The dashboard on new perf monitor should be configurable
+        https://bugs.webkit.org/show_bug.cgi?id=138994
+
+        Reviewed by Benjamin Poulain.
+
+        For now, make it configurable via config.json. We should eventually make it configurable via
+        an administrative page but this will do for now.
+
+        * config.json: Added the empty dashboard configuration.
+
+        * public/include/manifest.php: Include the dashboard configuration in the manifest file.
+
+        * public/v2/app.js:
+        (App.IndexController): Removed defaultTable since this is now dynamically obtained via App.Manifest.
+        (App.IndexController.gridChanged): Use App.Dashboard to parse the dashboard configuration.
+        Also obtain the default configuration from App.Manifest.
+        (App.IndexController._normalizeTable): Moved to App.Dashboard.
+
+        * public/v2/manifest.js:
+        (App.Repository.urlForRevision): Fixed the position of the open curly bracket.
+        (App.Repository.urlForRevisionRange): Ditto.
+        (App.Dashboard): Added.
+        (App.Dashboard.table): Extracted from App.IndexController.gridChanged.
+        (App.Dashboard.rows): Ditto.
+        (App.Dashboard.headerColumns): Ditto.
+        (App.Dashboard._normalizeTable): Moved from App.IndexController._normalizeTable.
+        (App.MetricSerializer.normalizePayload): Synthesize a dashboard record from the configuration.
+        Since there is exactly one dashboard object per app, it's okay to hard code an id here.
+        (App.Manifest._fetchedManifest): Set defaultDashboard to the one and only one dashboard we have.
+
+2014-11-21  Ryosuke Niwa  <rn...@webkit.org>
+
         There should be a way to associate bugs with analysis tasks
         https://bugs.webkit.org/show_bug.cgi?id=138977
 

Modified: trunk/Websites/perf.webkit.org/config.json (176496 => 176497)


--- trunk/Websites/perf.webkit.org/config.json	2014-11-22 03:29:58 UTC (rev 176496)
+++ trunk/Websites/perf.webkit.org/config.json	2014-11-22 03:42:26 UTC (rev 176497)
@@ -12,5 +12,6 @@
     "testServer": {
         "hostname": "localhost",
         "port": 80
-    }
+    },
+    "defaultDashboard": [[]]
 }

Modified: trunk/Websites/perf.webkit.org/public/include/manifest.php (176496 => 176497)


--- trunk/Websites/perf.webkit.org/public/include/manifest.php	2014-11-22 03:29:58 UTC (rev 176496)
+++ trunk/Websites/perf.webkit.org/public/include/manifest.php	2014-11-22 03:42:26 UTC (rev 176497)
@@ -32,6 +32,7 @@
             'repositories' => $this->repositories($repositories_table, $repositories_with_commit),
             'builders' => $this->builders(),
             'bugTrackers' => $this->bug_trackers($repositories_table),
+            'defaultDashboard' => config('defaultDashboard'),
         );
         return $this->manifest;
     }

Modified: trunk/Websites/perf.webkit.org/public/v2/app.js (176496 => 176497)


--- trunk/Websites/perf.webkit.org/public/v2/app.js	2014-11-22 03:29:58 UTC (rev 176496)
+++ trunk/Websites/perf.webkit.org/public/v2/app.js	2014-11-22 03:42:26 UTC (rev 176497)
@@ -57,7 +57,6 @@
 App.IndexController = Ember.Controller.extend({
     queryParams: ['grid', 'numberOfDays'],
     _previousGrid: {},
-    defaultTable: [],
     headerColumns: [],
     rows: [],
     numberOfDays: 30,
@@ -69,27 +68,24 @@
         if (grid === this._previousGrid)
             return;
 
-        var table = null;
-        try {
-            if (grid)
-                table = JSON.parse(grid);
-        } catch (error) {
-            console.log("Failed to parse the grid:", error, grid);
+        var dashboard = null;
+        if (grid) {
+            dashboard = App.Dashboard.create({serialized: grid});
+            if (!dashboard.get('headerColumns').length)
+                dashboard = null;
         }
+        if (!dashboard)
+            dashboard = App.Manifest.get('defaultDashboard');
+        if (!dashboard)
+            return;
 
-        if (!table || !table.length) // FIXME: We should fetch this from the manifest.
-            table = this.get('defaultTable');
-
-        table = this._normalizeTable(table);
-        var columnCount = table[0].length;
+        var headerColumns = dashboard.get('headerColumns');
+        this.set('headerColumns', headerColumns);
+        var columnCount = headerColumns.length;
         this.set('columnCount', columnCount);
 
-        this.set('headerColumns', table[0].map(function (name, index) {
-            return {label:name, index: index};
-        }));
-
         var store = this.store;
-        this.set('rows', table.slice(1).map(function (rowParam) {
+        this.set('rows', dashboard.get('rows').map(function (rowParam) {
             return App.DashboardRow.create({
                 store: store,
                 header: rowParam[0],
@@ -99,23 +95,8 @@
         }));
 
         this.set('emptyRow', new Array(columnCount));
-    }.observes('grid').on('init'),
+    }.observes('grid', 'App.Manifest.defaultDashboard').on('init'),
 
-    _normalizeTable: function (table)
-    {
-        var maxColumnCount = Math.max(table.map(function (column) { return column.length; }));
-        for (var i = 1; i < table.length; i++) {
-            var row = table[i];
-            for (var j = 1; j < row.length; j++) {
-                if (row[j] && !(row[j] instanceof Array)) {
-                    console.log('Unrecognized (platform, metric) pair at column ' + i + ' row ' + j + ':' + row[j]);
-                    row[j] = [];
-                }
-            }
-        }
-        return table;
-    },
-
     updateGrid: function()
     {
         var headers = this.get('headerColumns').map(function (header) { return header.label; });

Modified: trunk/Websites/perf.webkit.org/public/v2/manifest.js (176496 => 176497)


--- trunk/Websites/perf.webkit.org/public/v2/manifest.js	2014-11-22 03:29:58 UTC (rev 176496)
+++ trunk/Websites/perf.webkit.org/public/v2/manifest.js	2014-11-22 03:42:26 UTC (rev 176497)
@@ -82,14 +82,63 @@
     url: DS.attr('string'),
     blameUrl: DS.attr('string'),
     hasReportedCommits: DS.attr('boolean'),
-    urlForRevision: function (currentRevision) {
+    urlForRevision: function (currentRevision)
+    {
         return (this.get('url') || '').replace(/\$1/g, currentRevision);
     },
-    urlForRevisionRange: function (from, to) {
+    urlForRevisionRange: function (from, to)
+    {
         return (this.get('blameUrl') || '').replace(/\$1/g, from).replace(/\$2/g, to);
     },
 });
 
+App.Dashboard = App.Model.extend({
+    serialized: DS.attr('string'),
+    table: function ()
+    {
+        var json = this.get('serialized');
+        try {
+            var parsed = JSON.parse(json);
+        } catch (error) {
+            console.log("Failed to parse the grid:", error, json);
+            return [];
+        }
+        if (!parsed)
+            return [];
+        return this._normalizeTable(parsed);
+    }.property('serialized'),
+
+    rows: function ()
+    {
+        return this.get('table').slice(1);
+    }.property('table'),
+
+    headerColumns: function ()
+    {
+        var table = this.get('table');
+        if (!table || !table.length)
+            return [];
+        return table[0].map(function (name, index) {
+            return {label:name, index: index};
+        });
+    }.property('table'),
+
+    _normalizeTable: function (table)
+    {
+        var maxColumnCount = Math.max(table.map(function (column) { return column.length; }));
+        for (var i = 1; i < table.length; i++) {
+            var row = table[i];
+            for (var j = 1; j < row.length; j++) {
+                if (row[j] && !(row[j] instanceof Array)) {
+                    console.log('Unrecognized (platform, metric) pair at column ' + i + ' row ' + j + ':' + row[j]);
+                    row[j] = [];
+                }
+            }
+        }
+        return table;
+    },
+});
+
 App.MetricSerializer = App.PlatformSerializer = DS.RESTSerializer.extend({
     normalizePayload: function (payload)
     {
@@ -103,6 +152,7 @@
             metrics: this._normalizeIdMap(payload['metrics']),
             repositories: this._normalizeIdMap(payload['repositories']),
             bugTrackers: this._normalizeIdMap(payload['bugTrackers']),
+            dashboards: [{id: 1, serialized: JSON.stringify(payload['defaultDashboard'])}],
         };
 
         for (var testId in payload['tests']) {
@@ -208,6 +258,8 @@
             repositories.filter(function (repository) { return repository.get('hasReportedCommits'); }));
 
         this.set('bugTrackers', store.all('bugTracker').sortBy('name'));
+
+        this.set('defaultDashboard', store.all('dashboard').objectAt(0));
     },
     fetchRunsWithPlatformAndMetric: function (store, platformId, metricId)
     {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to