Chromium Code Reviews| Index: Tools/GardeningServer/model/tree-status.html |
| diff --git a/Tools/GardeningServer/model/tree-status.html b/Tools/GardeningServer/model/tree-status.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..34c2bd7fc21decfeee4cb9824c78dd8d57d50bd0 |
| --- /dev/null |
| +++ b/Tools/GardeningServer/model/tree-status.html |
| @@ -0,0 +1,50 @@ |
| +<!-- |
| +Copyright 2014 The Chromium Authors. All rights reserved. |
| +Use of this source code is governed by a BSD-style license that can be |
| +found in the LICENSE file. |
| +--> |
| + |
| +<script> |
| +function TreeStatus(project) { |
| + this.project = project; |
| + this.message = ''; |
| + this.status = { |
|
ojan
2014/08/07 18:30:48
this.status = 'unknown';
dsinclair
2014/08/08 13:43:47
Done.
|
| + value: '', |
| + reflect: true, |
| + }; |
| +} |
| + |
| +TreeStatus.prototype.url = function() { |
|
ojan
2014/08/07 18:30:48
Now that I look at this, there's no real reason fo
dsinclair
2014/08/08 13:43:47
Done.
|
| + if (this.project === 'blink') |
| + return "http://blink-status.appspot.com/"; |
| + if (this.project === 'chromium') |
| + return "http://chromium-status.appspot.com/"; |
| + return null; |
| +}; |
| + |
| + |
| +TreeStatus.prototype.update = function() { |
| + var url = this.url() + 'current?format=json'; |
| + return net.json(url).then(function(response) { |
| + this.updateStatus(response); |
| + }.bind(this)); |
| +}; |
| + |
| +TreeStatus.prototype.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> |