| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 Methods: | 55 Methods: |
| 56 signIn(): Force a signin of the user using OAuth. This happens | 56 signIn(): Force a signin of the user using OAuth. This happens |
| 57 automatically when auth_headers is set. | 57 automatically when auth_headers is set. |
| 58 | 58 |
| 59 Events: | 59 Events: |
| 60 None. | 60 None. |
| 61 --> | 61 --> |
| 62 | 62 |
| 63 <link rel="import" href="/res/imp/bower_components/iron-ajax/iron-ajax.html"> | 63 <link rel="import" href="/res/imp/bower_components/iron-ajax/iron-ajax.html"> |
| 64 | 64 |
| 65 <link rel="import" href="/res/imp/common/common-aliases.html"> |
| 66 |
| 65 <link rel="import" href="bot-list-shared.html"> | 67 <link rel="import" href="bot-list-shared.html"> |
| 66 | 68 |
| 67 <dom-module id="bot-list-data"> | 69 <dom-module id="bot-list-data"> |
| 68 <template> | 70 <template> |
| 69 <iron-ajax id="botlist" | 71 <iron-ajax id="botlist" |
| 70 url="/_ah/api/swarming/v1/bots/list" | 72 url="/_ah/api/swarming/v1/bots/list" |
| 71 headers="[[auth_headers]]" | 73 headers="[[auth_headers]]" |
| 72 params="[[query_params]]" | 74 params="[[query_params]]" |
| 73 handle-as="json" | 75 handle-as="json" |
| 74 last-response="{{_list}}" | 76 last-response="{{_list}}" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 91 loading="{{_busy3}}"> | 93 loading="{{_busy3}}"> |
| 92 </iron-ajax> | 94 </iron-ajax> |
| 93 </template> | 95 </template> |
| 94 <script> | 96 <script> |
| 95 (function(){ | 97 (function(){ |
| 96 var BLACKLIST_DIMENSIONS = ["quarantined", "error"]; | 98 var BLACKLIST_DIMENSIONS = ["quarantined", "error"]; |
| 97 | 99 |
| 98 Polymer({ | 100 Polymer({ |
| 99 is: 'bot-list-data', | 101 is: 'bot-list-data', |
| 100 | 102 |
| 101 behaviors: [SwarmingBehaviors.BotListBehavior], | 103 behaviors: [ |
| 104 SwarmingBehaviors.BotListBehavior, |
| 105 SwarmingBehaviors.Aliases, |
| 106 ], |
| 102 | 107 |
| 103 properties: { | 108 properties: { |
| 104 // inputs | 109 // inputs |
| 105 auth_headers: { | 110 auth_headers: { |
| 106 type: Object, | 111 type: Object, |
| 107 observer: "signIn", | 112 observer: "signIn", |
| 108 }, | 113 }, |
| 109 query_params: { | 114 query_params: { |
| 110 type: Object, | 115 type: Object, |
| 111 }, | 116 }, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 125 type: Array, | 130 type: Array, |
| 126 computed: "_makeArray(_dimensions)", | 131 computed: "_makeArray(_dimensions)", |
| 127 notify: true, | 132 notify: true, |
| 128 }, | 133 }, |
| 129 fleet: { | 134 fleet: { |
| 130 type: Object, | 135 type: Object, |
| 131 computed: "_fleet(_count)", | 136 computed: "_fleet(_count)", |
| 132 notify: true, | 137 notify: true, |
| 133 }, | 138 }, |
| 134 primary_map: { | 139 primary_map: { |
| 135 type:Object, | 140 type: Object, |
| 136 computed: "_primaryMap(_dimensions)", | 141 computed: "_primaryMap(_dimensions)", |
| 137 notify: true, | 142 notify: true, |
| 138 }, | 143 }, |
| 139 primary_arr: { | 144 primary_arr: { |
| 140 type: Array, | 145 type: Array, |
| 141 //BOT_PROPERTIES is inherited from BotListBehavior | 146 //BOT_PROPERTIES is inherited from BotListBehavior |
| 142 computed: "_primaryArr(dimensions, BOT_PROPERTIES)", | 147 computed: "_primaryArr(dimensions, BOT_PROPERTIES)", |
| 143 notify: true, | 148 notify: true, |
| 144 }, | 149 }, |
| 145 | 150 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 _makeArray: function(dimObj) { | 217 _makeArray: function(dimObj) { |
| 213 if (!dimObj || !dimObj.bots_dimensions) { | 218 if (!dimObj || !dimObj.bots_dimensions) { |
| 214 return []; | 219 return []; |
| 215 } | 220 } |
| 216 var dims = []; | 221 var dims = []; |
| 217 dimObj.bots_dimensions.forEach(function(d){ | 222 dimObj.bots_dimensions.forEach(function(d){ |
| 218 if (BLACKLIST_DIMENSIONS.indexOf(d.key) === -1) { | 223 if (BLACKLIST_DIMENSIONS.indexOf(d.key) === -1) { |
| 219 dims.push(d.key); | 224 dims.push(d.key); |
| 220 } | 225 } |
| 221 }); | 226 }); |
| 227 dims.push("id"); |
| 222 dims.sort(); | 228 dims.sort(); |
| 223 return dims; | 229 return dims; |
| 224 }, | 230 }, |
| 225 | 231 |
| 226 _primaryArr: function(dimensions, properties) { | 232 _primaryArr: function(dimensions, properties) { |
| 227 return dimensions.concat(properties); | 233 return dimensions.concat(properties); |
| 228 }, | 234 }, |
| 229 | 235 |
| 230 _primaryMap: function(dimensions){ | 236 _primaryMap: function(dimensions){ |
| 231 // pMap will have a list of columns to available values (primary key | 237 // pMap will have a list of columns to available values (primary key |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 285 |
| 280 // No need to sort any of this, bot-filters sorts secondary items | 286 // No need to sort any of this, bot-filters sorts secondary items |
| 281 // automatically, especially when the user types a query. | 287 // automatically, especially when the user types a query. |
| 282 return pMap; | 288 return pMap; |
| 283 }, | 289 }, |
| 284 | 290 |
| 285 }); | 291 }); |
| 286 })(); | 292 })(); |
| 287 </script> | 293 </script> |
| 288 </dom-module> | 294 </dom-module> |
| OLD | NEW |