Analysis task should show all possible revisions for A/B testing
[WebKit-https.git] / Websites / perf.webkit.org / public / v2 / commits-viewer.js
1 App.CommitsViewerComponent = Ember.Component.extend({
2     repository: null,
3     revisionInfo: null,
4     commits: null,
5     visible: true,
6     commitsChanged: function ()
7     {
8         var revisionInfo = this.get('revisionInfo');
9
10         var to = revisionInfo.get('currentRevision');
11         var from = revisionInfo.get('previousRevision');
12         var repository = this.get('repository');
13         if (!from || !repository || !repository.get('hasReportedCommits'))
14             return;
15
16         var self = this;
17         CommitLogs.fetchCommits(repository.get('id'), from, to).then(function (commits) {
18             if (self.isDestroyed)
19                 return;
20             self.set('commits', commits.map(function (commit) {
21                 return Ember.Object.create({
22                     repository: repository,
23                     revision: commit.revision,
24                     url: repository.urlForRevision(commit.revision),
25                     author: commit.authorName || commit.authorEmail,
26                     message: commit.message ? commit.message.substr(0, 75) : null,
27                 });
28             }));
29         }, function () {
30             if (!self.isDestroyed)
31                 self.set('commits', []);
32         })
33     }.observes('repository').observes('revisionInfo').on('init'),
34     actions: {
35         toggleVisibility: function ()
36         {
37             this.toggleProperty('visible');
38         }
39     }
40 });