diff --git a/app/azure/_module.js b/app/azure/_module.js
index 523fb20e3..68fb30f2f 100644
--- a/app/azure/_module.js
+++ b/app/azure/_module.js
@@ -8,17 +8,22 @@ angular.module('portainer.azure', ['portainer.app']).config([
url: '/azure',
parent: 'endpoint',
abstract: true,
- /* ngInject */
- async onEnter($state, endpoint, EndpointProvider, Notifications, StateManager) {
- try {
- EndpointProvider.setEndpointID(endpoint.Id);
- EndpointProvider.setEndpointPublicURL(endpoint.PublicURL);
- EndpointProvider.setOfflineModeFromStatus(endpoint.Status);
- await StateManager.updateEndpointState(endpoint, []);
- } catch (e) {
- Notifications.error('Failed loading endpoint', e);
- $state.go('portainer.home', {}, { reload: true });
- }
+ onEnter: /* @ngInject */ function onEnter($async, $state, endpoint, EndpointProvider, Notifications, StateManager) {
+ return $async(async () => {
+ if (endpoint.Type !== 3) {
+ $state.go('portainer.home');
+ return;
+ }
+ try {
+ EndpointProvider.setEndpointID(endpoint.Id);
+ EndpointProvider.setEndpointPublicURL(endpoint.PublicURL);
+ EndpointProvider.setOfflineModeFromStatus(endpoint.Status);
+ await StateManager.updateEndpointState(endpoint, []);
+ } catch (e) {
+ Notifications.error('Failed loading endpoint', e);
+ $state.go('portainer.home', {}, { reload: true });
+ }
+ });
},
};
diff --git a/app/azure/components/azure-sidebar-content/azure-sidebar-content.js b/app/azure/components/azure-sidebar-content/azure-sidebar-content.js
index daec3ef12..1cdf11ca3 100644
--- a/app/azure/components/azure-sidebar-content/azure-sidebar-content.js
+++ b/app/azure/components/azure-sidebar-content/azure-sidebar-content.js
@@ -1,3 +1,8 @@
+import angular from 'angular';
+
angular.module('portainer.azure').component('azureSidebarContent', {
templateUrl: './azureSidebarContent.html',
+ bindings: {
+ endpointId: '<',
+ },
});
diff --git a/app/azure/components/azure-sidebar-content/azureSidebarContent.html b/app/azure/components/azure-sidebar-content/azureSidebarContent.html
index 811ab7837..d6e68d12b 100644
--- a/app/azure/components/azure-sidebar-content/azureSidebarContent.html
+++ b/app/azure/components/azure-sidebar-content/azureSidebarContent.html
@@ -1,6 +1,6 @@
diff --git a/app/docker/__module.js b/app/docker/__module.js
index 1aa2d827b..5747164bf 100644
--- a/app/docker/__module.js
+++ b/app/docker/__module.js
@@ -7,51 +7,56 @@ angular.module('portainer.docker', ['portainer.app']).config([
name: 'docker',
parent: 'endpoint',
abstract: true,
- /* ngInject */
- async onEnter(endpoint, $state, EndpointService, EndpointProvider, LegacyExtensionManager, Notifications, StateManager, SystemService) {
- try {
- const status = await checkEndpointStatus(endpoint);
-
- if (endpoint.Type !== 4) {
- await updateEndpointStatus(endpoint, status);
- }
- endpoint.Status = status;
-
- if (status === 2) {
- if (!endpoint.Snapshots[0]) {
- throw new Error('Endpoint is unreachable and there is no snapshot available for offline browsing.');
- }
- if (endpoint.Snapshots[0].Swarm) {
- throw new Error('Endpoint is unreachable. Connect to another swarm manager.');
- }
- }
-
- EndpointProvider.setEndpointID(endpoint.Id);
- EndpointProvider.setEndpointPublicURL(endpoint.PublicURL);
- EndpointProvider.setOfflineModeFromStatus(endpoint.Status);
-
- const extensions = await LegacyExtensionManager.initEndpointExtensions(endpoint);
- await StateManager.updateEndpointState(endpoint, extensions);
- } catch (e) {
- Notifications.error('Failed loading endpoint', e);
- $state.go('portainer.home', {}, { reload: true });
- }
-
- async function checkEndpointStatus(endpoint) {
- try {
- await SystemService.ping(endpoint.Id);
- return 1;
- } catch (e) {
- return 2;
- }
- }
-
- async function updateEndpointStatus(endpoint, status) {
- if (endpoint.Status === status) {
+ onEnter: /* @ngInject */ function onEnter(endpoint, $async, $state, EndpointService, EndpointProvider, LegacyExtensionManager, Notifications, StateManager, SystemService) {
+ return $async(async () => {
+ if (![1, 2, 4].includes(endpoint.Type)) {
+ $state.go('portainer.home');
return;
}
- await EndpointService.updateEndpoint(endpoint.Id, { Status: status });
- }
+ try {
+ const status = await checkEndpointStatus(endpoint);
+
+ if (endpoint.Type !== 4) {
+ await updateEndpointStatus(endpoint, status);
+ }
+ endpoint.Status = status;
+
+ if (status === 2) {
+ if (!endpoint.Snapshots[0]) {
+ throw new Error('Endpoint is unreachable and there is no snapshot available for offline browsing.');
+ }
+ if (endpoint.Snapshots[0].Swarm) {
+ throw new Error('Endpoint is unreachable. Connect to another swarm manager.');
+ }
+ }
+
+ EndpointProvider.setEndpointID(endpoint.Id);
+ EndpointProvider.setEndpointPublicURL(endpoint.PublicURL);
+ EndpointProvider.setOfflineModeFromStatus(endpoint.Status);
+
+ const extensions = await LegacyExtensionManager.initEndpointExtensions(endpoint);
+ await StateManager.updateEndpointState(endpoint, extensions);
+ } catch (e) {
+ Notifications.error('Failed loading endpoint', e);
+ $state.go('portainer.home', {}, { reload: true });
+ }
+
+ async function checkEndpointStatus(endpoint) {
+ try {
+ await SystemService.ping(endpoint.Id);
+ return 1;
+ } catch (e) {
+ return 2;
+ }
+ }
+
+ async function updateEndpointStatus(endpoint, status) {
+ if (endpoint.Status === status) {
+ return;
+ }
+ await EndpointService.updateEndpoint(endpoint.Id, { Status: status });
+ }
+ });
},
};
@@ -179,7 +184,7 @@ angular.module('portainer.docker', ['portainer.app']).config([
};
const customTemplates = {
- name: 'portainer.templates.custom',
+ name: 'docker.templates.custom',
url: '/custom',
views: {
@@ -190,7 +195,7 @@ angular.module('portainer.docker', ['portainer.app']).config([
};
const customTemplatesNew = {
- name: 'portainer.templates.custom.new',
+ name: 'docker.templates.custom.new',
url: '/new?fileContent&type',
views: {
@@ -205,7 +210,7 @@ angular.module('portainer.docker', ['portainer.app']).config([
};
const customTemplatesEdit = {
- name: 'portainer.templates.custom.edit',
+ name: 'docker.templates.custom.edit',
url: '/:id',
views: {
diff --git a/app/docker/components/dockerSidebarContent/docker-sidebar-content.js b/app/docker/components/dockerSidebarContent/docker-sidebar-content.js
index 400293ee5..87734c8a2 100644
--- a/app/docker/components/dockerSidebarContent/docker-sidebar-content.js
+++ b/app/docker/components/dockerSidebarContent/docker-sidebar-content.js
@@ -8,5 +8,6 @@ angular.module('portainer.docker').component('dockerSidebarContent', {
offlineMode: '<',
toggle: '<',
currentRouteName: '<',
+ endpointId: '<',
},
});
diff --git a/app/docker/components/dockerSidebarContent/dockerSidebarContent.html b/app/docker/components/dockerSidebarContent/dockerSidebarContent.html
index ea8a47095..15d739ae2 100644
--- a/app/docker/components/dockerSidebarContent/dockerSidebarContent.html
+++ b/app/docker/components/dockerSidebarContent/dockerSidebarContent.html
@@ -1,43 +1,43 @@
diff --git a/app/kubernetes/__module.js b/app/kubernetes/__module.js
index 228f8fc96..6bc5c909a 100644
--- a/app/kubernetes/__module.js
+++ b/app/kubernetes/__module.js
@@ -8,24 +8,30 @@ angular.module('portainer.kubernetes', ['portainer.app']).config([
url: '/kubernetes',
parent: 'endpoint',
abstract: true,
- /* @ngInject */
- async onEnter($state, endpoint, EndpointProvider, KubernetesHealthService, Notifications, StateManager) {
- try {
- if (endpoint.Type === 7) {
- try {
- await KubernetesHealthService.ping();
- endpoint.Status = 1;
- } catch (e) {
- endpoint.Status = 2;
- }
- }
- EndpointProvider.setEndpointID(endpoint.Id);
- await StateManager.updateEndpointState(endpoint, []);
- } catch (e) {
- Notifications.error('Failed loading endpoint', e);
- $state.go('portainer.home', {}, { reload: true });
- }
+ onEnter: /* @ngInject */ function onEnter($async, $state, endpoint, EndpointProvider, KubernetesHealthService, Notifications, StateManager) {
+ return $async(async () => {
+ if (![5, 6, 7].includes(endpoint.Type)) {
+ $state.go('portainer.home');
+ return;
+ }
+ try {
+ if (endpoint.Type === 7) {
+ try {
+ await KubernetesHealthService.ping();
+ endpoint.Status = 1;
+ } catch (e) {
+ endpoint.Status = 2;
+ }
+ }
+
+ EndpointProvider.setEndpointID(endpoint.Id);
+ await StateManager.updateEndpointState(endpoint, []);
+ } catch (e) {
+ Notifications.error('Failed loading endpoint', e);
+ $state.go('portainer.home', {}, { reload: true });
+ }
+ });
},
};
diff --git a/app/kubernetes/components/kubernetes-sidebar-content/kubernetesSidebarContent.html b/app/kubernetes/components/kubernetes-sidebar-content/kubernetesSidebarContent.html
index 354ba3760..bcdf93b7e 100644
--- a/app/kubernetes/components/kubernetes-sidebar-content/kubernetesSidebarContent.html
+++ b/app/kubernetes/components/kubernetes-sidebar-content/kubernetesSidebarContent.html
@@ -1,18 +1,18 @@
diff --git a/app/kubernetes/components/kubernetes-sidebar-content/kubernetesSidebarContent.js b/app/kubernetes/components/kubernetes-sidebar-content/kubernetesSidebarContent.js
index c12568fa7..8b74d4a47 100644
--- a/app/kubernetes/components/kubernetes-sidebar-content/kubernetesSidebarContent.js
+++ b/app/kubernetes/components/kubernetes-sidebar-content/kubernetesSidebarContent.js
@@ -2,5 +2,6 @@ angular.module('portainer.kubernetes').component('kubernetesSidebarContent', {
templateUrl: './kubernetesSidebarContent.html',
bindings: {
adminAccess: '<',
+ endpointId: '<',
},
});
diff --git a/app/portainer/__module.js b/app/portainer/__module.js
index af0d7591a..5f3907272 100644
--- a/app/portainer/__module.js
+++ b/app/portainer/__module.js
@@ -81,8 +81,7 @@ angular.module('portainer.app', []).config([
parent: 'root',
abstract: true,
resolve: {
- /* @ngInject */
- endpoint($async, $state, $transition$, EndpointService, Notifications) {
+ endpoint: /* @ngInject */ function endpoint($async, $state, $transition$, EndpointService, Notifications) {
return $async(async () => {
try {
const endpointId = +$transition$.params().endpointId;
diff --git a/app/portainer/views/sidebar/sidebar.html b/app/portainer/views/sidebar/sidebar.html
index 44c1e0e16..9e7c3c0c2 100644
--- a/app/portainer/views/sidebar/sidebar.html
+++ b/app/portainer/views/sidebar/sidebar.html
@@ -13,9 +13,13 @@
Home
-
+
-
+