diff --git a/app/kubernetes/__module.js b/app/kubernetes/__module.js index 8def97d1b..9ef8d1ee7 100644 --- a/app/kubernetes/__module.js +++ b/app/kubernetes/__module.js @@ -322,8 +322,20 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo }, }; + const endpointKubernetesConfiguration = { + name: 'kubernetes.cluster.setup', + url: '/configure', + views: { + 'content@': { + templateUrl: './views/configure/configure.html', + controller: 'KubernetesConfigureController', + controllerAs: 'ctrl', + }, + }, + }; + const endpointKubernetesSecurityConstraint = { - name: 'portainer.k8sendpoint.securityConstraint', + name: 'kubernetes.cluster.securityConstraint', url: '/securityConstraint', views: { 'content@': { @@ -362,6 +374,7 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo $stateRegistryProvider.register(volume); $stateRegistryProvider.register(registries); $stateRegistryProvider.register(registriesAccess); + $stateRegistryProvider.register(endpointKubernetesConfiguration); $stateRegistryProvider.register(endpointKubernetesSecurityConstraint); }, ]); diff --git a/app/kubernetes/components/kube-services/kube-services-item/kube-services-item.html b/app/kubernetes/components/kube-services/kube-services-item/kube-services-item.html index 43c2cf447..a97c9c32c 100644 --- a/app/kubernetes/components/kube-services/kube-services-item/kube-services-item.html +++ b/app/kubernetes/components/kube-services/kube-services-item/kube-services-item.html @@ -2,7 +2,7 @@

No Load balancer is available in this cluster, click - here to configure load balancer. + here to configure load balancer.

diff --git a/app/kubernetes/components/kube-services/kube-services.html b/app/kubernetes/components/kube-services/kube-services.html index 3aca90531..db03e927e 100644 --- a/app/kubernetes/components/kube-services/kube-services.html +++ b/app/kubernetes/components/kube-services/kube-services.html @@ -56,7 +56,7 @@

Ingress is not configured in this namespace, select another namespace or click - here to configure ingress. + here to configure ingress.

diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html index 5871921cd..71206c3a0 100644 --- a/app/kubernetes/views/applications/create/createApplication.html +++ b/app/kubernetes/views/applications/create/createApplication.html @@ -1033,7 +1033,7 @@

This feature is currently disabled and must be enabled by an administrator user.

Server metrics features must be enabled in the - environment configuration view. + environment configuration view.

diff --git a/app/kubernetes/views/configure/configureController.js b/app/kubernetes/views/configure/configureController.js index 67cd69356..6630de3e7 100644 --- a/app/kubernetes/views/configure/configureController.js +++ b/app/kubernetes/views/configure/configureController.js @@ -269,7 +269,7 @@ class KubernetesConfigureController { actionInProgress: false, displayConfigureClassPanel: {}, viewReady: false, - endpointId: this.$state.params.id, + endpointId: this.$state.params.endpointId, duplicates: { ingressClasses: new KubernetesFormValidationReferences(), }, diff --git a/app/kubernetes/views/resource-pools/create/createResourcePool.html b/app/kubernetes/views/resource-pools/create/createResourcePool.html index fcba354c3..17fca8c44 100644 --- a/app/kubernetes/views/resource-pools/create/createResourcePool.html +++ b/app/kubernetes/views/resource-pools/create/createResourcePool.html @@ -186,8 +186,7 @@
The ingress feature must be enabled in the - environment configuration view to be able to register ingresses inside this - namespace. + environment configuration view to be able to register ingresses inside this namespace.
diff --git a/app/kubernetes/views/resource-pools/edit/resourcePool.html b/app/kubernetes/views/resource-pools/edit/resourcePool.html index f8e5a52de..fc0d91e3e 100644 --- a/app/kubernetes/views/resource-pools/edit/resourcePool.html +++ b/app/kubernetes/views/resource-pools/edit/resourcePool.html @@ -152,8 +152,7 @@
The ingress feature must be enabled in the - environment configuration view to be able to register ingresses inside this - namespace. + environment configuration view to be able to register ingresses inside this namespace.
diff --git a/app/portainer/__module.js b/app/portainer/__module.js index 009d7ffa1..8377350bb 100644 --- a/app/portainer/__module.js +++ b/app/portainer/__module.js @@ -186,23 +186,6 @@ angular }, }; - var k8sendpoint = { - name: 'portainer.k8sendpoint', - url: '/:id', - }; - - const endpointKubernetesConfiguration = { - name: 'portainer.k8sendpoint.kubernetesConfig', - url: '/configure', - views: { - 'content@': { - templateUrl: '../kubernetes/views/configure/configure.html', - controller: 'KubernetesConfigureController', - controllerAs: 'ctrl', - }, - }, - }; - var edgeDeviceCreation = { name: 'portainer.endpoints.newEdgeDevice', url: '/newEdgeDevice', @@ -484,14 +467,12 @@ angular $stateRegistryProvider.register(logout); $stateRegistryProvider.register(endpoints); $stateRegistryProvider.register(endpoint); - $stateRegistryProvider.register(k8sendpoint); $stateRegistryProvider.register(endpointAccess); $stateRegistryProvider.register(endpointKVM); $stateRegistryProvider.register(edgeDeviceCreation); $stateRegistryProvider.register(deviceImport); $stateRegistryProvider.register(addFDOProfile); $stateRegistryProvider.register(editFDOProfile); - $stateRegistryProvider.register(endpointKubernetesConfiguration); $stateRegistryProvider.register(groups); $stateRegistryProvider.register(group); $stateRegistryProvider.register(groupAccess); diff --git a/app/portainer/hooks/useUser.tsx b/app/portainer/hooks/useUser.tsx index a5da2468b..12005f2f4 100644 --- a/app/portainer/hooks/useUser.tsx +++ b/app/portainer/hooks/useUser.tsx @@ -47,6 +47,7 @@ export function useUser() { export function useAuthorizations( authorizations: string | string[], + forceEnvironmentId?: EnvironmentId, adminOnlyCE = false ) { const { user } = useUser(); @@ -58,7 +59,12 @@ export function useAuthorizations( return false; } - return hasAuthorizations(user, authorizations, endpointId, adminOnlyCE); + return hasAuthorizations( + user, + authorizations, + forceEnvironmentId || endpointId, + adminOnlyCE + ); } export function isEnvironmentAdmin( @@ -114,15 +120,21 @@ export function hasAuthorizations( interface AuthorizedProps { authorizations: string | string[]; + environmentId?: EnvironmentId; adminOnlyCE?: boolean; } export function Authorized({ authorizations, + environmentId, adminOnlyCE = false, children, }: PropsWithChildren) { - const isAllowed = useAuthorizations(authorizations, adminOnlyCE); + const isAllowed = useAuthorizations( + authorizations, + environmentId, + adminOnlyCE + ); return isAllowed ? <>{children} : null; } diff --git a/app/portainer/views/endpoints/create/createEndpointController.js b/app/portainer/views/endpoints/create/createEndpointController.js index 2adb30fea..840a4ea12 100644 --- a/app/portainer/views/endpoints/create/createEndpointController.js +++ b/app/portainer/views/endpoints/create/createEndpointController.js @@ -168,7 +168,7 @@ angular EndpointService.createLocalKubernetesEndpoint(name, tagIds) .then(function success(result) { Notifications.success('Environment created', name); - $state.go('portainer.k8sendpoint.kubernetesConfig', { id: result.Id }); + $state.go('kubernetes.cluster.setup', { endpoinId: result.Id }); }) .catch(function error(err) { Notifications.error('Failure', err, 'Unable to create environment'); @@ -282,7 +282,7 @@ angular $state.go('portainer.endpoints.endpoint', { id: endpoint.Id }); break; case PortainerEndpointTypes.AgentOnKubernetesEnvironment: - $state.go('portainer.k8sendpoint.kubernetesConfig', { id: endpoint.Id }); + $state.go('kubernetes.cluster.setup', { endpoinId: endpoint.Id }); break; default: $state.go('portainer.endpoints', {}, { reload: true }); diff --git a/app/portainer/views/endpoints/edit/endpoint.html b/app/portainer/views/endpoints/edit/endpoint.html index 53ebad509..7775d9fdd 100644 --- a/app/portainer/views/endpoints/edit/endpoint.html +++ b/app/portainer/views/endpoints/edit/endpoint.html @@ -79,7 +79,7 @@ You should configure the features available in this Kubernetes environment in the - Kubernetes configuration view. + Kubernetes configuration view. diff --git a/app/portainer/views/init/endpoint/initEndpointController.js b/app/portainer/views/init/endpoint/initEndpointController.js index 610ef467a..ee7f086d0 100644 --- a/app/portainer/views/init/endpoint/initEndpointController.js +++ b/app/portainer/views/init/endpoint/initEndpointController.js @@ -94,7 +94,7 @@ class InitEndpointController { try { this.state.actionInProgress = true; const endpoint = await this.EndpointService.createLocalKubernetesEndpoint(); - this.$state.go('portainer.k8sendpoint.kubernetesConfig', { id: endpoint.Id }); + this.$state.go('kubernetes.cluster.setup', { endpointId: endpoint.Id }); } catch (err) { this.Notifications.error('Failure', err, 'Unable to connect to the Kubernetes environment'); } finally { @@ -130,8 +130,8 @@ class InitEndpointController { null, null ); - const routeName = endpoint.Type === PortainerEndpointTypes.AgentOnKubernetesEnvironment ? 'portainer.k8sendpoint.kubernetesConfig' : 'portainer.home'; - this.$state.go(routeName, { id: endpoint.Id }); + const routeName = endpoint.Type === PortainerEndpointTypes.AgentOnKubernetesEnvironment ? 'kubernetes.cluster.setup' : 'portainer.home'; + this.$state.go(routeName, { endpointId: endpoint.Id }); } catch (err) { this.Notifications.error('Failure', err, 'Unable to connect to the Docker environment'); } finally { diff --git a/app/react/sidebar/DockerSidebar.tsx b/app/react/sidebar/DockerSidebar.tsx index bf4ad0333..90f5c31e6 100644 --- a/app/react/sidebar/DockerSidebar.tsx +++ b/app/react/sidebar/DockerSidebar.tsx @@ -180,6 +180,7 @@ export function DockerSidebar({ environmentId, environment }: Props) { - + - + - +