| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 This in an HTML Import-able file that contains the definition | 2 This in an HTML Import-able file that contains the definition |
| 3 of the following elements: | 3 of the following elements: |
| 4 | 4 |
| 5 <pageable-data> | 5 <pageable-data> |
| 6 | 6 |
| 7 The pageable-data element allows for easy paging of data from the swarming | 7 The pageable-data element allows for easy paging of data from the swarming |
| 8 server. It displays a button to the user to go fetch more data, which will | 8 server. It displays a button to the user to go fetch more data, which will |
| 9 be appended to the output, rather than replaced, which is typical in | 9 be appended to the output, rather than replaced, which is typical in |
| 10 elements like iron-ajax. | 10 elements like iron-ajax. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 var vals = this.parse(json); | 148 var vals = this.parse(json); |
| 149 // !this._cursor means this is our first load and we should empty the | 149 // !this._cursor means this is our first load and we should empty the |
| 150 // array | 150 // array |
| 151 if (!this._cursor || !this.output) { | 151 if (!this._cursor || !this.output) { |
| 152 this.set("output", vals); | 152 this.set("output", vals); |
| 153 } else { | 153 } else { |
| 154 this.push("output", ...vals); | 154 this.push("output", ...vals); |
| 155 } | 155 } |
| 156 this.set("_cursor", json.cursor || END); | 156 this.set("_cursor", json.cursor || END); |
| 157 this.set("busy", false); | 157 this.set("busy", false); |
| 158 // for unit testing |
| 159 this.fire("_finishedLoading", {success:true}); |
| 158 }.bind(this)).catch(function(reason){ | 160 }.bind(this)).catch(function(reason){ |
| 159 console.log("Reason for failure of request to " + this._url, reason); | 161 console.log("Reason for failure of request to " + this._url, reason); |
| 160 sk.errorMessage("Could not get next set of results. Try reloading the
page?", 0); | 162 sk.errorMessage("Could not get next set of results. Try reloading the
page?", 0); |
| 161 this.set("busy", false); | 163 this.set("busy", false); |
| 164 // for unit testing |
| 165 this.fire("_finishedLoading", {success:false}); |
| 162 }.bind(this)); | 166 }.bind(this)); |
| 163 }, | 167 }, |
| 164 | 168 |
| 165 _noMore: function(cursor) { | 169 _noMore: function(cursor) { |
| 166 return cursor === END; | 170 return cursor === END; |
| 167 } | 171 } |
| 168 }); | 172 }); |
| 169 })(); | 173 })(); |
| 170 </script> | 174 </script> |
| 171 </dom-module> | 175 </dom-module> |
| OLD | NEW |