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

Side by Side Diff: milo/appengine/logdog/http.go

Issue 2748073006: Milo Refactor: Remove theme support (Closed)
Patch Set: Fix tests Created 3 years, 9 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 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 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 logdog 5 package logdog
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 "strings" 9 "strings"
10 10
11 "github.com/luci/luci-go/common/errors" 11 "github.com/luci/luci-go/common/errors"
12 log "github.com/luci/luci-go/common/logging" 12 log "github.com/luci/luci-go/common/logging"
13 "github.com/luci/luci-go/grpc/prpc" 13 "github.com/luci/luci-go/grpc/prpc"
14 "github.com/luci/luci-go/logdog/client/coordinator" 14 "github.com/luci/luci-go/logdog/client/coordinator"
15 "github.com/luci/luci-go/logdog/common/types" 15 "github.com/luci/luci-go/logdog/common/types"
16 "github.com/luci/luci-go/luci_config/common/cfgtypes" 16 "github.com/luci/luci-go/luci_config/common/cfgtypes"
17 "github.com/luci/luci-go/milo/appengine/settings"
18 "github.com/luci/luci-go/milo/common/miloerror" 17 "github.com/luci/luci-go/milo/common/miloerror"
19 "github.com/luci/luci-go/server/auth" 18 "github.com/luci/luci-go/server/auth"
20 "github.com/luci/luci-go/server/templates" 19 "github.com/luci/luci-go/server/templates"
21 20
22 "github.com/julienschmidt/httprouter" 21 "github.com/julienschmidt/httprouter"
23 "golang.org/x/net/context" 22 "golang.org/x/net/context"
24 ) 23 )
25 24
26 // AnnotationStreamHandler is a ThemedHandler that renders a LogDog Milo 25 // AnnotationStreamHandler is a ThemedHandler that renders a LogDog Milo
27 // annotation protobuf stream. 26 // annotation protobuf stream.
28 // 27 //
29 // The protobuf stream is fetched live from LogDog and cached locally, either 28 // The protobuf stream is fetched live from LogDog and cached locally, either
30 // temporarily (if incomplete) or indefinitely (if complete). 29 // temporarily (if incomplete) or indefinitely (if complete).
31 type AnnotationStreamHandler struct{} 30 type AnnotationStreamHandler struct{}
32 31
33 // GetTemplateName implements settings.ThemedHandler. 32 func BuildHandler(c context.Context, req *http.Request, p httprouter.Params) (*t emplates.Args, error) {
34 func (s *AnnotationStreamHandler) GetTemplateName(t settings.Theme) string { 33 » return (&AnnotationStreamHandler{}).Render(c, req, p)
35 » return "build.html"
36 } 34 }
37 35
38 // Render implements settings.ThemedHandler. 36 // Render implements settings.ThemedHandler.
39 func (s *AnnotationStreamHandler) Render(c context.Context, req *http.Request, p httprouter.Params) ( 37 func (s *AnnotationStreamHandler) Render(c context.Context, req *http.Request, p httprouter.Params) (
40 *templates.Args, error) { 38 *templates.Args, error) {
41 39
42 as := AnnotationStream{ 40 as := AnnotationStream{
43 Project: cfgtypes.ProjectName(p.ByName("project")), 41 Project: cfgtypes.ProjectName(p.ByName("project")),
44 Path: types.StreamPath(strings.Trim(p.ByName("path"), "/")), 42 Path: types.StreamPath(strings.Trim(p.ByName("path"), "/")),
45 } 43 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 115 }
118 116
119 // Setup our LogDog client. 117 // Setup our LogDog client.
120 return coordinator.NewClient(&prpc.Client{ 118 return coordinator.NewClient(&prpc.Client{
121 C: &http.Client{ 119 C: &http.Client{
122 Transport: t, 120 Transport: t,
123 }, 121 },
124 Host: host, 122 Host: host,
125 }), nil 123 }), nil
126 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698