Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: appengine/swarming/elements/res/imp/common/common-behavior.html

Issue 2302973002: Refactor post requests, implement bot cancel/terminate (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@basic-layout
Patch Set: Build using new skia-common-js Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 It contains the definition of the following Behaviors: 6 It contains the definition of the following Behaviors:
7 7
8 SwarmingBehaviors.CommonBehavior 8 SwarmingBehaviors.CommonBehavior
9 9
10 To use it, include 10 To use it, include
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 }, 61 },
62 62
63 _or: function() { 63 _or: function() {
64 var result = false; 64 var result = false;
65 // can't use .foreach, as arguments isn't really an Array. 65 // can't use .foreach, as arguments isn't really an Array.
66 for (var i = 0; i < arguments.length; i++) { 66 for (var i = 0; i < arguments.length; i++) {
67 result = result || arguments[i]; 67 result = result || arguments[i];
68 } 68 }
69 return result; 69 return result;
70 }, 70 },
71
72 // _postWithToast makes a post request and updates the provided paper-toas t
73 // element with the response, regardless of failure.
74 _postWithToast: function(url, msg, auth_headers) {
jcgregorio 2016/09/06 20:40:56 Now that you are using errorMessage and the error-
kjlubick 2016/09/07 12:00:20 Done.
75 // Keep toast displayed until we hear back from the request.
76 sk.errorMessage(msg, 0);
77
78 sk.request("POST", url, undefined, auth_headers).then(function(response) {
79 sk.errorMessage("Request sent. Response: "+response, 3000);
80 }.bind(this)).catch(function(reason) {
81 console.log("Request failed", reason);
82 sk.errorMessage("Request failed. Reason: "+reason, 5000);
83 }.bind(this));
84 }
71 }; 85 };
72 })(); 86 })();
73 </script> 87 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698