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

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: 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 side-by-side diff with in-line comments
Download patch
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..43b82bb7aa665d31b5395f05ca869b49a5a3f690
--- /dev/null
+++ b/appengine/cmd/milo/console/html.go
@@ -0,0 +1,83 @@
+// 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/resp"
+ "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 {
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
+ return "console.html"
+}
+
+type ConsoleDef struct {
+ Name string
+ Repository string
+ Branch string
+ Builders []resp.BuilderRef
+}
+
+// TODO(hinoka): Move all this into some sorta luci-config thing
+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.
+ Name: "Chromium Main Waterfall",
+ Repository: "https://chromium.googlesource.com/chromium/src",
+ Branch: "master",
+ Builders: []resp.BuilderRef{
+ {"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, &def)
+ if err != nil {
+ return nil, err
+ }
+
+ // Render into the template
+ args := &templates.Args{
+ "Console": result,
+ }
+ return args, nil
+}

Powered by Google App Engine
This is Rietveld 408576698