| Index: appengine/swarming/ui/res/imp/botlist/bot-list-demo.html
|
| diff --git a/appengine/swarming/ui/res/imp/botlist/bot-list-demo.html b/appengine/swarming/ui/res/imp/botlist/bot-list-demo.html
|
| index 4cbe1e1cce75beda2d961cfdf304faaa69358c5e..977733222505e846eaed17b26e86665197c7b2cc 100644
|
| --- a/appengine/swarming/ui/res/imp/botlist/bot-list-demo.html
|
| +++ b/appengine/swarming/ui/res/imp/botlist/bot-list-demo.html
|
| @@ -27,7 +27,7 @@
|
| sinon.log = function(message) {console.log(message);};
|
| var server = sinon.fakeServer.create();
|
| server.autoRespond = true;
|
| - //server.autoRespondAfter = 2000;
|
| + server.autoRespondAfter = 1300;
|
|
|
| var respond = function(request){
|
| if (!request.requestHeaders.authorization) {
|
| @@ -37,7 +37,15 @@
|
| }
|
| sinon.log("User authenticated :) "+ request.requestHeaders.authorization);
|
| sinon.log("List Request: "+sinon.format(request));
|
| - request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(data));
|
| + if (request.url.indexOf("is_dead") > 0) {
|
| + // pretend there are 5 bots to delete
|
| + request.respond(200, {"Content-Type":"application/json"}, JSON.stringify({
|
| + items:data.items.slice(0, 5),
|
| + }));
|
| + } else {
|
| + request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(data));
|
| + }
|
| +
|
| }
|
|
|
| server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/list.*/, respond);
|
| @@ -53,8 +61,8 @@
|
| "etag": "\"nhThK35uIVdvx1_Mr5DChu_DyBs/aO8fy5IdESDx-fy3If19oDKu0f0\""
|
| };
|
|
|
| - server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bots\/count/, JSON.stringify(mockFleetSummary));
|
| - server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/count/, JSON.stringify(mockFleetSummary));
|
| + server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bots\/count$/, JSON.stringify(mockFleetSummary));
|
| + server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/count$/, JSON.stringify(mockFleetSummary));
|
|
|
| server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/bots\/dimensions/, JSON.stringify(fleetData));
|
| server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/dimensions/, JSON.stringify(fleetData));
|
| @@ -68,12 +76,39 @@
|
| server.respondWith("GET", /^\/api\/swarming\/v1\/server\/details/, JSON.stringify(details));
|
|
|
| var count = {
|
| + count: 25,
|
| + busy: 0,
|
| + dead: 5,
|
| + quarantined: 0,
|
| + }
|
| + server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/count\?is_dead=TRUE.*/, JSON.stringify(count));
|
| +
|
| + count = {
|
| count: 905,
|
| busy: 581,
|
| dead: 10,
|
| quarantined: 0,
|
| }
|
| - server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/count.*/, JSON.stringify(count));
|
| + server.respondWith("GET", /^\/api\/swarming\/v1\/bots\/count\?[^i].*/, JSON.stringify(count));
|
| +
|
| + var permissions = {
|
| + delete_bot: true
|
| + };
|
| + server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/server\/permissions/, JSON.stringify(permissions));
|
| + server.respondWith("GET", /^\/api\/swarming\/v1\/server\/permissions/, JSON.stringify(permissions));
|
| +
|
| + var deleteRequest = function(request) {
|
| + console.log("Deleting", request);
|
| + if (!request.requestHeaders.authorization) {
|
| + sinon.log("You must be logged in (check your Oauth?)");
|
| + request.respond(403, {}, "You must be logged in (check your Oauth?)");
|
| + return;
|
| + }
|
| + request.respond(200, {}, "Bot has been deleted.");
|
| + }
|
| +
|
| + server.respondWith("POST", /^\/_ah\/api\/swarming\/v1\/bot\/.+\/delete/, deleteRequest);
|
| + server.respondWith("POST", /^\/api\/swarming\/v1\/bot\/.+\/delete/, deleteRequest);
|
| </script>
|
|
|
| <link rel="import" href="bot-list.html">
|
|
|