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

Side by Side Diff: appengine/cmd/milo/console/html.go

Issue 2196453002: Milo: Console view prototype (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: fixes Created 4 years, 4 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
(Empty)
1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package console
6
7 import (
8 "net/http"
9
10 "github.com/julienschmidt/httprouter"
11 "golang.org/x/net/context"
12
13 "github.com/luci/luci-go/appengine/cmd/milo/miloerror"
14 "github.com/luci/luci-go/appengine/cmd/milo/resp"
15 "github.com/luci/luci-go/appengine/cmd/milo/settings"
16 "github.com/luci/luci-go/server/templates"
17 )
18
19 type Console struct{}
20
21 // GetTemplateName returns the template name for console pages.
22 func (x Console) GetTemplateName(t settings.Theme) string {
estaab 2016/08/04 23:21:25 Why is this a method and not just a function?
hinoka 2016/08/05 00:10:42 Milo design: A themedHandler is a "class" that imp
23 return "console.html"
24 }
25
26 type ConsoleDef struct {
27 Name string
28 Repository string
29 Branch string
30 Builders []resp.BuilderRef
31 }
32
33 // TODO(hinoka): Move all this into some sorta luci-config thing
34 var def = ConsoleDef{
estaab 2016/08/04 23:21:24 s/def/chromiumConsoleDef/ so it's clear and so it'
hinoka 2016/08/05 00:10:42 Done.
35 Name: "Chromium Main Waterfall",
36 Repository: "https://chromium.googlesource.com/chromium/src",
37 Branch: "master",
38 Builders: []resp.BuilderRef{
39 {"buildbot", "chromium/Android", "clobber", "an"},
40 {"buildbot", "chromium/Linux x64", "clobber", "lx"},
41 {"buildbot", "chromium/Mac", "clobber", "mc"},
42 {"buildbot", "chromium/Win", "clobber|win", "32"},
43 {"buildbot", "chromium/Win x64", "clobber|win", "64"},
44 {"buildbot", "chromium.linux/Android Arm64 Builder (dbg)", "linu x|android|arm", "db"},
45 {"buildbot", "chromium.linux/Android Builder", "linux|android|x8 6", "rl"},
46 {"buildbot", "chromium.linux/Android Builder (dbg)", "linux|andr oid|x86", "db"},
47 {"buildbot", "chromium.linux/Android Clang Builder (dbg)", "linu x|android|clang", "db"},
48 {"buildbot", "chromium.linux/Android Tests", "linux|android|test s", "db"},
49 {"buildbot", "chromium.linux/Android Tests (dbg)", "linux|androi d|tests", "db"},
50 {"buildbot", "chromium.linux/Blimp Linux (dbg)", "linux", "bl"},
51 {"buildbot", "chromium.linux/Cast Android (dbg)", "linux|cast", "an"},
52 {"buildbot", "chromium.linux/Cast Linux", "linux|cast", "lx"},
53 {"buildbot", "chromium.linux/Linux Builder", "linux|build", "rl" },
54 {"buildbot", "chromium.linux/Linux Builder (dbg)", "linux|build" , "d6"},
55 {"buildbot", "chromium.linux/Linux Builder (dbg)(32)", "linux|bu ild", "d3"},
56 {"buildbot", "chromium.linux/Linux Tests", "linux|test", "rl"},
57 {"buildbot", "chromium.linux/Linux Tests (dbg)(1)", "linux|test" , "d1"},
58 {"buildbot", "chromium.linux/Linux Tests (dbg)(1)(32)", "linux|t est", "d2"},
59 },
60 }
61
62 // Render renders the console page.
63 func (x Console) Render(c context.Context, r *http.Request, p httprouter.Params) (*templates.Args, error) {
64 // Ignore, hardcoded for demo
65 name := p.ByName("name")
66 if name == "" {
67 return nil, &miloerror.Error{
68 Message: "No name",
69 Code: http.StatusBadRequest,
70 }
71 }
72
73 result, err := console(c, &def)
74 if err != nil {
75 return nil, err
76 }
77
78 // Render into the template
79 args := &templates.Args{
80 "Console": result,
81 }
82 return args, nil
83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698