| 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-list-data> | 9 <bot-list-data> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 tasks: Array<Object>, all tasks returned by the server. | 33 tasks: Array<Object>, all tasks returned by the server. |
| 34 | 34 |
| 35 Methods: | 35 Methods: |
| 36 signIn(): Force a signin of the user using OAuth. This happens | 36 signIn(): Force a signin of the user using OAuth. This happens |
| 37 automatically when auth_headers is set. | 37 automatically when auth_headers is set. |
| 38 | 38 |
| 39 Events: | 39 Events: |
| 40 None. | 40 None. |
| 41 --> | 41 --> |
| 42 | 42 |
| 43 <link rel="import" href="/res/imp/bower_components/iron-ajax/iron-ajax.html"> | |
| 44 <link rel="import" href="/res/imp/common/common-behavior.html"> | 43 <link rel="import" href="/res/imp/common/common-behavior.html"> |
| 45 | 44 |
| 46 <dom-module id="task-list-data"> | 45 <dom-module id="task-list-data"> |
| 47 <script> | 46 <script> |
| 48 (function(){ | 47 (function(){ |
| 49 Polymer({ | 48 Polymer({ |
| 50 is: 'task-list-data', | 49 is: 'task-list-data', |
| 51 | 50 |
| 52 behaviors: [ | 51 behaviors: [ |
| 53 SwarmingBehaviors.CommonBehavior, | 52 SwarmingBehaviors.CommonBehavior, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 pMap["deduped_from"] = []; | 216 pMap["deduped_from"] = []; |
| 218 pMap["duration"] = []; | 217 pMap["duration"] = []; |
| 219 pMap["modified_ts"] = []; | 218 pMap["modified_ts"] = []; |
| 220 pMap["server_versions"] = []; | 219 pMap["server_versions"] = []; |
| 221 pMap["started_ts"] = []; | 220 pMap["started_ts"] = []; |
| 222 | 221 |
| 223 return pMap; | 222 return pMap; |
| 224 }, | 223 }, |
| 225 | 224 |
| 226 _request: function() { | 225 _request: function() { |
| 227 // wait until the user has logged in before requesting this. | 226 // wait until the user has logged in and the filters have loaded before
requesting this to avoid double or even triple requests. |
| 228 if (!this.auth_headers) { | 227 if (!this.auth_headers || !this.query_params) { |
| 229 return; | 228 return; |
| 230 } | 229 } |
| 231 this._getJsonAsync("_list", "/_ah/api/swarming/v1/tasks/list", | 230 this._getJsonAsync("_list", "/_ah/api/swarming/v1/tasks/list", |
| 232 "_busy1", this.auth_headers, this.query_params); | 231 "_busy1", this.auth_headers, this.query_params); |
| 233 }, | 232 }, |
| 234 | 233 |
| 235 _tasks: function() { | 234 _tasks: function() { |
| 236 if (!this._list || !this._list.items) { | 235 if (!this._list || !this._list.items) { |
| 237 return []; | 236 return []; |
| 238 } | 237 } |
| 239 // Do any preprocessing here | 238 // Do any preprocessing here |
| 240 this._list.items.forEach(function(t) { | 239 this._list.items.forEach(function(t) { |
| 241 var tagMap = {}; | 240 var tagMap = {}; |
| 242 t.tags.forEach(function(tag) { | 241 t.tags.forEach(function(tag) { |
| 243 var split = tag.split(":", 1) | 242 var split = tag.split(":", 1) |
| 244 var key = split[0]; | 243 var key = split[0]; |
| 245 var rest = tag.substring(key.length + 1); | 244 var rest = tag.substring(key.length + 1); |
| 246 tagMap[key] = rest; | 245 tagMap[key] = rest; |
| 247 }); | 246 }); |
| 248 t.tagMap = tagMap; | 247 t.tagMap = tagMap; |
| 249 }); | 248 }); |
| 250 return this._list.items; | 249 return this._list.items; |
| 251 } | 250 } |
| 252 }); | 251 }); |
| 253 })(); | 252 })(); |
| 254 </script> | 253 </script> |
| 255 </dom-module> | 254 </dom-module> |
| OLD | NEW |