| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. | |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | |
| 4 that can be found in the LICENSE file. | |
| 5 | |
| 6 --> | |
| 7 <!DOCTYPE html> | |
| 8 <html> | |
| 9 <head> | |
| 10 <title>bot-list Demo</title> | |
| 11 <meta charset="utf-8"> | |
| 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"> | |
| 14 <script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></scri
pt> | |
| 15 <script src="../../../node_modules/skia-common-js/common.js"></script> | |
| 16 <script src="/res/js/common.js"></script> | |
| 17 <script src="/res/js/alias.js"></script> | |
| 18 <script src="../../../node_modules/sinon/pkg/sinon-1.17.5.js"></script> | |
| 19 <!-- Makes a var called data--> | |
| 20 <script type="text/javascript" src="bot-list-demo.json"></script> | |
| 21 <!-- Makes a var called fleetData--> | |
| 22 <script type="text/javascript" src="bot-list-fleet-data-demo.json"></script> | |
| 23 | |
| 24 <script type="text/javascript" charset="utf-8"> | |
| 25 sinon.format = function(object) {return JSON.stringify(object);} | |
| 26 sinon.log = function(message) {console.log(message);}; | |
| 27 var server = sinon.fakeServer.create(); | |
| 28 server.autoRespond = true; | |
| 29 //server.autoRespondAfter = 2000; | |
| 30 | |
| 31 var respond = function(request){ | |
| 32 if (!request.requestHeaders.authorization) { | |
| 33 sinon.log("You must be logged in (check your Oauth?)"); | |
| 34 request.respond(403, {}, "You must be logged in (check your Oauth?)"); | |
| 35 return; | |
| 36 } | |
| 37 sinon.log("User authenticated :) "+ request.requestHeaders.authorization); | |
| 38 sinon.log("List Request: "+sinon.format(request)); | |
| 39 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(d
ata)); | |
| 40 } | |
| 41 | |
| 42 server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/list.*/, respond); | |
| 43 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bots\/list.*/, respond
); | |
| 44 | |
| 45 var mockFleetSummary = { | |
| 46 "count": "2625", | |
| 47 "busy": "531", | |
| 48 "now": "2016-08-01T17:21:07.239940", | |
| 49 "dead": "22", | |
| 50 "quarantined": "15", | |
| 51 "kind": "swarming#botsItem", | |
| 52 "etag": "\"nhThK35uIVdvx1_Mr5DChu_DyBs/aO8fy5IdESDx-fy3If19oDKu0f0\"" | |
| 53 }; | |
| 54 | |
| 55 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bots\/count/, JSON.str
ingify(mockFleetSummary)); | |
| 56 server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/count/, JSON.stringif
y(mockFleetSummary)); | |
| 57 | |
| 58 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bots\/dimensions/, JSO
N.stringify(fleetData)); | |
| 59 server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/dimensions/, JSON.str
ingify(fleetData)); | |
| 60 | |
| 61 var details = { | |
| 62 server_version: "1234-deadbeef", | |
| 63 machine_provider_template: "http://example.com#/leases/%s?foo=bar", | |
| 64 }; | |
| 65 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/server\/details/, JSON
.stringify(details)); | |
| 66 server.respondWith("GET", /^\/api\/swarming\/v1\/server\/details/, JSON.stri
ngify(details)); | |
| 67 </script> | |
| 68 | |
| 69 <link rel="import" href="bot-list.html"> | |
| 70 </head> | |
| 71 <body> | |
| 72 | |
| 73 <bot-list | |
| 74 client_id="20770472288-t5smpbpjptka4nd888fv0ctd23ftba2o.apps.googleusercontent
.com"> | |
| 75 </bot-list> | |
| 76 | |
| 77 </body> | |
| 78 </html> | |
| OLD | NEW |