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

Side by Side Diff: appengine/isolate/handlers_frontend.py

Issue 2991153002: Add stub for new polymer-based Isolate UI (Closed)
Patch Set: Address feedback 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 | « appengine/isolate/app.yaml ('k') | appengine/isolate/templates/public_isolate_index.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 The LUCI Authors. All rights reserved. 1 # Copyright 2012 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """This module defines Isolate Server frontend url handlers.""" 5 """This module defines Isolate Server frontend url handlers."""
6 6
7 import collections 7 import collections
8 import datetime 8 import datetime
9 import json 9 import json
10 import logging 10 import logging
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 379 }
380 if auth.is_admin(): 380 if auth.is_admin():
381 params['mapreduce_jobs'] = [ 381 params['mapreduce_jobs'] = [
382 {'id': job_id, 'name': job_def['job_name']} 382 {'id': job_id, 'name': job_def['job_name']}
383 for job_id, job_def in mapreduce_jobs.MAPREDUCE_JOBS.iteritems() 383 for job_id, job_def in mapreduce_jobs.MAPREDUCE_JOBS.iteritems()
384 ] 384 ]
385 params['xsrf_token'] = self.generate_xsrf_token() 385 params['xsrf_token'] = self.generate_xsrf_token()
386 self.response.write(template.render('isolate/root.html', params)) 386 self.response.write(template.render('isolate/root.html', params))
387 387
388 388
389 class UIHandler(auth.AuthenticatingHandler):
390 """Serves the landing page for the new UI of the requested page.
391
392 This landing page is stamped with the OAuth 2.0 client id from the
393 configuration.
394 """
395 @auth.public
396 def get(self):
397 params = {}
398 # Can cache for 1 week, because the only thing that would change in this
399 # template is the oauth client id, which changes very infrequently.
400 self.response.cache_control.no_cache = None
401 self.response.cache_control.public = True
402 self.response.cache_control.max_age = 604800
403 try:
404 self.response.write(template.render(
405 'isolate/public_isolate_index.html', params))
406 except template.TemplateNotFound:
407 self.abort(404, 'Page not found.')
408
409
389 class WarmupHandler(webapp2.RequestHandler): 410 class WarmupHandler(webapp2.RequestHandler):
390 def get(self): 411 def get(self):
391 config.warmup() 412 config.warmup()
392 auth.warmup() 413 auth.warmup()
393 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' 414 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
394 self.response.write('ok') 415 self.response.write('ok')
395 416
396 417
397 class EmailHandler(webapp2.RequestHandler): 418 class EmailHandler(webapp2.RequestHandler):
398 """Blackhole any email sent.""" 419 """Blackhole any email sent."""
(...skipping 15 matching lines...) Expand all
414 # User web pages. 435 # User web pages.
415 webapp2.Route(r'/browse', BrowseHandler), 436 webapp2.Route(r'/browse', BrowseHandler),
416 webapp2.Route(r'/content', ContentHandler), 437 webapp2.Route(r'/content', ContentHandler),
417 # TODO(maruel): These really need to be migrated to Cloud Endpoints, gviz 438 # TODO(maruel): These really need to be migrated to Cloud Endpoints, gviz
418 # is just too sorry. 439 # is just too sorry.
419 #webapp2.Route(r'/stats', StatsHandler), 440 #webapp2.Route(r'/stats', StatsHandler),
420 #webapp2.Route(r'/isolate/api/v1/stats/days', StatsGvizDaysHandler), 441 #webapp2.Route(r'/isolate/api/v1/stats/days', StatsGvizDaysHandler),
421 #webapp2.Route(r'/isolate/api/v1/stats/hours', StatsGvizHoursHandler), 442 #webapp2.Route(r'/isolate/api/v1/stats/hours', StatsGvizHoursHandler),
422 #webapp2.Route(r'/isolate/api/v1/stats/minutes', StatsGvizMinutesHandler), 443 #webapp2.Route(r'/isolate/api/v1/stats/minutes', StatsGvizMinutesHandler),
423 webapp2.Route(r'/', RootHandler), 444 webapp2.Route(r'/', RootHandler),
445 webapp2.Route(r'/newui', UIHandler),
424 446
425 # AppEngine-specific urls: 447 # AppEngine-specific urls:
426 webapp2.Route(r'/_ah/mail/<to:.+>', EmailHandler), 448 webapp2.Route(r'/_ah/mail/<to:.+>', EmailHandler),
427 webapp2.Route(r'/_ah/warmup', WarmupHandler), 449 webapp2.Route(r'/_ah/warmup', WarmupHandler),
428 ] 450 ]
429 routes.extend(handlers_endpoints_v1.get_routes()) 451 routes.extend(handlers_endpoints_v1.get_routes())
430 return routes 452 return routes
431 453
432 454
433 def create_application(debug): 455 def create_application(debug):
434 """Creates the url router. 456 """Creates the url router.
435 457
436 The basic layouts is as follow: 458 The basic layouts is as follow:
437 - /restricted/.* requires being an instance administrator. 459 - /restricted/.* requires being an instance administrator.
438 - /stats/.* has statistics. 460 - /stats/.* has statistics.
439 """ 461 """
440 acl.bootstrap() 462 acl.bootstrap()
441 template.bootstrap() 463 template.bootstrap()
442 return webapp2.WSGIApplication(get_routes(), debug=debug) 464 return webapp2.WSGIApplication(get_routes(), debug=debug)
OLDNEW
« no previous file with comments | « appengine/isolate/app.yaml ('k') | appengine/isolate/templates/public_isolate_index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698