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

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: block;
25 padding-left: 1em;
26 padding-right: 1em;
27 }
28 .toggle {
29 text-decoration: underline;
30 color: -webkit-link;
31 }
32 .toggle > core-icon {
33 color: black;
34 }
15 </style> 35 </style>
16 <template repeat="{{ repository in commits.commits | _repositories }}"> 36 <template repeat="{{ repository in commits.commits | _repositories }}">
17 <template repeat="{{ commit in repository | _commits }}"> 37 <template if="{{ !_repositoryEmpty(repository) }}">
18 <ct-commit data="{{ commit }}"></ct-commit> 38 <div class="repository-info">
39 <div class="toggle" on-click="{{ _toggleRepository }}"
40 repository="{{ repository + _range(repository) }}">
41 {{ repository }} {{ _range(repository) }}
42 <core-icon icon="arrow-drop-down"></core-icon>
ojan 2014/08/12 01:44:23 My previous advice turned out to be wrong I think.
dsinclair 2014/08/15 14:40:05 Done.
43 </div>
44
45 <template if="{{ repositoryVisible[repository + _range(repository)] }} ">
46 <commit-list>
47 <template repeat="{{ commit in repository | _commits }}">
48 <ct-commit data="{{ commit }}"></ct-commit>
49 </template>
50 </commit-list>
51 </template>
52 </div>
19 </template> 53 </template>
20 </template> 54 </template>
21 </template> 55 </template>
22 <script> 56 <script>
23 Polymer({ 57 Polymer({
24 commits: null, 58 commits: null,
25 first: null, 59 first: null,
26 last: null, 60 last: null,
61 repositoryVisible: undefined,
62
63 created: function() {
64 this.repositoryVisible = {};
65 },
27 66
28 _repositories: function(commits) { 67 _repositories: function(commits) {
29 if (!commits) 68 if (!commits)
30 return []; 69 return [];
31 return Object.keys(commits).sort(); 70 return Object.keys(commits).sort();
32 }, 71 },
33 72
34 _commits: function(repository) { 73 _commits: function(repository) {
35 var commits = []; 74 var commits = [];
36 if (!this.first || !this.last) 75 if (!this.first || !this.last)
37 return commits; 76 return commits;
38 77
39 var first = Number(this.first[repository]); 78 var first = Number(this.first[repository]);
40 var last = Number(this.last[repository]); 79 var last = Number(this.last[repository]);
41 if (first == last) 80 if (first == last)
42 return commits; 81 return commits;
43 82
44 if (first > last) { 83 if (first > last) {
45 console.warn('Revision range is backwards, which is invalid:', first, last); 84 console.warn('Revision range is backwards, which is invalid:', first, last);
46 return commits; 85 return commits;
47 } 86 }
48 87
49 return this.commits.range(repository, first + 1, last); 88 return this.commits.range(repository, first + 1, last);
50 }, 89 },
90
91 _repositoryEmpty: function(repository) {
92 return this._commits(repository).length === 0;
93 },
94
95 _range: function(repository) {
96 var commits = this._commits(repository);
97 if (commits.length === 0)
98 return "";
99 return commits.first().revision + " : " + commits.last().revision;
100 },
101
102 _toggleRepository: function(event, detail, sender, target) {
ojan 2014/08/12 01:44:23 I was picturing that this would work more like htt
103 var repoName = sender.getAttribute('repository');
104 this.repositoryVisible[repoName] = !this.repositoryVisible[repoName];
105 }
51 }); 106 });
52 </script> 107 </script>
53 </polymer-element> 108 </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