Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 "net/http" | |
| 9 | |
| 10 "github.com/luci/luci-go/common/logging" | |
| 11 "github.com/luci/luci-go/milo/appengine/common" | |
| 12 "github.com/luci/luci-go/server/router" | |
| 13 "github.com/luci/luci-go/server/templates" | |
| 14 ) | |
| 15 | |
| 16 // ConfigsHandler renders the page showing the currently loaded set of luci-conf igs. | |
| 17 func ConfigsHandler(c *router.Context) { | |
| 18 projects, err := common.GetAllProjects(c.Context) | |
| 19 if err != nil { | |
| 20 common.ErrorPage( | |
| 21 c, http.StatusInternalServerError, | |
| 22 "Error while getting projects: "+err.Error()) | |
| 23 return | |
| 24 } | |
| 25 | |
| 26 templates.MustRender(c.Context, c.Writer, "pages/config.html", templates .Args{ | |
| 27 "Projects": projects, | |
| 28 }) | |
| 29 } | |
| 30 | |
| 31 // UpdateHandler is an HTTP handler that handles configuration update requests. | |
| 32 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.
| |
| 33 c, h := ctx.Context, ctx.Writer | |
| 34 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.
| |
| 35 if err != nil { | |
| 36 logging.WithError(err).Errorf(c, "Update Handler encountered err or") | |
| 37 h.WriteHeader(500) | |
| 38 } | |
| 39 logging.Infof(c, "Successfully completed") | |
| 40 h.WriteHeader(200) | |
| 41 } | |
| OLD | NEW |