mirror of https://github.com/portainer/portainer
feat(app): redirect to home if no endpoint is set (#2601)
* refactor(stacks): set newstack state as a child state of stacks * fix(docker): add check on docker states for endpoint * refactor(app): remove redirect notificationpull/2659/head
parent
86c60807cd
commit
8160fe4717
|
@ -5,7 +5,17 @@ angular.module('portainer.docker', ['portainer.app'])
|
|||
var docker = {
|
||||
name: 'docker',
|
||||
parent: 'root',
|
||||
abstract: true
|
||||
abstract: true,
|
||||
resolve: {
|
||||
endpointID: ['EndpointProvider', '$state',
|
||||
function (EndpointProvider, $state) {
|
||||
var id = EndpointProvider.endpointID();
|
||||
if (!id) {
|
||||
return $state.go('portainer.home');
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
var configs = {
|
||||
|
|
|
@ -327,6 +327,16 @@ angular.module('portainer.app', [])
|
|||
templateUrl: 'app/portainer/views/stacks/stacks.html',
|
||||
controller: 'StacksController'
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
endpointID: ['EndpointProvider', '$state',
|
||||
function (EndpointProvider, $state) {
|
||||
var id = EndpointProvider.endpointID();
|
||||
if (!id) {
|
||||
return $state.go('portainer.home');
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -342,7 +352,7 @@ angular.module('portainer.app', [])
|
|||
};
|
||||
|
||||
var stackCreation = {
|
||||
name: 'portainer.newstack',
|
||||
name: 'portainer.stacks.newstack',
|
||||
url: '/newstack',
|
||||
views: {
|
||||
'content@': {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
|
||||
<i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="portainer.newstack">
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="portainer.stacks.newstack">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add stack
|
||||
</button>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue