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

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

Issue 2238883003: Milo: Use luci-cfg for defining projects and console view. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: review 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
« no previous file with comments | « milo/appengine/console/console.go ('k') | milo/appengine/frontend/app.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 13 "github.com/luci/luci-go/milo/appengine/settings"
14 "github.com/luci/luci-go/milo/common/miloerror" 14 "github.com/luci/luci-go/milo/common/miloerror"
15 "github.com/luci/luci-go/server/templates" 15 "github.com/luci/luci-go/server/templates"
16 ) 16 )
17 17
18 type Console struct{} 18 type Console struct{}
19 19
20 // GetTemplateName returns the template name for console pages. 20 // GetTemplateName returns the template name for console pages.
21 func (x Console) GetTemplateName(t settings.Theme) string { 21 func (x Console) GetTemplateName(t settings.Theme) string {
22 return "console.html" 22 return "console.html"
23 } 23 }
24 24
25 type ConsoleDef struct {
26 Name string
27 Repository string
28 Branch string
29 // TODO(hinoka): Replace this with resp.BuilderRef when tmpBuilderRef is removed.
30 Builders []tmpBuilderRef
31 }
32
33 // This is like a resp.BuilderRef, but the Categories are pipe deliminated strin gs.
34 // This is so that it's easier to define inline here, and this will be deleted o nce
35 // console definitions are moved to luci-cfg.
36 type tmpBuilderRef struct {
37 Module string
38 Name string
39 Category string
40 ShortName string
41 }
42
43 // TODO(hinoka): Move all this into some sorta luci-config thing
44 var chromiumConsoleDef = ConsoleDef{
45 Name: "Chromium Main Waterfall",
46 Repository: "https://chromium.googlesource.com/chromium/src",
47 Branch: "master",
48 Builders: []tmpBuilderRef{
49 {"buildbot", "chromium/Android", "clobber", "an"},
50 {"buildbot", "chromium/Linux x64", "clobber", "lx"},
51 {"buildbot", "chromium/Mac", "clobber", "mc"},
52 {"buildbot", "chromium/Win", "clobber|win", "32"},
53 {"buildbot", "chromium/Win x64", "clobber|win", "64"},
54 {"buildbot", "chromium.linux/Android Arm64 Builder (dbg)", "linu x|android|arm", "db"},
55 {"buildbot", "chromium.linux/Android Builder", "linux|android|x8 6", "rl"},
56 {"buildbot", "chromium.linux/Android Builder (dbg)", "linux|andr oid|x86", "db"},
57 {"buildbot", "chromium.linux/Android Clang Builder (dbg)", "linu x|android|clang", "db"},
58 {"buildbot", "chromium.linux/Android Tests", "linux|android|test s", "db"},
59 {"buildbot", "chromium.linux/Android Tests (dbg)", "linux|androi d|tests", "db"},
60 {"buildbot", "chromium.linux/Blimp Linux (dbg)", "linux", "bl"},
61 {"buildbot", "chromium.linux/Cast Android (dbg)", "linux|cast", "an"},
62 {"buildbot", "chromium.linux/Cast Linux", "linux|cast", "lx"},
63 {"buildbot", "chromium.linux/Linux Builder", "linux|build", "rl" },
64 {"buildbot", "chromium.linux/Linux Builder (dbg)", "linux|build" , "d6"},
65 {"buildbot", "chromium.linux/Linux Builder (dbg)(32)", "linux|bu ild", "d3"},
66 {"buildbot", "chromium.linux/Linux Tests", "linux|test", "rl"},
67 {"buildbot", "chromium.linux/Linux Tests (dbg)(1)", "linux|test" , "d1"},
68 {"buildbot", "chromium.linux/Linux Tests (dbg)(1)(32)", "linux|t est", "d2"},
69 },
70 }
71
72 // Render renders the console page. 25 // Render renders the console page.
73 func (x Console) Render(c context.Context, r *http.Request, p httprouter.Params) (*templates.Args, error) { 26 func (x Console) Render(c context.Context, r *http.Request, p httprouter.Params) (*templates.Args, error) {
74 » // Ignore, hardcoded for demo 27 » project := p.ByName("project")
75 » name := p.ByName("name") 28 » if project == "" {
76 » if name == "" {
77 return nil, &miloerror.Error{ 29 return nil, &miloerror.Error{
78 » » » Message: "No name", 30 » » » Message: "Missing project",
79 Code: http.StatusBadRequest, 31 Code: http.StatusBadRequest,
80 } 32 }
81 } 33 }
34 name := p.ByName("name")
82 35
83 » result, err := console(c, &chromiumConsoleDef) 36 » result, err := console(c, project, name)
84 if err != nil { 37 if err != nil {
85 return nil, err 38 return nil, err
86 } 39 }
87 40
88 // Render into the template 41 // Render into the template
89 args := &templates.Args{ 42 args := &templates.Args{
90 "Console": result, 43 "Console": result,
91 } 44 }
92 return args, nil 45 return args, nil
93 } 46 }
OLDNEW
« no previous file with comments | « milo/appengine/console/console.go ('k') | milo/appengine/frontend/app.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698