From: Martin Stockhammer Date: Sun, 29 Nov 2020 17:57:56 +0000 (+0100) Subject: Moving route to user module X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fb912956ab82f78aec230d78328296630217267b;p=archiva.git Moving route to user module --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts index 3a7666531..e6fef5e28 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts @@ -29,13 +29,8 @@ import {BrowseComponent} from "./modules/repo/browse/browse.component"; import {UploadComponent} from "./modules/repo/upload/upload.component"; import {ManageRolesComponent} from "./modules/user/manage-roles/manage-roles.component"; import {SecurityConfigurationComponent} from "./modules/user/security-configuration/security-configuration.component"; -import {ManageUsersListComponent} from "./modules/user/users/manage-users-list/manage-users-list.component"; -import {ManageUsersAddComponent} from "./modules/user/users/manage-users-add/manage-users-add.component"; -import {ManageUsersEditComponent} from "./modules/user/users/manage-users-edit/manage-users-edit.component"; import {RoutingGuardService as Guard} from "./services/routing-guard.service"; -import {ManageUsersDeleteComponent} from "./modules/user/users/manage-users-delete/manage-users-delete.component"; import {UserModule} from "./modules/user/user.module"; -import { ManageUsersComponent } from './modules/user/users/manage-users/manage-users.component'; /** * You can use Guard (RoutingGuardService) for permission checking. The service needs data with one parameter 'perm', @@ -50,19 +45,10 @@ const routes: Routes = [ {path:'repo/upload', component: UploadComponent}, {path:'', redirectTo:'repo/search', pathMatch:'full'}, ]}, + { path: 'users', loadChildren: () => import('./modules/user/user.module').then(m => m.UserModule) + }, { path: 'user', component: HomeComponent,canActivate:[Guard],data:{perm: 'menu.user.section'}, children: [ - { path: 'users', component: ManageUsersComponent,canActivate:[Guard], - data: { perm: 'menu.user.manage' }, - children: [ - {path: 'list', component: ManageUsersListComponent}, - {path: 'add', component: ManageUsersAddComponent}, - {path: 'edit/:userid', component: ManageUsersEditComponent}, - {path: 'edit', redirectTo:'edit/guest' }, - {path: 'delete/:userid', component: ManageUsersDeleteComponent}, - {path: '', redirectTo:'list', pathMatch:'full'} - ] - }, { path: 'roles', component: ManageRolesComponent }, { path: 'config', component: SecurityConfigurationComponent}, ] @@ -72,10 +58,16 @@ const routes: Routes = [ { path: 'login', component: LoginComponent }, { path: 'logout', component: HomeComponent }, { path: '**', component: NotFoundComponent } + , + { + path: '', + redirectTo: '', + pathMatch: 'full' + } ]; @NgModule({ - imports: [RouterModule.forRoot(routes)], + imports: [RouterModule.forRoot(routes), UserModule], exports: [RouterModule], declarations: [] }) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/user-routing.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/user-routing.module.ts new file mode 100644 index 000000000..eaada2d68 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/user-routing.module.ts @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { ManageUsersComponent } from './users/manage-users/manage-users.component'; +import { ManageUsersListComponent } from './users/manage-users-list/manage-users-list.component'; +import { ManageUsersAddComponent } from './users/manage-users-add/manage-users-add.component'; +import { ManageUsersEditComponent } from './users/manage-users-edit/manage-users-edit.component'; +import { ManageUsersDeleteComponent } from './users/manage-users-delete/manage-users-delete.component'; + + +/** + * You can use Guard (RoutingGuardService) for permission checking. The service needs data with one parameter 'perm', + * that gives the path of the uiPermission map of the user service. + */ + +const routes: Routes = [ + { path: 'users', component: ManageUsersComponent, + data: { perm: 'menu.user.manage' }, + children: [ + {path: 'list', component: ManageUsersListComponent}, + {path: 'add', component: ManageUsersAddComponent}, + {path: 'edit/:userid', component: ManageUsersEditComponent}, + {path: 'edit', redirectTo:'edit/guest' }, + {path: 'delete/:userid', component: ManageUsersDeleteComponent}, + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], + declarations: [] +}) +export class UserRoutingModule { } + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/user.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/user.module.ts index 1e9cc5197..5757b3d9e 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/user.module.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/user.module.ts @@ -16,37 +16,39 @@ * under the License. */ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; import {ManageUsersComponent} from "./users/manage-users/manage-users.component"; import {ManageUsersListComponent} from "./users/manage-users-list/manage-users-list.component"; import {ManageUsersAddComponent} from "./users/manage-users-add/manage-users-add.component"; import {ManageUsersEditComponent} from "./users/manage-users-edit/manage-users-edit.component"; import {SharedModule} from "../shared/shared.module"; import {FormsModule, ReactiveFormsModule} from "@angular/forms"; -import { ManageUsersDeleteComponent } from './users/manage-users-delete/manage-users-delete.component'; - +import {ManageUsersDeleteComponent} from './users/manage-users-delete/manage-users-delete.component'; +import {UserRoutingModule} from "./user-routing.module"; @NgModule({ - declarations: [ - ManageUsersComponent, - ManageUsersListComponent, - ManageUsersAddComponent, - ManageUsersEditComponent, - ManageUsersDeleteComponent - ], - exports: [ - ManageUsersComponent, - ManageUsersListComponent, - ManageUsersAddComponent, - ManageUsersEditComponent - ], - imports: [ - CommonModule, - SharedModule, - FormsModule, - ReactiveFormsModule - ] + declarations: [ + ManageUsersComponent, + ManageUsersListComponent, + ManageUsersAddComponent, + ManageUsersEditComponent, + ManageUsersDeleteComponent + ], + exports: [ + ManageUsersComponent, + ManageUsersListComponent, + ManageUsersAddComponent, + ManageUsersEditComponent + ], + imports: [ + CommonModule, + UserRoutingModule, + SharedModule, + FormsModule, + ReactiveFormsModule + ] }) -export class UserModule { } +export class UserModule { +}