Introduce the concept of analysis task to perf dashboard
[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     testGroups: function () {
9         return this.store.find('testGroup', {task: this.get('id')});
10     }.property(),
11 });
12
13 // FIXME: Use DS.RESTAdapter instead.
14 App.AnalysisTask.create = function (name, startMeasurement, endMeasurement)
15 {
16     return PrivilegedAPI.sendRequest('create-analysis-task', {
17         name: name,
18         startRun: startMeasurement.id(),
19         endRun: endMeasurement.id(),
20     });
21 }
22
23 App.AnalysisTaskAdapter = DS.RESTAdapter.extend({
24     buildURL: function (type, id)
25     {
26         return '../api/analysis-tasks/' + (id ? id : '');
27     },
28 });
29
30 App.TestGroup = App.NameLabelModel.extend({
31     analysisTask: DS.belongsTo('analysisTask'),
32     author: DS.attr('string'),
33     createdAt: DS.attr('date'),
34     buildRequests: DS.hasMany('buildRequests'),
35 });
36
37 App.TestGroupAdapter = DS.RESTAdapter.extend({
38     buildURL: function (type, id)
39     {
40         return '../api/test-groups/' + (id ? id : '');
41     },
42 });
43
44 App.AnalysisTaskSerializer = App.TestGroupSerializer = DS.RESTSerializer.extend({
45     normalizePayload: function (payload)
46     {
47         delete payload['status'];
48         return payload;
49     }
50 });
51
52 App.BuildRequest = DS.Model.extend({
53     group: DS.belongsTo('testGroup'),
54     order: DS.attr('number'),
55     rootSet: DS.attr('number'),
56     build: DS.attr('number'),
57     buildNumber: DS.attr('number'),
58     buildBuilder: DS.belongsTo('builder'),
59     buildTime: DS.attr('date'),
60 });