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

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