mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
switch natural sort lib for a better one (#6862)
Switched to better natural sorting package
This commit is contained in:
parent
f7780cecb3
commit
840a3ce732
4 changed files with 6 additions and 129 deletions
|
@ -3,8 +3,8 @@ package endpoints
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/fvbommel/sortorder"
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
"github.com/portainer/portainer/api/internal/natsort"
|
||||
)
|
||||
|
||||
type EndpointsByName []portainer.Endpoint
|
||||
|
@ -18,7 +18,7 @@ func (e EndpointsByName) Swap(i, j int) {
|
|||
}
|
||||
|
||||
func (e EndpointsByName) Less(i, j int) bool {
|
||||
return natsort.Compare(strings.ToLower(e[i].Name), strings.ToLower(e[j].Name))
|
||||
return sortorder.NaturalLess(strings.ToLower(e[i].Name), strings.ToLower(e[j].Name))
|
||||
}
|
||||
|
||||
type EndpointsByGroup []portainer.Endpoint
|
||||
|
@ -39,5 +39,5 @@ func (e EndpointsByGroup) Less(i, j int) bool {
|
|||
groupA := endpointGroupNames[e[i].GroupID]
|
||||
groupB := endpointGroupNames[e[j].GroupID]
|
||||
|
||||
return natsort.Compare(strings.ToLower(groupA), strings.ToLower(groupB))
|
||||
return sortorder.NaturalLess(strings.ToLower(groupA), strings.ToLower(groupB))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue