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

fix(app): use deps injection in router correctly (#4049)

* fix(app): use deps injection in router correctly

* feat(app): guard against using wrong endpoint type

* feat(sidebar): supply endpoint id

* feat(templates): move custom templates to docker
This commit is contained in:
Chaim Lev-Ari 2020-07-21 00:06:37 +03:00 committed by GitHub
parent 66a3104805
commit 4b97cf738e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 135 additions and 101 deletions

View file

@ -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 });
}
});
},
};