From 311129e74624e2b133c4b7770f456c90a37d8f08 Mon Sep 17 00:00:00 2001 From: sunportainer <93502624+sunportainer@users.noreply.github.com> Date: Mon, 4 Apr 2022 18:24:47 +0800 Subject: [PATCH] fix(docker):show error for offline endpoint (#6702) --- app/docker/__module.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/docker/__module.js b/app/docker/__module.js index c0c539aad..e4cd47a4a 100644 --- a/app/docker/__module.js +++ b/app/docker/__module.js @@ -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);