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

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

Issue 2991153002: Add stub for new polymer-based Isolate UI (Closed)
Patch Set: fix common.js 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
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."""
M-A Ruel 2017/08/01 19:13:13 """ on its own line
kjlubick 2017/08/02 12:51:22 Done.
394 @auth.public
395 def get(self):
396 params = {}
397 # Can cache for 1 week, because the only thing that would change in this
398 # template is the oauth client id, which changes very infrequently.
399 self.response.cache_control.no_cache = None
400 self.response.cache_control.public = True
401 self.response.cache_control.max_age = 604800
402 try:
403 self.response.write(template.render(
404 'isolate/public_isolate_index.html', params))
405 except template.TemplateNotFound:
406 self.abort(404, 'Page not found.')
407
408
389 class WarmupHandler(webapp2.RequestHandler): 409 class WarmupHandler(webapp2.RequestHandler):
390 def get(self): 410 def get(self):
391 config.warmup() 411 config.warmup()
392 auth.warmup() 412 auth.warmup()
393 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' 413 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
394 self.response.write('ok') 414 self.response.write('ok')
395 415
396 416
397 class EmailHandler(webapp2.RequestHandler): 417 class EmailHandler(webapp2.RequestHandler):
398 """Blackhole any email sent.""" 418 """Blackhole any email sent."""
(...skipping 15 matching lines...) Expand all
414 # User web pages. 434 # User web pages.
415 webapp2.Route(r'/browse', BrowseHandler), 435 webapp2.Route(r'/browse', BrowseHandler),
416 webapp2.Route(r'/content', ContentHandler), 436 webapp2.Route(r'/content', ContentHandler),
417 # TODO(maruel): These really need to be migrated to Cloud Endpoints, gviz 437 # TODO(maruel): These really need to be migrated to Cloud Endpoints, gviz
418 # is just too sorry. 438 # is just too sorry.
419 #webapp2.Route(r'/stats', StatsHandler), 439 #webapp2.Route(r'/stats', StatsHandler),
420 #webapp2.Route(r'/isolate/api/v1/stats/days', StatsGvizDaysHandler), 440 #webapp2.Route(r'/isolate/api/v1/stats/days', StatsGvizDaysHandler),
421 #webapp2.Route(r'/isolate/api/v1/stats/hours', StatsGvizHoursHandler), 441 #webapp2.Route(r'/isolate/api/v1/stats/hours', StatsGvizHoursHandler),
422 #webapp2.Route(r'/isolate/api/v1/stats/minutes', StatsGvizMinutesHandler), 442 #webapp2.Route(r'/isolate/api/v1/stats/minutes', StatsGvizMinutesHandler),
423 webapp2.Route(r'/', RootHandler), 443 webapp2.Route(r'/', RootHandler),
444 webapp2.Route(r'/newui', UIHandler),
424 445
425 # AppEngine-specific urls: 446 # AppEngine-specific urls:
426 webapp2.Route(r'/_ah/mail/<to:.+>', EmailHandler), 447 webapp2.Route(r'/_ah/mail/<to:.+>', EmailHandler),
427 webapp2.Route(r'/_ah/warmup', WarmupHandler), 448 webapp2.Route(r'/_ah/warmup', WarmupHandler),
428 ] 449 ]
429 routes.extend(handlers_endpoints_v1.get_routes()) 450 routes.extend(handlers_endpoints_v1.get_routes())
430 return routes 451 return routes
431 452
432 453
433 def create_application(debug): 454 def create_application(debug):
434 """Creates the url router. 455 """Creates the url router.
435 456
436 The basic layouts is as follow: 457 The basic layouts is as follow:
437 - /restricted/.* requires being an instance administrator. 458 - /restricted/.* requires being an instance administrator.
438 - /stats/.* has statistics. 459 - /stats/.* has statistics.
439 """ 460 """
440 acl.bootstrap() 461 acl.bootstrap()
441 template.bootstrap() 462 template.bootstrap()
442 return webapp2.WSGIApplication(get_routes(), debug=debug) 463 return webapp2.WSGIApplication(get_routes(), debug=debug)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698