From 6b1283d2ce0e5c36029f8e2fb8eeb3c6b7c29209 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 26 Jan 2023 11:36:00 +0100 Subject: dashboard: display subsystems in bug lists To generate filtering URLs, use the ability of context.Context to carry on variable values. --- pkg/html/html.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'pkg/html/html.go') diff --git a/pkg/html/html.go b/pkg/html/html.go index 8dc075bb6..c89c42fbb 100644 --- a/pkg/html/html.go +++ b/pkg/html/html.go @@ -6,6 +6,7 @@ package html import ( "fmt" "html/template" + "net/url" "reflect" "strings" texttemplate "text/template" @@ -191,3 +192,17 @@ func dereferencePointer(v interface{}) interface{} { func commitLink(repo, commit string) string { return vcs.CommitLink(repo, commit) } + +func AmendURL(baseURL, key, value string) string { + if baseURL == "" { + return "" + } + parsed, err := url.Parse(baseURL) + if err != nil { + return "" + } + values := parsed.Query() + values.Set(key, value) + parsed.RawQuery = values.Encode() + return parsed.String() +} -- cgit mrf-deployment