| 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 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-page Demo</title> | 10 <title>bot-page Demo</title> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 sinon.log("User authenticated :) "+ request.requestHeaders.authorization
); | 40 sinon.log("User authenticated :) "+ request.requestHeaders.authorization
); |
| 41 sinon.log("Bot Request: "+sinon.format(request)); | 41 sinon.log("Bot Request: "+sinon.format(request)); |
| 42 // If the user changes bot id, show them some of the other sample data. | 42 // If the user changes bot id, show them some of the other sample data. |
| 43 var idx = request.url.indexOf("-00"); | 43 var idx = request.url.indexOf("-00"); |
| 44 var item = 0; | 44 var item = 0; |
| 45 if (idx !=-1) { | 45 if (idx !=-1) { |
| 46 var name = request.url.substring(idx+1, idx+4); | 46 var name = request.url.substring(idx+1, idx+4); |
| 47 item = parseInt(name) || 0; | 47 item = parseInt(name) || 0; |
| 48 name = Math.max(name - 1, 0); | 48 item = Math.max(item - 1, 0); |
| 49 name = Math.min(name, arr.length-1); | 49 item = Math.min(item, arr.length-1); |
| 50 } | 50 } |
| 51 | 51 |
| 52 | 52 |
| 53 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify
(arr[name])); | 53 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify
(arr[item])); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bot\/test-bot-\d+\/get
.*/, genResponse(bots)); | 58 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bot\/test-bot-\d+\/get
.*/, genResponse(bots)); |
| 59 server.respondWith("GET", /^\/api\/swarming\/v1\/bot\/test-bot-\d+\/get.*/,
genResponse(bots)); | 59 server.respondWith("GET", /^\/api\/swarming\/v1\/bot\/test-bot-\d+\/get.*/,
genResponse(bots)); |
| 60 | 60 |
| 61 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bot\/test-bot-\d+\/eve
nts.*/, genResponse(events)); | 61 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bot\/test-bot-\d+\/eve
nts.*/, genResponse(events)); |
| 62 server.respondWith("GET", /^\/api\/swarming\/v1\/bot\/test-bot-\d+\/events.*
/, genResponse(events)); | 62 server.respondWith("GET", /^\/api\/swarming\/v1\/bot\/test-bot-\d+\/events.*
/, genResponse(events)); |
| 63 | 63 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 </head> | 110 </head> |
| 111 <body> | 111 <body> |
| 112 | 112 |
| 113 <bot-page | 113 <bot-page |
| 114 bot_id="test-bot-001" | 114 bot_id="test-bot-001" |
| 115 client_id="20770472288-t5smpbpjptka4nd888fv0ctd23ftba2o.apps.googleusercontent
.com"> | 115 client_id="20770472288-t5smpbpjptka4nd888fv0ctd23ftba2o.apps.googleusercontent
.com"> |
| 116 </bot-page> | 116 </bot-page> |
| 117 | 117 |
| 118 </body> | 118 </body> |
| 119 </html> | 119 </html> |
| OLD | NEW |