Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add name filters for workflow list (exact/prefix/pattern) #13160

Merged
merged 10 commits into from
Oct 17, 2024
6 changes: 6 additions & 0 deletions api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion persist/sqldb/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,19 @@ func BuildWorkflowSelector(in string, inArgs []any, tableName, labelTableName st
clauses = append(clauses, db.Raw("namespace = ?", options.Namespace))
}
if options.Name != "" {
clauses = append(clauses, db.Raw("name = ?", options.Name))
nameFilter := options.NameFilter
if nameFilter == "" {
nameFilter = "Exact"
}
if nameFilter == "Exact" {
clauses = append(clauses, db.Raw("name = ?", options.Name))
}
if nameFilter == "Contains" {
clauses = append(clauses, db.Raw("name like ?", "%"+options.Name+"%"))
}
if nameFilter == "Prefix" {
clauses = append(clauses, db.Raw("name like ?", options.Name+"%"))
}
}
if options.NamePrefix != "" {
clauses = append(clauses, db.Raw("name like ?", options.NamePrefix+"%"))
Expand Down
238 changes: 145 additions & 93 deletions pkg/apiclient/workflow/workflow.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pkg/apiclient/workflow/workflow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ message WorkflowListRequest {
k8s.io.apimachinery.pkg.apis.meta.v1.ListOptions listOptions = 2;
// Fields to be included or excluded in the response. e.g. "items.spec,items.status.phase", "-items.status.nodes"
string fields = 3;
// Filter type used for name filtering. Exact | Contains | Prefix. Default to Exact
string nameFilter = 4;
}

message WorkflowResubmitRequest {
Expand Down
6 changes: 4 additions & 2 deletions sdks/java/client/docs/WorkflowServiceApi.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions sdks/python/client/argo_workflows/api/workflow_service_api.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading