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

Side by Side Diff: Tools/GardeningServer/model/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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Tools/GardeningServer/model/tree-status-tests.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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>
OLDNEW
« no previous file with comments | « no previous file | Tools/GardeningServer/model/tree-status-tests.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698