1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 05:19:39 +02:00

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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 245 additions and 316 deletions

View file

@ -6,19 +6,26 @@ angular.module('portainer.kubernetes', ['portainer.app']).config([
const kubernetes = {
name: 'kubernetes',
url: '/kubernetes',
parent: 'root',
parent: 'endpoint',
abstract: true,
resolve: {
endpointID: [
'EndpointProvider',
'$state',
function (EndpointProvider, $state) {
const id = EndpointProvider.endpointID();
if (!id) {
return $state.go('portainer.home');
/* @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 });
}
},
};