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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176497
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2014-11-21 Ryosuke Niwa <rniwa@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 <rniwa@webkit.org>
+
There should be a way to associate bugs with analysis tasks
https://bugs.webkit.org/show_bug.cgi?id=138977
"testServer": {
"hostname": "localhost",
"port": 80
- }
+ },
+ "defaultDashboard": [[]]
}
'repositories' => $this->repositories($repositories_table, $repositories_with_commit),
'builders' => $this->builders(),
'bugTrackers' => $this->bug_trackers($repositories_table),
+ 'defaultDashboard' => config('defaultDashboard'),
);
return $this->manifest;
}
App.IndexController = Ember.Controller.extend({
queryParams: ['grid', 'numberOfDays'],
_previousGrid: {},
- defaultTable: [],
headerColumns: [],
rows: [],
numberOfDays: 30,
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],
}));
this.set('emptyRow', new Array(columnCount));
- }.observes('grid').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;
- },
+ }.observes('grid', 'App.Manifest.defaultDashboard').on('init'),
updateGrid: function()
{
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)
{
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']) {
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)
{