| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 # Copyright 2016 The LUCI Authors. All rights reserved. | |
| 3 # Use of this source code is governed by the Apache v2.0 license that can be | |
| 4 # found in the LICENSE file. | |
| 5 --> | |
| 6 <!DOCTYPE html> | |
| 7 <html> | |
| 8 <head> | |
| 9 <title>Swarming index Demo</title> | |
| 10 <meta charset="utf-8"> | |
| 11 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| 12 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1, user-scalable=yes"> | |
| 13 <script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></scri
pt> | |
| 14 <script src="../../../node_modules/skia-common-js/common.js"></script> | |
| 15 <script src="/res/js/common.js"></script> | |
| 16 <script src="/res/js/alias.js"></script> | |
| 17 <script src="../../../node_modules/sinon/pkg/sinon-1.17.5.js"></script> | |
| 18 | |
| 19 <!-- Makes a var called stats--> | |
| 20 <script type="text/javascript" src="index-overview-stats-demo.json"></script> | |
| 21 | |
| 22 <script type="text/javascript" charset="utf-8"> | |
| 23 sinon.format = function(object) {return JSON.stringify(object);} | |
| 24 sinon.log = function(message) {console.log(message);}; | |
| 25 var server = sinon.fakeServer.create(); | |
| 26 server.autoRespondAfter = 1200; | |
| 27 server.autoRespond = true; | |
| 28 | |
| 29 var details = { | |
| 30 server_version: "1234-deadbeef", | |
| 31 bot_version: "abcdoeraymeyouandme", | |
| 32 }; | |
| 33 | |
| 34 var respond = function(request){ | |
| 35 if (!request.requestHeaders.authorization) { | |
| 36 sinon.log("You must be logged in (check your Oauth?)"); | |
| 37 request.respond(403, {}, "You must be logged in (check your Oauth?)"); | |
| 38 return; | |
| 39 } | |
| 40 sinon.log("User authenticated :) "+ request.requestHeaders.authorization); | |
| 41 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(d
etails)); | |
| 42 } | |
| 43 | |
| 44 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/server\/details/, res
pond); | |
| 45 server.respondWith("GET", /^\/api\/swarming\/v1\/server\/details/, respond); | |
| 46 | |
| 47 var permissions = { | |
| 48 get_bootstrap_token: true | |
| 49 }; | |
| 50 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/server\/permissions/,
JSON.stringify(permissions)); | |
| 51 server.respondWith("GET", /^\/api\/swarming\/v1\/server\/permissions/, JSON.
stringify(permissions)); | |
| 52 | |
| 53 var token = { | |
| 54 bootstrap_token: "8675309JennyDontChangeYourNumber8675309" | |
| 55 }; | |
| 56 server.respondWith("POST", /^\/_ah\/api\/swarming\/v1\/server\/token/, JSON
.stringify(token)); | |
| 57 server.respondWith("POST", /^\/api\/swarming\/v1\/server\/token/, JSON.strin
gify(token)); | |
| 58 | |
| 59 server.respondWith("GET", "/swarming/api/v1/stats/summary/minutes?duration=2
0",JSON.stringify(stats)); | |
| 60 </script> | |
| 61 | |
| 62 <link rel="import" href="swarming-index.html"> | |
| 63 </head> | |
| 64 <body> | |
| 65 | |
| 66 <swarming-index | |
| 67 client_id="20770472288-t5smpbpjptka4nd888fv0ctd23ftba2o.apps.googleusercontent
.com"> | |
| 68 </swarming-index> | |
| 69 | |
| 70 </body> | |
| 71 </html> | |
| OLD | NEW |