| OLD | NEW |
| 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 This in an HTML Import-able file that contains the definition | 6 This in an HTML Import-able file that contains the definition |
| 7 of the following elements: | 7 of the following elements: |
| 8 | 8 |
| 9 <bot-page-data> | 9 <bot-page-data> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 busy: { | 90 busy: { |
| 91 type: Boolean, | 91 type: Boolean, |
| 92 computed: "_or(_busy1)", | 92 computed: "_or(_busy1)", |
| 93 notify: true, | 93 notify: true, |
| 94 }, | 94 }, |
| 95 bot: { | 95 bot: { |
| 96 type: Object, | 96 type: Object, |
| 97 computed: "_parseBot(_bot)", | 97 computed: "_parseBot(_bot)", |
| 98 notify: true, | 98 notify: true, |
| 99 }, | 99 }, |
| 100 bot_exists: { |
| 101 type: Boolean, |
| 102 value: true, |
| 103 notify: true, |
| 104 }, |
| 100 | 105 |
| 101 // private | 106 // private |
| 102 _busy1: { | 107 _busy1: { |
| 103 type: Boolean, | 108 type: Boolean, |
| 104 value: false | 109 value: false |
| 105 }, | 110 }, |
| 106 _bot: { | 111 _bot: { |
| 107 type: Object, | 112 type: Object, |
| 108 }, | 113 }, |
| 109 _events: { | 114 _events: { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 122 if (!this.bot_id || !this.auth_headers) { | 127 if (!this.bot_id || !this.auth_headers) { |
| 123 return; | 128 return; |
| 124 } | 129 } |
| 125 if (lastRequest) { | 130 if (lastRequest) { |
| 126 this.cancelAsync(lastRequest); | 131 this.cancelAsync(lastRequest); |
| 127 } | 132 } |
| 128 | 133 |
| 129 lastRequest = this.async(function(){ | 134 lastRequest = this.async(function(){ |
| 130 lastRequest = undefined; | 135 lastRequest = undefined; |
| 131 var baseUrl = "/api/swarming/v1/bot/"+this.bot_id; | 136 var baseUrl = "/api/swarming/v1/bot/"+this.bot_id; |
| 132 this._getJsonAsync("_bot", baseUrl + "/get", | 137 var p = this._getJsonAsync("_bot", baseUrl + "/get", |
| 133 "_busy1", this.auth_headers); | 138 "_busy1", this.auth_headers); |
| 139 p.then(function(){ |
| 140 this.set("bot_exists", true); |
| 141 }.bind(this)).catch(function(r){ |
| 142 if (r.status === 404) { |
| 143 this.set("bot_exists", false); |
| 144 } else { |
| 145 sk.errorMessage("Http response: " + (r.status || " ") + " " + r.re
sponse); |
| 146 } |
| 147 }.bind(this)); |
| 134 this.fire("reload", {id: this.bot_id}); | 148 this.fire("reload", {id: this.bot_id}); |
| 135 }, BOT_ID_DEBOUNCE_MS); | 149 }, BOT_ID_DEBOUNCE_MS); |
| 136 | 150 |
| 137 }, | 151 }, |
| 138 | 152 |
| 139 _parseBot: function(bot) { | 153 _parseBot: function(bot) { |
| 140 if (!bot) { | 154 if (!bot) { |
| 141 return {}; | 155 return {}; |
| 142 } | 156 } |
| 143 // Do any preprocessing here | 157 // Do any preprocessing here |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 return b.started_ts - a.started_ts; | 252 return b.started_ts - a.started_ts; |
| 239 }); | 253 }); |
| 240 | 254 |
| 241 return tasks; | 255 return tasks; |
| 242 } | 256 } |
| 243 | 257 |
| 244 }); | 258 }); |
| 245 })(); | 259 })(); |
| 246 </script> | 260 </script> |
| 247 </dom-module> | 261 </dom-module> |
| OLD | NEW |