refactor(router): show endpoint id in url (#3966)

* refactor(module): provide basic endpoint id url

* fix(stacks): fix route to include endpointId

* fix(stacks): fix stacks urls

* fix(sidebar): fix urls to docker routes

* refactor(app): set endpoint id on change view

* refactor(dashboard): revert to old version

* refactor(sidebar): revert file

* feat(app): wip load endpoint on route change

* feat(home): show error

* feat(app): load endpoint route

* feat(sidebar): show endpoint per provider

* refactor(app): revert

* refactor(app): clean endpoint startup

* feat(edge): check for edge k8s

* refactor(endpoints): move all modules under endpoint route

* refactor(stacks): move stacks route to docker

* refactor(templates): move templates route to docker

* refactor(app): check endpoint when entering docker module

* fix(app): load endpoint when entering endpoints modules

* feat(azure): check endpoint

* feat(kubernetes): check endpoint

* feat(home): show loading state when loading edge

* style(app): revert small changes

* refactor(sidebar): remove refernce to endpointId

* fix(stacks): fix stacks route

* style(docker): sort routes

* feat(app): change route to home if endpoint failed

* fix(services): guard against empty snapshots

* feat(app): show error when failed to load endpoint

* feat(app): reload home route when failing

* refactor(router): replace resolvers with onEnter
This commit is contained in:
Chaim Lev-Ari
2020-07-14 23:46:38 +03:00
committed by GitHub
parent 1b3e2c8f69
commit 3c34fbd8f2
20 changed files with 245 additions and 316 deletions

View File

@@ -14,7 +14,6 @@ angular
FormValidator,
ResourceControlService,
FormHelper,
EndpointProvider,
CustomTemplateService
) {
$scope.formValues = {
@@ -60,7 +59,7 @@ angular
function createSwarmStack(name, method) {
var env = FormHelper.removeInvalidEnvVars($scope.formValues.Env);
var endpointId = EndpointProvider.endpointID();
const endpointId = +$state.params.endpointId;
if (method === 'template' || method === 'editor') {
var stackFileContent = $scope.formValues.StackFileContent;
@@ -87,7 +86,7 @@ angular
function createComposeStack(name, method) {
var env = FormHelper.removeInvalidEnvVars($scope.formValues.Env);
var endpointId = EndpointProvider.endpointID();
const endpointId = +$state.params.endpointId;
if (method === 'editor' || method === 'template') {
var stackFileContent = $scope.formValues.StackFileContent;
@@ -142,7 +141,7 @@ angular
})
.then(function success() {
Notifications.success('Stack successfully deployed');
$state.go('portainer.stacks');
$state.go('docker.stacks');
})
.catch(function error(err) {
Notifications.error('Deployment error', err, 'Unable to deploy stack');