Split InteractiveChartComponent and CommitsViewerComponent into separate files
[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     commitsChanged: function ()
6     {
7         var revisionInfo = this.get('revisionInfo');
8
9         var to = revisionInfo.get('currentRevision');
10         var from = revisionInfo.get('previousRevision');
11         var repository = this.get('repository');
12         if (!from || !repository || !repository.get('hasReportedCommits'))
13             return;
14
15         var self = this;
16         CommitLogs.fetchForTimeRange(repository.get('id'), from, to).then(function (commits) {
17             if (self.isDestroyed)
18                 return;
19             self.set('commits', commits.map(function (commit) {
20                 return Ember.Object.create({
21                     repository: repository,
22                     revision: commit.revision,
23                     url: repository.urlForRevision(commit.revision),
24                     author: commit.authorName || commit.authorEmail,
25                     message: commit.message ? commit.message.substr(0, 75) : null,
26                 });
27             }));
28         }, function () {
29             if (!self.isDestroyed)
30                 self.set('commits', []);
31         })
32     }.observes('repository').observes('revisionInfo').on('init'),
33 });