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

fix cluster setup page route (#6020)

This commit is contained in:
Richard Wei 2021-11-08 14:32:36 +13:00 committed by GitHub
parent ebfabe6c47
commit af0d637414
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 403 additions and 389 deletions

View file

@ -28,7 +28,13 @@
Namespaces
</sidebar-menu-item>
<sidebar-menu-item path="kubernetes.templates.helm" path-params="{ endpointId: $ctrl.endpointId }" icon-class="fa-dharmachakra fa-fw" class-name="sidebar-list" data-cy="k8sSidebar-helm">
<sidebar-menu-item
path="kubernetes.templates.helm"
path-params="{ endpointId: $ctrl.endpointId }"
icon-class="fa-dharmachakra fa-fw"
class-name="sidebar-list"
data-cy="k8sSidebar-helm"
>
Helm
</sidebar-menu-item>
@ -62,12 +68,12 @@
path="kubernetes.cluster"
path-params="{ endpointId: $ctrl.endpointId }"
is-sidebar-open="$ctrl.isSidebarOpen"
children-paths="['kubernetes.cluster', 'portainer.endpoints.endpoint.kubernetesConfig', 'kubernetes.registries', 'kubernetes.registries.access']"
children-paths="['kubernetes.cluster', 'portainer.k8sendpoint.kubernetesConfig', 'kubernetes.registries', 'kubernetes.registries.access']"
>
<div ng-if="$ctrl.adminAccess">
<sidebar-menu-item
authorization="K8sClusterSetupRW"
path="portainer.endpoints.endpoint.kubernetesConfig"
path="portainer.k8sendpoint.kubernetesConfig"
path-params="{ id: $ctrl.endpointId }"
class-name="sidebar-sublist"
data-cy="k8sSidebar-setup"

View file

@ -1007,7 +1007,7 @@
</p>
<p ng-if="ctrl.isAdmin">
Server metrics features must be enabled in the
<a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: ctrl.endpoint.Id})" class="ctrl.isAdmin">environment configuration view</a>.
<a ui-sref="portainer.k8sendpoint.kubernetesConfig({id: ctrl.endpoint.Id})" class="ctrl.isAdmin">environment configuration view</a>.
</p>
</div>
</div>

View file

@ -1,4 +1,4 @@
<kubernetes-view-header title="Kubernetes features configuration" state="portainer.endpoints.endpoint.kubernetesConfig" view-ready="ctrl.state.viewReady">
<kubernetes-view-header title="Kubernetes features configuration" state="portainer.k8sendpoint.kubernetesConfig" view-ready="ctrl.state.viewReady">
<a ui-sref="portainer.endpoints">Environment</a> &gt; <a ui-sref="portainer.endpoints.endpoint({id: ctrl.endpoint.Id})">{{ ctrl.endpoint.Name }}</a> &gt; Kubernetes configuration
</kubernetes-view-header>

View file

@ -210,8 +210,8 @@
<div class="form-group" ng-if="$ctrl.formValues.IngressClasses.length === 0">
<div class="col-sm-12 small text-muted">
The ingress feature must be enabled in the
<a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: $ctrl.endpoint.Id})">environment configuration view</a> to be able to register ingresses inside
this namespace.
<a ui-sref="portainer.k8sendpoint.kubernetesConfig({id: $ctrl.endpoint.Id})">environment configuration view</a> to be able to register ingresses inside this
namespace.
</div>
</div>

View file

@ -164,8 +164,8 @@
<div class="form-group" ng-if="ctrl.formValues.IngressClasses.length === 0">
<div class="col-sm-12 small text-muted">
The ingress feature must be enabled in the
<a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: ctrl.endpoint.Id})">environment configuration view</a> to be able to register ingresses inside
this namespace.
<a ui-sref="portainer.k8sendpoint.kubernetesConfig({id: ctrl.endpoint.Id})">environment configuration view</a> to be able to register ingresses inside this
namespace.
</div>
</div>

View file

@ -21,7 +21,9 @@ async function initAuthentication(authManager, Authentication, $rootScope, $stat
return await Authentication.init();
}
angular.module('portainer.app', ['portainer.oauth', 'portainer.rbac', componentsModule, settingsModule, featureFlagModule, userActivityModule, 'portainer.shared.datatable']).config([
angular
.module('portainer.app', ['portainer.oauth', 'portainer.rbac', componentsModule, settingsModule, featureFlagModule, userActivityModule, 'portainer.shared.datatable'])
.config([
'$stateRegistryProvider',
function ($stateRegistryProvider) {
'use strict';
@ -167,8 +169,13 @@ angular.module('portainer.app', ['portainer.oauth', 'portainer.rbac', components
},
};
var k8sendpoint = {
name: 'portainer.k8sendpoint',
url: '/:id',
};
const endpointKubernetesConfiguration = {
name: 'portainer.endpoints.endpoint.kubernetesConfig',
name: 'portainer.k8sendpoint.kubernetesConfig',
url: '/configure',
views: {
'content@': {
@ -426,6 +433,7 @@ angular.module('portainer.app', ['portainer.oauth', 'portainer.rbac', components
$stateRegistryProvider.register(logout);
$stateRegistryProvider.register(endpoints);
$stateRegistryProvider.register(endpoint);
$stateRegistryProvider.register(k8sendpoint);
$stateRegistryProvider.register(endpointAccess);
$stateRegistryProvider.register(endpointCreation);
$stateRegistryProvider.register(endpointKubernetesConfiguration);
@ -450,7 +458,7 @@ angular.module('portainer.app', ['portainer.oauth', 'portainer.rbac', components
$stateRegistryProvider.register(teams);
$stateRegistryProvider.register(team);
},
]);
]);
function isTransitionRequiresAuthentication(transition) {
const UNAUTHENTICATED_ROUTES = ['portainer.logout', 'portainer.auth'];

View file

@ -164,7 +164,7 @@ angular
EndpointService.createLocalKubernetesEndpoint(name, tagIds)
.then(function success(result) {
Notifications.success('Environment created', name);
$state.go('portainer.endpoints.endpoint.kubernetesConfig', { id: result.Id });
$state.go('portainer.k8sendpoint.kubernetesConfig', { id: result.Id });
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to create environment');
@ -263,7 +263,7 @@ angular
$state.go('portainer.endpoints.endpoint', { id: endpoint.Id });
break;
case PortainerEndpointTypes.AgentOnKubernetesEnvironment:
$state.go('portainer.endpoints.endpoint.kubernetesConfig', { id: endpoint.Id });
$state.go('portainer.k8sendpoint.kubernetesConfig', { id: endpoint.Id });
break;
default:
$state.go('portainer.endpoints', {}, { reload: true });

View file

@ -104,7 +104,7 @@
<span class="small text-muted">
<i class="fa fa-tools blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
You should configure the features available in this Kubernetes environment in the
<a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: endpoint.Id})">Kubernetes configuration</a> view.
<a ui-sref="portainer.k8sendpoint.kubernetesConfig({id: endpoint.Id})">Kubernetes configuration</a> view.
</span>
</information-panel>
</div>

View file

@ -95,7 +95,7 @@ class InitEndpointController {
try {
this.state.actionInProgress = true;
const endpoint = await this.EndpointService.createLocalKubernetesEndpoint();
this.$state.go('portainer.endpoints.endpoint.kubernetesConfig', { id: endpoint.Id });
this.$state.go('portainer.k8sendpoint.kubernetesConfig', { id: endpoint.Id });
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to connect to the Kubernetes environment');
} finally {
@ -131,7 +131,7 @@ class InitEndpointController {
null,
null
);
const routeName = endpoint.Type === PortainerEndpointTypes.AgentOnKubernetesEnvironment ? 'portainer.endpoints.endpoint.kubernetesConfig' : 'portainer.home';
const routeName = endpoint.Type === PortainerEndpointTypes.AgentOnKubernetesEnvironment ? 'portainer.k8sendpoint.kubernetesConfig' : 'portainer.home';
this.$state.go(routeName, { id: endpoint.Id });
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to connect to the Docker environment');