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

Side by Side Diff: appengine/swarming/elements/res/imp/botlist/bot-list-demo.html

Issue 2211163003: Update new botlist to use dimensions endpoint (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@limiting
Patch Set: Make devices column make more sense Created 4 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
OLDNEW
1 <!-- 1 <!--
2 Copyright 2016 The LUCI Authors. All rights reserved. 2 Copyright 2016 The LUCI Authors. All rights reserved.
3 Use of this source code is governed under the Apache License, Version 2.0 3 Use of this source code is governed under the Apache License, Version 2.0
4 that can be found in the LICENSE file. 4 that can be found in the LICENSE file.
5 5
6 --> 6 -->
7 <!DOCTYPE html> 7 <!DOCTYPE html>
8 <html> 8 <html>
9 <head> 9 <head>
10 <title>bot-list Demo</title> 10 <title>bot-list Demo</title>
11 <meta charset="utf-8"> 11 <meta charset="utf-8">
12 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 12 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
13 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial- scale=1, user-scalable=yes"> 13 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial- scale=1, user-scalable=yes">
14 <script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></scri pt> 14 <script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></scri pt>
15 <script src="/res/js/common.js"></script> 15 <script src="/res/js/common.js"></script>
16 <script src="../../../node_modules/sinon/pkg/sinon-1.17.2.js"></script> 16 <script src="../../../node_modules/sinon/pkg/sinon-1.17.5.js"></script>
17 <!-- Makes a var called data--> 17 <!-- Makes a var called data-->
18 <script type="text/javascript" src="bot-list-demo.json"></script> 18 <script type="text/javascript" src="bot-list-demo.json"></script>
19 <!-- Makes a var called fleetData-->
20 <script type="text/javascript" src="bot-list-fleet-data-demo.json"></script>
19 21
20 <script type="text/javascript" charset="utf-8"> 22 <script type="text/javascript" charset="utf-8">
21 sinon.format = function(object) {return JSON.stringify(object);} 23 sinon.format = function(object) {return JSON.stringify(object);}
22 sinon.log = function(message) {console.log(message);}; 24 sinon.log = function(message) {console.log(message);};
23 var server = sinon.fakeServer.create(); 25 var server = sinon.fakeServer.create();
24 server.autoRespond = true; 26 server.autoRespond = true;
27 //server.autoRespondAfter = 2000;
jcgregorio 2016/08/08 16:14:42 leftover?
kjlubick 2016/08/08 19:07:10 This is convenient for testing how the demo looks
25 28
26 var respond = function(request){ 29 var respond = function(request){
27 if (!request.requestHeaders.authorization) { 30 if (!request.requestHeaders.authorization) {
28 sinon.log("You must be logged in (check your Oauth?)"); 31 sinon.log("You must be logged in (check your Oauth?)");
29 request.respond(403, {}, "You must be logged in (check your Oauth?)"); 32 request.respond(403, {}, "You must be logged in (check your Oauth?)");
30 return; 33 return;
31 } 34 }
32 sinon.log("User authenticated :) "+ request.requestHeaders.authorization); 35 sinon.log("User authenticated :) "+ request.requestHeaders.authorization);
36 sinon.log("List Request: "+sinon.format(request));
33 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(d ata)); 37 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(d ata));
34 } 38 }
35 39
36 server.respondWith("GET", "/_ah/api/swarming/v1/bots/list", respond); 40 server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/list.*/, respond);
37 server.respondWith("GET", "/api/swarming/v1/bots/list", respond); 41 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bots\/list.*/, respond );
38 42
39 var mockFleetSummary = { 43 var mockFleetSummary = {
40 "count": "2625", 44 "count": "2625",
41 "busy": "531", 45 "busy": "531",
42 "now": "2016-08-01T17:21:07.239940", 46 "now": "2016-08-01T17:21:07.239940",
43 "dead": "22", 47 "dead": "22",
44 "quarantined": "15", 48 "quarantined": "15",
45 "kind": "swarming#botsItem", 49 "kind": "swarming#botsItem",
46 "etag": "\"nhThK35uIVdvx1_Mr5DChu_DyBs/aO8fy5IdESDx-fy3If19oDKu0f0\"" 50 "etag": "\"nhThK35uIVdvx1_Mr5DChu_DyBs/aO8fy5IdESDx-fy3If19oDKu0f0\""
47 }; 51 };
48 52
49 server.respondWith("GET", "/_ah/api/swarming/v1/bots/count", JSON.stringify( mockFleetSummary)); 53 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bots\/count/, JSON.str ingify(mockFleetSummary));
50 server.respondWith("GET", "/api/swarming/v1/bots/count", JSON.stringify(mock FleetSummary)); 54 server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/count/, JSON.stringif y(mockFleetSummary));
55
56 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bots\/dimensions/, JSO N.stringify(fleetData));
57 server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/dimensions/, JSON.str ingify(fleetData));
51 </script> 58 </script>
52 59
53 <link rel="import" href="bot-list.html"> 60 <link rel="import" href="bot-list.html">
54 </head> 61 </head>
55 <body> 62 <body>
56 63
57 <bot-list></bot-list> 64 <bot-list></bot-list>
58 65
59 </body> 66 </body>
60 </html> 67 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698