| OLD | NEW |
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 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 import httplib | 5 import httplib |
| 6 | 6 |
| 7 import webapp2 | 7 import webapp2 |
| 8 | 8 |
| 9 from components import decorators | 9 from components import decorators |
| 10 from components.config.proto import service_config_pb2 | 10 from components.config.proto import service_config_pb2 |
| 11 from google.appengine.ext.webapp import template | 11 from google.appengine.ext.webapp import template |
| 12 | 12 |
| 13 import common | 13 import common |
| 14 import gitiles_import | 14 import gitiles_import |
| 15 import notifications | 15 import notifications |
| 16 import os | 16 import os |
| 17 import storage | 17 import storage |
| 18 | 18 |
| 19 | 19 |
| 20 class CronGitilesImport(webapp2.RequestHandler): | 20 class CronGitilesImport(webapp2.RequestHandler): |
| 21 """Imports configs from Gitiles.""" | 21 """Imports configs from Gitiles.""" |
| 22 @decorators.require_cronjob | 22 @decorators.require_cronjob |
| 23 def get(self): | 23 def get(self): |
| 24 gitiles_import.cron_run_import() | 24 gitiles_import.cron_run_import() |
| 25 | 25 |
| 26 | 26 |
| 27 class MainPageHandler(webapp2.RequestHandler): | 27 class MainPageHandler(webapp2.RequestHandler): |
| 28 """Redirects to API Explorer.""" | |
| 29 | |
| 30 def get(self): | |
| 31 self.redirect('_ah/api/explorer') | |
| 32 | |
| 33 class UIHandler(webapp2.RequestHandler): | |
| 34 """ Serves the UI with the proper client ID. """ | 28 """ Serves the UI with the proper client ID. """ |
| 35 | 29 |
| 36 def get(self): | 30 def get(self): |
| 37 # TODO(cwpayton): put the client_id in a proto file so that it is | 31 # TODO(cwpayton): put the client_id in a proto file so that it is |
| 38 # configurable and can be read dynamically by this file. | 32 # configurable and can be read dynamically by this file. |
| 39 template_values = { | 33 template_values = { |
| 40 'client_id': | 34 'client_id': |
| 41 '247108661754-svmo17vmk1j5hlt388gb45qblgvg2h98.apps.googleusercontent.
com' | 35 '247108661754-svmo17vmk1j5hlt388gb45qblgvg2h98.apps.googleusercontent.
com' |
| 42 } | 36 } |
| 43 path = os.path.join(os.path.dirname(__file__), 'ui/static/index.html') | 37 path = os.path.join(os.path.dirname(__file__), 'ui/static/index.html') |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 self.redirect(str(schema.url)) | 53 self.redirect(str(schema.url)) |
| 60 return | 54 return |
| 61 | 55 |
| 62 self.response.write('Schema %s not found\n' % name) | 56 self.response.write('Schema %s not found\n' % name) |
| 63 self.response.set_status(httplib.NOT_FOUND) | 57 self.response.set_status(httplib.NOT_FOUND) |
| 64 | 58 |
| 65 | 59 |
| 66 def get_frontend_routes(): # pragma: no cover | 60 def get_frontend_routes(): # pragma: no cover |
| 67 return [ | 61 return [ |
| 68 webapp2.Route(r'/', MainPageHandler), | 62 webapp2.Route(r'/', MainPageHandler), |
| 69 webapp2.Route(r'/newui', UIHandler), | |
| 70 webapp2.Route(r'/schemas/<name:.+>', SchemasHandler), | 63 webapp2.Route(r'/schemas/<name:.+>', SchemasHandler), |
| 71 webapp2.Route(r'/_ah/bounce', notifications.BounceHandler), | 64 webapp2.Route(r'/_ah/bounce', notifications.BounceHandler), |
| 72 ] | 65 ] |
| 73 | 66 |
| 74 | 67 |
| 75 def get_backend_routes(): # pragma: no cover | 68 def get_backend_routes(): # pragma: no cover |
| 76 return [ | 69 return [ |
| 77 webapp2.Route( | 70 webapp2.Route( |
| 78 r'/internal/cron/luci-config/gitiles_import', | 71 r'/internal/cron/luci-config/gitiles_import', |
| 79 CronGitilesImport), | 72 CronGitilesImport), |
| 80 ] | 73 ] |
| OLD | NEW |