fix(home): redirect home if edge endpoint is down (#4670)

* fix(home): redirect home if edge endpoint is down

* fix(kubernetes): rephrase error message when endpoint is down

Co-authored-by: Anthony Lapenna <anthony.lapenna@portainer.io>

Co-authored-by: Anthony Lapenna <anthony.lapenna@portainer.io>
pull/4941/head
Chaim Lev-Ari 2021-03-23 22:38:30 +02:00 committed by GitHub
parent c542964073
commit d1a21ef6c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,7 @@ angular.module('portainer.kubernetes', ['portainer.app']).config([
}
try {
if (endpoint.Type === 7) {
//edge
try {
await KubernetesHealthService.ping(endpoint.Id);
endpoint.Status = 1;
@ -27,6 +28,10 @@ angular.module('portainer.kubernetes', ['portainer.app']).config([
EndpointProvider.setEndpointID(endpoint.Id);
await StateManager.updateEndpointState(endpoint, []);
if (endpoint.Type === 7 && endpoint.Status === 2) {
throw new Error('Unable to contact Edge agent, please ensure that the agent is properly running on the remote environment.');
}
} catch (e) {
Notifications.error('Failed loading endpoint', e);
$state.go('portainer.home', {}, { reload: true });