Skip to content

Commit

Permalink
sort results on dashboard (#295)
Browse files Browse the repository at this point in the history
This reverts commit 0c671d0.
  • Loading branch information
rbren authored May 18, 2020
1 parent d50d9c8 commit ac94129
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/validator/summary.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package validator

import (
"sort"
"strings"

"github.com/fairwindsops/polaris/pkg/config"
)

Expand Down Expand Up @@ -143,6 +146,19 @@ func (a AuditData) GetResultsByNamespace() map[string][]*ControllerResult {
nsResults = append(nsResults, &a.Results[idx])
allResults[ctrlResult.Namespace] = nsResults
}
for ns := range allResults {
sort.SliceStable(allResults[ns], func(i, j int) bool {
kind := strings.Compare(allResults[ns][i].Kind, allResults[ns][j].Kind)
if kind != 0 {
return kind == -1
}
name := strings.Compare(allResults[ns][i].Name, allResults[ns][j].Name)
if name != 0 {
return name == -1
}
return true
})
}
return allResults
}

Expand Down

0 comments on commit ac94129

Please sign in to comment.