scopes: sort scope dashboard bindings on dashboard title (#93305)

Signed-off-by: bergquist <carl.bergquist@gmail.com>
ieva/perm-validation-for-group-attr-sync
Carl Bergquist 8 months ago committed by GitHub
parent d28e76e93b
commit 56616e69a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      pkg/registry/apis/scope/find_scope_dashboards.go

@ -4,6 +4,8 @@ import (
"context"
"fmt"
"net/http"
"slices"
"strings"
scope "github.com/grafana/grafana/pkg/apis/scope/v0alpha1"
"k8s.io/apimachinery/pkg/api/errors"
@ -92,6 +94,11 @@ func (f *findScopeDashboardsREST) Connect(ctx context.Context, name string, opts
}
}
// sort the dashboard lists based on dashboard title.
slices.SortFunc(results.Items, func(i, j scope.ScopeDashboardBinding) int {
return strings.Compare(i.Status.DashboardTitle, j.Status.DashboardTitle)
})
logger.FromContext(req.Context()).Debug("find scopedashboardbinding", "raw", len(all.Items), "filtered", len(results.Items))
responder.Object(200, results)

Loading…
Cancel
Save