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

Changeset 176493 in webkit


Ignore:
Timestamp:
Nov 21, 2014, 6:06:00 PM (12 years ago)
Author:
rniwa@webkit.org
Message:

There should be a way to associate bugs with analysis tasks
https://bugs.webkit.org/show_bug.cgi?id=138977

Reviewed by Benjamin Poulain.

Updated associate-bug.php to match the new database schema.

  • public/include/json-header.php:

(require_format): Removed the call to camel_case_words_separated_by_underscore since the name is
already camel-cased in require_existence_of. This makes the function usable elsewhere.

  • public/privileged-api/associate-bug.php:

(main): Changed the API to take run, bugTracker, and number to match the new database schema.
Also verify that those values are integers using require_format.

  • public/v2/analysis.js:

(App.AnalysisTask.label): Added. Concatenates the task's name with the bug numbers.
(App.Bug.label): Added.
(App.BugAdapter): Added.
(App.BugAdapter.createRecord): Use PrivilegedAPI instead of the builtin ajax call.
(App.BuildRequest): Inherit from newly added App.Model, which is set to DS.Model right now.

  • public/v2/app.css: Renamed .test-groups to .analysis-group. Also added new rules for the table

containing the bug information.

  • public/v2/app.js:

(App.InteractiveChartComponent._rangesChanged): Added label to range bar objects.
(App.AnalysisTaskRoute):
(App.AnalysisTaskController): Replaced the functionality of App.AnalysisTaskViewModel.
(App.AnalysisTaskController._fetchedManifest): Added.
(App.AnalysisTaskController.actions.associateBug): Added.

  • public/v2/chart-pane.css: Renamed .bugs-pane to .analysis-pane.
  • public/v2/data.js:

(Measurement.prototype.associateBug): Deleted.

  • public/v2/index.html: Renamed .bugs-pane to .analysis-pane and .test-groups to .analysis-group.

Added a table show the bug information. Also hide the chart until chartData is available.

  • public/v2/manifest.js:

(App.Model): Added.

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

Legend:

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

    r176435 r176493  
     12014-11-21  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        There should be a way to associate bugs with analysis tasks
     4        https://bugs.webkit.org/show_bug.cgi?id=138977
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Updated associate-bug.php to match the new database schema.
     9
     10        * public/include/json-header.php:
     11        (require_format): Removed the call to camel_case_words_separated_by_underscore since the name is
     12        already camel-cased in require_existence_of. This makes the function usable elsewhere.
     13
     14        * public/privileged-api/associate-bug.php:
     15        (main): Changed the API to take run, bugTracker, and number to match the new database schema.
     16        Also verify that those values are integers using require_format.
     17
     18        * public/v2/analysis.js:
     19        (App.AnalysisTask.label): Added. Concatenates the task's name with the bug numbers.
     20        (App.Bug.label): Added.
     21        (App.BugAdapter): Added.
     22        (App.BugAdapter.createRecord): Use PrivilegedAPI instead of the builtin ajax call.
     23        (App.BuildRequest): Inherit from newly added App.Model, which is set to DS.Model right now.
     24
     25        * public/v2/app.css: Renamed .test-groups to .analysis-group. Also added new rules for the table
     26        containing the bug information.
     27
     28        * public/v2/app.js:
     29        (App.InteractiveChartComponent._rangesChanged): Added label to range bar objects.
     30        (App.AnalysisTaskRoute):
     31        (App.AnalysisTaskController): Replaced the functionality of App.AnalysisTaskViewModel.
     32        (App.AnalysisTaskController._fetchedManifest): Added.
     33        (App.AnalysisTaskController.actions.associateBug): Added.
     34
     35        * public/v2/chart-pane.css: Renamed .bugs-pane to .analysis-pane.
     36
     37        * public/v2/data.js:
     38        (Measurement.prototype.associateBug): Deleted.
     39
     40        * public/v2/index.html: Renamed .bugs-pane to .analysis-pane and .test-groups to .analysis-group.
     41        Added a table show the bug information. Also hide the chart until chartData is available.
     42
     43        * public/v2/manifest.js:
     44        (App.Model): Added.
     45
    1462014-11-20  Ryosuke Niwa  <rniwa@webkit.org>
    247
  • trunk/Websites/perf.webkit.org/public/include/json-header.php

    r175768 r176493  
    5454}
    5555
    56 function require_format($key, $value, $pattern) {
     56function require_format($name, $value, $pattern) {
    5757    if (!preg_match($pattern, $value))
    58         exit_with_error('Invalid' . camel_case_words_separated_by_underscore($key), array('value' => $value));
     58        exit_with_error('Invalid' . $name, array('value' => $value));
    5959}
    6060
  • trunk/Websites/perf.webkit.org/public/privileged-api/associate-bug.php

    r175768 r176493  
    66    $data = ensure_privileged_api_data_and_token();
    77
    8     $run_id = array_get($data, 'run');
    9     $bug_tracker_id = array_get($data, 'tracker');
    10     $bug_number = array_get($data, 'bugNumber');
     8    $analysis_task_id = array_get($data, 'task');
     9    $bug_tracker_id = array_get($data, 'bugTracker');
     10    $bug_number = array_get($data, 'number');
    1111
    12     if (!$run_id)
    13         exit_with_error('InvalidRunId', array('run' => $run_id));
    14     if (!$bug_tracker_id)
    15         exit_with_error('InvalidBugTrackerId', array('tracker' => $bug_tracker_id));
     12    require_format('AnalysisTask', $analysis_task_id, '/^\d+$/');
     13    require_format('BugTracker', $bug_tracker_id, '/^\d+$/');
     14    require_format('BugNumber', $bug_number, '/^\d*$/');
    1615
    1716    $db = connect();
     
    2019    $bug_id = NULL;
    2120    if (!$bug_number) {
    22         $count = $db->query_and_get_affected_rows("DELETE FROM bugs WHERE bug_run = $1 AND bug_tracker = $2",
    23             array($run_id, $bug_tracker_id));
     21        $count = $db->query_and_get_affected_rows("DELETE FROM bugs WHERE bug_task = $1 AND bug_tracker = $2",
     22            array($analysis_task_id, $bug_tracker_id));
    2423        if ($count > 1) {
    2524            $db->rollback_transaction();
     
    2726        }
    2827    } else {
    29         $bug_id = $db->update_or_insert_row('bugs', 'bug', array('run' => $run_id, 'tracker' => $bug_tracker_id),
    30             array('run' => $run_id, 'tracker' => $bug_tracker_id, 'number' => $bug_number));
     28        $bug_id = $db->update_or_insert_row('bugs', 'bug', array('task' => $analysis_task_id, 'tracker' => $bug_tracker_id),
     29            array('task' => $analysis_task_id, 'tracker' => $bug_tracker_id, 'number' => $bug_number));
    3130    }
    3231    $db->commit_transaction();
  • trunk/Websites/perf.webkit.org/public/v2/analysis.js

    r176422 r176493  
    1010        return this.store.find('testGroup', {task: this.get('id')});
    1111    }.property(),
     12    label: function () {
     13        var label = this.get('name');
     14        var bugs = this.get('bugs').map(function (bug) { return bug.get('label'); }).join(' / ');
     15        return bugs ? label + ' (' + bugs + ')' : label;
     16    }.property('name', 'bugs'),
    1217});
    1318
    14 App.Bug = App.NameLabelModel.extend({
     19App.Bug = App.Model.extend({
    1520    task: DS.belongsTo('AnalysisTask'),
    1621    bugTracker: DS.belongsTo('BugTracker'),
    1722    createdAt: DS.attr('date'),
    1823    number: DS.attr('number'),
     24    label: function () {
     25        return this.get('bugTracker').get('label') + ': ' + this.get('number');
     26    }.property('name', 'bugTracker'),
    1927});
    2028
     
    3442        return '../api/analysis-tasks/' + (id ? id : '');
    3543    },
     44});
     45
     46App.BugAdapter = DS.RESTAdapter.extend({
     47    createRecord: function (store, type, record)
     48    {
     49        var param = {
     50            task: record.get('task').get('id'),
     51            bugTracker: record.get('bugTracker').get('id'),
     52            number: record.get('number'),
     53        };
     54        return PrivilegedAPI.sendRequest('associate-bug', param).then(function (data) {
     55            param['id'] = data['bugId'];
     56            return {'bug': param};
     57        });
     58    }
    3659});
    3760
     
    5881});
    5982
    60 App.BuildRequest = DS.Model.extend({
     83App.BuildRequest = App.Model.extend({
    6184    group: DS.belongsTo('testGroup'),
    6285    order: DS.attr('number'),
  • trunk/Websites/perf.webkit.org/public/v2/app.css

    r175768 r176493  
    414414
    415415#analysis-tasks,
    416 .test-groups > table {
     416.analysis-group > table {
    417417    border: solid 0px #999;
    418418    border-collapse: collapse;
     
    420420
    421421#analysis-tasks thead,
    422 .test-groups > table thead {
     422.analysis-group > table thead {
    423423    color: #c93;
    424424}
    425425
    426426#analysis-tasks th,
    427 .test-groups > table th {
     427.analysis-group > table th {
    428428    font-weight: normal;
    429429}
     
    431431#analysis-tasks td,
    432432#analysis-tasks th,
    433 .test-groups > table td,
    434 .test-groups > table th {
     433.analysis-group > table td,
     434.analysis-group > table th {
    435435    padding: 0.2rem 0.5rem;
    436436}
     
    438438#analysis-tasks tbody td,
    439439#analysis-tasks tbody th,
    440 .test-groups > table tbody td,
    441 .test-groups > table tbody th {
     440.analysis-group > table tbody td,
     441.analysis-group > table tbody th {
    442442    border-top: solid 1px #ddd;
    443443}
     
    458458}
    459459
    460 .test-groups {
     460.analysis-group {
    461461    border: 1px solid #bbb;
    462462    border-radius: 0.5rem;
     
    467467}
    468468
    469 .test-groups caption {
     469.analysis-group caption {
    470470    font-size: 1.1rem;
    471471    text-align: left;
    472472    margin-bottom: 0.5rem;
    473473}
     474
     475.analysis-bugs th {
     476    font-weight: normal;
     477    text-align: right;
     478}
  • trunk/Websites/perf.webkit.org/public/v2/app.js

    r176435 r176493  
    14711471                linkRoute: linkRoute,
    14721472                linkId: range.get('id'),
     1473                label: range.get('label'),
    14731474            });
    14741475        }));
     
    16541655
    16551656App.AnalysisTaskRoute = Ember.Route.extend({
    1656     model: function (param) {
    1657         return this.store.find('analysisTask', param.taskId).then(function (task) {
    1658             return App.AnalysisTaskViewModel.create({content: task, store: store});
    1659         });
     1657    model: function (param)
     1658    {
     1659        return this.store.find('analysisTask', param.taskId);
    16601660    },
    16611661});
    16621662
    1663 App.AnalysisTaskViewModel = Ember.ObjectProxy.extend({
     1663App.AnalysisTaskController = Ember.Controller.extend({
     1664    label: Ember.computed.alias('model.name'),
     1665    platform: Ember.computed.alias('model.platform'),
     1666    metric: Ember.computed.alias('model.metric'),
    16641667    testSets: [],
    16651668    roots: [],
     1669    bugTrackers: [],
    16661670    _taskUpdated: function ()
    16671671    {
    1668         var platformId = this.get('platform').get('id');
    1669         var metricId = this.get('metric').get('id');
    1670         App.Manifest.fetchRunsWithPlatformAndMetric(this.get('store'), platformId, metricId).then(this._fetchedRuns.bind(this));
    1671     }.observes('platform', 'metric').on('init'),
     1672        var model = this.get('model');
     1673        if (!model)
     1674            return;
     1675
     1676        var platformId = model.get('platform').get('id');
     1677        var metricId = model.get('metric').get('id');
     1678        App.Manifest.fetch(this.store).then(this._fetchedManifest.bind(this));
     1679        App.Manifest.fetchRunsWithPlatformAndMetric(this.store, platformId, metricId).then(this._fetchedRuns.bind(this));
     1680    }.observes('model').on('init'),
     1681    _fetchedManifest: function ()
     1682    {
     1683        var trackerIdToBugNumber = {};
     1684        this.get('model').get('bugs').forEach(function (bug) {
     1685            trackerIdToBugNumber[bug.get('bugTracker').get('id')] = bug.get('number');
     1686        });
     1687
     1688        this.set('bugTrackers', App.Manifest.get('bugTrackers').map(function (bugTracker) {
     1689            var bugNumber = trackerIdToBugNumber[bugTracker.get('id')];
     1690            return Ember.ObjectProxy.create({
     1691                content: bugTracker,
     1692                bugNumber: bugNumber,
     1693                editedBugNumber: bugNumber,
     1694            });
     1695        }));
     1696    },
    16721697    _fetchedRuns: function (data) {
    16731698        var runs = data.runs;
     
    16771702            return; // FIXME: Report an error.
    16781703
    1679         var start = currentTimeSeries.findPointByMeasurementId(this.get('startRun'));
    1680         var end = currentTimeSeries.findPointByMeasurementId(this.get('endRun'));
     1704        var start = currentTimeSeries.findPointByMeasurementId(this.get('model').get('startRun'));
     1705        var end = currentTimeSeries.findPointByMeasurementId(this.get('model').get('endRun'));
    16811706        if (!start || !end)
    16821707            return; // FIXME: Report an error.
     
    17691794        return roots;
    17701795    }.property('analysisPoints'),
     1796    actions: {
     1797        associateBug: function (bugTracker, bugNumber)
     1798        {
     1799            var model = this.get('model');
     1800            this.store.createRecord('bug',
     1801                {task: this.get('model'), bugTracker: bugTracker.get('content'), number: bugNumber}).save().then(function () {
     1802                    // FIXME: Should we notify the user?
     1803                }, function (error) {
     1804                    alert('Failed to associate the bug: ' + error);
     1805                });
     1806        }
     1807    },
    17711808});
  • trunk/Websites/perf.webkit.org/public/v2/chart-pane.css

    r176422 r176493  
    6565}
    6666
    67 .search-pane, .bugs-pane {
     67.search-pane, .analysis-pane {
    6868    position: absolute;
    6969    top: 1.7rem;
     
    7575}
    7676
    77 .bugs-pane {
     77.analysis-pane {
    7878    right: 1.3rem;
    7979}
    8080
    81 .bugs-pane table {
     81.analysis-pane table {
    8282    margin: 0.2rem;
    8383    font-size: 0.8rem;
    8484}
    8585
    86 .bugs-pane th {
     86.analysis-pane th {
    8787    font-weight: normal;
    8888}
     
    9292}
    9393
    94 .bugs-pane.hidden,
     94.analysis-pane.hidden,
    9595.search-pane.hidden {
    9696    display: none;
  • trunk/Websites/perf.webkit.org/public/v2/data.js

    r176422 r176493  
    279279}
    280280
    281 Measurement.prototype.associateBug = function (trackerId, bugNumber)
    282 {
    283     var bugs = this._raw['bugs'];
    284     trackerId = parseInt(trackerId);
    285     bugNumber = bugNumber ? parseInt(bugNumber) : null;
    286     return PrivilegedAPI.sendRequest('associate-bug', {
    287         run: this.id(),
    288         tracker: trackerId,
    289         bugNumber: bugNumber,
    290     }).then(function () {
    291         if (bugNumber)
    292             bugs[trackerId] = bugNumber;
    293         else
    294             delete bugs[trackerId];
    295     });
    296 }
    297 
    298281function RunsData(rawData)
    299282{
  • trunk/Websites/perf.webkit.org/public/v2/index.html

    r176422 r176493  
    197197                </form>
    198198
    199                 <div {{bind-attr class=":bugs-pane showingAnalysisPane::hidden"}}>
     199                <div {{bind-attr class=":analysis-pane showingAnalysisPane::hidden"}}>
    200200                    <table>
    201201                        <tbody>
     
    230230        <div class="rangeBarsContainerInlineStyle">
    231231            {{#each rangeBars}}
    232                 {{#link-to linkRoute linkId}}
     232                {{#link-to linkRoute linkId title=label}}
    233233                    <span class="rangeBar" {{bind-attr style=inlineStyle}}></span>
    234234                {{/link-to}}
     
    448448        </header>
    449449
    450         <h2 id="analysis-task-title">{{name}}</h2>
     450        <h2 id="analysis-task-title">{{label}}</h2>
    451451        {{#if platform.label}}
    452452            <h3 id="analysis-task-testname">{{metric.fullName}} - {{platform.label}}</h3>
    453 
     453        {{/if}}
     454
     455        {{#if chartData}}
    454456            <section class="analysis-chart-pane chart-pane">
    455457                <div class="svg-container">
     
    462464                </div>
    463465                <div class="details">
     466                    <table class="analysis-bugs">
     467                        <tbody>
     468                            {{#each bugTrackers}}
     469                                <tr>
     470                                    <th>{{label}}</th>
     471                                    <td>
     472                                        <form {{action "associateBug" this editedBugNumber on="submit"}}>
     473                                            {{input type=text value=editedBugNumber}}
     474                                        </form>
     475                                    </td>
     476                                </tr>
     477                            {{/each}}
     478                        </tbody>
     479                    </table>
    464480                    <table>
    465481                        <tbody>
     
    473489
    474490            {{#each testGroups}}
    475                 <section class="test-groups">
     491                <section class="analysis-group">
    476492                    <table>
    477493                        <caption>{{name}}</caption>
     
    498514            {{/each}}
    499515
    500             <form class="test-groups">
     516            <form class="analysis-group">
    501517                <table>
    502518                    <caption><input name="name" placeholder="Test group name" required></caption>
  • trunk/Websites/perf.webkit.org/public/v2/manifest.js

    r176203 r176493  
     1App.Model = DS.Model;
     2
    13App.NameLabelModel = DS.Model.extend({
    24    name: DS.attr('string'),
Note: See TracChangeset for help on using the changeset viewer.