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

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

Issue 2980973002: config_service: Fixed multiple ajax requests in the front page while the page determines whether a … (Closed)
Patch Set: Forgot to revert ajax links. Fixed in this commit. Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/config_service/ui/src/config-ui/config-ui.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/config_service/ui/src/config-ui/front-page.html
diff --git a/appengine/config_service/ui/src/config-ui/front-page.html b/appengine/config_service/ui/src/config-ui/front-page.html
index b7d31a9c9827edac319b2eb3557510df83087874..64ae2e82b4f85faaa93d8bfa58b51f697972ba90 100644
--- a/appengine/config_service/ui/src/config-ui/front-page.html
+++ b/appengine/config_service/ui/src/config-ui/front-page.html
@@ -48,7 +48,6 @@
</style>
<iron-ajax
- auto
id="requestConfigs"
url="/_ah/api/config/v1/config-sets?include_last_import_attempt=true"
handle-as="json"
@@ -108,6 +107,37 @@
searchResults: {
type: Array,
value: () => []
+ },
+
+ user: {
+ type: Object,
+ value: () => null,
+ notify: true,
+ observer: '_fetchConfigs'
+ }
+ },
+
+ _fetchConfigs: function() {
+ // If the google auth API has been initialized,
+ // and the user is not signed in, then generate the
+ // ajax request. If the google auth API has been
+ // initialized, and the user is signed in, we wait for
+ // the auth headers to be set, and then generate the
+ // ajax request to get the config sets.
+ if (this.initialized && this.user) {
+ if (this.user.getBasicProfile()){
+ window.setTimeout(function() {
Ryan Tseng 2017/07/14 18:52:30 Can we bind to and event where the auth_header bei
+ if (this.auth_headers) {
+ this.isLoading = true;
+ this.$.requestConfigs.generateRequest();
+ } else {
+ this._fetchConfigs.bind(this);
+ }
+ }.bind(this), 50);
+ } else {
+ this.isLoading = true;
+ this.$.requestConfigs.generateRequest();
+ }
}
},
« no previous file with comments | « appengine/config_service/ui/src/config-ui/config-ui.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698