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

Side by Side Diff: appengine/config_service/ui/src/config-ui/front-page.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="../../bower_components/app-layout/app-layout.html"> 7 <link rel="import" href="../../bower_components/app-layout/app-layout.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/paper-button/paper-button.html"> 9 <link rel="import" href="../../bower_components/paper-button/paper-button.html">
10 <link rel="import" href="../../bower_components/paper-search/paper-search-bar.ht ml"> 10 <link rel="import" href="../../bower_components/paper-search/paper-search-bar.ht ml">
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/paper-styles/shadow.html"> 12 <link rel="import" href="../../bower_components/paper-styles/shadow.html">
13 <link rel="import" href="../../bower_components/polymer/polymer.html"> 13 <link rel="import" href="../../bower_components/polymer/polymer.html">
14 <link rel="import" href="../../common/common-behaviors.html">
14 15
15 <link rel="import" href="config-set-card.html"> 16 <link rel="import" href="config-set-card.html">
16 17
17 <dom-module id="front-page"> 18 <dom-module id="front-page">
18 <template> 19 <template>
19 <style> 20 <style>
20 @media only screen and (min-width: 768px) { 21 @media only screen and (min-width: 768px) {
21 .center { 22 .center {
22 width: 550px; 23 width: 550px;
23 } 24 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 <template is="dom-if" if="[[_not(isLoading)]]"> 87 <template is="dom-if" if="[[_not(isLoading)]]">
87 <template is="dom-if" if="[[_not(errorMessage)]]"> 88 <template is="dom-if" if="[[_not(errorMessage)]]">
88 <template is="dom-if" if="[[_isEmpty(searchResults)]]"> 89 <template is="dom-if" if="[[_isEmpty(searchResults)]]">
89 <div class="center name">No config sets found.</div> 90 <div class="center name">No config sets found.</div>
90 </template> 91 </template>
91 <template is="dom-if" if="[[_not(_isEmpty(searchResults))]]"> 92 <template is="dom-if" if="[[_not(_isEmpty(searchResults))]]">
92 <template is="dom-repeat" items="[[searchResults]]" as="config"> 93 <template is="dom-repeat" items="[[searchResults]]" as="config">
93 <div class="center config-card"> 94 <div class="center config-card">
94 <config-set-card 95 <config-set-card
95 name="[[config.config_set]]" 96 name="[[config.config_set]]"
96 last-import-attempt="[[_getLastImportAttempt(config.last_impor t_attempt)]]"> 97 last-import-attempt="[[_getLastImportAttempt(config.last_impor t_attempt)]]"
98 revision="[[_getRevision(config.revision)]]"
99 link="[[_getURL(config)]]"
100 timestamp="[[_getTimestamp(config.last_import_attempt, config. revision)]]">
97 </config-set-card> 101 </config-set-card>
98 </div> 102 </div>
99 </template> 103 </template>
100 </template> 104 </template>
101 </template> 105 </template>
102 <template is="dom-if" if="[[errorMessage]]"> 106 <template is="dom-if" if="[[errorMessage]]">
103 <div class="center name">[[errorMessage]]</div> 107 <div class="center name">[[errorMessage]]</div>
104 </template> 108 </template>
105 </template> 109 </template>
106 </div> 110 </div>
107 </template> 111 </template>
108 <script> 112 <script>
109 Polymer({ 113 Polymer({
110 is: 'front-page', 114 is: 'front-page',
111 115
116 behaviors: [ConfigUIBehaviors.CommonBehavior],
117
112 properties: { 118 properties: {
113 configSetList: { 119 configSetList: {
114 type: Array, 120 type: Array,
115 value: () => [] 121 value: () => []
116 }, 122 },
117 123
118 errorMessage: { 124 errorMessage: {
119 type: String, 125 type: String,
120 value: null 126 value: null
121 }, 127 },
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 164 }
159 }, 165 },
160 166
161 _formatName: function(name) { 167 _formatName: function(name) {
162 var tempName = name.substring(name.indexOf("/") + 1); 168 var tempName = name.substring(name.indexOf("/") + 1);
163 return tempName.includes("/") ? 169 return tempName.includes("/") ?
164 tempName.substring(0, tempName.indexOf("/")) : tempName; 170 tempName.substring(0, tempName.indexOf("/")) : tempName;
165 }, 171 },
166 172
167 _getLastImportAttempt: function(lastImportAttempt) { 173 _getLastImportAttempt: function(lastImportAttempt) {
168 if (lastImportAttempt) { 174 return lastImportAttempt || null;
169 return lastImportAttempt; 175 },
176
177 _getURL: function(config) {
178 if (config.last_import_attempt && config.last_import_attempt.success) {
179 return config.last_import_attempt.revision.url;
180 } else if (config.revision && config.revision.url) {
181 return config.revision.url;
170 } else { 182 } else {
171 return null; 183 return config.location;
172 } 184 }
173 }, 185 },
174 186
175 _isEmpty: function(array) {
176 return array.length === 0;
177 },
178
179 _not: function(b) {
180 return !b;
181 },
182
183 _onGotConfigSets: function(event) { 187 _onGotConfigSets: function(event) {
184 this.configSetList = event.detail.response.config_sets; 188 this.configSetList = event.detail.response.config_sets;
185 this._updateSearchResults(); 189 this._updateSearchResults();
186 this.isLoading = false; 190 this.isLoading = false;
187 this.fire('processedConfigSets'); 191 this.fire('processedConfigSets');
188 }, 192 },
189 193
190 _onRequestError: function(event) { 194 _onRequestError: function(event) {
191 var error = parseInt(event.detail.error.message.match(/\d+/g)); 195 var error = parseInt(event.detail.error.message.match(/\d+/g));
192 if (error === 403) { 196 if (error === 403) {
(...skipping 14 matching lines...) Expand all
207 var tempResults = this.configSetList.filter(e => e.config_set.includes(t his.query)); 211 var tempResults = this.configSetList.filter(e => e.config_set.includes(t his.query));
208 tempResults.sort(function(a, b) { 212 tempResults.sort(function(a, b) {
209 return this._formatName(a.config_set).localeCompare(this._formatName(b .config_set)); 213 return this._formatName(a.config_set).localeCompare(this._formatName(b .config_set));
210 }.bind(this)); 214 }.bind(this));
211 this.searchResults = tempResults; 215 this.searchResults = tempResults;
212 }, 216 },
213 217
214 }); 218 });
215 </script> 219 </script>
216 </dom-module> 220 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698