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.
7 <link rel="import" href="../lib/net.html">
10 function TreeStatus(project) {
11 this.project = project;
13 this.status = 'unknown';
15 this.url = "https://{1}-status.appspot.com/".assign(project);
18 TreeStatus.prototype.update = function() {
19 var url = this.url + 'current?format=json';
20 return net.json(url).then(function(response) {
21 this.updateStatus(response);
25 TreeStatus.prototype.updateStatus = function(status) {
26 if (status.can_commit_freely) {
32 this.message = status.message + ' by ' + status.username;
33 var responseLowerCase = status.message.toLowerCase();
34 if (responseLowerCase.indexOf('throttled') != -1) {
35 this.status = 'throttled';
36 } else if (responseLowerCase.indexOf("closed") != -1) {
37 this.status = 'closed';
39 this.status = 'unknown';