chore: allow search by build params in workspace search filter (#12694)

* chore: workspace search filter allow search by params
* has_param will return all workspaces with the param existance
* exact matching
This commit is contained in:
Steven Masley
2024-03-22 14:22:47 -05:00
committed by GitHub
parent b4fd819f0d
commit c674128105
10 changed files with 485 additions and 47 deletions
+5 -4
View File
@@ -1,6 +1,7 @@
package httpapi
import (
"errors"
"fmt"
"net/url"
"strconv"
@@ -268,18 +269,18 @@ func ParseCustomList[T any](parser *QueryParamParser, vals url.Values, def []T,
allTerms = append(allTerms, terms...)
}
var badValues []string
var badErrors error
var output []T
for _, s := range allTerms {
good, err := parseFunc(s)
if err != nil {
badValues = append(badValues, s)
badErrors = errors.Join(badErrors, err)
continue
}
output = append(output, good)
}
if len(badValues) > 0 {
return []T{}, xerrors.Errorf("%s", strings.Join(badValues, ","))
if badErrors != nil {
return []T{}, badErrors
}
return output, nil
+1 -1
View File
@@ -388,7 +388,7 @@ func TestParseQueryParams(t *testing.T) {
Value: "6c8ef17d-5dd8-4b92-bac9-41944f90f237,bogus",
Expected: []uuid.UUID{},
Default: []uuid.UUID{},
ExpectedErrorContains: "bogus",
ExpectedErrorContains: "invalid UUID length",
},
{
QueryParam: "multiple_keys",