Changeset 176493 in webkit
- Timestamp:
- Nov 21, 2014, 6:06:00 PM (12 years ago)
- Location:
- trunk/Websites/perf.webkit.org
- Files:
-
- 10 edited
-
ChangeLog (modified) (1 diff)
-
public/include/json-header.php (modified) (1 diff)
-
public/privileged-api/associate-bug.php (modified) (3 diffs)
-
public/v2/analysis.js (modified) (3 diffs)
-
public/v2/app.css (modified) (6 diffs)
-
public/v2/app.js (modified) (4 diffs)
-
public/v2/chart-pane.css (modified) (3 diffs)
-
public/v2/data.js (modified) (1 diff)
-
public/v2/index.html (modified) (6 diffs)
-
public/v2/manifest.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Websites/perf.webkit.org/ChangeLog
r176435 r176493 1 2014-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 1 46 2014-11-20 Ryosuke Niwa <rniwa@webkit.org> 2 47 -
trunk/Websites/perf.webkit.org/public/include/json-header.php
r175768 r176493 54 54 } 55 55 56 function require_format($ key, $value, $pattern) {56 function require_format($name, $value, $pattern) { 57 57 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)); 59 59 } 60 60 -
trunk/Websites/perf.webkit.org/public/privileged-api/associate-bug.php
r175768 r176493 6 6 $data = ensure_privileged_api_data_and_token(); 7 7 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'); 11 11 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*$/'); 16 15 17 16 $db = connect(); … … 20 19 $bug_id = NULL; 21 20 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)); 24 23 if ($count > 1) { 25 24 $db->rollback_transaction(); … … 27 26 } 28 27 } 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)); 31 30 } 32 31 $db->commit_transaction(); -
trunk/Websites/perf.webkit.org/public/v2/analysis.js
r176422 r176493 10 10 return this.store.find('testGroup', {task: this.get('id')}); 11 11 }.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'), 12 17 }); 13 18 14 App.Bug = App. NameLabelModel.extend({19 App.Bug = App.Model.extend({ 15 20 task: DS.belongsTo('AnalysisTask'), 16 21 bugTracker: DS.belongsTo('BugTracker'), 17 22 createdAt: DS.attr('date'), 18 23 number: DS.attr('number'), 24 label: function () { 25 return this.get('bugTracker').get('label') + ': ' + this.get('number'); 26 }.property('name', 'bugTracker'), 19 27 }); 20 28 … … 34 42 return '../api/analysis-tasks/' + (id ? id : ''); 35 43 }, 44 }); 45 46 App.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 } 36 59 }); 37 60 … … 58 81 }); 59 82 60 App.BuildRequest = DS.Model.extend({83 App.BuildRequest = App.Model.extend({ 61 84 group: DS.belongsTo('testGroup'), 62 85 order: DS.attr('number'), -
trunk/Websites/perf.webkit.org/public/v2/app.css
r175768 r176493 414 414 415 415 #analysis-tasks, 416 . test-groups> table {416 .analysis-group > table { 417 417 border: solid 0px #999; 418 418 border-collapse: collapse; … … 420 420 421 421 #analysis-tasks thead, 422 . test-groups> table thead {422 .analysis-group > table thead { 423 423 color: #c93; 424 424 } 425 425 426 426 #analysis-tasks th, 427 . test-groups> table th {427 .analysis-group > table th { 428 428 font-weight: normal; 429 429 } … … 431 431 #analysis-tasks td, 432 432 #analysis-tasks th, 433 . test-groups> table td,434 . test-groups> table th {433 .analysis-group > table td, 434 .analysis-group > table th { 435 435 padding: 0.2rem 0.5rem; 436 436 } … … 438 438 #analysis-tasks tbody td, 439 439 #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 { 442 442 border-top: solid 1px #ddd; 443 443 } … … 458 458 } 459 459 460 . test-groups{460 .analysis-group { 461 461 border: 1px solid #bbb; 462 462 border-radius: 0.5rem; … … 467 467 } 468 468 469 . test-groupscaption {469 .analysis-group caption { 470 470 font-size: 1.1rem; 471 471 text-align: left; 472 472 margin-bottom: 0.5rem; 473 473 } 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 1471 1471 linkRoute: linkRoute, 1472 1472 linkId: range.get('id'), 1473 label: range.get('label'), 1473 1474 }); 1474 1475 })); … … 1654 1655 1655 1656 App.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); 1660 1660 }, 1661 1661 }); 1662 1662 1663 App.AnalysisTaskViewModel = Ember.ObjectProxy.extend({ 1663 App.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'), 1664 1667 testSets: [], 1665 1668 roots: [], 1669 bugTrackers: [], 1666 1670 _taskUpdated: function () 1667 1671 { 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 }, 1672 1697 _fetchedRuns: function (data) { 1673 1698 var runs = data.runs; … … 1677 1702 return; // FIXME: Report an error. 1678 1703 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')); 1681 1706 if (!start || !end) 1682 1707 return; // FIXME: Report an error. … … 1769 1794 return roots; 1770 1795 }.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 }, 1771 1808 }); -
trunk/Websites/perf.webkit.org/public/v2/chart-pane.css
r176422 r176493 65 65 } 66 66 67 .search-pane, . bugs-pane {67 .search-pane, .analysis-pane { 68 68 position: absolute; 69 69 top: 1.7rem; … … 75 75 } 76 76 77 . bugs-pane {77 .analysis-pane { 78 78 right: 1.3rem; 79 79 } 80 80 81 . bugs-pane table {81 .analysis-pane table { 82 82 margin: 0.2rem; 83 83 font-size: 0.8rem; 84 84 } 85 85 86 . bugs-pane th {86 .analysis-pane th { 87 87 font-weight: normal; 88 88 } … … 92 92 } 93 93 94 . bugs-pane.hidden,94 .analysis-pane.hidden, 95 95 .search-pane.hidden { 96 96 display: none; -
trunk/Websites/perf.webkit.org/public/v2/data.js
r176422 r176493 279 279 } 280 280 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 else294 delete bugs[trackerId];295 });296 }297 298 281 function RunsData(rawData) 299 282 { -
trunk/Websites/perf.webkit.org/public/v2/index.html
r176422 r176493 197 197 </form> 198 198 199 <div {{bind-attr class=": bugs-pane showingAnalysisPane::hidden"}}>199 <div {{bind-attr class=":analysis-pane showingAnalysisPane::hidden"}}> 200 200 <table> 201 201 <tbody> … … 230 230 <div class="rangeBarsContainerInlineStyle"> 231 231 {{#each rangeBars}} 232 {{#link-to linkRoute linkId }}232 {{#link-to linkRoute linkId title=label}} 233 233 <span class="rangeBar" {{bind-attr style=inlineStyle}}></span> 234 234 {{/link-to}} … … 448 448 </header> 449 449 450 <h2 id="analysis-task-title">{{ name}}</h2>450 <h2 id="analysis-task-title">{{label}}</h2> 451 451 {{#if platform.label}} 452 452 <h3 id="analysis-task-testname">{{metric.fullName}} - {{platform.label}}</h3> 453 453 {{/if}} 454 455 {{#if chartData}} 454 456 <section class="analysis-chart-pane chart-pane"> 455 457 <div class="svg-container"> … … 462 464 </div> 463 465 <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> 464 480 <table> 465 481 <tbody> … … 473 489 474 490 {{#each testGroups}} 475 <section class=" test-groups">491 <section class="analysis-group"> 476 492 <table> 477 493 <caption>{{name}}</caption> … … 498 514 {{/each}} 499 515 500 <form class=" test-groups">516 <form class="analysis-group"> 501 517 <table> 502 518 <caption><input name="name" placeholder="Test group name" required></caption> -
trunk/Websites/perf.webkit.org/public/v2/manifest.js
r176203 r176493 1 App.Model = DS.Model; 2 1 3 App.NameLabelModel = DS.Model.extend({ 2 4 name: DS.attr('string'),
Note:
See TracChangeset
for help on using the changeset viewer.