From 8f32d58fae28de0c6b3fb3985890405117f16d7f Mon Sep 17 00:00:00 2001 From: linquize Date: Thu, 14 Feb 2019 07:08:46 +0800 Subject: [PATCH] fix(templates): redirect to home if endpoint not yet selected #2709 (#2710) --- app/portainer/__module.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/portainer/__module.js b/app/portainer/__module.js index 129c6b4b2..d3cb2b46c 100644 --- a/app/portainer/__module.js +++ b/app/portainer/__module.js @@ -457,6 +457,16 @@ angular.module('portainer.app', []) var templates = { name: 'portainer.templates', url: '/templates', + resolve: { + endpointID: ['EndpointProvider', '$state', + function (EndpointProvider, $state) { + var id = EndpointProvider.endpointID(); + if (!id) { + return $state.go('portainer.home'); + } + } + ] + }, views: { 'content@': { templateUrl: 'app/portainer/views/templates/templates.html',