| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2017 The LUCI Authors. All rights reserved. | 2 Copyright 2017 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 | 6 |
| 7 <link rel="import" href="config-file-card.html"> | 7 <link rel="import" href="config-file-card.html"> |
| 8 <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> | 8 <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> |
| 9 <link rel="import" href="../../bower_components/iron-icons/iron-icons.html"> | 9 <link rel="import" href="../../bower_components/iron-icons/iron-icons.html"> |
| 10 <link rel="import" href="../../bower_components/paper-item/paper-item.html"> | 10 <link rel="import" href="../../bower_components/paper-item/paper-item.html"> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 <template is="dom-if" if="[[_not(isLoading)]]"> | 145 <template is="dom-if" if="[[_not(isLoading)]]"> |
| 146 <template is="dom-if" if="[[_isEmpty(files)]]"> | 146 <template is="dom-if" if="[[_isEmpty(files)]]"> |
| 147 <div class="center" style="font-family: sans-serif;"> | 147 <div class="center" style="font-family: sans-serif;"> |
| 148 No config files found. | 148 No config files found. |
| 149 </div> | 149 </div> |
| 150 </template> | 150 </template> |
| 151 <template is="dom-if" if="[[_not(_isEmpty(files))]]"> | 151 <template is="dom-if" if="[[_not(_isEmpty(files))]]"> |
| 152 <template is="dom-repeat" items="[[files]]" as="file"> | 152 <template is="dom-repeat" items="[[files]]" as="file"> |
| 153 <div class="center config-card"> | 153 <div class="center config-card"> |
| 154 <config-file-card | 154 <config-file-card |
| 155 name="[[file.path]]" link="[[location]]/[[file.path]]"> | 155 name="[[file.path]]" link="[[url]]/[[file.path]]"> |
| 156 </config-file-card> | 156 </config-file-card> |
| 157 </div> | 157 </div> |
| 158 </template> | 158 </template> |
| 159 </template> | 159 </template> |
| 160 </template> | 160 </template> |
| 161 </template> | 161 </template> |
| 162 </template> | 162 </template> |
| 163 <template is="dom-if" if="[[errorMessage]]"> | 163 <template is="dom-if" if="[[errorMessage]]"> |
| 164 <div class="center"> | 164 <div class="center"> |
| 165 <p>[[errorMessage]]</p> | 165 <p>[[errorMessage]]</p> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 191 | 191 |
| 192 isRefreshing: { | 192 isRefreshing: { |
| 193 type: Boolean, | 193 type: Boolean, |
| 194 value: false | 194 value: false |
| 195 }, | 195 }, |
| 196 | 196 |
| 197 lastImportAttempt: { | 197 lastImportAttempt: { |
| 198 type: Object | 198 type: Object |
| 199 }, | 199 }, |
| 200 | 200 |
| 201 location: { | 201 url: { |
| 202 type: String | 202 type: String |
| 203 }, | 203 }, |
| 204 | 204 |
| 205 name: { | 205 name: { |
| 206 type: String | 206 type: String |
| 207 }, | 207 }, |
| 208 | 208 |
| 209 refreshMessage: { | 209 refreshMessage: { |
| 210 type: String, | 210 type: String, |
| 211 value: null | 211 value: null |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 this.isRefreshing = false; | 249 this.isRefreshing = false; |
| 250 this.refreshMessage = "Refresh successful."; | 250 this.refreshMessage = "Refresh successful."; |
| 251 this.fire('refreshComplete'); | 251 this.fire('refreshComplete'); |
| 252 }, | 252 }, |
| 253 | 253 |
| 254 _not: function(b) { | 254 _not: function(b) { |
| 255 return !b; | 255 return !b; |
| 256 }, | 256 }, |
| 257 | 257 |
| 258 _onGotConfigFiles: function(event) { | 258 _onGotConfigFiles: function(event) { |
| 259 this.files = event.detail.response.config_sets[0].files || []; | 259 var config_set = event.detail.response.config_sets[0]; |
| 260 this.location = event.detail.response.config_sets[0].location; | 260 this.files = config_set.files || []; |
| 261 this.lastImportAttempt = | 261 this.lastImportAttempt = config_set.last_import_attempt || null; |
| 262 event.detail.response.config_sets[0].last_import_attempt || null; | 262 if (config_set.revision && config_set.revision.url) { |
| 263 this.url = config_set.revision.url; |
| 264 } else { |
| 265 this.url = config_set.location; |
| 266 } |
| 263 this.isLoading = false; | 267 this.isLoading = false; |
| 264 this.errorMessage = null; | 268 this.errorMessage = null; |
| 265 this.fire('processedConfigFiles'); | 269 this.fire('processedConfigFiles'); |
| 266 }, | 270 }, |
| 267 | 271 |
| 268 _onRefreshError: function() { | 272 _onRefreshError: function() { |
| 269 this.isRefreshing = false; | 273 this.isRefreshing = false; |
| 270 this.refreshMessage = "Error: Files could not be refreshed."; | 274 this.refreshMessage = "Error: Files could not be refreshed."; |
| 271 this.fire('refreshError'); | 275 this.fire('refreshError'); |
| 272 }, | 276 }, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 286 this.errorMessage = "Internal server error."; | 290 this.errorMessage = "Internal server error."; |
| 287 } else { | 291 } else { |
| 288 this.errorMessage = "Error occured. Try again later."; | 292 this.errorMessage = "Error occured. Try again later."; |
| 289 } | 293 } |
| 290 this.fire('fetchError'); | 294 this.fire('fetchError'); |
| 291 } | 295 } |
| 292 | 296 |
| 293 }); | 297 }); |
| 294 </script> | 298 </script> |
| 295 </dom-module> | 299 </dom-module> |
| OLD | NEW |