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

Unified 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: Reviews 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/cmd/milo/console/console.go ('k') | appengine/cmd/milo/console/html_data.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cmd/milo/console/html.go
diff --git a/appengine/cmd/milo/console/html.go b/appengine/cmd/milo/console/html.go
new file mode 100644
index 0000000000000000000000000000000000000000..017d1b7198cdbb45a80d71b713f6df3aac79405a
--- /dev/null
+++ b/appengine/cmd/milo/console/html.go
@@ -0,0 +1,93 @@
+// Copyright 2016 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+package console
+
+import (
+ "net/http"
+
+ "github.com/julienschmidt/httprouter"
+ "golang.org/x/net/context"
+
+ "github.com/luci/luci-go/appengine/cmd/milo/miloerror"
+ "github.com/luci/luci-go/appengine/cmd/milo/settings"
+ "github.com/luci/luci-go/server/templates"
+)
+
+type Console struct{}
+
+// GetTemplateName returns the template name for console pages.
+func (x Console) GetTemplateName(t settings.Theme) string {
+ return "console.html"
+}
+
+type ConsoleDef struct {
+ Name string
+ Repository string
+ Branch string
+ // TODO(hinoka): Replace this with resp.BuilderRef when tmpBuilderRef is removed.
+ Builders []tmpBuilderRef
+}
+
+// This is like a resp.BuilderRef, but the Categories are pipe deliminated strings.
+// This is so that it's easier to define inline here, and this will be deleted once
+// console definitions are moved to luci-cfg.
+type tmpBuilderRef struct {
+ Module string
+ Name string
+ Category string
+ ShortName string
+}
+
+// TODO(hinoka): Move all this into some sorta luci-config thing
+var chromiumConsoleDef = ConsoleDef{
+ Name: "Chromium Main Waterfall",
+ Repository: "https://chromium.googlesource.com/chromium/src",
+ Branch: "master",
+ Builders: []tmpBuilderRef{
+ {"buildbot", "chromium/Android", "clobber", "an"},
+ {"buildbot", "chromium/Linux x64", "clobber", "lx"},
+ {"buildbot", "chromium/Mac", "clobber", "mc"},
+ {"buildbot", "chromium/Win", "clobber|win", "32"},
+ {"buildbot", "chromium/Win x64", "clobber|win", "64"},
+ {"buildbot", "chromium.linux/Android Arm64 Builder (dbg)", "linux|android|arm", "db"},
+ {"buildbot", "chromium.linux/Android Builder", "linux|android|x86", "rl"},
+ {"buildbot", "chromium.linux/Android Builder (dbg)", "linux|android|x86", "db"},
+ {"buildbot", "chromium.linux/Android Clang Builder (dbg)", "linux|android|clang", "db"},
+ {"buildbot", "chromium.linux/Android Tests", "linux|android|tests", "db"},
+ {"buildbot", "chromium.linux/Android Tests (dbg)", "linux|android|tests", "db"},
+ {"buildbot", "chromium.linux/Blimp Linux (dbg)", "linux", "bl"},
+ {"buildbot", "chromium.linux/Cast Android (dbg)", "linux|cast", "an"},
+ {"buildbot", "chromium.linux/Cast Linux", "linux|cast", "lx"},
+ {"buildbot", "chromium.linux/Linux Builder", "linux|build", "rl"},
+ {"buildbot", "chromium.linux/Linux Builder (dbg)", "linux|build", "d6"},
+ {"buildbot", "chromium.linux/Linux Builder (dbg)(32)", "linux|build", "d3"},
+ {"buildbot", "chromium.linux/Linux Tests", "linux|test", "rl"},
+ {"buildbot", "chromium.linux/Linux Tests (dbg)(1)", "linux|test", "d1"},
+ {"buildbot", "chromium.linux/Linux Tests (dbg)(1)(32)", "linux|test", "d2"},
+ },
+}
+
+// Render renders the console page.
+func (x Console) Render(c context.Context, r *http.Request, p httprouter.Params) (*templates.Args, error) {
+ // Ignore, hardcoded for demo
+ name := p.ByName("name")
+ if name == "" {
+ return nil, &miloerror.Error{
+ Message: "No name",
+ Code: http.StatusBadRequest,
+ }
+ }
+
+ result, err := console(c, &chromiumConsoleDef)
+ if err != nil {
+ return nil, err
+ }
+
+ // Render into the template
+ args := &templates.Args{
+ "Console": result,
+ }
+ return args, nil
+}
« no previous file with comments | « appengine/cmd/milo/console/console.go ('k') | appengine/cmd/milo/console/html_data.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698