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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: appengine/swarming/elements/res/imp/common/common-behavior.html
diff --git a/appengine/swarming/elements/res/imp/common/common-behavior.html b/appengine/swarming/elements/res/imp/common/common-behavior.html
index 76254a1ab1d51fec135169bf19aacd8bab98a269..06b78ba90afff6c7cf4fb34b767050aad16a6a6b 100644
--- a/appengine/swarming/elements/res/imp/common/common-behavior.html
+++ b/appengine/swarming/elements/res/imp/common/common-behavior.html
@@ -68,6 +68,20 @@
}
return result;
},
+
+ // _postWithToast makes a post request and updates the provided paper-toast
+ // element with the response, regardless of failure.
+ _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.
+ // Keep toast displayed until we hear back from the request.
+ sk.errorMessage(msg, 0);
+
+ sk.request("POST", url, undefined, auth_headers).then(function(response) {
+ sk.errorMessage("Request sent. Response: "+response, 3000);
+ }.bind(this)).catch(function(reason) {
+ console.log("Request failed", reason);
+ sk.errorMessage("Request failed. Reason: "+reason, 5000);
+ }.bind(this));
+ }
};
})();
</script>

Powered by Google App Engine
This is Rietveld 408576698