Index: Tools/GardeningServer/ui/ct-tree-status.html |
diff --git a/Tools/GardeningServer/ui/ct-tree-status.html b/Tools/GardeningServer/ui/ct-tree-status.html |
index f285246f8254605442e6ccfc41d56f73fb6fd50a..e3f3877b49d23387c764c2ee647c2211296ddbb9 100644 |
--- a/Tools/GardeningServer/ui/ct-tree-status.html |
+++ b/Tools/GardeningServer/ui/ct-tree-status.html |
@@ -4,21 +4,34 @@ Use of this source code is governed by a BSD-style license that can be |
found in the LICENSE file. |
--> |
-<polymer-element name="ct-tree-status"> |
+<link rel="import" href="../model/tree-status.html"> |
+ |
+<polymer-element name="ct-tree-status" attributes="treeStatus"> |
ojan
2014/08/07 18:30:48
Nit: how about just calling the attribute "status"
dsinclair
2014/08/08 13:43:47
Done.
|
<template> |
<style> |
:host { |
display: flex; |
+ white-space: nowrap; |
+ overflow: hidden; |
+ text-overflow: ellipsis; |
} |
- :host([status=throttled]) { |
+ #container { |
+ display: flex; |
+ width: 100%; |
+ } |
+ #container[status=throttled] { |
background-color: #fffc6c; |
+ margin: 5px; |
+ padding: 3px; |
} |
- :host([status=closed]), |
- :host([status=closed]) a { |
+ #container[status=closed], |
+ #container[status=closed] a { |
color: white; |
background-color: #e98080; |
+ margin: 5px; |
+ padding: 3px; |
} |
.message { |
@@ -28,50 +41,18 @@ found in the LICENSE file. |
white-space: nowrap; |
} |
</style> |
- <template if="{{ message }}"> |
- <div class="message">{{ project }}: {{ message }}</div> |
- <div style="padding: 0 5px;">[ <a href="{{ project | _url }}">details</a> ]</div> |
+ <template if="{{ treeStatus.message }}"> |
+ <div id="container" status="{{ treeStatus.status }}"> |
+ <div class="message">{{ treeStatus.project }}: {{ treeStatus.message }}</div> |
+ <div style="padding: 0 5px;">[ <a href="{{ _url() }}">details</a> ]</div> |
+ </div> |
</template> |
</template> |
<script> |
- Polymer({ |
- publish: { |
- project: '', |
- message: '', |
- status: { |
- value: '', |
- reflect: true, |
- }, |
- }, |
- |
- _url: function(project) { |
- return treestatus.urlByName(this.project); |
- }, |
- |
- update: function() { |
- var url = this._url(this.project) + 'current?format=json'; |
- return net.json(url).then(function(response) { |
- this.updateStatus(response); |
- }.bind(this)); |
- }, |
- |
- updateStatus: function(status) { |
- if (status.can_commit_freely) { |
- this.message = null; |
- this.status = 'open'; |
- return; |
- } |
- |
- this.message = status.message + ' by ' + status.username; |
- var responseLowerCase = status.message.toLowerCase(); |
- if (responseLowerCase.indexOf('throttled') != -1) { |
- this.status = 'throttled'; |
- } else if (responseLowerCase.indexOf("closed") != -1) { |
- this.status = 'closed'; |
- } else { |
- this.status = 'unknown'; |
- } |
- }, |
- }); |
+ Polymer({ |
+ _url: function() { |
+ return this.treeStatus.url(); |
+ } |
+ }); |
</script> |
</polymer-element> |