Skip to content

Commit

Permalink
feat: Add name filters for workflow list (exact/prefix/pattern) (#13160)
Browse files Browse the repository at this point in the history
Signed-off-by: Adrien Delannoy <[email protected]>
  • Loading branch information
Adrien-D authored Oct 17, 2024
1 parent b5a7a88 commit d8f2d85
Show file tree
Hide file tree
Showing 21 changed files with 355 additions and 131 deletions.
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

0 comments on commit d8f2d85

Please sign in to comment.