| 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"> |
| 11 <link rel="import" href="../../bower_components/paper-spinner/paper-spinner.html
"> |
| 11 <link rel="import" href="../../bower_components/polymer/polymer.html"> | 12 <link rel="import" href="../../bower_components/polymer/polymer.html"> |
| 12 <link rel="import" href="../../bower_components/iron-icons/maps-icons.html"> | 13 <link rel="import" href="../../bower_components/iron-icons/maps-icons.html"> |
| 13 | 14 |
| 14 <dom-module id="config-set"> | 15 <dom-module id="config-set"> |
| 15 <template> | 16 <template> |
| 16 <style> | 17 <style> |
| 17 .category { | 18 .category { |
| 18 font-size: 100%; | 19 font-size: 100%; |
| 19 font-family: sans-serif; | 20 font-family: sans-serif; |
| 20 } | 21 } |
| 21 | 22 |
| 22 .center { | 23 .center { |
| 23 width: 27%; | 24 width: 27%; |
| 24 margin: auto; | 25 margin: auto; |
| 25 text-align: left; | 26 text-align: left; |
| 26 } | 27 } |
| 27 | 28 |
| 29 .config-card { |
| 30 padding-bottom: 1%; |
| 31 animation: fadein 1.5s; |
| 32 } |
| 33 |
| 34 @keyframes fadein { |
| 35 from {opacity: 0} |
| 36 to {opacity: 1} |
| 37 } |
| 38 |
| 28 .name { | 39 .name { |
| 29 font-size: 200%; | 40 font-size: 200%; |
| 30 font-family: sans-serif; | 41 font-family: sans-serif; |
| 31 } | 42 } |
| 32 | 43 |
| 33 #refreshStatus { | 44 #refreshStatus { font-size: 35%; } |
| 34 font-size: 35%; | |
| 35 } | |
| 36 | 45 |
| 37 .title { | 46 .title { |
| 38 padding-bottom: 1%; | 47 padding-bottom: 1%; |
| 39 padding-top: 5%; | 48 padding-top: 5%; |
| 40 } | 49 } |
| 41 </style> | 50 </style> |
| 42 | 51 |
| 43 <iron-ajax | 52 <iron-ajax |
| 44 auto | 53 auto |
| 45 id="requestConfigs" | 54 id="requestConfigs" |
| 46 url="/_ah/api/config/v1/config-sets?config_set=[[category]]%2F[[name]][[
route.path]]&include_files=true&include_last_import_attempt=true" | 55 url="/_ah/api/config/v1/config-sets?config_set=[[category]]/[[name]][[ro
ute.path]]&include_files=true&include_last_import_attempt=true" |
| 47 handle-as="json" | 56 handle-as="json" |
| 48 on-response="_onGotConfigFiles" | 57 on-response="_onGotConfigFiles" |
| 49 headers="[[auth_headers]]"> | 58 headers="[[auth_headers]]"> |
| 50 </iron-ajax> | 59 </iron-ajax> |
| 51 | 60 |
| 52 <iron-ajax | 61 <iron-ajax |
| 53 id="refreshConfigs" | 62 id="refreshConfigs" |
| 54 url="/_ah/api/config/v1/reimport?config_set=[[category]]/[[name]][[route
.path]]" | 63 url="/_ah/api/config/v1/reimport?config_set=[[category]]/[[name]][[route
.path]]" |
| 55 method="POST" | 64 method="POST" |
| 56 handle-as="json" | 65 handle-as="json" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 Last import attempt failed: [[lastImportAttempt.message]] | 97 Last import attempt failed: [[lastImportAttempt.message]] |
| 89 </template> | 98 </template> |
| 90 </template> | 99 </template> |
| 91 <template is="dom-if" if="[[_not(lastImportAttempt)]]"> | 100 <template is="dom-if" if="[[_not(lastImportAttempt)]]"> |
| 92 Last import attempt info not available. | 101 Last import attempt info not available. |
| 93 </template> | 102 </template> |
| 94 </template> | 103 </template> |
| 95 </div> | 104 </div> |
| 96 </div> | 105 </div> |
| 97 <template is="dom-if" if="[[isRefreshing]]"> | 106 <template is="dom-if" if="[[isRefreshing]]"> |
| 98 <div class="center">Refreshing config files...</div> | 107 <div class="center"> |
| 108 <paper-spinner active></paper-spinner> |
| 109 </div> |
| 99 </template> | 110 </template> |
| 100 <template is="dom-if" if="[[_not(isRefreshing)]]"> | 111 <template is="dom-if" if="[[_not(isRefreshing)]]"> |
| 101 <template is="dom-if" if="[[isLoading]]"> | 112 <template is="dom-if" if="[[isLoading]]"> |
| 102 <div class="center">Fetching config files...</div> | 113 <div class="center"> |
| 114 <paper-spinner active></paper-spinner> |
| 115 </div> |
| 103 </template> | 116 </template> |
| 104 <template is="dom-if" if="[[_not(isLoading)]]"> | 117 <template is="dom-if" if="[[_not(isLoading)]]"> |
| 105 <template is="dom-if" if="[[_isEmpty(files)]]"> | 118 <template is="dom-if" if="[[_isEmpty(files)]]"> |
| 106 <div class="center" style="font-family: sans-serif;"> | 119 <div class="center" style="font-family: sans-serif;"> |
| 107 No config files found. | 120 No config files found. |
| 108 </div> | 121 </div> |
| 109 </template> | 122 </template> |
| 110 <template is="dom-if" if="[[_not(_isEmpty(files))]]"> | 123 <template is="dom-if" if="[[_not(_isEmpty(files))]]"> |
| 111 <template is="dom-repeat" items="[[files]]" as="file"> | 124 <template is="dom-repeat" items="[[files]]" as="file"> |
| 112 <config-file-card | 125 <div class="center config-card"> |
| 113 name="[[file.path]]" link="[[location]]/[[file.path]]"> | 126 <config-file-card |
| 114 </config-file-card> | 127 name="[[file.path]]" link="[[location]]/[[file.path]]"> |
| 128 </config-file-card> |
| 129 </div> |
| 115 </template> | 130 </template> |
| 116 </template> | 131 </template> |
| 117 </template> | 132 </template> |
| 118 </template> | 133 </template> |
| 119 </template> | 134 </template> |
| 120 <script> | 135 <script> |
| 121 Polymer({ | 136 Polymer({ |
| 122 is: "config-set", | 137 is: "config-set", |
| 123 | 138 |
| 124 properties: { | 139 properties: { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 event.detail.response.config_sets[0].last_import_attempt || null; | 221 event.detail.response.config_sets[0].last_import_attempt || null; |
| 207 this.isLoading = false; | 222 this.isLoading = false; |
| 208 }, | 223 }, |
| 209 | 224 |
| 210 _onRefreshError: function() { | 225 _onRefreshError: function() { |
| 211 this.isRefreshing = false; | 226 this.isRefreshing = false; |
| 212 this.refreshMessage = "Error: Files could not be refreshed."; | 227 this.refreshMessage = "Error: Files could not be refreshed."; |
| 213 } | 228 } |
| 214 }); | 229 }); |
| 215 </script> | 230 </script> |
| 216 </dom-module> | 231 </dom-module> |
| OLD | NEW |