fix tabs to spaces

This commit is contained in:
Ryan McKinley 2024-07-03 13:38:16 -07:00
parent 2a4fedb6ee
commit ddcbc753d3
2 changed files with 19 additions and 14 deletions

View File

@ -7,6 +7,7 @@ import (
"path/filepath" "path/filepath"
"gocloud.dev/blob/fileblob" "gocloud.dev/blob/fileblob"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/klog/v2" "k8s.io/klog/v2"
grafanaregistry "github.com/grafana/grafana/pkg/apiserver/registry/generic" grafanaregistry "github.com/grafana/grafana/pkg/apiserver/registry/generic"
@ -244,13 +245,17 @@ func (b *entityBridge) PrepareList(ctx context.Context, req *resource.ListReques
WithBody: true, WithBody: true,
} }
// Assumes everything is equals
if len(req.Options.Labels) > 0 { if len(req.Options.Labels) > 0 {
query.Labels = make(map[string]string) query.Labels = make(map[string]string)
for _, q := range req.Options.Labels { for _, q := range req.Options.Labels {
// The entity structure only supports equals
// the rest will be processed handled by the upstream predicate
op := selection.Operator(q.Operator)
if op == selection.Equals || op == selection.DoubleEquals {
query.Labels[q.Key] = q.Values[0] query.Labels[q.Key] = q.Values[0]
} }
} }
}
found, err := b.client.List(ctx, query) found, err := b.client.List(ctx, query)
if err != nil { if err != nil {