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..2c9b21f82291ccd40e65e5b7dcecf1ab33d05574 100644 |
| --- a/appengine/swarming/elements/res/imp/common/common-behavior.html |
| +++ b/appengine/swarming/elements/res/imp/common/common-behavior.html |
| @@ -68,6 +68,28 @@ |
| } |
| return result; |
| }, |
| + |
|
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
|
| + // _postWithToast makes a post request and updates the provided paper-toast |
| + // element with the response, regardless of failure. |
| + _postWithToast: function(url, toast, auth_headers) { |
| + // Keep toast displayed until we hear back from the request. |
| + toast.duration = 0; |
| + toast.open(); |
| + sk.request("POST", url, undefined, auth_headers).then(function(response) { |
| + toast.close(); |
| + toast.show({ |
| + text: "Request sent. Response: "+response, |
| + duration: 3000, |
| + }); |
| + }.bind(this)).catch(function(reason) { |
| + console.log("Request failed", reason); |
| + toast.close(); |
| + toast.show({ |
| + text: "Request failed. Reason: "+reason, |
| + duration: 3000, |
| + }); |
| + }.bind(this)); |
| + } |
| }; |
| })(); |
| </script> |