| 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 file contains most of the logic needed to create a dynamic table. It is b
roken up into two | 6 This file contains most of the logic needed to create a dynamic table. It is b
roken up into two |
| 7 parts, a style dom-module called "dynamic-table-style" and a behavior called | 7 parts, a style dom-module called "dynamic-table-style" and a behavior called |
| 8 SwarmingBehaviors.DynamicTableBehavior. This behavior ties together filtering,
sorting and column | 8 SwarmingBehaviors.DynamicTableBehavior. This behavior ties together filtering,
sorting and column |
| 9 content. It also offers a few utilities to make creating the table easier. A c
lient of these two | 9 content. It also offers a few utilities to make creating the table easier. A c
lient of these two |
| 10 parts needs to create the templates to actually draw the <table>,<tr> and so o
n. See | 10 parts needs to create the templates to actually draw the <table>,<tr> and so o
n. See |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 if (aCol === "none"){ | 157 if (aCol === "none"){ |
| 158 // put "none" at the bottom of the sort order | 158 // put "none" at the bottom of the sort order |
| 159 aCol = "ZZZ"; | 159 aCol = "ZZZ"; |
| 160 } | 160 } |
| 161 var bCol = this._column(this._sort.name, b); | 161 var bCol = this._column(this._sort.name, b); |
| 162 if (bCol === "none"){ | 162 if (bCol === "none"){ |
| 163 // put "none" at the bottom of the sort order | 163 // put "none" at the bottom of the sort order |
| 164 bCol = "ZZZ"; | 164 bCol = "ZZZ"; |
| 165 } | 165 } |
| 166 | 166 |
| 167 return dir * swarming.naturalCompare(aCol, bCol); | 167 return dir * naturalSort(aCol, bCol); |
| 168 }, | 168 }, |
| 169 | 169 |
| 170 _filterAndSort: function() { | 170 _filterAndSort: function() { |
| 171 // We intentionally sort this._items (and not a copy) to allow users to | 171 // We intentionally sort this._items (and not a copy) to allow users to |
| 172 // "chain" sorts, that is, sort by one thing and then another, and | 172 // "chain" sorts, that is, sort by one thing and then another, and |
| 173 // have both orderings properly impact the list. | 173 // have both orderings properly impact the list. |
| 174 swarming.stableSort(this._items, this._compare.bind(this)); | 174 swarming.stableSort(this._items, this._compare.bind(this)); |
| 175 var items = this._items; | 175 var items = this._items; |
| 176 if (this._filter) { | 176 if (this._filter) { |
| 177 items = items.filter(this._filter.bind(this)); | 177 items = items.filter(this._filter.bind(this)); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 return pool.join(" | "); | 270 return pool.join(" | "); |
| 271 }, | 271 }, |
| 272 | 272 |
| 273 }; | 273 }; |
| 274 }, | 274 }, |
| 275 | 275 |
| 276 | 276 |
| 277 }]; | 277 }]; |
| 278 })(); | 278 })(); |
| 279 </script> | 279 </script> |
| OLD | NEW |