You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to use duplicate keys in the Query Params user interface.
Expected behaviour
User can have duplicate (even multiple duplicate) keys, so the URL params will be like this: myparam=valueA&myparam=valueB&myparam=valueC so that a variable represented by myparam []string can be populated.
Observed behaviour
Grafana only passes one of the duplicate keys, like this: myparam=valueC, ignoring the other myparam keys.
Work-around solution
Enable the use of a comma-delimited string for the value; then check for this:
issueLinkTypeNameExcludes, issueLinkTypeNameExcludesParamExists := c.GetQuery("issueLinkTypeNameExcludes")
if issueLinkTypeNameExcludesParamExists == true {
if strings.Contains(issueLinkTypeNameExcludes, ",") {
qry.IssueLinkTypeNameExcludes = strings.Split(issueLinkTypeNameExcludes, ",")
}
}
issueLinkStatusExcludes, issueLinkStatusExcludesParamExists := c.GetQuery("issueLinkStatusExcludes")
if issueLinkStatusExcludesParamExists == true {
if strings.Contains(issueLinkStatusExcludes, ",") {
qry.IssueLinkStatusExcludes = strings.Split(issueLinkStatusExcludes, ",")
}
}
Originally posted by mikequentel February 27, 2023 Is it possible to make the Query Params user interface of Grafana/grafana-csv-datasource accept duplicate keys?
The reason I would like to do this is because I have a web service implemented in Go using Gin that can accept URL parameters that become a list, to populate a struct named Query, where issueLinkTypeNames (for example) can take a list, but this list is typically resolved from URL parameters that are repeated (this appears to be a normal way to do this). This web service successfully returns the CSV when these parameters are passed like this example:
The struct Query that gets populated has some []string fields like this:
package model
type Query struct {
...
IssueLinkTypeNameExcludes []string `form:"issueLinkTypeNameExcludes"`
IssueLinkStatusExcludes []string `form:"issueLinkStatusExcludes"`
IssueLinkKeyExcludes []string `form:"issueLinkKeyExcludes"`
...
}
But the records in Grafana (from grafana-csv-datasource) do not show the expected results because only one of the values of issueLinkTypeNameExcludes is being sent to the web service. This behaviour is definitely happening only through Grafana.
The text was updated successfully, but these errors were encountered:
Problem
Unable to use duplicate keys in the Query Params user interface.
Expected behaviour
User can have duplicate (even multiple duplicate) keys, so the URL params will be like this:
myparam=valueA&myparam=valueB&myparam=valueC
so that a variable represented bymyparam []string
can be populated.Observed behaviour
Grafana only passes one of the duplicate keys, like this:
myparam=valueC
, ignoring the othermyparam
keys.Work-around solution
Enable the use of a comma-delimited string for the value; then check for this:
Discussed in #229
Originally posted by mikequentel February 27, 2023
Is it possible to make the Query Params user interface of Grafana/grafana-csv-datasource accept duplicate keys?
The reason I would like to do this is because I have a web service implemented in Go using Gin that can accept URL parameters that become a list, to populate a struct named
Query
, whereissueLinkTypeNames
(for example) can take a list, but this list is typically resolved from URL parameters that are repeated (this appears to be a normal way to do this). This web service successfully returns the CSV when these parameters are passed like this example:The struct Query that gets populated has some
[]string
fields like this:But the records in Grafana (from grafana-csv-datasource) do not show the expected results because only one of the values of
issueLinkTypeNameExcludes
is being sent to the web service. This behaviour is definitely happening only through Grafana.The text was updated successfully, but these errors were encountered: