diff --git a/api/http/handler/edgegroups/associated_endpoints.go b/api/http/handler/edgegroups/associated_endpoints.go
index 6b5ae3d87..d03618c56 100644
--- a/api/http/handler/edgegroups/associated_endpoints.go
+++ b/api/http/handler/edgegroups/associated_endpoints.go
@@ -49,6 +49,24 @@ func GetEndpointsByTags(tx dataservices.DataStoreTx, tagIDs []portainer.TagID, p
return results, nil
}
+func getTrustedEndpoints(tx dataservices.DataStoreTx, endpointIDs []portainer.EndpointID) ([]portainer.EndpointID, error) {
+ results := []portainer.EndpointID{}
+ for _, endpointID := range endpointIDs {
+ endpoint, err := tx.Endpoint().Endpoint(endpointID)
+ if err != nil {
+ return nil, err
+ }
+
+ if !endpoint.UserTrusted {
+ continue
+ }
+
+ results = append(results, endpoint.ID)
+ }
+
+ return results, nil
+}
+
func mapEndpointGroupToEndpoints(endpoints []portainer.Endpoint) map[portainer.EndpointGroupID]endpointSetType {
groupEndpoints := map[portainer.EndpointGroupID]endpointSetType{}
diff --git a/api/http/handler/edgegroups/edgegroup_list.go b/api/http/handler/edgegroups/edgegroup_list.go
index 82b91368b..785fb551e 100644
--- a/api/http/handler/edgegroups/edgegroup_list.go
+++ b/api/http/handler/edgegroups/edgegroup_list.go
@@ -12,9 +12,10 @@ import (
type decoratedEdgeGroup struct {
portainer.EdgeGroup
- HasEdgeStack bool `json:"HasEdgeStack"`
- HasEdgeJob bool `json:"HasEdgeJob"`
- EndpointTypes []portainer.EndpointType
+ HasEdgeStack bool `json:"HasEdgeStack"`
+ HasEdgeJob bool `json:"HasEdgeJob"`
+ EndpointTypes []portainer.EndpointType
+ TrustedEndpoints []portainer.EndpointID `json:"TrustedEndpoints"`
}
// @id EdgeGroupList
@@ -85,6 +86,14 @@ func getEdgeGroupList(tx dataservices.DataStoreTx) ([]decoratedEdgeGroup, error)
}
edgeGroup.Endpoints = endpointIDs
+ edgeGroup.TrustedEndpoints = endpointIDs
+ } else {
+ trustedEndpoints, err := getTrustedEndpoints(tx, edgeGroup.Endpoints)
+ if err != nil {
+ return nil, httperror.InternalServerError("Unable to retrieve environments for Edge group", err)
+ }
+
+ edgeGroup.TrustedEndpoints = trustedEndpoints
}
endpointTypes, err := getEndpointTypes(tx, edgeGroup.Endpoints)
diff --git a/app/edge/components/groups-datatable/groupsDatatable.html b/app/edge/components/groups-datatable/groupsDatatable.html
index 331aec6f2..271c37a12 100644
--- a/app/edge/components/groups-datatable/groupsDatatable.html
+++ b/app/edge/components/groups-datatable/groupsDatatable.html
@@ -56,9 +56,9 @@