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

Side by Side Diff: milo/frontend/main.go

Issue 2975023002: [milo] remove linkBase and calculate links directly. (Closed)
Patch Set: common url base Created 3 years, 5 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 | « milo/frontend/expectations/swarming.build-build-unicode.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 package frontend 5 package frontend
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 9
10 "github.com/golang/protobuf/proto" 10 "github.com/golang/protobuf/proto"
(...skipping 11 matching lines...) Expand all
22 "github.com/luci/luci-go/milo/common" 22 "github.com/luci/luci-go/milo/common"
23 "github.com/luci/luci-go/milo/frontend/console" 23 "github.com/luci/luci-go/milo/frontend/console"
24 "github.com/luci/luci-go/milo/rpc" 24 "github.com/luci/luci-go/milo/rpc"
25 "github.com/luci/luci-go/server/router" 25 "github.com/luci/luci-go/server/router"
26 ) 26 )
27 27
28 func emptyPrelude(c context.Context, methodName string, req proto.Message) (cont ext.Context, error) { 28 func emptyPrelude(c context.Context, methodName string, req proto.Message) (cont ext.Context, error) {
29 return c, nil 29 return c, nil
30 } 30 }
31 31
32 // Where it all begins!!! 32 // Run sets up all the routes and runs the server.
33 func Run(templatePath string) { 33 func Run(templatePath string) {
34 // Register plain ol' http handlers. 34 // Register plain ol' http handlers.
35 r := router.New() 35 r := router.New()
36 gaemiddleware.InstallHandlers(r) 36 gaemiddleware.InstallHandlers(r)
37 37
38 basemw := common.Base(templatePath) 38 basemw := common.Base(templatePath)
39 r.GET("/", basemw, frontpageHandler) 39 r.GET("/", basemw, frontpageHandler)
40 40
41 // Admin and cron endpoints. 41 // Admin and cron endpoints.
42 r.GET("/admin/update", basemw.Extend(gaemiddleware.RequireCron), UpdateC onfigHandler) 42 r.GET("/admin/update", basemw.Extend(gaemiddleware.RequireCron), UpdateC onfigHandler)
43 r.GET("/admin/configs", basemw, ConfigsHandler) 43 r.GET("/admin/configs", basemw, ConfigsHandler)
44 44
45 // Console 45 // Console
46 r.GET("/console/:project/:name", basemw, console.ConsoleHandler) 46 r.GET("/console/:project/:name", basemw, console.ConsoleHandler)
47 r.GET("/console/:project", basemw, console.Main) 47 r.GET("/console/:project", basemw, console.Main)
48 48
49 // Swarming 49 // Swarming
50 » r.GET("/swarming/task/:id/steps/*logname", basemw, swarming.LogHandler) 50 » r.GET(swarming.URLBase+"/:id/steps/*logname", basemw, swarming.LogHandle r)
51 » r.GET("/swarming/task/:id", basemw, swarming.BuildHandler) 51 » r.GET(swarming.URLBase+"/:id", basemw, swarming.BuildHandler)
52 // Backward-compatible URLs for Swarming: 52 // Backward-compatible URLs for Swarming:
53 r.GET("/swarming/prod/:id/steps/*logname", basemw, swarming.LogHandler) 53 r.GET("/swarming/prod/:id/steps/*logname", basemw, swarming.LogHandler)
54 r.GET("/swarming/prod/:id", basemw, swarming.BuildHandler) 54 r.GET("/swarming/prod/:id", basemw, swarming.BuildHandler)
55 55
56 // Buildbucket 56 // Buildbucket
57 r.GET("/buildbucket/:bucket/:builder", basemw, buildbucket.BuilderHandle r) 57 r.GET("/buildbucket/:bucket/:builder", basemw, buildbucket.BuilderHandle r)
58 58
59 // Buildbot 59 // Buildbot
60 r.GET("/buildbot/:master/:builder/:build", basemw, buildbot.BuildHandler ) 60 r.GET("/buildbot/:master/:builder/:build", basemw, buildbot.BuildHandler )
61 r.GET("/buildbot/:master/:builder/", basemw, buildbot.BuilderHandler) 61 r.GET("/buildbot/:master/:builder/", basemw, buildbot.BuilderHandler)
(...skipping 17 matching lines...) Expand all
79 }) 79 })
80 milo.RegisterBuildInfoServer(&api, &milo.DecoratedBuildInfo{ 80 milo.RegisterBuildInfoServer(&api, &milo.DecoratedBuildInfo{
81 Service: &rpc.BuildInfoService{}, 81 Service: &rpc.BuildInfoService{},
82 Prelude: emptyPrelude, 82 Prelude: emptyPrelude,
83 }) 83 })
84 discovery.Enable(&api) 84 discovery.Enable(&api)
85 api.InstallHandlers(r, gaemiddleware.BaseProd()) 85 api.InstallHandlers(r, gaemiddleware.BaseProd())
86 86
87 http.DefaultServeMux.Handle("/", r) 87 http.DefaultServeMux.Handle("/", r)
88 } 88 }
OLDNEW
« no previous file with comments | « milo/frontend/expectations/swarming.build-build-unicode.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698