aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/handler.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-01-26 11:36:00 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-01-27 17:31:25 +0100
commit6b1283d2ce0e5c36029f8e2fb8eeb3c6b7c29209 (patch)
tree94c669cff01ff5d4952fd2fd0815009c55229367 /dashboard/app/handler.go
parent9da06344c240d3cd7ce53ee0261722ee2198654a (diff)
dashboard: display subsystems in bug lists
To generate filtering URLs, use the ability of context.Context to carry on variable values.
Diffstat (limited to 'dashboard/app/handler.go')
-rw-r--r--dashboard/app/handler.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go
index 2cb0d2739..7c6e9a23e 100644
--- a/dashboard/app/handler.go
+++ b/dashboard/app/handler.go
@@ -32,6 +32,7 @@ func handlerWrapper(fn contextHandler) http.Handler {
func handleContext(fn contextHandler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
+ c = context.WithValue(c, currentURLKey, r.URL.RequestURI())
if err := fn(c, w, r); err != nil {
hdr := commonHeaderRaw(c, r)
data := &struct {
@@ -73,6 +74,16 @@ func handleContext(fn contextHandler) http.Handler {
})
}
+const currentURLKey = "current_url"
+
+func getCurrentURL(c context.Context) string {
+ val, ok := c.Value(currentURLKey).(string)
+ if ok {
+ return val
+ }
+ return ""
+}
+
type (
ErrClient struct{ error }
ErrRedirect struct{ error }