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:
parent
c748385879
commit
4a39122415
19 changed files with 33 additions and 224 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue