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

Unified Diff: appengine/auth_service/handlers_frontend.py

Issue 2840053003: auth_service: Fetch revisions of all configs (for UI) at once. (Closed)
Patch Set: comments Created 3 years, 8 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/auth_service/config_test.py ('k') | appengine/auth_service/templates/config.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/auth_service/handlers_frontend.py
diff --git a/appengine/auth_service/handlers_frontend.py b/appengine/auth_service/handlers_frontend.py
index ef87bca4982e6edd6266ff72168effdec903858f..f6f3fd147c6ad1f4d7ebb60a28ed8835a2be8185 100644
--- a/appengine/auth_service/handlers_frontend.py
+++ b/appengine/auth_service/handlers_frontend.py
@@ -70,23 +70,22 @@ class ServicesHandler(ui.UINavbarTabHandler):
template_file = 'auth_service/services.html'
-def get_additional_ui_environment(handler):
+def get_additional_ui_data():
"""Gets injected into Jinja and Javascript environment."""
- # See config._CONFIG_SCHEMAS for where these paths are defined.
- if isinstance(handler, ConfigHandler):
- path = 'imports.cfg'
- elif isinstance(handler, ui.IPWhitelistsHandler):
- path = 'ip_whitelist.cfg'
- elif isinstance(handler, ui.OAuthConfigHandler):
- path = 'oauth.cfg'
- else:
- return {'auth_service_config_locked': config.is_remote_configured()}
- rev = config.get_config_revision(path)
+ if not config.is_remote_configured():
+ return {'auth_service_config_locked': False}
+ config_revisions = {}
+ for path, rev in config.get_revisions().iteritems():
+ config_revisions[path] = {
+ 'rev': rev.revision if rev else 'none',
+ 'url': rev.url if rev else 'about:blank',
+ }
return {
- 'auth_service_config_locked': config.is_remote_configured(),
- 'auth_service_config_remote_url': config.get_remote_url(),
- 'auth_service_config_rev': rev.revision if rev else 'none',
- 'auth_service_config_url': rev.url if rev else 'about:blank',
+ 'auth_service_config_locked': True,
+ 'auth_service_configs': {
+ 'remote_url': config.get_remote_url(),
+ 'revisions': config_revisions,
+ },
}
@@ -440,7 +439,7 @@ def create_application(debug):
ConfigHandler,
ui.ApiDocHandler,
],
- env_callback=get_additional_ui_environment)
+ ui_data_callback=get_additional_ui_data)
template.bootstrap({'auth_service': TEMPLATES_DIR})
# Add a fake admin for local dev server.
« no previous file with comments | « appengine/auth_service/config_test.py ('k') | appengine/auth_service/templates/config.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698