Chromium Code Reviews| 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(){ | |
| 142 this.set("bot_exists", false); | |
|
nodir
2016/11/02 18:46:29
what happens if swarming returns a transient error
kjlubick
2016/11/03 15:48:35
Done.
| |
| 143 }.bind(this)); | |
| 134 this.fire("reload", {id: this.bot_id}); | 144 this.fire("reload", {id: this.bot_id}); |
| 135 }, BOT_ID_DEBOUNCE_MS); | 145 }, BOT_ID_DEBOUNCE_MS); |
| 136 | 146 |
| 137 }, | 147 }, |
| 138 | 148 |
| 139 _parseBot: function(bot) { | 149 _parseBot: function(bot) { |
| 140 if (!bot) { | 150 if (!bot) { |
| 141 return {}; | 151 return {}; |
| 142 } | 152 } |
| 143 // Do any preprocessing here | 153 // 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; | 248 return b.started_ts - a.started_ts; |
| 239 }); | 249 }); |
| 240 | 250 |
| 241 return tasks; | 251 return tasks; |
| 242 } | 252 } |
| 243 | 253 |
| 244 }); | 254 }); |
| 245 })(); | 255 })(); |
| 246 </script> | 256 </script> |
| 247 </dom-module> | 257 </dom-module> |
| OLD | NEW |