]> source.dussan.org Git - archiva.git/commitdiff
Fixing routing for new user module in web app
authorMartin Stockhammer <martin_s@apache.org>
Sun, 29 Nov 2020 20:00:58 +0000 (21:00 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Sun, 29 Nov 2020 20:00:58 +0000 (21:00 +0100)
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app.module.ts
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/shared/shared.module.ts
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/user-routing.module.ts
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/user.module.ts

index 6e13f819d41ef722d5e181492839d4ca0c192b26..877e4ac2ae14459ee7e1e5d890a8100016af9ac3 100644 (file)
  * specific language governing permissions and limitations
  * under the License.
  */
-import { NgModule } from '@angular/core';
-import { Routes, RouterModule } from '@angular/router';
+import {NgModule} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
 
-import { AboutComponent } from './modules/shared/about/about.component';
-import { ContactComponent } from './modules/shared/contact/contact.component';
-import { HomeComponent } from './modules/shared/home/home.component';
-import { NotFoundComponent } from './modules/shared/not-found/not-found.component';
-import { LoginComponent } from "./modules/shared/login/login.component";
-import { SearchComponent } from './modules/repo/search/search.component';
+import {AboutComponent} from './modules/shared/about/about.component';
+import {ContactComponent} from './modules/shared/contact/contact.component';
+import {HomeComponent} from './modules/shared/home/home.component';
+import {NotFoundComponent} from './modules/shared/not-found/not-found.component';
+import {LoginComponent} from "./modules/shared/login/login.component";
+import {SearchComponent} from './modules/repo/search/search.component';
 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 {RoutingGuardService as Guard} from "./services/routing-guard.service";
-import {UserModule} from "./modules/user/user.module";
+import {SecurityConfigurationComponent} from "./modules/user/security-configuration/security-configuration.component";
 
 /**
  * You can use Guard (RoutingGuardService) for permission checking. The service needs data with one parameter 'perm',
@@ -38,38 +37,37 @@ import {UserModule} from "./modules/user/user.module";
  */
 
 const routes: Routes = [
-  { path: '', component: HomeComponent,
-  children: [
-    {path:'repo/search', component: SearchComponent},
-    {path:'repo/browse', component: BrowseComponent},
-    {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: 'roles', component: ManageRolesComponent },
-      { path: 'config', component: SecurityConfigurationComponent},
-    ]
-  },
-  { path: 'contact', component: ContactComponent },
-  { path: 'about', component: AboutComponent },
-  { path: 'login', component: LoginComponent },
-  { path: 'logout', component: HomeComponent },
-  { path: '**', component: NotFoundComponent }
-  ,
-  {
-    path: '',
-    redirectTo: '',
-    pathMatch: 'full'
-  }
+    {
+        path: '', component: HomeComponent,
+        children: [
+            {path: 'repo/search', component: SearchComponent},
+            {path: 'repo/browse', component: BrowseComponent},
+            {path: 'repo/upload', component: UploadComponent},
+            {path: '', redirectTo: 'repo/search', pathMatch: 'full'},
+        ]
+    },
+
+    {
+        path: 'user', component: HomeComponent,canActivate:[Guard],data:{perm: 'menu.user.section'},
+        children: [
+            {path: 'users', loadChildren: () => import('./modules/user/user.module').then(m => m.UserModule)},
+            {path: 'roles', component: ManageRolesComponent},
+            {path: 'config', component: SecurityConfigurationComponent},
+        ]
+    },
+    {path: 'contact', component: ContactComponent},
+    {path: 'about', component: AboutComponent},
+    {path: 'login', component: LoginComponent},
+    {path: 'logout', component: HomeComponent},
+    {path: '**', component: NotFoundComponent}
+
 ];
 
 @NgModule({
-  imports: [RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' }), UserModule],
-  exports: [RouterModule],
-  declarations: []
+    imports: [RouterModule.forRoot(routes)],
+    exports: [RouterModule],
+    declarations: []
 })
-export class AppRoutingModule { }
+export class AppRoutingModule {
+}
 
index 73bfc21c2a8170fae9d7506f4e79db1448d15ad3..91332a4465c54d13ac1def9ff34a35213a345a9b 100644 (file)
@@ -18,8 +18,8 @@
  */
 import {BrowserModule} from '@angular/platform-browser';
 import {NgModule} from '@angular/core';
-import {HttpClientModule} from '@angular/common/http';
-import {MESSAGE_FORMAT_CONFIG} from 'ngx-translate-messageformat-compiler';
+import {HttpClient, HttpClientModule} from '@angular/common/http';
+import {MESSAGE_FORMAT_CONFIG, TranslateMessageFormatCompiler} from 'ngx-translate-messageformat-compiler';
 
 import {AppRoutingModule} from './app-routing.module';
 import {AppComponent} from './app.component';
@@ -37,8 +37,8 @@ import {BrowseComponent} from './modules/repo/browse/browse.component';
 import {UploadComponent} from './modules/repo/upload/upload.component';
 import {SecurityConfigurationComponent} from './modules/user/security-configuration/security-configuration.component';
 import {CoreModule} from "./modules/core/core.module";
-import {SharedModule} from "./modules/shared/shared.module";
-import {UserModule} from "./modules/user/user.module";
+import {httpTranslateLoader, SharedModule} from "./modules/shared/shared.module";
+import {TranslateCompiler, TranslateLoader, TranslateModule} from "@ngx-translate/core";
 
 
 @NgModule({
@@ -58,6 +58,17 @@ import {UserModule} from "./modules/user/user.module";
     SecurityConfigurationComponent,
   ],
   imports: [
+    TranslateModule.forRoot({
+      compiler: {
+        provide: TranslateCompiler,
+        useClass: TranslateMessageFormatCompiler
+      },
+      loader: {
+        provide: TranslateLoader,
+        useFactory: httpTranslateLoader,
+        deps: [HttpClient]
+      }
+    }),
     BrowserModule,
     AppRoutingModule,
     FormsModule,
@@ -65,8 +76,7 @@ import {UserModule} from "./modules/user/user.module";
     HttpClientModule,
 
       CoreModule,
-      SharedModule,
-      UserModule
+      SharedModule
   ],
   providers: [
     { provide: MESSAGE_FORMAT_CONFIG, useValue: { locales: ['en', 'de'] }}
index 93ae0df318258e5152e496a3f556124169655204..cf7ef71f72e742e3a6f93ce9a0544fda913ab803 100644 (file)
@@ -27,7 +27,6 @@ import {TranslateMessageFormatCompiler} from "ngx-translate-messageformat-compil
 import {HttpClient} from "@angular/common/http";
 import {TranslateHttpLoader} from "@ngx-translate/http-loader";
 import {RouterModule} from "@angular/router";
-import {FormsModule} from "@angular/forms";
 
 
 
@@ -52,7 +51,7 @@ import {FormsModule} from "@angular/forms";
       RouterModule,
       NgbPaginationModule,
       NgbTooltipModule,
-    TranslateModule.forRoot({
+    TranslateModule.forChild({
       compiler: {
         provide: TranslateCompiler,
         useClass: TranslateMessageFormatCompiler
index eaada2d6827710b4e79dada6dd2c4100ee570654..bd88f139d5545955c43d5d06d0043030d5ca0262 100644 (file)
@@ -23,6 +23,8 @@ import { ManageUsersListComponent } from './users/manage-users-list/manage-users
 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';
+import {SharedModule} from "../shared/shared.module";
+import {TranslateModule} from "@ngx-translate/core";
 
 
 /**
@@ -31,8 +33,7 @@ import { ManageUsersDeleteComponent } from './users/manage-users-delete/manage-u
  */
 
 const routes: Routes = [
-      { path: 'users', component: ManageUsersComponent,
-        data: { perm: 'menu.user.manage' },
+      { path: '', component: ManageUsersComponent,
         children: [
           {path: 'list', component: ManageUsersListComponent},
           {path: 'add', component: ManageUsersAddComponent},
@@ -45,7 +46,7 @@ const routes: Routes = [
 
 @NgModule({
   imports: [RouterModule.forChild(routes)],
-  exports: [RouterModule],
+  exports: [],
   declarations: []
 })
 export class UserRoutingModule { }
index 5757b3d9ea481fa97ad343d69d57f0409a620aa8..a5cc6edfd11898493cd3992b36ac543a6b736980 100644 (file)
@@ -26,6 +26,8 @@ import {SharedModule} from "../shared/shared.module";
 import {FormsModule, ReactiveFormsModule} from "@angular/forms";
 import {ManageUsersDeleteComponent} from './users/manage-users-delete/manage-users-delete.component';
 import {UserRoutingModule} from "./user-routing.module";
+import {TranslateLoader, TranslateModule } from '@ngx-translate/core';
+import { HttpClient } from '@angular/common/http';
 
 
 @NgModule({
@@ -44,10 +46,10 @@ import {UserRoutingModule} from "./user-routing.module";
     ],
     imports: [
         CommonModule,
-        UserRoutingModule,
         SharedModule,
         FormsModule,
-        ReactiveFormsModule
+        ReactiveFormsModule,
+        UserRoutingModule
     ]
 })
 export class UserModule {