| OLD | NEW |
| 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 by the Apache v2.0 license that can be | 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # found in the LICENSE file. | 4 that can be found in the LICENSE file. |
| 5 |
| 5 --> | 6 --> |
| 6 <!DOCTYPE html> | 7 <!DOCTYPE html> |
| 7 <html> | 8 <html> |
| 8 <head> | 9 <head> |
| 9 <title>Swarming index Demo</title> | 10 <title>bot-list Demo</title> |
| 10 <meta charset="utf-8"> | 11 <meta charset="utf-8"> |
| 11 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 12 <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 <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="../bower_components/webcomponentsjs/webcomponents-lite.js"></scri
pt> |
| 15 <script src="/res/js/common.js"></script> |
| 14 <script src="../../../node_modules/sinon/pkg/sinon-1.17.2.js"></script> | 16 <script src="../../../node_modules/sinon/pkg/sinon-1.17.2.js"></script> |
| 17 <!-- Makes a var called data--> |
| 18 <script type="text/javascript" src="bot-list-demo.json"></script> |
| 15 | 19 |
| 16 <script type="text/javascript" charset="utf-8"> | 20 <script type="text/javascript" charset="utf-8"> |
| 17 sinon.format = function(object) {return JSON.stringify(object);} | 21 sinon.format = function(object) {return JSON.stringify(object);} |
| 18 sinon.log = function(message) {console.log(message);}; | 22 sinon.log = function(message) {console.log(message);}; |
| 19 var server = sinon.fakeServer.create(); | 23 var server = sinon.fakeServer.create(); |
| 20 server.autoRespondAfter = 1200; | |
| 21 server.autoRespond = true; | 24 server.autoRespond = true; |
| 22 | 25 |
| 23 var details = { | |
| 24 server_version: "not-quite-ready", | |
| 25 }; | |
| 26 | |
| 27 var respond = function(request){ | 26 var respond = function(request){ |
| 28 if (!request.requestHeaders.authorization) { | 27 if (!request.requestHeaders.authorization) { |
| 29 sinon.log("You must be logged in (check your Oauth?)"); | 28 sinon.log("You must be logged in (check your Oauth?)"); |
| 30 request.respond(403, {}, "You must be logged in (check your Oauth?)"); | 29 request.respond(403, {}, "You must be logged in (check your Oauth?)"); |
| 31 return; | 30 return; |
| 32 } | 31 } |
| 33 sinon.log("User authenticated :) "+ request.requestHeaders.authorization); | 32 sinon.log("User authenticated :) "+ request.requestHeaders.authorization); |
| 34 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(d
etails)); | 33 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(d
ata)); |
| 35 } | 34 } |
| 36 | 35 |
| 37 server.respondWith("GET", "/_ah/api/swarming/v1/server/details", respond); | 36 server.respondWith("GET", "/_ah/api/swarming/v1/bots/list", respond); |
| 38 server.respondWith("GET", "/api/swarming/v1/server/details", respond); | 37 server.respondWith("GET", "/api/swarming/v1/bots/list", respond); |
| 39 </script> | 38 </script> |
| 40 | 39 |
| 41 <link rel="import" href="swarming-index.html"> | 40 <link rel="import" href="bot-list.html"> |
| 42 </head> | 41 </head> |
| 43 <body> | 42 <body> |
| 44 | 43 |
| 45 <swarming-index></swarming-index> | 44 <bot-list></bot-list> |
| 46 | 45 |
| 47 </body> | 46 </body> |
| 48 </html> | 47 </html> |
| OLD | NEW |