diff --git a/api/http/handler/endpoints/endpoint_list.go b/api/http/handler/endpoints/endpoint_list.go index 53a982a10..024aafb44 100644 --- a/api/http/handler/endpoints/endpoint_list.go +++ b/api/http/handler/endpoints/endpoint_list.go @@ -19,8 +19,6 @@ const ( EdgeDeviceIntervalAdd = 20 ) -var endpointGroupNames map[portainer.EndpointGroupID]string - // @id EndpointList // @summary List environments(endpoints) // @description List all environments(endpoints) based on the current user authorizations. Will @@ -141,7 +139,7 @@ func sortEndpointsByField(endpoints []portainer.Endpoint, endpointGroups []porta } case "Group": - endpointGroupNames = make(map[portainer.EndpointGroupID]string, 0) + endpointGroupNames := make(map[portainer.EndpointGroupID]string, 0) for _, group := range endpointGroups { endpointGroupNames[group.ID] = group.Name } diff --git a/api/http/handler/endpoints/sort.go b/api/http/handler/endpoints/sort.go index 1ac5dd11d..f82d5e210 100644 --- a/api/http/handler/endpoints/sort.go +++ b/api/http/handler/endpoints/sort.go @@ -39,8 +39,8 @@ func (e EndpointsByGroup) Less(i, j int) bool { return false } - groupA := endpointGroupNames[e.endpoints[i].GroupID] - groupB := endpointGroupNames[e.endpoints[j].GroupID] + groupA := e.endpointGroupNames[e.endpoints[i].GroupID] + groupB := e.endpointGroupNames[e.endpoints[j].GroupID] return sortorder.NaturalLess(strings.ToLower(groupA), strings.ToLower(groupB)) }