Skip to content

Commit

Permalink
Add support for labels to minder history list. (#4961)
Browse files Browse the repository at this point in the history
  • Loading branch information
blkt authored Nov 18, 2024
1 parent 5f4407f commit ea52b4b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/cli/app/history/history_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"
"io"
"os"
"slices"
"strings"
"time"
Expand Down Expand Up @@ -48,6 +49,7 @@ func listCommand(ctx context.Context, cmd *cobra.Command, _ []string, conn *grpc
evalStatus := viper.GetStringSlice("eval-status")
remediationStatus := viper.GetStringSlice("remediation-status")
alertStatus := viper.GetStringSlice("alert-status")
labels := viper.GetStringSlice("label")

// time range
from := viper.GetTime("from")
Expand Down Expand Up @@ -90,6 +92,7 @@ func listCommand(ctx context.Context, cmd *cobra.Command, _ []string, conn *grpc
Status: evalStatus,
Remediation: remediationStatus,
Alert: alertStatus,
LabelFilter: labels,
From: nil,
To: nil,
Cursor: cursorFromOptions(cursorStr, size),
Expand Down Expand Up @@ -223,6 +226,11 @@ func init() {
listCmd.Flags().StringSlice("eval-status", nil, evalFilterMsg)
listCmd.Flags().StringSlice("remediation-status", nil, remediationFilterMsg)
listCmd.Flags().StringSlice("alert-status", nil, alertFilterMsg)
listCmd.Flags().StringSliceP("label", "l", nil, "Filter evaluation history list by label")
if err := listCmd.Flags().MarkHidden("label"); err != nil {
listCmd.Printf("Error hiding flag: %s", err)
os.Exit(1)
}
listCmd.Flags().String("from", "", "Filter evaluation history list by time")
listCmd.Flags().String("to", "", "Filter evaluation history list by time")
listCmd.Flags().StringP("cursor", "c", "", "Fetch previous or next page from the list")
Expand Down

0 comments on commit ea52b4b

Please sign in to comment.