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

Side by Side Diff: Tools/GardeningServer/ui/ct-tree-status.html

Issue 403723005: Only show tree status if the tree isn't open. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move if-statement Created 6 years, 5 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 | Tools/GardeningServer/ui/ct-tree-status-tests.html » ('j') | 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 <polymer-element name="ct-tree-status" attributes="project status"> 7 <polymer-element name="ct-tree-status">
8 <template> 8 <template>
9 <style> 9 <template if="{{ message }}">
10 :host { 10 <style>
11 display: block; 11 :host {
12 whitespace: nowrap; 12 display: block;
13 overflow: hidden; 13 whitespace: nowrap;
14 text-overflow: ellispis; 14 overflow: hidden;
15 } 15 text-overflow: ellispis;
16 }
16 17
17 :host([status=throttled]) { 18 :host([status=throttled]) {
18 background-color: khaki; 19 background-color: khaki;
19 } 20 }
20 21
21 :host([status=closed]) { 22 :host([status=closed]) {
22 color: white; 23 color: white;
23 background-color: tomato; 24 background-color: tomato;
24 } 25 }
25 </style> 26 </style>
26 {{project}}: {{message}} 27 {{project}}: {{message}}
28 </template>
27 </template> 29 </template>
28 <script> 30 <script>
29 Polymer({ 31 Polymer({
30 publish: { 32 publish: {
33 project: '',
34 message: '',
31 status: { 35 status: {
32 value: 'unknown', 36 value: 'open',
33 reflect: true, 37 reflect: true,
34 }, 38 },
35 }, 39 },
36 40
37 update: function() { 41 update: function() {
38 var url = treestatus.urlByName(this.project); 42 var url = treestatus.urlByName(this.project);
39 return net.json(url).then(function(response) { 43 return net.json(url).then(function(response) {
40 this.updateStatus(response); 44 this.updateStatus(response);
41 }.bind(this)); 45 }.bind(this));
42 }, 46 },
43 47
44 updateStatus: function(status) { 48 updateStatus: function(status) {
45 if (status.can_commit_freely) { 49 if (status.can_commit_freely) {
46 this.message = 'Tree is open'; 50 this.message = '';
47 this.status = 'open'; 51 this.status = 'open';
52 return;
53 }
54
55 this.message = status.message + ' by ' + status.username;
56 var responseLowerCase = status.message.toLowerCase();
57 if (responseLowerCase.indexOf('throttled') != -1) {
58 this.status = 'throttled';
59 } else if (responseLowerCase.indexOf("closed") != -1) {
60 this.status = 'closed';
48 } else { 61 } else {
49 this.message = status.message + ' by ' + status.username; 62 this.status = 'unknown';
50 var responseLowerCase = status.message.toLowerCase();
51 if (responseLowerCase.indexOf('throttled') != -1) {
52 this.status = 'throttled';
53 } else if (responseLowerCase.indexOf("closed") != -1) {
54 this.status = 'closed';
55 } else {
56 this.status = 'unknown';
57 }
58 } 63 }
59 }, 64 },
60 }); 65 });
61 </script> 66 </script>
62 </polymer-element> 67 </polymer-element>
OLDNEW
« no previous file with comments | « no previous file | Tools/GardeningServer/ui/ct-tree-status-tests.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698