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

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

Issue 443243002: Move treestatus.js to a model class. (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 side-by-side diff with in-line comments
Download patch
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..01cfc12221f063a8935494e9a116d791325f861d 100644
--- a/Tools/GardeningServer/ui/ct-tree-status.html
+++ b/Tools/GardeningServer/ui/ct-tree-status.html
@@ -4,19 +4,20 @@ 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" noscript attributes="status">
<template>
<style>
:host {
display: flex;
}
-
- :host([status=throttled]) {
+ :host([state=throttled]) {
background-color: #fffc6c;
}
- :host([status=closed]),
- :host([status=closed]) a {
+ :host([state=closed]),
+ :host([state=closed]) a {
color: white;
background-color: #e98080;
}
@@ -28,50 +29,9 @@ 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="{{ status.message }}">
+ <div class="message">{{ status.project }}: {{ status.message }}</div>
+ <div style="padding: 0 5px;">[ <a href="{{ status.url }}">details</a> ]</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';
- }
- },
- });
- </script>
</polymer-element>
« no previous file with comments | « Tools/GardeningServer/ui/ct-sheriff-o-matic.html ('k') | Tools/GardeningServer/ui/ct-tree-status-tests.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698