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

Side by Side Diff: milo/appengine/frontend/config.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
« no previous file with comments | « milo/appengine/frontend/buildbot_data.go ('k') | milo/appengine/frontend/console/console.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "cloud.google.com/go/datastore"
11
12 "github.com/luci/luci-go/common/logging"
13 "github.com/luci/luci-go/milo/appengine/common"
14 "github.com/luci/luci-go/server/router"
15 "github.com/luci/luci-go/server/templates"
16 )
17
18 // ConfigsHandler renders the page showing the currently loaded set of luci-conf igs.
19 func ConfigsHandler(c *router.Context) {
20 projects, err := common.GetAllProjects(c.Context)
21 if err != nil {
22 common.ErrorPage(
23 c, http.StatusInternalServerError,
24 "Error while getting projects: "+err.Error())
25 return
26 }
27 sc, err := common.GetCurrentServiceConfig(c.Context)
28 if err != nil && err != datastore.ErrNoSuchEntity {
29 common.ErrorPage(
30 c, http.StatusInternalServerError,
31 "Error while getting service config: "+err.Error())
32 return
33 }
34
35 templates.MustRender(c.Context, c.Writer, "pages/configs.html", template s.Args{
36 "Projects": projects,
37 "ServiceConfig": sc,
38 })
39 }
40
41 // UpdateHandler is an HTTP handler that handles configuration update requests.
42 func UpdateConfigHandler(ctx *router.Context) {
43 c, h := ctx.Context, ctx.Writer
44 projErr := common.UpdateProjectConfigs(c)
45 if projErr != nil {
46 logging.WithError(projErr).Errorf(c, "project update handler enc ountered error")
47 }
48 servErr := common.UpdateServiceConfig(c)
49 if servErr != nil {
50 logging.WithError(servErr).Errorf(c, "service update handler enc ountered error")
51 }
52 if projErr != nil || servErr != nil {
53 h.WriteHeader(http.StatusInternalServerError)
54 return
55 }
56 h.WriteHeader(http.StatusOK)
57 }
OLDNEW
« no previous file with comments | « milo/appengine/frontend/buildbot_data.go ('k') | milo/appengine/frontend/console/console.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698