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

Side by Side Diff: milo/appengine/console/html.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 console 5 package console
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 9
10 "github.com/julienschmidt/httprouter" 10 "github.com/julienschmidt/httprouter"
11 "golang.org/x/net/context" 11 "golang.org/x/net/context"
12 12
13 "github.com/luci/luci-go/milo/appengine/settings"
14 "github.com/luci/luci-go/milo/common/miloerror" 13 "github.com/luci/luci-go/milo/common/miloerror"
15 "github.com/luci/luci-go/server/templates" 14 "github.com/luci/luci-go/server/templates"
16 ) 15 )
17 16
18 type Console struct{} 17 // ConsoleHandler renders the console page.
19 18 func ConsoleHandler(c context.Context, r *http.Request, p httprouter.Params) (*t emplates.Args, error) {
20 // GetTemplateName returns the template name for console pages.
21 func (x Console) GetTemplateName(t settings.Theme) string {
22 » return "console.html"
23 }
24
25 // Render renders the console page.
26 func (x Console) Render(c context.Context, r *http.Request, p httprouter.Params) (*templates.Args, error) {
27 project := p.ByName("project") 19 project := p.ByName("project")
28 if project == "" { 20 if project == "" {
29 return nil, &miloerror.Error{ 21 return nil, &miloerror.Error{
30 Message: "Missing project", 22 Message: "Missing project",
31 Code: http.StatusBadRequest, 23 Code: http.StatusBadRequest,
32 } 24 }
33 } 25 }
34 name := p.ByName("name") 26 name := p.ByName("name")
35 27
36 result, err := console(c, project, name) 28 result, err := console(c, project, name)
37 if err != nil { 29 if err != nil {
38 return nil, err 30 return nil, err
39 } 31 }
40 32
41 // Render into the template 33 // Render into the template
42 args := &templates.Args{ 34 args := &templates.Args{
43 "Console": result, 35 "Console": result,
44 } 36 }
45 return args, nil 37 return args, nil
46 } 38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698