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

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

Issue 441393002: Collapse commit list by default in sheriff-o-matic. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <link rel="import" href="../bower_components/paper-button/paper-button.html">
8 9
9 <polymer-element name="ct-commit-list" attributes="first last commits" noscript> 10 <polymer-element name="ct-commit-list" attributes="first last commits" noscript>
10 <template> 11 <template>
11 <style> 12 <style>
12 :host { 13 :host {
13 display: block; 14 display: block;
14 } 15 }
16 paper-button[repository] {
17 margin: .5em;
18 text-transform: lowercase;
19 }
20 repository-info {
21 display: block;
22 }
23 commit-list {
24 display: none;
25 padding-left: 1em;
26 padding-right: 1em;
27 }
28 commit-list[visible="true"] {
29 display: block;
30 }
15 </style> 31 </style>
16 <template repeat="{{ repository in commits.commits | _repositories }}"> 32 <template repeat="{{ repository in commits.commits | _repositories }}">
17 <template repeat="{{ commit in repository | _commits }}"> 33 <template if="{{ !_repositoryEmpty(repository) }}">
18 <ct-commit data="{{ commit }}"></ct-commit> 34 <repository-info>
ojan 2014/08/06 23:45:55 It's kinda weird to define new elements that are n
dsinclair 2014/08/12 01:11:19 Done.
35 <paper-button raisedbutton role="button"
ojan 2014/08/06 23:45:55 I'm sensitive to taking up too much screen real es
dsinclair 2014/08/12 01:11:20 I dropped the button and went with text and an arr
36 label="{{ repository }} {{ _range(repository) }}"
37 on-click="{{ _toggleRepository }} "
38 repository="{{ repository + _range(repository) }}"></paper-button>
39
40 <commit-list visible="{{ repositoryVisible[repository + _range(reposit ory)] }}">
ojan 2014/08/06 23:45:55 Use <template if> instead of attribute + display.
dsinclair 2014/08/12 01:11:19 Done.
41 <template repeat="{{ commit in repository | _commits }}">
42 <ct-commit data="{{ commit }}"></ct-commit>
43 </template>
44 </commit-list>
45 </repository-info>
19 </template> 46 </template>
20 </template> 47 </template>
21 </template> 48 </template>
22 <script> 49 <script>
23 Polymer({ 50 Polymer({
24 commits: null, 51 commits: null,
25 first: null, 52 first: null,
26 last: null, 53 last: null,
27 54
55 // FIXME: This is a hack. This hash ends up being shared between all of th e
56 // elements of this type. We name the repos above with name and commit
57 // information to tell them apart. If we don't make this 'global' we
58 // end up losing the expansion information when we refresh the failure
59 // list.
ojan 2014/08/06 23:45:55 TL;DR: I think it's worth the effort to fix the un
dsinclair 2014/08/12 01:11:19 Acknowledged.
60 repositoryVisible: {},
61
28 _repositories: function(commits) { 62 _repositories: function(commits) {
29 if (!commits) 63 if (!commits)
30 return []; 64 return [];
31 return Object.keys(commits).sort(); 65 return Object.keys(commits).sort();
32 }, 66 },
33 67
34 _commits: function(repository) { 68 _commits: function(repository) {
35 var commits = []; 69 var commits = [];
36 if (!this.first || !this.last) 70 if (!this.first || !this.last)
37 return commits; 71 return commits;
38 72
39 var first = Number(this.first[repository]); 73 var first = Number(this.first[repository]);
40 var last = Number(this.last[repository]); 74 var last = Number(this.last[repository]);
41 if (first == last) 75 if (first == last)
42 return commits; 76 return commits;
43 77
44 if (first > last) { 78 if (first > last) {
45 console.warn('Revision range is backwards, which is invalid:', first, last); 79 console.warn('Revision range is backwards, which is invalid:', first, last);
46 return commits; 80 return commits;
47 } 81 }
48 82
49 return this.commits.range(repository, first + 1, last); 83 return this.commits.range(repository, first + 1, last);
50 }, 84 },
85
86 _repositoryEmpty: function(repository) {
87 return this._commits(repository).length === 0;
88 },
89
90 _range: function(repository) {
91 var commits = this._commits(repository);
92 if (commits.length === 0)
93 return "";
94 return commits[0].revision + " : " + commits[commits.length - 1].revisio n;
ojan 2014/08/06 23:45:55 Nit: sugarjs has first() and last() on array.
dsinclair 2014/08/12 01:11:19 Done.
95 },
96
97 _toggleRepository: function(event, detail, sender, target) {
98 var repoName = sender.getAttribute('repository');
99 this.repositoryVisible[repoName] = !this.repositoryVisible[repoName];
100 }
51 }); 101 });
52 </script> 102 </script>
53 </polymer-element> 103 </polymer-element>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698