Chromium Code Reviews| 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> |