Changeset 176497 in webkit
- Timestamp:
- Nov 21, 2014, 7:42:26 PM (12 years ago)
- Location:
- trunk/Websites/perf.webkit.org
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
config.json (modified) (1 diff)
-
public/include/manifest.php (modified) (1 diff)
-
public/v2/app.js (modified) (3 diffs)
-
public/v2/manifest.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Websites/perf.webkit.org/ChangeLog
r176493 r176497 1 2014-11-21 Ryosuke Niwa <rniwa@webkit.org> 2 3 The dashboard on new perf monitor should be configurable 4 https://bugs.webkit.org/show_bug.cgi?id=138994 5 6 Reviewed by Benjamin Poulain. 7 8 For now, make it configurable via config.json. We should eventually make it configurable via 9 an administrative page but this will do for now. 10 11 * config.json: Added the empty dashboard configuration. 12 13 * public/include/manifest.php: Include the dashboard configuration in the manifest file. 14 15 * public/v2/app.js: 16 (App.IndexController): Removed defaultTable since this is now dynamically obtained via App.Manifest. 17 (App.IndexController.gridChanged): Use App.Dashboard to parse the dashboard configuration. 18 Also obtain the default configuration from App.Manifest. 19 (App.IndexController._normalizeTable): Moved to App.Dashboard. 20 21 * public/v2/manifest.js: 22 (App.Repository.urlForRevision): Fixed the position of the open curly bracket. 23 (App.Repository.urlForRevisionRange): Ditto. 24 (App.Dashboard): Added. 25 (App.Dashboard.table): Extracted from App.IndexController.gridChanged. 26 (App.Dashboard.rows): Ditto. 27 (App.Dashboard.headerColumns): Ditto. 28 (App.Dashboard._normalizeTable): Moved from App.IndexController._normalizeTable. 29 (App.MetricSerializer.normalizePayload): Synthesize a dashboard record from the configuration. 30 Since there is exactly one dashboard object per app, it's okay to hard code an id here. 31 (App.Manifest._fetchedManifest): Set defaultDashboard to the one and only one dashboard we have. 32 1 33 2014-11-21 Ryosuke Niwa <rniwa@webkit.org> 2 34 -
trunk/Websites/perf.webkit.org/config.json
r163688 r176497 13 13 "hostname": "localhost", 14 14 "port": 80 15 } 15 }, 16 "defaultDashboard": [[]] 16 17 } -
trunk/Websites/perf.webkit.org/public/include/manifest.php
r175006 r176497 33 33 'builders' => $this->builders(), 34 34 'bugTrackers' => $this->bug_trackers($repositories_table), 35 'defaultDashboard' => config('defaultDashboard'), 35 36 ); 36 37 return $this->manifest; -
trunk/Websites/perf.webkit.org/public/v2/app.js
r176493 r176497 58 58 queryParams: ['grid', 'numberOfDays'], 59 59 _previousGrid: {}, 60 defaultTable: [],61 60 headerColumns: [], 62 61 rows: [], … … 70 69 return; 71 70 72 var table = null; 73 try { 74 if (grid) 75 table = JSON.parse(grid); 76 } catch (error) { 77 console.log("Failed to parse the grid:", error, grid); 78 } 79 80 if (!table || !table.length) // FIXME: We should fetch this from the manifest. 81 table = this.get('defaultTable'); 82 83 table = this._normalizeTable(table); 84 var columnCount = table[0].length; 71 var dashboard = null; 72 if (grid) { 73 dashboard = App.Dashboard.create({serialized: grid}); 74 if (!dashboard.get('headerColumns').length) 75 dashboard = null; 76 } 77 if (!dashboard) 78 dashboard = App.Manifest.get('defaultDashboard'); 79 if (!dashboard) 80 return; 81 82 var headerColumns = dashboard.get('headerColumns'); 83 this.set('headerColumns', headerColumns); 84 var columnCount = headerColumns.length; 85 85 this.set('columnCount', columnCount); 86 86 87 this.set('headerColumns', table[0].map(function (name, index) {88 return {label:name, index: index};89 }));90 91 87 var store = this.store; 92 this.set('rows', table.slice(1).map(function (rowParam) {88 this.set('rows', dashboard.get('rows').map(function (rowParam) { 93 89 return App.DashboardRow.create({ 94 90 store: store, … … 100 96 101 97 this.set('emptyRow', new Array(columnCount)); 102 }.observes('grid').on('init'), 103 104 _normalizeTable: function (table) 105 { 106 var maxColumnCount = Math.max(table.map(function (column) { return column.length; })); 107 for (var i = 1; i < table.length; i++) { 108 var row = table[i]; 109 for (var j = 1; j < row.length; j++) { 110 if (row[j] && !(row[j] instanceof Array)) { 111 console.log('Unrecognized (platform, metric) pair at column ' + i + ' row ' + j + ':' + row[j]); 112 row[j] = []; 113 } 114 } 115 } 116 return table; 117 }, 98 }.observes('grid', 'App.Manifest.defaultDashboard').on('init'), 118 99 119 100 updateGrid: function() -
trunk/Websites/perf.webkit.org/public/v2/manifest.js
r176493 r176497 83 83 blameUrl: DS.attr('string'), 84 84 hasReportedCommits: DS.attr('boolean'), 85 urlForRevision: function (currentRevision) { 85 urlForRevision: function (currentRevision) 86 { 86 87 return (this.get('url') || '').replace(/\$1/g, currentRevision); 87 88 }, 88 urlForRevisionRange: function (from, to) { 89 urlForRevisionRange: function (from, to) 90 { 89 91 return (this.get('blameUrl') || '').replace(/\$1/g, from).replace(/\$2/g, to); 92 }, 93 }); 94 95 App.Dashboard = App.Model.extend({ 96 serialized: DS.attr('string'), 97 table: function () 98 { 99 var json = this.get('serialized'); 100 try { 101 var parsed = JSON.parse(json); 102 } catch (error) { 103 console.log("Failed to parse the grid:", error, json); 104 return []; 105 } 106 if (!parsed) 107 return []; 108 return this._normalizeTable(parsed); 109 }.property('serialized'), 110 111 rows: function () 112 { 113 return this.get('table').slice(1); 114 }.property('table'), 115 116 headerColumns: function () 117 { 118 var table = this.get('table'); 119 if (!table || !table.length) 120 return []; 121 return table[0].map(function (name, index) { 122 return {label:name, index: index}; 123 }); 124 }.property('table'), 125 126 _normalizeTable: function (table) 127 { 128 var maxColumnCount = Math.max(table.map(function (column) { return column.length; })); 129 for (var i = 1; i < table.length; i++) { 130 var row = table[i]; 131 for (var j = 1; j < row.length; j++) { 132 if (row[j] && !(row[j] instanceof Array)) { 133 console.log('Unrecognized (platform, metric) pair at column ' + i + ' row ' + j + ':' + row[j]); 134 row[j] = []; 135 } 136 } 137 } 138 return table; 90 139 }, 91 140 }); … … 104 153 repositories: this._normalizeIdMap(payload['repositories']), 105 154 bugTrackers: this._normalizeIdMap(payload['bugTrackers']), 155 dashboards: [{id: 1, serialized: JSON.stringify(payload['defaultDashboard'])}], 106 156 }; 107 157 … … 209 259 210 260 this.set('bugTrackers', store.all('bugTracker').sortBy('name')); 261 262 this.set('defaultDashboard', store.all('dashboard').objectAt(0)); 211 263 }, 212 264 fetchRunsWithPlatformAndMetric: function (store, platformId, metricId)
Note:
See TracChangeset
for help on using the changeset viewer.