| 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> | 9 <bot-list> |
| 10 | 10 |
| 11 bot-list creats a dynamic table for viewing swarming bots. Columns can be | 11 bot-list creats a dynamic table for viewing swarming bots. Columns can be |
| 12 dynamically filtered and it supports client-side filtering. | 12 dynamically filtered and it supports client-side filtering. |
| 13 | 13 |
| 14 This is a top-level element. | 14 This is a top-level element. |
| 15 | 15 |
| 16 Properties: | 16 Properties: |
| 17 client_id: String, will be set by server-side template evaluation. | 17 client_id: String, Oauth 2.0 client id. It will be set by server-side |
| 18 template evaluation. |
| 18 | 19 |
| 19 Methods: | 20 Methods: |
| 20 None. | 21 None. |
| 21 | 22 |
| 22 Events: | 23 Events: |
| 23 None. | 24 None. |
| 24 --> | 25 --> |
| 25 | 26 |
| 26 <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-la
yout-classes.html"> | 27 <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-la
yout-classes.html"> |
| 27 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> | 28 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 not of much use, so we'll ignore it in _hide() and use this._colum
ns. | 131 not of much use, so we'll ignore it in _hide() and use this._colum
ns. |
| 131 --> | 132 --> |
| 132 <th hidden$="[[_hide('task', _columns.*)]]"> | 133 <th hidden$="[[_hide('task', _columns.*)]]"> |
| 133 <span>Current Task</span> | 134 <span>Current Task</span> |
| 134 <sort-toggle | 135 <sort-toggle |
| 135 name="task" | 136 name="task" |
| 136 current="[[_sort]]"> | 137 current="[[_sort]]"> |
| 137 </sort-toggle> | 138 </sort-toggle> |
| 138 </th> | 139 </th> |
| 139 | 140 |
| 140 <template is="dom-repeat" | 141 <template |
| 141 items="[[_plainColumns]]" | 142 is="dom-repeat" |
| 142 as="c"> | 143 items="[[_plainColumns]]" |
| 144 as="c"> |
| 143 <th hidden$="[[_hide(c)]]"> | 145 <th hidden$="[[_hide(c)]]"> |
| 144 <span>[[_header(c)]]</span> | 146 <span>[[_header(c)]]</span> |
| 145 <sort-toggle | 147 <sort-toggle |
| 146 name="[[c]]" | 148 name="[[c]]" |
| 147 current="[[_sort]]"> | 149 current="[[_sort]]"> |
| 148 </sort-toggle> | 150 </sort-toggle> |
| 149 </th> | 151 </th> |
| 150 </template> | 152 </template> |
| 151 </tr> | 153 </tr> |
| 152 </thead> | 154 </thead> |
| 153 <tbody> | 155 <tbody> |
| 154 <template id="bot_table" is="dom-repeat" | 156 <template |
| 155 items="[[_filteredSortedItems]]" | 157 id="bot_table" |
| 156 as="bot" | 158 is="dom-repeat" |
| 157 initial-count=50> | 159 items="[[_filteredSortedItems]]" |
| 160 as="bot" |
| 161 initial-count=50> |
| 158 | 162 |
| 159 <tr class$="[[_botClass(bot)]]"> | 163 <tr class$="[[_botClass(bot)]]"> |
| 160 <td> | 164 <td> |
| 161 <a class="center" | 165 <a |
| 162 href$="[[_botLink(bot.bot_id)]]" | 166 class="center" |
| 163 target="_blank"> | 167 href$="[[_botLink(bot.bot_id)]]" |
| 164 [[bot.bot_id]] | 168 target="_blank"> |
| 169 [[bot.bot_id]] |
| 165 </a> | 170 </a> |
| 166 </td> | 171 </td> |
| 167 <td hidden$="[[_hide('task', _columns.*)]]"> | 172 <td hidden$="[[_hide('task', _columns.*)]]"> |
| 168 <a href$="[[_taskLink(bot)]]">[[_taskId(bot)]]</a> | 173 <a href$="[[_taskLink(bot)]]">[[_taskId(bot)]]</a> |
| 169 </td> | 174 </td> |
| 170 | 175 |
| 171 <template is="dom-repeat" | 176 <template |
| 172 items="[[_plainColumns]]" | 177 is="dom-repeat" |
| 173 as="c"> | 178 items="[[_plainColumns]]" |
| 179 as="c"> |
| 174 <td hidden$="[[_hide(c)]]"> | 180 <td hidden$="[[_hide(c)]]"> |
| 175 [[_column(c, bot, _verbose)]] | 181 [[_column(c, bot, _verbose)]] |
| 176 </td> | 182 </td> |
| 177 </template> | 183 </template> |
| 178 | 184 |
| 179 </tr> | 185 </tr> |
| 180 <template is="dom-repeat" | 186 <template |
| 181 items="[[_devices(bot)]]" | 187 is="dom-repeat" |
| 182 as="device"> | 188 items="[[_devices(bot)]]" |
| 183 <tr hidden$="[[_hide('android_devices', _columns.*)]]" | 189 as="device"> |
| 190 <tr |
| 191 hidden$="[[_hide('android_devices', _columns.*)]]" |
| 184 class$="[[_deviceClass(device)]]"> | 192 class$="[[_deviceClass(device)]]"> |
| 185 <td></td> | 193 <td></td> |
| 186 <td hidden$="[[_hide('task', _columns.*)]]"></td> | 194 <td hidden$="[[_hide('task', _columns.*)]]"></td> |
| 187 <template is="dom-repeat" | 195 <template |
| 188 items="[[_plainColumns]]" | 196 is="dom-repeat" |
| 189 as="c"> | 197 items="[[_plainColumns]]" |
| 198 as="c"> |
| 190 <td hidden$="[[_hide(c)]]"> | 199 <td hidden$="[[_hide(c)]]"> |
| 191 [[_deviceColumn(c, device, _verbose)]] | 200 [[_deviceColumn(c, device, _verbose)]] |
| 192 </td> | 201 </td> |
| 193 </template> | 202 </template> |
| 194 </tr> | 203 </tr> |
| 195 </template> <!--devices repeat--> | 204 </template> <!--devices repeat--> |
| 196 </template> <!--bot-table repeat--> | 205 </template> <!--bot-table repeat--> |
| 197 </tbody> | 206 </tbody> |
| 198 </table> | 207 </table> |
| 199 </div> | 208 </div> |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 return dir * swarming.naturalCompare(botACol, botBCol); | 349 return dir * swarming.naturalCompare(botACol, botBCol); |
| 341 }, | 350 }, |
| 342 }; | 351 }; |
| 343 | 352 |
| 344 Polymer({ | 353 Polymer({ |
| 345 is: 'bot-list', | 354 is: 'bot-list', |
| 346 behaviors: [SwarmingBehaviors.BotListBehavior, | 355 behaviors: [SwarmingBehaviors.BotListBehavior, |
| 347 SwarmingBehaviors.DynamicTableBehavior], | 356 SwarmingBehaviors.DynamicTableBehavior], |
| 348 | 357 |
| 349 properties: { | 358 properties: { |
| 350 | |
| 351 client_id: { | 359 client_id: { |
| 352 type: String, | 360 type: String, |
| 353 }, | 361 }, |
| 354 | 362 |
| 355 // for dynamic table | 363 // For dynamic table. |
| 356 _columnMap: { | 364 _columnMap: { |
| 357 type: Object, | 365 type: Object, |
| 358 value: function() { | 366 value: columnMap, |
| 359 return columnMap; | |
| 360 } | |
| 361 }, | 367 }, |
| 362 _headerMap: { | 368 _headerMap: { |
| 363 type: Object, | 369 type: Object, |
| 364 value: function() { | 370 value: headerMap, |
| 365 return headerMap; | |
| 366 }, | |
| 367 }, | 371 }, |
| 368 // special columns contain html. non-special (i.e. normal colunns) just | |
| 369 // contain text. | |
| 370 _specialColumns: { | 372 _specialColumns: { |
| 371 type: Array, | 373 type: Array, |
| 372 value: function() { | 374 value: specialColumns, |
| 373 return specialColumns; | |
| 374 } | |
| 375 }, | 375 }, |
| 376 _specialSort: { | 376 _specialSort: { |
| 377 type: Object, | 377 type: Object, |
| 378 value: function() { | 378 value: specialSort, |
| 379 return specialSort; | |
| 380 } | |
| 381 }, | 379 }, |
| 382 | 380 |
| 383 }, | 381 }, |
| 384 | 382 |
| 385 _botClass: function(bot) { | 383 _botClass: function(bot) { |
| 386 if (bot.is_dead) { | 384 if (bot.is_dead) { |
| 387 return "dead"; | 385 return "dead"; |
| 388 } | 386 } |
| 389 if (bot.quarantined) { | 387 if (bot.quarantined) { |
| 390 return "quarantined"; | 388 return "quarantined"; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 if (data && data.task_id) { | 422 if (data && data.task_id) { |
| 425 return "/user/task/" + data.task_id; | 423 return "/user/task/" + data.task_id; |
| 426 } | 424 } |
| 427 return undefined; | 425 return undefined; |
| 428 } | 426 } |
| 429 | 427 |
| 430 }); | 428 }); |
| 431 })(); | 429 })(); |
| 432 </script> | 430 </script> |
| 433 </dom-module> | 431 </dom-module> |
| OLD | NEW |