Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: Tools/GardeningServer/ui/ct-commit-list.html

Issue 464963003: Move commit list out its own model. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!-- 1 <!--
2 Copyright 2014 The Chromium Authors. All rights reserved. 2 Copyright 2014 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be 3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file. 4 found in the LICENSE file.
5 --> 5 -->
6 6
7 <link rel="import" href="ct-commit.html"> 7 <link rel="import" href="ct-commit.html">
8 8
9 <polymer-element name="ct-commit-list" attributes="first last commits" noscript> 9 <polymer-element name="ct-commit-list" attributes="commitList">
10 <template> 10 <template>
11 <style> 11 <style>
12 :host { 12 :host {
13 display: block; 13 display: block;
14 } 14 }
15 </style> 15 </style>
16 <template repeat="{{ repository in commits.commits | _repositories }}"> 16 <template repeat="{{ repository in commitList | _repositories }}">
17 <template repeat="{{ commit in repository | _commits }}"> 17 <template repeat="{{ commit in repository.commits }}">
18 <ct-commit data="{{ commit }}"></ct-commit> 18 <ct-commit data="{{ commit }}"></ct-commit>
19 </template> 19 </template>
20 </template> 20 </template>
21 </template> 21 </template>
22 <script> 22 <script>
23 Polymer({ 23 Polymer({
24 commits: null, 24 _repositories: function() {
25 first: null, 25 if (!this.commitList)
26 last: null, 26 return [];
27 27 return this.commitList.repositories();
28 _repositories: function(commits) { 28 }
29 if (!commits) 29 });
30 return [];
31 return Object.keys(commits).sort();
32 },
33
34 _commits: function(repository) {
35 var commits = [];
36 if (!this.first || !this.last)
37 return commits;
38
39 var first = Number(this.first[repository]);
40 var last = Number(this.last[repository]);
41 if (first == last)
42 return commits;
43
44 if (first > last) {
45 console.warn('Revision range is backwards, which is invalid:', first, last);
46 return commits;
47 }
48
49 return this.commits.range(repository, first + 1, last);
50 },
51 });
52 </script> 30 </script>
53 </polymer-element> 31 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698