chore: Allow entity key ordering for actionless components

This commit is contained in:
jamesread 2026-03-09 09:18:24 +00:00
parent 93a9636a82
commit dcb5bd0c82
1 changed files with 5 additions and 0 deletions

View File

@ -182,6 +182,11 @@ func entityKeyLess(a, b string) bool {
func sortDashboardComponents(components []*apiv1.DashboardComponent) []*apiv1.DashboardComponent {
sort.Slice(components, func(i, j int) bool {
if components[i].Action == nil || components[j].Action == nil {
if components[i].EntityKey != "" && components[j].EntityKey != "" &&
components[i].EntityKey != components[j].EntityKey {
return entityKeyLess(components[i].EntityKey, components[j].EntityKey)
}
return components[i].Title < components[j].Title
}