Chromium Code Reviews| 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 = { | |
|
ojan
2014/08/07 18:30:48
this.status = 'unknown';
dsinclair
2014/08/08 13:43:47
Done.
| |
| 12 value: '', | |
| 13 reflect: true, | |
| 14 }; | |
| 15 } | |
| 16 | |
| 17 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.
| |
| 18 if (this.project === 'blink') | |
| 19 return "http://blink-status.appspot.com/"; | |
| 20 if (this.project === 'chromium') | |
| 21 return "http://chromium-status.appspot.com/"; | |
| 22 return null; | |
| 23 }; | |
| 24 | |
| 25 | |
| 26 TreeStatus.prototype.update = function() { | |
| 27 var url = this.url() + 'current?format=json'; | |
| 28 return net.json(url).then(function(response) { | |
| 29 this.updateStatus(response); | |
| 30 }.bind(this)); | |
| 31 }; | |
| 32 | |
| 33 TreeStatus.prototype.updateStatus = function(status) { | |
| 34 if (status.can_commit_freely) { | |
| 35 this.message = null; | |
| 36 this.status = 'open'; | |
| 37 return; | |
| 38 } | |
| 39 | |
| 40 this.message = status.message + ' by ' + status.username; | |
| 41 var responseLowerCase = status.message.toLowerCase(); | |
| 42 if (responseLowerCase.indexOf('throttled') != -1) { | |
| 43 this.status = 'throttled'; | |
| 44 } else if (responseLowerCase.indexOf("closed") != -1) { | |
| 45 this.status = 'closed'; | |
| 46 } else { | |
| 47 this.status = 'unknown'; | |
| 48 } | |
| 49 }; | |
| 50 </script> | |
| OLD | NEW |