| 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 <task-list> | 9 <task-list> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 busy="[[_busy]]" | 57 busy="[[_busy]]" |
| 58 name="Swarming Task List"> | 58 name="Swarming Task List"> |
| 59 | 59 |
| 60 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> | 60 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> |
| 61 | 61 |
| 62 <div hidden$="[[_not(_signed_in)]]"> | 62 <div hidden$="[[_not(_signed_in)]]"> |
| 63 <task-list-data | 63 <task-list-data |
| 64 auth_headers="[[_auth_headers]]" | 64 auth_headers="[[_auth_headers]]" |
| 65 query_params="[[_query_params]]" | 65 query_params="[[_query_params]]" |
| 66 tasks="{{_items}}" | 66 tasks="{{_items}}" |
| 67 busy="{{_busy}}"> | 67 busy="{{_busy}}" |
| 68 primary_map="{{_primary_map}}" |
| 69 primary_arr="{{_primary_arr}}"> |
| 68 </task-list-data> | 70 </task-list-data> |
| 69 | 71 |
| 70 <div class="horizontal layout"> | 72 <div class="horizontal layout"> |
| 71 | 73 |
| 72 <task-filters | 74 <task-filters |
| 75 primary_map="[[_primary_map]]" |
| 76 primary_arr="[[_primary_arr]]" |
| 73 columns="{{_columns}}" | 77 columns="{{_columns}}" |
| 74 query_params="{{_query_params}}" | 78 query_params="{{_query_params}}" |
| 75 filter="{{_filter}}" | 79 filter="{{_filter}}" |
| 76 verbose="{{_verbose}}"> | 80 verbose="{{_verbose}}"> |
| 77 </task-filters> | 81 </task-filters> |
| 78 | 82 |
| 79 </div> | 83 </div> |
| 80 | 84 |
| 81 <table class="task-list"> | 85 <table class="task-list"> |
| 82 <thead on-sort_change="_sortChange"> | 86 <thead on-sort_change="_sortChange"> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 94 <sort-toggle | 98 <sort-toggle |
| 95 name="name" | 99 name="name" |
| 96 current="[[_sort]]"> | 100 current="[[_sort]]"> |
| 97 </sort-toggle> | 101 </sort-toggle> |
| 98 </th> | 102 </th> |
| 99 <!-- This wonky syntax is the proper way to listen to changes on a
n | 103 <!-- This wonky syntax is the proper way to listen to changes on a
n |
| 100 array (we are listening to all subproperties). The element returne
d is | 104 array (we are listening to all subproperties). The element returne
d is |
| 101 not of much use, so we'll ignore it in _hide() and use this._colum
ns. | 105 not of much use, so we'll ignore it in _hide() and use this._colum
ns. |
| 102 --> | 106 --> |
| 103 <th hidden$="[[_hide('state', _columns.*)]]"> | 107 <th hidden$="[[_hide('state', _columns.*)]]"> |
| 104 <span>Status</span> | 108 <span>State</span> |
| 105 <sort-toggle | 109 <sort-toggle |
| 106 name="state" | 110 name="state" |
| 107 current="[[_sort]]"> | 111 current="[[_sort]]"> |
| 108 </sort-toggle> | 112 </sort-toggle> |
| 109 </th> | 113 </th> |
| 110 | 114 |
| 111 <template | 115 <template |
| 112 is="dom-repeat" | 116 is="dom-repeat" |
| 113 items="[[_plainColumns]]" | 117 items="[[_plainColumns]]" |
| 114 as="c"> | 118 as="c"> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 (function(){ | 170 (function(){ |
| 167 var specialColumns = ["name", "state"]; | 171 var specialColumns = ["name", "state"]; |
| 168 var columnMap = {}; | 172 var columnMap = {}; |
| 169 var headerMap = { | 173 var headerMap = { |
| 170 "user": "Requesting User", | 174 "user": "Requesting User", |
| 171 }; | 175 }; |
| 172 var specialSort = {}; | 176 var specialSort = {}; |
| 173 | 177 |
| 174 Polymer({ | 178 Polymer({ |
| 175 is: 'task-list', | 179 is: 'task-list', |
| 180 |
| 181 // The order behaviors are applied in matters - later ones overwrite |
| 182 // attributes of earlier ones |
| 176 behaviors: [ | 183 behaviors: [ |
| 177 SwarmingBehaviors.SwarmingBehavior, | 184 SwarmingBehaviors.SwarmingBehavior, |
| 178 SwarmingBehaviors.DynamicTableBehavior, | 185 SwarmingBehaviors.DynamicTableBehavior, |
| 179 ], | 186 ], |
| 180 | 187 |
| 181 properties: { | 188 properties: { |
| 182 client_id: { | 189 client_id: { |
| 183 type: String, | 190 type: String, |
| 184 }, | 191 }, |
| 185 | 192 |
| 186 // For dynamic table. | 193 // For dynamic table. |
| 187 _columnMap: { | 194 _columnMap: { |
| 188 type: Object, | 195 type: Object, |
| 189 value: columnMap, | 196 value: function() { |
| 197 var base = this._commonColumns(); |
| 198 for (var attr in columnMap) { |
| 199 base[attr] = columnMap[attr]; |
| 200 } |
| 201 return base; |
| 202 }, |
| 190 }, | 203 }, |
| 191 _headerMap: { | 204 _headerMap: { |
| 192 type: Object, | 205 type: Object, |
| 193 value: headerMap, | 206 value: headerMap, |
| 194 }, | 207 }, |
| 195 _specialColumns: { | 208 _specialColumns: { |
| 196 type: Array, | 209 type: Array, |
| 197 value: specialColumns, | 210 value: specialColumns, |
| 198 }, | 211 }, |
| 199 _specialSort: { | 212 _specialSort: { |
| 200 type: Object, | 213 type: Object, |
| 201 value: specialSort, | 214 value: specialSort, |
| 202 }, | 215 }, |
| 203 }, | 216 }, |
| 204 | 217 |
| 205 _attribute: function(task, col, def) { | 218 _attribute: function(task, col, def) { |
| 206 var retVal = task[col] || [def]; | 219 var retVal = this._tag(task, col) || task[col] || [def]; |
| 207 if (!Array.isArray(retVal)) { | 220 if (!Array.isArray(retVal)) { |
| 208 return [retVal]; | 221 return [retVal]; |
| 209 } | 222 } |
| 210 return retVal; | 223 return retVal; |
| 211 }, | 224 }, |
| 212 | 225 |
| 226 _tag: function(task, col) { |
| 227 if (!task || !task.tagMap) { |
| 228 return undefined; |
| 229 } |
| 230 return task.tagMap[col]; |
| 231 }, |
| 232 |
| 213 _taskLink: function(task) { | 233 _taskLink: function(task) { |
| 214 // TODO(kjlubick) Make this point to /newui/ when appropriate. | 234 // TODO(kjlubick) Make this point to /newui/ when appropriate. |
| 215 return "/restricted/task/"+task.task_id; | 235 return "/restricted/task/"+task.task_id; |
| 216 }, | 236 }, |
| 217 | 237 |
| 218 _taskClass: function(task) { | 238 _taskClass: function(task) { |
| 219 // TODO(kjlubick): Color tasks? | 239 // TODO(kjlubick): Color tasks? |
| 220 return ""; | 240 return ""; |
| 221 } | 241 } |
| 222 | 242 |
| 223 }); | 243 }); |
| 224 })(); | 244 })(); |
| 225 </script> | 245 </script> |
| 226 </dom-module> | 246 </dom-module> |
| OLD | NEW |