Skip to content

Commit

Permalink
chore(runs): filter by name instead of id (#1047)
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Martinez Trivino <[email protected]>
  • Loading branch information
migmartri authored Jun 27, 2024
1 parent 6145c30 commit c43a346
Show file tree
Hide file tree
Showing 16 changed files with 679 additions and 639 deletions.
6 changes: 3 additions & 3 deletions app/cli/cmd/workflow_workflow_run_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func newWorkflowWorkflowRunListCmd() *cobra.Command {
DefaultLimit: 20,
}

var workflowID, status string
var workflowName, status string

cmd := &cobra.Command{
Use: "list",
Expand All @@ -47,7 +47,7 @@ func newWorkflowWorkflowRunListCmd() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
res, err := action.NewWorkflowRunList(actionOpts).Run(
&action.WorkflowRunListOpts{
WorkflowID: workflowID,
WorkflowName: workflowName,
Pagination: &action.PaginationOpts{
Limit: paginationOpts.Limit,
NextCursor: paginationOpts.NextCursor,
Expand Down Expand Up @@ -78,7 +78,7 @@ func newWorkflowWorkflowRunListCmd() *cobra.Command {
},
}

cmd.Flags().StringVar(&workflowID, "workflow", "", "workflow ID")
cmd.Flags().StringVar(&workflowName, "workflow", "", "workflow name")
cmd.Flags().BoolVar(&full, "full", false, "full report")
cmd.Flags().StringVar(&status, "status", "", fmt.Sprintf("filter by workflow run status: %v", listAvailableWorkflowStatusFlag()))
// Add pagination flags
Expand Down
10 changes: 5 additions & 5 deletions app/cli/internal/action/workflow_run_list.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2023 The Chainloop Authors.
// Copyright 2024 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,9 +63,9 @@ func NewWorkflowRunList(cfg *ActionsOpts) *WorkflowRunList {
}

type WorkflowRunListOpts struct {
WorkflowID string
Pagination *PaginationOpts
Status string
WorkflowName string
Pagination *PaginationOpts
Status string
}
type PaginationOpts struct {
Limit int
Expand All @@ -75,7 +75,7 @@ type PaginationOpts struct {
func (action *WorkflowRunList) Run(opts *WorkflowRunListOpts) (*PaginatedWorkflowRunItem, error) {
client := pb.NewWorkflowRunServiceClient(action.cfg.CPConnection)
req := &pb.WorkflowRunServiceListRequest{
WorkflowId: opts.WorkflowID,
WorkflowName: opts.WorkflowName,
Pagination: &pb.CursorPaginationRequest{
Limit: int32(opts.Pagination.Limit),
Cursor: opts.Pagination.NextCursor,
Expand Down
128 changes: 65 additions & 63 deletions app/controlplane/api/controlplane/v1/api_token.pb.go

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

2 changes: 1 addition & 1 deletion app/controlplane/api/controlplane/v1/api_token.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ message APITokenServiceRevokeRequest {
string name = 1 [(buf.validate.field) = {
// NOTE: validations can not be shared yet https://github.com/bufbuild/protovalidate/issues/51
cel: {
message: "has an invalid format",
message: "must contain only lowercase letters, numbers, and hyphens.",
expression: "this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')",
id: "name.dns-1123",
},
Expand Down
Loading

0 comments on commit c43a346

Please sign in to comment.