| 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 » t, err := auth.GetRPCTransport(c, auth.AsUser) |
| 44 » t, err := auth.GetRPCTransport(c, auth.AsSelf) | |
| 45 if err != nil { | 44 if err != nil { |
| 46 log.WithError(err).Errorf(c, "Failed to get transport for LogDog
server.") | 45 log.WithError(err).Errorf(c, "Failed to get transport for LogDog
server.") |
| 47 return nil, &miloerror.Error{ | 46 return nil, &miloerror.Error{ |
| 48 Code: http.StatusInternalServerError, | 47 Code: http.StatusInternalServerError, |
| 49 } | 48 } |
| 50 } | 49 } |
| 51 | 50 |
| 52 as := annotationStreamRequest{ | 51 as := annotationStreamRequest{ |
| 53 AnnotationStream: s, | 52 AnnotationStream: s, |
| 54 | 53 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 // Load the Milo annotation protobuf from the annotation stream. | 70 // Load the Milo annotation protobuf from the annotation stream. |
| 72 if err := as.load(c); err != nil { | 71 if err := as.load(c); err != nil { |
| 73 return nil, err | 72 return nil, err |
| 74 } | 73 } |
| 75 | 74 |
| 76 // Convert the Milo Annotation protobuf to Milo objects. | 75 // Convert the Milo Annotation protobuf to Milo objects. |
| 77 return &templates.Args{ | 76 return &templates.Args{ |
| 78 "Build": as.toMiloBuild(c), | 77 "Build": as.toMiloBuild(c), |
| 79 }, nil | 78 }, nil |
| 80 } | 79 } |
| OLD | NEW |