1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 05:15:25 +02:00

feat(app/kubernetes): Popout kubectl shell into new window [r8s-307] (#922)

This commit is contained in:
James Player 2025-07-25 15:24:32 +12:00 committed by GitHub
parent e7d97d7a2b
commit 7bcb37c761
10 changed files with 677 additions and 158 deletions

View file

@ -83,6 +83,13 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo
});
}
// EE-5842: do not redirect shell views when the env is removed
const nextTransition = $state.transition && $state.transition.to();
const nextTransitionName = nextTransition ? nextTransition.name : '';
if (nextTransitionName === 'kubernetes.kubectlshell' && !endpoint) {
return;
}
const kubeTypes = [
PortainerEndpointTypes.KubernetesLocalEnvironment,
PortainerEndpointTypes.AgentOnKubernetesEnvironment,
@ -120,6 +127,11 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo
EndpointProvider.clean();
Notifications.error('Failed loading environment', e);
}
// Prevent redirect to home for shell views when environment is unreachable
// Show toast error instead (handled above in Notifications.error)
if (nextTransitionName === 'kubernetes.kubectlshell') {
return;
}
$state.go('portainer.home', params, { reload: true, inherit: false });
return false;
}
@ -424,6 +436,17 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo
},
};
const kubectlShell = {
name: 'kubernetes.kubectlshell',
url: '/kubectl-shell',
views: {
'content@': {
component: 'kubectlShellView',
},
'sidebar@': {},
},
};
const dashboard = {
name: 'kubernetes.dashboard',
url: '/dashboard',
@ -657,6 +680,7 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo
$stateRegistryProvider.register(deploy);
$stateRegistryProvider.register(node);
$stateRegistryProvider.register(nodeStats);
$stateRegistryProvider.register(kubectlShell);
$stateRegistryProvider.register(resourcePools);
$stateRegistryProvider.register(namespaceCreation);
$stateRegistryProvider.register(resourcePool);