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

Unified Diff: server/settings/admin/index.go

Issue 2043423004: Make HTTP middleware easier to use (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: gaemiddleware: add middleware func for WithProd Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « server/settings/admin/handlers.go ('k') | server/settings/admin/settings.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/settings/admin/index.go
diff --git a/server/settings/admin/index.go b/server/settings/admin/index.go
index aa5d6d6501acd25d3c9a0c346427e5de98d7229c..c52cb3a0f080490a67936b375c83a72c2154f2a5 100644
--- a/server/settings/admin/index.go
+++ b/server/settings/admin/index.go
@@ -1,42 +1,42 @@
// Copyright 2016 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 admin
import (
- "net/http"
"sort"
"time"
"github.com/dustin/go-humanize"
- "github.com/julienschmidt/httprouter"
- "golang.org/x/net/context"
"github.com/luci/luci-go/common/clock"
+ "github.com/luci/luci-go/server/router"
"github.com/luci/luci-go/server/settings"
"github.com/luci/luci-go/server/templates"
)
type pageIndexEntry struct {
ID string
Title string
}
type pageIndexEntries []pageIndexEntry
func (a pageIndexEntries) Len() int { return len(a) }
func (a pageIndexEntries) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a pageIndexEntries) Less(i, j int) bool { return a[i].Title < a[j].Title }
-func indexPage(c context.Context, rw http.ResponseWriter, r *http.Request, p httprouter.Params) {
+func indexPage(ctx *router.Context) {
+ c, rw := ctx.Context, ctx.Writer
+
entries := pageIndexEntries{}
for id, p := range settings.GetUIPages() {
title, err := p.Title(c)
if err != nil {
replyError(c, rw, err)
return
}
entries = append(entries, pageIndexEntry{
ID: id,
Title: title,
« no previous file with comments | « server/settings/admin/handlers.go ('k') | server/settings/admin/settings.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698