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

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
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 = {
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>
OLDNEW
« no previous file with comments | « no previous file | Tools/GardeningServer/model/tree-status-tests.html » ('j') | Tools/GardeningServer/ui/ct-tree-status.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698