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

Side by Side Diff: appengine/swarming/elements/res/imp/common/error-toast.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
(Empty)
1 <!--
2 Copyright 2016 The LUCI Authors. All rights reserved.
3 Use of this source code is governed under the Apache License, Version 2.0
4 that can be found in the LICENSE file.
5
6 Listens for 'error-sk' events that bubble up to the document
7 and displays them.
8
9 The 'error-sk' event should have 'detail' of the form:
10
11 {
12 message: "The error message to display goes here.",
jcgregorio 2016/09/06 20:40:56 Document duration in the example.
kjlubick 2016/09/07 12:00:20 Done.
13 }
14
15 Attributes:
16 None
17 Events:
18 Methods:
19 -->
20 <link rel="import" href="/res/imp/bower_components/paper-toast/paper-toast.html" />
21
22 <dom-module id="error-toast">
23 <template>
24 <paper-toast id=toast></paper-toast>
25 </template>
26 </dom-module>
27
28 <script>
29 Polymer({
30 is: "error-toast",
31 ready: function() {
32 document.addEventListener('error-sk', function(e) {
33 this.$.toast.close();
34 if (e.detail.message) {
35 this.$.toast.text = e.detail.message;
36 var duration = 10000;
37 // duration = 0 is a valid input for "keep open indefinitely".
38 if (e.detail.duration !== undefined) {
39 duration = e.detail.duration;
40 }
41 this.$.toast.duration = duration;
42 this.$.toast.show();
43 } else {
44 console.log("Empty message?", e);
45 }
46 }.bind(this));
47 },
48 });
49 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698