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

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

Issue 2990963002: config_service: focus search bar on page load (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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">
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 <iron-ajax 65 <iron-ajax
66 id="requestConfigs" 66 id="requestConfigs"
67 url="/_ah/api/config/v1/config-sets?include_last_import_attempt=true" 67 url="/_ah/api/config/v1/config-sets?include_last_import_attempt=true"
68 handle-as="json" 68 handle-as="json"
69 on-error="_onRequestError" 69 on-error="_onRequestError"
70 on-response="_onGotConfigSets" 70 on-response="_onGotConfigSets"
71 headers="[[auth_headers]]"> 71 headers="[[auth_headers]]">
72 </iron-ajax> 72 </iron-ajax>
73 73
74 <div class="search-bar"> 74 <div class="search-bar">
75 <paper-search-bar 75 <paper-search-bar
76 id = "searchBar"
76 query="{{query}}" 77 query="{{query}}"
77 hide-filter-button="true"></paper-search-bar> 78 hide-filter-button="true"></paper-search-bar>
78 </div> 79 </div>
79 80
80 <div class="config-list"> 81 <div class="config-list">
81 <template is="dom-if" if="[[isLoading]]"> 82 <template is="dom-if" if="[[isLoading]]">
82 <div class="center loading"> 83 <div class="center loading">
83 <paper-spinner active></paper-spinner> 84 <paper-spinner active></paper-spinner>
84 </div> 85 </div>
85 </template> 86 </template>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 }, 143 },
143 144
144 ready: function() { 145 ready: function() {
145 if (!this.initialized) { 146 if (!this.initialized) {
146 document.addEventListener('fetch-configs', function() { 147 document.addEventListener('fetch-configs', function() {
147 this.$.requestConfigs.generateRequest(); 148 this.$.requestConfigs.generateRequest();
148 }.bind(this)); 149 }.bind(this));
149 } else { 150 } else {
150 this.$.requestConfigs.generateRequest(); 151 this.$.requestConfigs.generateRequest();
151 } 152 }
153 setTimeout(function() {
154 this.$['searchBar'].focus();
Sergey Berezin 2017/07/31 18:37:15 Any reason why focus is inside a timeout rather th
ayanaadylova 2017/07/31 18:51:52 Calling focus directly does not actually focus on
Sergey Berezin 2017/07/31 20:31:45 Indeed, I'd prefer an event trigger rather than a
155 }.bind(this), 0);
152 }, 156 },
153 157
154 _onSignIn: function() { 158 _onSignIn: function() {
155 if (this.signed_in) { 159 if (this.signed_in) {
156 this.isLoading = true; 160 this.isLoading = true;
157 this.$.requestConfigs.generateRequest(); 161 this.$.requestConfigs.generateRequest();
158 } 162 }
159 }, 163 },
160 164
161 _formatName: function(name) { 165 _formatName: function(name) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698