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

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: rebase 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
jcgregorio 2016/09/02 18:31:22 So there's already a similar solution that we have
kjlubick 2016/09/06 13:06:31 I considered using sk.errorMessage, but it doesn't
jcgregorio 2016/09/06 15:16:53 I don't understand, why are you keeping it open?
kjlubick 2016/09/06 15:26:50 It just feels like a better way to communicate wit
jcgregorio 2016/09/06 15:33:32 Yes, or add a parameter to error-toast-sk, either
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, toast, auth_headers) {
75 // Keep toast displayed until we hear back from the request.
76 toast.duration = 0;
77 toast.open();
78 sk.request("POST", url, undefined, auth_headers).then(function(response) {
79 toast.close();
80 toast.show({
81 text: "Request sent. Response: "+response,
82 duration: 3000,
83 });
84 }.bind(this)).catch(function(reason) {
85 console.log("Request failed", reason);
86 toast.close();
87 toast.show({
88 text: "Request failed. Reason: "+reason,
89 duration: 3000,
90 });
91 }.bind(this));
92 }
71 }; 93 };
72 })(); 94 })();
73 </script> 95 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698