OLD | NEW |
(Empty) | |
| 1 <!-- |
| 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 |
| 4 found in the LICENSE file. |
| 5 --> |
| 6 |
| 7 <script> |
| 8 function TreeStatus(project) { |
| 9 this.project = project; |
| 10 this.message = ''; |
| 11 this.status = 'unknown'; |
| 12 |
| 13 this.url = "http://{1}-status.appspot.com/".assign(project); |
| 14 } |
| 15 |
| 16 TreeStatus.prototype.update = function() { |
| 17 var url = this.url + 'current?format=json'; |
| 18 return net.json(url).then(function(response) { |
| 19 this.updateStatus(response); |
| 20 }.bind(this)); |
| 21 }; |
| 22 |
| 23 TreeStatus.prototype.updateStatus = function(status) { |
| 24 if (status.can_commit_freely) { |
| 25 this.message = null; |
| 26 this.status = 'open'; |
| 27 return; |
| 28 } |
| 29 |
| 30 this.message = status.message + ' by ' + status.username; |
| 31 var responseLowerCase = status.message.toLowerCase(); |
| 32 if (responseLowerCase.indexOf('throttled') != -1) { |
| 33 this.status = 'throttled'; |
| 34 } else if (responseLowerCase.indexOf("closed") != -1) { |
| 35 this.status = 'closed'; |
| 36 } else { |
| 37 this.status = 'unknown'; |
| 38 } |
| 39 }; |
| 40 </script> |
OLD | NEW |