Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1632)

Side by Side Diff: appengine/config_service/ui/src/config-ui/config-set.html

Issue 2991013002: config_service: Added revision and timestamp to config-set-cards and config-set pages (Closed)
Patch Set: Nit: forgot to add launch icon to config set page Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/paper-spinner/paper-spinner.html ">
12 <link rel="import" href="../../bower_components/polymer/polymer.html"> 12 <link rel="import" href="../../bower_components/polymer/polymer.html">
13 <link rel="import" href="../../bower_components/iron-icons/maps-icons.html"> 13 <link rel="import" href="../../bower_components/iron-icons/maps-icons.html">
14 <link rel="import" href="../../bower_components/paper-tooltip/paper-tooltip.html "> 14 <link rel="import" href="../../bower_components/paper-tooltip/paper-tooltip.html ">
15 <link rel="import" href="../../common/common-behaviors.html">
15 16
16 <dom-module id="config-set"> 17 <dom-module id="config-set">
17 <template> 18 <template>
18 <style> 19 <style>
19 @media only screen and (min-width: 768px) { 20 @media only screen and (min-width: 768px) {
20 .center { 21 .center {
21 width: 550px; 22 width: 550px;
22 } 23 }
23 } 24 }
24 25
26 a {
27 text-decoration: none;
28 color: inherit;
29 }
30
25 .category { 31 .category {
26 font-size: 100%; 32 font-size: 100%;
27 font-family: sans-serif; 33 font-family: sans-serif;
28 } 34 }
29 35
30 .name { 36 .name {
31 font-size: 200%; 37 font-size: 200%;
32 font-family: sans-serif; 38 font-family: sans-serif;
33 word-wrap: break-word; 39 word-wrap: break-word;
34 } 40 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 handle-as="json" 89 handle-as="json"
84 on-error="_onRefreshError" 90 on-error="_onRefreshError"
85 on-response="_onCompleteRefresh" 91 on-response="_onCompleteRefresh"
86 headers="[[auth_headers]]"> 92 headers="[[auth_headers]]">
87 </iron-ajax> 93 </iron-ajax>
88 94
89 <div class="center title"> 95 <div class="center title">
90 <div class="name"> 96 <div class="name">
91 [[name]][[route.path]] 97 [[name]][[route.path]]
92 <template is="dom-if" if="[[_not(isLoading)]]"> 98 <template is="dom-if" if="[[_not(isLoading)]]">
99 <a href="[[url]]">
100 <iron-icon id="launch"
101 icon="icons:launch"
102 class="paper-grey">
103 </iron-icon>
104 <paper-tooltip for="launch" offset="0">
105 [[url]]
106 </paper-tooltip>
107 </a>
93 <template is="dom-if" if="[[lastImportAttempt]]"> 108 <template is="dom-if" if="[[lastImportAttempt]]">
94 <template is="dom-if" if="[[lastImportAttempt.success]]"> 109 <template is="dom-if" if="[[lastImportAttempt.success]]">
95 <iron-icon id="valid" icon="icons:check-circle" class="paper-green "></iron-icon> 110 <iron-icon id="valid" icon="icons:check-circle" class="paper-green "></iron-icon>
96 </template> 111 </template>
97 <template is="dom-if" if="[[_not(lastImportAttempt.success)]]"> 112 <template is="dom-if" if="[[_not(lastImportAttempt.success)]]">
98 <iron-icon id="invalid" icon="icons:warning" class="paper-red"></i ron-icon> 113 <iron-icon id="invalid" icon="icons:warning" class="paper-red"></i ron-icon>
99 </template> 114 </template>
100 </template> 115 </template>
101 <template is="dom-if" if="[[_not(lastImportAttempt)]]"> 116 <template is="dom-if" if="[[_not(lastImportAttempt)]]">
102 <iron-icon icon="icons:help" class="paper-grey"></iron-icon> 117 <iron-icon icon="icons:help" class="paper-grey"></iron-icon>
(...skipping 16 matching lines...) Expand all
119 <template is="dom-if" if="[[_not(lastImportAttempt.success)]]"> 134 <template is="dom-if" if="[[_not(lastImportAttempt.success)]]">
120 Last import attempt failed: [[lastImportAttempt.message]] 135 Last import attempt failed: [[lastImportAttempt.message]]
121 </template> 136 </template>
122 <template is="dom-if" if="[[lastImportAttempt.success]]"> 137 <template is="dom-if" if="[[lastImportAttempt.success]]">
123 Last import succeeded. 138 Last import succeeded.
124 </template> 139 </template>
125 </template> 140 </template>
126 <template is="dom-if" if="[[_not(lastImportAttempt)]]"> 141 <template is="dom-if" if="[[_not(lastImportAttempt)]]">
127 Last import attempt info not available. 142 Last import attempt info not available.
128 </template> 143 </template>
144 <p>Revision: [[_getRevision(revision)]]</p>
Sergey Berezin 2017/07/31 20:21:18 I'd try to fit it all in one line, see comment in
cwpayton 2017/07/31 23:40:53 Done.
145 <p>Timestamp: [[_getTimestamp(lastImportAttempt, revision)]]</p>
129 </template> 146 </template>
130 <p id="refreshStatus">[[refreshMessage]]</p> 147 <p id="refreshStatus">[[refreshMessage]]</p>
131 </div> 148 </div>
132 </div> 149 </div>
133 <template is="dom-if" if="[[_not(errorMessage)]]"> 150 <template is="dom-if" if="[[_not(errorMessage)]]">
134 <template is="dom-if" if="[[isRefreshing]]"> 151 <template is="dom-if" if="[[isRefreshing]]">
135 <div class="spinner"> 152 <div class="spinner">
136 <paper-spinner active></paper-spinner> 153 <paper-spinner active></paper-spinner>
137 </div> 154 </div>
138 </template> 155 </template>
(...skipping 24 matching lines...) Expand all
163 <template is="dom-if" if="[[errorMessage]]"> 180 <template is="dom-if" if="[[errorMessage]]">
164 <div class="center"> 181 <div class="center">
165 <p>[[errorMessage]]</p> 182 <p>[[errorMessage]]</p>
166 </div> 183 </div>
167 </template> 184 </template>
168 </template> 185 </template>
169 <script> 186 <script>
170 Polymer({ 187 Polymer({
171 is: "config-set", 188 is: "config-set",
172 189
190 behaviors: [ConfigUIBehaviors.CommonBehavior],
191
173 properties: { 192 properties: {
174 frontPageIsActive: { 193 frontPageIsActive: {
175 type: Boolean, 194 type: Boolean,
176 observer: '_frontPageIsActive' 195 observer: '_frontPageIsActive'
177 }, 196 },
178 197
179 category: { 198 category: {
180 type: String 199 type: String
181 }, 200 },
182 201
(...skipping 21 matching lines...) Expand all
204 223
205 name: { 224 name: {
206 type: String 225 type: String
207 }, 226 },
208 227
209 refreshMessage: { 228 refreshMessage: {
210 type: String, 229 type: String,
211 value: null 230 value: null
212 }, 231 },
213 232
233 revision: {
234 type: String,
235 value: null
236 },
237
214 errorMessage: { 238 errorMessage: {
215 type: String, 239 type: String,
216 value: null 240 value: null
217 } 241 }
218 }, 242 },
219 243
220 _forceRefresh: function() { 244 _forceRefresh: function() {
221 this.refreshMessage = null; 245 this.refreshMessage = null;
222 this.$.refreshConfigs.generateRequest(); 246 this.$.refreshConfigs.generateRequest();
223 this.isRefreshing = true; 247 this.isRefreshing = true;
224 }, 248 },
225 249
226 _frontPageIsActive: function() {
227 if (this.frontPageIsActive === false) {
228 this.isLoading = true;
229 if (!this.initialized) {
230 document.addEventListener('fetch-configs', function() {
231 this.$.requestConfigs.generateRequest();
232 }.bind(this));
233 } else {
234 this.$.requestConfigs.generateRequest();
235 }
236 }
237 },
238
239 _isEmpty: function(list) {
240 return list.length === 0;
241 },
242
243 _formatCategory: function(category) { 250 _formatCategory: function(category) {
244 if (category === "projects") return "Project"; 251 if (category === "projects") return "Project";
245 if (category === "services") return "Service"; 252 if (category === "services") return "Service";
246 }, 253 },
247 254
248 _onCompleteRefresh: function() { 255 _onCompleteRefresh: function() {
249 this.isRefreshing = false; 256 this.isRefreshing = false;
250 this.refreshMessage = "Refresh successful."; 257 this.refreshMessage = "Refresh successful.";
251 this.fire('refreshComplete'); 258 this.fire('refreshComplete');
252 }, 259 },
253 260
254 _not: function(b) {
255 return !b;
256 },
257
258 _onGotConfigFiles: function(event) { 261 _onGotConfigFiles: function(event) {
259 var config_set = event.detail.response.config_sets[0]; 262 var config_set = event.detail.response.config_sets[0];
260 this.files = config_set.files || []; 263 this.files = config_set.files || [];
261 this.lastImportAttempt = config_set.last_import_attempt || null; 264 this.lastImportAttempt = config_set.last_import_attempt || null;
262 if (config_set.revision && config_set.revision.url) { 265 if (this.lastImportAttempt && this.lastImportAttempt.success) {
263 this.url = config_set.revision.url; 266 this.url = config_set.last_import_attempt.revision.url;
267 this.revision = config_set.last_import_attempt.revision;
268 } else if (config_set.revision) {
269 this.url = config_set.revision.url || config_set.location;
270 this.revision = config_set.revision;
264 } else { 271 } else {
265 this.url = config_set.location; 272 this.url = config_set.location;
266 } 273 }
267 this.isLoading = false; 274 this.isLoading = false;
268 this.errorMessage = null; 275 this.errorMessage = null;
269 this.fire('processedConfigFiles'); 276 this.fire('processedConfigFiles');
270 }, 277 },
271 278
272 _onRefreshError: function() { 279 _onRefreshError: function() {
273 this.isRefreshing = false; 280 this.isRefreshing = false;
(...skipping 16 matching lines...) Expand all
290 this.errorMessage = "Internal server error."; 297 this.errorMessage = "Internal server error.";
291 } else { 298 } else {
292 this.errorMessage = "Error occured. Try again later."; 299 this.errorMessage = "Error occured. Try again later.";
293 } 300 }
294 this.fire('fetchError'); 301 this.fire('fetchError');
295 } 302 }
296 303
297 }); 304 });
298 </script> 305 </script>
299 </dom-module> 306 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698