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

Side by Side Diff: milo/appengine/frontend/frontpage.go

Issue 2949783002: [milo] appengine/* -> * (Closed)
Patch Set: rebase Created 3 years, 6 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 frontend
6
7 import (
8 "github.com/luci/luci-go/server/router"
9 "github.com/luci/luci-go/server/templates"
10
11 "github.com/luci/luci-go/common/sync/parallel"
12 "github.com/luci/luci-go/milo/api/resp"
13 "github.com/luci/luci-go/milo/appengine/common"
14 "github.com/luci/luci-go/milo/appengine/job_source/buildbot"
15 "github.com/luci/luci-go/milo/appengine/job_source/buildbucket"
16 )
17
18 func frontpageHandler(c *router.Context) {
19 fp := resp.FrontPage{}
20 var mBuildbot, mBuildbucket *resp.CIService
21
22 err := parallel.FanOutIn(func(ch chan<- func() error) {
23 ch <- func() (err error) {
24 mBuildbot, err = buildbot.GetAllBuilders(c.Context)
25 return err
26 }
27 ch <- func() (err error) {
28 mBuildbucket, err = buildbucket.GetAllBuilders(c.Context )
29 return err
30 }
31 })
32
33 fp.CIServices = append(fp.CIServices, *mBuildbucket)
34 fp.CIServices = append(fp.CIServices, *mBuildbot)
35 errMsg := ""
36 if err != nil {
37 errMsg = err.Error()
38 }
39 templates.MustRender(c.Context, c.Writer, "pages/frontpage.html", templa tes.Args{
40 "frontpage": fp,
41 "error": errMsg,
42 })
43 }
44
45 func frontpageTestData() []common.TestBundle {
46 data := &templates.Args{
47 "frontpage": resp.FrontPage{
48 CIServices: []resp.CIService{
49 {
50 Name: "Module 1",
51 BuilderGroups: []resp.BuilderGroup{
52 {
53 Name: "Example master A" ,
54 Builders: []resp.Link{
55 *resp.NewLink("E xample builder", "/master1/buildera"),
56 *resp.NewLink("E xample builder 2", "/master1/builderb"),
57 },
58 },
59 },
60 },
61 },
62 },
63 "error": "couldn't find ice cream",
64 }
65 return []common.TestBundle{
66 {
67 Description: "Basic frontpage",
68 Data: *data,
69 },
70 }
71 }
OLDNEW
« no previous file with comments | « milo/appengine/frontend/expectations/swarming.log-Basic_log.html ('k') | milo/appengine/frontend/index.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698