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

Unified Diff: milo/appengine/console/console.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: comments 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 | « no previous file | milo/appengine/console/html.go » ('j') | milo/appengine/frontend/milo.go » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/console/console.go
diff --git a/milo/appengine/console/console.go b/milo/appengine/console/console.go
index c5338e719a79426ed9436d217aea98ce679bc641..75e11e0f7b7cf80ead43d911264818c2a0a9d1d0 100644
--- a/milo/appengine/console/console.go
+++ b/milo/appengine/console/console.go
@@ -13,6 +13,8 @@ import (
"github.com/luci/luci-go/milo/api/resp"
"github.com/luci/luci-go/milo/appengine/backend/git"
"github.com/luci/luci-go/milo/appengine/buildbot"
+ "github.com/luci/luci-go/milo/appengine/settings"
+ "github.com/luci/luci-go/milo/common/config"
"golang.org/x/net/context"
)
@@ -31,10 +33,31 @@ func GetConsoleBuilds(
}
}
-func console(c context.Context, def *ConsoleDef) (*resp.Console, error) {
+// getConsoleDef finds the console definition as defined by any project.
+// If the user is not a reader of the project, this will return a 404.
+// TODO(hinoka): If the user is not a reader of any of of the builders returned,
+// that builder will be removed from list of results.
+// If no name is specified (ie the user hits a url /console/<project>), the
+// default console for that project (named "default") will be looked up.
estaab 2016/08/18 23:19:37 Should we 302 redirect to the actual console url s
Ryan Tseng 2016/08/18 23:55:30 Hm okay. In that case i'll name it something nice
+func getConsoleDef(c context.Context, project, name string) (*config.Console, error) {
+ if name == "" {
+ name = "default"
+ }
+ cs, err := settings.GetConsole(c, project, name)
+ if err != nil {
+ return nil, err
+ }
+ // TODO(hinoka): Remove builders that the user does not have access to.
+ return cs, nil
+}
+
+func console(c context.Context, project, name string) (*resp.Console, error) {
tStart := clock.Now(c)
- // Lookup Commits. For this hack, we're just gonna hardcode src.git
- commits, err := git.GetCommits(c, def.Repository, def.Branch, 25)
+ def, err := getConsoleDef(c, project, name)
+ if err != nil {
+ return nil, err
+ }
+ commits, err := git.GetCommits(c, def.RepoURL, def.Branch, 25)
if err != nil {
return nil, err
}
« no previous file with comments | « no previous file | milo/appengine/console/html.go » ('j') | milo/appengine/frontend/milo.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698