New perf dashboard should provide UI to create a new analysis task
[WebKit-https.git] / Websites / perf.webkit.org / public / v2 / analysis.js
1 App.AnalysisTask = App.NameLabelModel.extend({
2     author: DS.attr('string'),
3     createdAt: DS.attr('date'),
4     platform: DS.belongsTo('platform'),
5     metric: DS.belongsTo('metric'),
6     startRun: DS.attr('number'),
7     endRun: DS.attr('number'),
8     bugs: DS.hasMany('bugs'),
9     testGroups: function () {
10         return this.store.find('testGroup', {task: this.get('id')});
11     }.property(),
12 });
13
14 App.Bug = App.NameLabelModel.extend({
15     task: DS.belongsTo('AnalysisTask'),
16     bugTracker: DS.belongsTo('BugTracker'),
17     createdAt: DS.attr('date'),
18     number: DS.attr('number'),
19 });
20
21 // FIXME: Use DS.RESTAdapter instead.
22 App.AnalysisTask.create = function (name, startMeasurement, endMeasurement)
23 {
24     return PrivilegedAPI.sendRequest('create-analysis-task', {
25         name: name,
26         startRun: startMeasurement.id(),
27         endRun: endMeasurement.id(),
28     });
29 }
30
31 App.AnalysisTaskAdapter = DS.RESTAdapter.extend({
32     buildURL: function (type, id)
33     {
34         return '../api/analysis-tasks/' + (id ? id : '');
35     },
36 });
37
38 App.TestGroup = App.NameLabelModel.extend({
39     analysisTask: DS.belongsTo('analysisTask'),
40     author: DS.attr('string'),
41     createdAt: DS.attr('date'),
42     buildRequests: DS.hasMany('buildRequests'),
43 });
44
45 App.TestGroupAdapter = DS.RESTAdapter.extend({
46     buildURL: function (type, id)
47     {
48         return '../api/test-groups/' + (id ? id : '');
49     },
50 });
51
52 App.AnalysisTaskSerializer = App.TestGroupSerializer = DS.RESTSerializer.extend({
53     normalizePayload: function (payload)
54     {
55         delete payload['status'];
56         return payload;
57     }
58 });
59
60 App.BuildRequest = DS.Model.extend({
61     group: DS.belongsTo('testGroup'),
62     order: DS.attr('number'),
63     rootSet: DS.attr('number'),
64     build: DS.attr('number'),
65     buildNumber: DS.attr('number'),
66     buildBuilder: DS.belongsTo('builder'),
67     buildTime: DS.attr('date'),
68 });