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

Unified Diff: appengine/auth_service/handlers_frontend.py

Issue 2840053003: auth_service: Fetch revisions of all configs (for UI) at once. (Closed)
Patch Set: 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
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..7e3b9be0cc1208753d7ba34a0676bb6599d0bce1 100644
--- a/appengine/auth_service/handlers_frontend.py
+++ b/appengine/auth_service/handlers_frontend.py
@@ -70,23 +70,20 @@ 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_locked': True,
'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_revisions': config_revisions,
nodir 2017/04/28 17:49:24 `auth_service_configs`? because there is URL and y
Vadim Sh. 2017/04/29 01:59:10 Done.
}
@@ -440,7 +437,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.

Powered by Google App Engine
This is Rietveld 408576698