Chromium Code Reviews| Index: appengine/config_service/ui/src/config-ui/config-set.html |
| diff --git a/appengine/config_service/ui/src/config-ui/config-set.html b/appengine/config_service/ui/src/config-ui/config-set.html |
| index 917048e5d7a0380b0111429f48ca844349123f06..eaaf1b667df8c91162f1f0c6015ab1a0923a6d9a 100644 |
| --- a/appengine/config_service/ui/src/config-ui/config-set.html |
| +++ b/appengine/config_service/ui/src/config-ui/config-set.html |
| @@ -6,6 +6,7 @@ |
| <link rel="import" href="config-file-card.html"> |
| <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> |
| +<link rel="import" href="../../bower_components/iron-icons/iron-icons.html"> |
| <link rel="import" href="../../bower_components/paper-item/paper-item.html"> |
| <link rel="import" href="../../bower_components/polymer/polymer.html"> |
| @@ -28,6 +29,10 @@ |
| font-family: sans-serif; |
| } |
| + #refreshStatus { |
| + font-size: 35%; |
| + } |
| + |
| .title { |
| padding-bottom: 1%; |
| padding-top: 5%; |
| @@ -43,19 +48,37 @@ |
| headers="[[auth_headers]]"> |
| </iron-ajax> |
| + <iron-ajax |
| + id="refreshConfigs" |
| + url="/_ah/api/config/v1/reimport?config_set=[[category]]/[[name]][[route.path]]" |
| + method="POST" |
| + handle-as="json" |
| + on-error="_onRefreshError" |
| + on-response="_onCompleteRefresh" |
| + headers="[[auth_headers]]"> |
| + </iron-ajax> |
| + |
| <div class="center title"> |
| - <div class="name">[[name]][[route.path]]</div> |
| + <div class="name"> |
| + [[name]][[route.path]] |
| + <iron-icon icon="icons:refresh" on-tap="_forceRefresh"></iron-icon> |
|
Ryan Tseng
2017/07/06 18:27:11
Show this only if the user is logged in
|
| + <span id="refreshStatus">[[refreshMessage]]</span> |
| + </div> |
| <div class="category">[[_formatCategory(category)]]</div> |
| </div> |
| - |
| - <template is="dom-if" if="[[isLoading]]"> |
| - <div class="center">Fetching config files...</div> |
| + <template is="dom-if" if="[[isRefreshing]]"> |
| + <div class="center">Refreshing config files...</div> |
| </template> |
| - <template is="dom-if" if="[[!isLoading]]"> |
| - <template is="dom-repeat" items="[[files]]" as="file"> |
| - <config-file-card |
| - name="[[file.path]]" link="[[location]]/[[file.path]]"> |
| - </config-file-card> |
| + <template is="dom-if" if="[[!isRefreshing]]"> |
| + <template is="dom-if" if="[[isLoading]]"> |
| + <div class="center">Fetching config files...</div> |
| + </template> |
| + <template is="dom-if" if="[[!isLoading]]"> |
| + <template is="dom-repeat" items="[[files]]" as="file"> |
| + <config-file-card |
| + name="[[file.path]]" link="[[location]]/[[file.path]]"> |
| + </config-file-card> |
| + </template> |
| </template> |
| </template> |
| </template> |
| @@ -77,24 +100,50 @@ |
| value: true |
| }, |
| + isRefreshing: { |
| + type: Boolean, |
| + value: false |
| + }, |
| + |
| location: { |
| type: String |
| }, |
| name: { |
| type: String |
| + }, |
| + |
| + refreshMessage: { |
| + type: String, |
| + value: null |
| } |
| }, |
| + _forceRefresh: function() { |
| + this.refreshMessage = null; |
| + this.$.refreshConfigs.generateRequest(); |
| + this.isRefreshing = true; |
| + }, |
| + |
| _formatCategory: function(category) { |
| if (category === "projects") return "Project"; |
| if (category === "services") return "Service"; |
| }, |
| + _onCompleteRefresh: function() { |
| + this.isRefreshing = false; |
| + this.refreshMessage = "Refresh successful."; |
| + }, |
| + |
| _onGotConfigFiles: function(event) { |
| this.files = event.detail.response.config_sets[0].files; |
| this.location = event.detail.response.config_sets[0].location; |
| this.isLoading = false; |
| + }, |
| + |
| + _onRefreshError: function() { |
| + this.isRefreshing = false; |
| + this.refreshMessage = "Error: Files could not be refreshed."; |
| } |
| }); |
| </script> |