1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

fix(code): remove code that is no longer necessary EE-6078 (#10256)

This commit is contained in:
andres-portainer 2023-09-05 22:35:16 -03:00 committed by GitHub
parent c748385879
commit 4a39122415
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 33 additions and 224 deletions

View file

@ -3,6 +3,7 @@ package endpoints
import (
"errors"
"net/http"
"slices"
"strconv"
portainer "github.com/portainer/portainer/api"
@ -117,9 +118,11 @@ func (handler *Handler) deleteEndpoint(tx dataservices.DataStoreTx, endpointID p
}
for _, edgeGroup := range edgeGroups {
edgeGroup.Endpoints = removeElement(edgeGroup.Endpoints, endpoint.ID)
tx.EdgeGroup().Update(edgeGroup.ID, &edgeGroup)
edgeGroup.Endpoints = slices.DeleteFunc(edgeGroup.Endpoints, func(e portainer.EndpointID) bool {
return e == endpoint.ID
})
err = tx.EdgeGroup().Update(edgeGroup.ID, &edgeGroup)
if err != nil {
log.Warn().Err(err).Msgf("Unable to update edge group")
}
@ -183,15 +186,3 @@ func (handler *Handler) deleteEndpoint(tx dataservices.DataStoreTx, endpointID p
return nil
}
func removeElement(slice []portainer.EndpointID, elem portainer.EndpointID) []portainer.EndpointID {
for i, id := range slice {
if id == elem {
slice[i] = slice[len(slice)-1]
return slice[:len(slice)-1]
}
}
return slice
}