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

Side by Side Diff: milo/frontend/view_config.go

Issue 2977863002: [milo] Refactor all html knowledge out of backends. (Closed)
Patch Set: now with case insensitivity Created 3 years, 5 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/frontend/view_builder.go ('k') | milo/frontend/view_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
1 // Copyright 2015 The LUCI Authors. 1 // Copyright 2015 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 package frontend 15 package frontend
16 16
17 import ( 17 import (
18 "net/http" 18 "net/http"
19 19
20 "cloud.google.com/go/datastore" 20 "cloud.google.com/go/datastore"
21 "google.golang.org/appengine" 21 "google.golang.org/appengine"
22 22
23 "github.com/luci/luci-go/common/errors"
23 "github.com/luci/luci-go/common/logging" 24 "github.com/luci/luci-go/common/logging"
24 "github.com/luci/luci-go/milo/common" 25 "github.com/luci/luci-go/milo/common"
25 "github.com/luci/luci-go/server/router" 26 "github.com/luci/luci-go/server/router"
26 "github.com/luci/luci-go/server/templates" 27 "github.com/luci/luci-go/server/templates"
27 ) 28 )
28 29
29 // ConfigsHandler renders the page showing the currently loaded set of luci-conf igs. 30 // ConfigsHandler renders the page showing the currently loaded set of luci-conf igs.
30 func ConfigsHandler(c *router.Context) { 31 func ConfigsHandler(c *router.Context) {
31 projects, err := common.GetAllProjects(c.Context) 32 projects, err := common.GetAllProjects(c.Context)
32 if err != nil { 33 if err != nil {
33 » » common.ErrorPage( 34 » » ErrorHandler(c, errors.Annotate(err, "Error while getting projec ts").Err())
34 » » » c, http.StatusInternalServerError,
35 » » » "Error while getting projects: "+err.Error())
36 return 35 return
37 } 36 }
38 sc, err := common.GetCurrentServiceConfig(c.Context) 37 sc, err := common.GetCurrentServiceConfig(c.Context)
39 if err != nil && err != datastore.ErrNoSuchEntity { 38 if err != nil && err != datastore.ErrNoSuchEntity {
40 » » common.ErrorPage( 39 » » ErrorHandler(c, errors.Annotate(err, "Error while getting servic e config").Err())
41 » » » c, http.StatusInternalServerError,
42 » » » "Error while getting service config: "+err.Error())
43 return 40 return
44 } 41 }
45 42
46 templates.MustRender(c.Context, c.Writer, "pages/configs.html", template s.Args{ 43 templates.MustRender(c.Context, c.Writer, "pages/configs.html", template s.Args{
47 "Projects": projects, 44 "Projects": projects,
48 "ServiceConfig": sc, 45 "ServiceConfig": sc,
49 }) 46 })
50 } 47 }
51 48
52 // UpdateHandler is an HTTP handler that handles configuration update requests. 49 // UpdateHandler is an HTTP handler that handles configuration update requests.
(...skipping 14 matching lines...) Expand all
67 logging.WithError(servErr).Errorf( 64 logging.WithError(servErr).Errorf(
68 c, "pubsub subscriber handler encountered error" ) 65 c, "pubsub subscriber handler encountered error" )
69 } 66 }
70 } 67 }
71 if projErr != nil || servErr != nil { 68 if projErr != nil || servErr != nil {
72 h.WriteHeader(http.StatusInternalServerError) 69 h.WriteHeader(http.StatusInternalServerError)
73 return 70 return
74 } 71 }
75 h.WriteHeader(http.StatusOK) 72 h.WriteHeader(http.StatusOK)
76 } 73 }
OLDNEW
« no previous file with comments | « milo/frontend/view_builder.go ('k') | milo/frontend/view_console.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698