⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176497 in webkit


Ignore:
Timestamp:
Nov 21, 2014, 7:42:26 PM (12 years ago)
Author:
rniwa@webkit.org
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.

Location:
trunk/Websites/perf.webkit.org
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Websites/perf.webkit.org/ChangeLog

    r176493 r176497  
     12014-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
    1332014-11-21  Ryosuke Niwa  <rniwa@webkit.org>
    234
  • trunk/Websites/perf.webkit.org/config.json

    r163688 r176497  
    1313        "hostname": "localhost",
    1414        "port": 80
    15     }
     15    },
     16    "defaultDashboard": [[]]
    1617}
  • trunk/Websites/perf.webkit.org/public/include/manifest.php

    r175006 r176497  
    3333            'builders' => $this->builders(),
    3434            'bugTrackers' => $this->bug_trackers($repositories_table),
     35            'defaultDashboard' => config('defaultDashboard'),
    3536        );
    3637        return $this->manifest;
  • trunk/Websites/perf.webkit.org/public/v2/app.js

    r176493 r176497  
    5858    queryParams: ['grid', 'numberOfDays'],
    5959    _previousGrid: {},
    60     defaultTable: [],
    6160    headerColumns: [],
    6261    rows: [],
     
    7069            return;
    7170
    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;
    8585        this.set('columnCount', columnCount);
    8686
    87         this.set('headerColumns', table[0].map(function (name, index) {
    88             return {label:name, index: index};
    89         }));
    90 
    9187        var store = this.store;
    92         this.set('rows', table.slice(1).map(function (rowParam) {
     88        this.set('rows', dashboard.get('rows').map(function (rowParam) {
    9389            return App.DashboardRow.create({
    9490                store: store,
     
    10096
    10197        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'),
    11899
    119100    updateGrid: function()
  • trunk/Websites/perf.webkit.org/public/v2/manifest.js

    r176493 r176497  
    8383    blameUrl: DS.attr('string'),
    8484    hasReportedCommits: DS.attr('boolean'),
    85     urlForRevision: function (currentRevision) {
     85    urlForRevision: function (currentRevision)
     86    {
    8687        return (this.get('url') || '').replace(/\$1/g, currentRevision);
    8788    },
    88     urlForRevisionRange: function (from, to) {
     89    urlForRevisionRange: function (from, to)
     90    {
    8991        return (this.get('blameUrl') || '').replace(/\$1/g, from).replace(/\$2/g, to);
     92    },
     93});
     94
     95App.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;
    90139    },
    91140});
     
    104153            repositories: this._normalizeIdMap(payload['repositories']),
    105154            bugTrackers: this._normalizeIdMap(payload['bugTrackers']),
     155            dashboards: [{id: 1, serialized: JSON.stringify(payload['defaultDashboard'])}],
    106156        };
    107157
     
    209259
    210260        this.set('bugTrackers', store.all('bugTracker').sortBy('name'));
     261
     262        this.set('defaultDashboard', store.all('dashboard').objectAt(0));
    211263    },
    212264    fetchRunsWithPlatformAndMetric: function (store, platformId, metricId)
Note: See TracChangeset for help on using the changeset viewer.