mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 23:39:41 +02:00
fix(endpoints): use default edge checkin interval if n/a (#4909)
This commit is contained in:
parent
f4dd3067ed
commit
dbb9a21384
2 changed files with 12 additions and 12 deletions
|
@ -66,6 +66,11 @@ func (handler *Handler) endpointList(w http.ResponseWriter, r *http.Request) *ht
|
||||||
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from the database", err}
|
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from the database", err}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings, err := handler.DataStore.Settings().Settings()
|
||||||
|
if err != nil {
|
||||||
|
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve settings from the database", err}
|
||||||
|
}
|
||||||
|
|
||||||
securityContext, err := security.RetrieveRestrictedRequestContext(r)
|
securityContext, err := security.RetrieveRestrictedRequestContext(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve info from request context", err}
|
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve info from request context", err}
|
||||||
|
@ -108,6 +113,9 @@ func (handler *Handler) endpointList(w http.ResponseWriter, r *http.Request) *ht
|
||||||
for idx := range paginatedEndpoints {
|
for idx := range paginatedEndpoints {
|
||||||
hideFields(&paginatedEndpoints[idx])
|
hideFields(&paginatedEndpoints[idx])
|
||||||
paginatedEndpoints[idx].ComposeSyntaxMaxVersion = handler.ComposeStackManager.ComposeSyntaxMaxVersion()
|
paginatedEndpoints[idx].ComposeSyntaxMaxVersion = handler.ComposeStackManager.ComposeSyntaxMaxVersion()
|
||||||
|
if paginatedEndpoints[idx].EdgeCheckinInterval == 0 {
|
||||||
|
paginatedEndpoints[idx].EdgeCheckinInterval = settings.EdgeAgentCheckinInterval
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("X-Total-Count", strconv.Itoa(filteredEndpointCount))
|
w.Header().Set("X-Total-Count", strconv.Itoa(filteredEndpointCount))
|
||||||
|
|
|
@ -13,8 +13,7 @@ angular
|
||||||
EndpointProvider,
|
EndpointProvider,
|
||||||
StateManager,
|
StateManager,
|
||||||
ModalService,
|
ModalService,
|
||||||
MotdService,
|
MotdService
|
||||||
SettingsService
|
|
||||||
) {
|
) {
|
||||||
$scope.state = {
|
$scope.state = {
|
||||||
connectingToEdgeEndpoint: false,
|
connectingToEdgeEndpoint: false,
|
||||||
|
@ -83,7 +82,7 @@ angular
|
||||||
var groups = data.groups;
|
var groups = data.groups;
|
||||||
EndpointHelper.mapGroupNameToEndpoint(endpoints, groups);
|
EndpointHelper.mapGroupNameToEndpoint(endpoints, groups);
|
||||||
EndpointProvider.setEndpoints(endpoints);
|
EndpointProvider.setEndpoints(endpoints);
|
||||||
deferred.resolve({ endpoints: decorateEndpoints(endpoints), totalCount: data.endpoints.totalCount });
|
deferred.resolve({ endpoints: endpoints, totalCount: data.endpoints.totalCount });
|
||||||
})
|
})
|
||||||
.catch(function error(err) {
|
.catch(function error(err) {
|
||||||
Notifications.error('Failure', err, 'Unable to retrieve endpoint information');
|
Notifications.error('Failure', err, 'Unable to retrieve endpoint information');
|
||||||
|
@ -99,15 +98,14 @@ angular
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [{ totalCount, endpoints }, tags, settings] = await Promise.all([getPaginatedEndpoints(0, 100), TagService.tags(), SettingsService.settings()]);
|
const [{ totalCount, endpoints }, tags] = await Promise.all([getPaginatedEndpoints(0, 100), TagService.tags()]);
|
||||||
$scope.tags = tags;
|
$scope.tags = tags;
|
||||||
$scope.defaultEdgeCheckInInterval = settings.EdgeAgentCheckinInterval;
|
|
||||||
|
|
||||||
$scope.totalCount = totalCount;
|
$scope.totalCount = totalCount;
|
||||||
if (totalCount > 100) {
|
if (totalCount > 100) {
|
||||||
$scope.endpoints = [];
|
$scope.endpoints = [];
|
||||||
} else {
|
} else {
|
||||||
$scope.endpoints = decorateEndpoints(endpoints);
|
$scope.endpoints = endpoints;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Notifications.error('Failed loading page data', err);
|
Notifications.error('Failed loading page data', err);
|
||||||
|
@ -115,10 +113,4 @@ angular
|
||||||
}
|
}
|
||||||
|
|
||||||
initView();
|
initView();
|
||||||
|
|
||||||
function decorateEndpoints(endpoints) {
|
|
||||||
return endpoints.map((endpoint) => {
|
|
||||||
return { ...endpoint, EdgeCheckinInterval: endpoint.EdgeAgentCheckinInterval || $scope.defaultEdgeCheckInInterval };
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue