fix(docker):show error for offline endpoint (#6702)

pull/6709/head
sunportainer 2022-04-04 18:24:47 +08:00 committed by GitHub
parent f59459f936
commit 311129e746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import angular from 'angular';
import { EnvironmentStatus } from '@/portainer/environments/types';
import containersModule from './containers';
import { componentsModule } from './components';
@ -27,13 +28,8 @@ angular.module('portainer.docker', ['portainer.app', containersModule, component
}
endpoint.Status = status;
if (status === 2) {
if (!endpoint.Snapshots[0]) {
throw new Error('Environment is unreachable and there is no snapshot available for offline browsing.');
}
if (endpoint.Snapshots[0].Swarm) {
throw new Error('Environment is unreachable. Connect to another swarm manager.');
}
if (status === EnvironmentStatus.Down) {
throw new Error('Environment is unreachable.');
}
EndpointProvider.setEndpointID(endpoint.Id);