Chromium Code Reviews| Index: milo/appengine/frontend/config.go |
| diff --git a/milo/appengine/frontend/config.go b/milo/appengine/frontend/config.go |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2006a75081f4f0181b223854db590fc86f7e80f4 |
| --- /dev/null |
| +++ b/milo/appengine/frontend/config.go |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2015 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 frontend |
| + |
| +import ( |
| + "net/http" |
| + |
| + "github.com/luci/luci-go/common/logging" |
| + "github.com/luci/luci-go/milo/appengine/common" |
| + "github.com/luci/luci-go/server/router" |
| + "github.com/luci/luci-go/server/templates" |
| +) |
| + |
| +// ConfigsHandler renders the page showing the currently loaded set of luci-configs. |
| +func ConfigsHandler(c *router.Context) { |
| + projects, err := common.GetAllProjects(c.Context) |
| + if err != nil { |
| + common.ErrorPage( |
| + c, http.StatusInternalServerError, |
| + "Error while getting projects: "+err.Error()) |
| + return |
| + } |
| + |
| + templates.MustRender(c.Context, c.Writer, "pages/config.html", templates.Args{ |
| + "Projects": projects, |
| + }) |
| +} |
| + |
| +// UpdateHandler is an HTTP handler that handles configuration update requests. |
| +func UpdateHandler(ctx *router.Context) { |
|
nodir
2017/03/20 19:11:36
(in another CL) UpdateHandler is abstract name. Up
hinoka
2017/03/20 19:16:31
Acknowledged.
|
| + c, h := ctx.Context, ctx.Writer |
| + err := common.Update(c) |
|
nodir
2017/03/20 19:11:36
(in another CL): "common.Update" is very abstract.
hinoka
2017/03/20 19:16:31
Acknowledged.
|
| + if err != nil { |
| + logging.WithError(err).Errorf(c, "Update Handler encountered error") |
| + h.WriteHeader(500) |
| + } |
| + logging.Infof(c, "Successfully completed") |
| + h.WriteHeader(200) |
| +} |