mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
scopes: sort scope dashboard bindings on dashboard title (#93305)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
This commit is contained in:
parent
d28e76e93b
commit
56616e69a1
@ -4,6 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
|
|
||||||
scope "github.com/grafana/grafana/pkg/apis/scope/v0alpha1"
|
scope "github.com/grafana/grafana/pkg/apis/scope/v0alpha1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"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))
|
logger.FromContext(req.Context()).Debug("find scopedashboardbinding", "raw", len(all.Items), "filtered", len(results.Items))
|
||||||
|
|
||||||
responder.Object(200, results)
|
responder.Object(200, results)
|
||||||
|
Loading…
Reference in New Issue
Block a user