Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 } | 33 } |
| 34 | 34 |
| 35 // GetTemplateName implements settings.ThemedHandler. | 35 // GetTemplateName implements settings.ThemedHandler. |
| 36 func (s *AnnotationStream) GetTemplateName(t settings.Theme) string { | 36 func (s *AnnotationStream) GetTemplateName(t settings.Theme) string { |
| 37 return "build.html" | 37 return "build.html" |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Render implements settings.ThemedHandler. | 40 // Render implements settings.ThemedHandler. |
| 41 func (s *AnnotationStream) Render(c context.Context, req *http.Request, p httpro uter.Params) (*templates.Args, error) { | 41 func (s *AnnotationStream) Render(c context.Context, req *http.Request, p httpro uter.Params) (*templates.Args, error) { |
| 42 // Initialize the LogDog client authentication. | 42 // Initialize the LogDog client authentication. |
| 43 // TODO(vadimsh): Use auth.AsUser. | 43 // TODO(vadimsh): Use auth.AsUser. |
|
Vadim Sh.
2016/09/28 19:42:20
remove the TODO
dnj
2016/09/28 20:12:52
lol didn't even see that.
| |
| 44 » t, err := auth.GetRPCTransport(c, auth.AsSelf) | 44 » t, err := auth.GetRPCTransport(c, auth.AsUser) |
| 45 if err != nil { | 45 if err != nil { |
| 46 log.WithError(err).Errorf(c, "Failed to get transport for LogDog server.") | 46 log.WithError(err).Errorf(c, "Failed to get transport for LogDog server.") |
| 47 return nil, &miloerror.Error{ | 47 return nil, &miloerror.Error{ |
| 48 Code: http.StatusInternalServerError, | 48 Code: http.StatusInternalServerError, |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 as := annotationStreamRequest{ | 52 as := annotationStreamRequest{ |
| 53 AnnotationStream: s, | 53 AnnotationStream: s, |
| 54 | 54 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 71 // Load the Milo annotation protobuf from the annotation stream. | 71 // Load the Milo annotation protobuf from the annotation stream. |
| 72 if err := as.load(c); err != nil { | 72 if err := as.load(c); err != nil { |
| 73 return nil, err | 73 return nil, err |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Convert the Milo Annotation protobuf to Milo objects. | 76 // Convert the Milo Annotation protobuf to Milo objects. |
| 77 return &templates.Args{ | 77 return &templates.Args{ |
| 78 "Build": as.toMiloBuild(c), | 78 "Build": as.toMiloBuild(c), |
| 79 }, nil | 79 }, nil |
| 80 } | 80 } |
| OLD | NEW |