All files / src/app app-routing.module.ts

17.64% Statements 3/17
100% Branches 0/0
0% Functions 0/14
20% Lines 2/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129                                              1x                                                                                                                                                                                                               1x  
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AppRootComponent } from './app-root/app-root.component';
import { LoginComponent } from './app-root/login/login.component';
import { SysCheckStarterComponent } from './app-root/sys-check-starter/sys-check-starter.component';
import { CodeInputComponent } from './app-root/code-input/code-input.component';
import {
  AdminComponentActivateGuard,
  AdminOrSuperAdminComponentActivateGuard,
  CodeInputComponentActivateGuard,
  DirectLoginActivateGuard,
  GroupMonitorActivateGuard,
  RouteDispatcherActivateGuard,
  StarterActivateGuard,
  StudyMonitorActivateGuard,
  SuperAdminComponentActivateGuard,
  TestComponentActivateGuard
} from './app-route-guards';
import { RouteDispatcherComponent } from './app-root/route-dispatcher/route-dispatcher.component';
import { LegalNoticeComponent } from './app-root/legal-notice/legal-notice.component';
import { AppModuleSettings } from './app.interfaces';
import { StarterComponent } from './app-root/starter/starter.component';
 
const routes: Routes = [
  {
    path: '',
    redirectTo: 'r/route-dispatcher',
    pathMatch: 'full'
  },
  {
    path: 'r',
    component: AppRootComponent,
    children: [
      {
        path: '',
        redirectTo: 'route-dispatcher',
        pathMatch: 'full'
      },
      {
        path: 'login',
        redirectTo: 'route-dispatcher',
        pathMatch: 'full'
      },
      {
        path: 'login/:returnTo',
        component: LoginComponent
      },
      {
        path: 'check-starter',
        component: SysCheckStarterComponent
      },
      {
        path: 'route-dispatcher',
        component: RouteDispatcherComponent,
        canActivate: [RouteDispatcherActivateGuard]
      },
      {
        path: 'code-input',
        component: CodeInputComponent,
        canActivate: [CodeInputComponentActivateGuard]
      },
      {
        path: 'starter',
        component: StarterComponent,
        canActivate: [StarterActivateGuard]
      }
    ]
  },
  {
    path: 'legal-notice',
    component: LegalNoticeComponent
  },
  {
    path: 'check',
    loadChildren: () => import('./sys-check/sys-check.module').then(module => module.SysCheckModule)
  },
  {
    path: 'admin',
    loadChildren: () => import('./workspace-admin/workspace.module').then(module => module.WorkspaceModule),
    canActivate: [AdminComponentActivateGuard]
  },
  {
    path: 'superadmin',
    loadChildren: () => import('./superadmin/superadmin.module').then(module => module.SuperadminModule),
    canActivate: [SuperAdminComponentActivateGuard]
  },
  {
    path: 'gm',
    loadChildren: () => import('./group-monitor/group-monitor.module').then(module => module.GroupMonitorModule),
    canActivate: [GroupMonitorActivateGuard]
  },
  {
    path: 'sm',
    loadChildren: () => import('./study-monitor/study-monitor.module').then(module => module.StudyMonitorModule),
    canActivate: [StudyMonitorActivateGuard]
  },
  {
    path: 'am',
    loadChildren: () => import('./attachment-manager/attachment-manager.module')
      .then(module => module.AttachmentManagerModule)
    // canActivate: [GroupMonitorActivateGuard]
  },
  {
    path: 't',
    loadChildren: () => import('./test-controller/test-controller.module').then(module => module.TestControllerModule),
    canActivate: [TestComponentActivateGuard],
    data: <AppModuleSettings>{
      httpRetryPolicy: 'test',
      disableGlobalErrorDisplay: true // because test-controller module has its own error display
    }
  },
  {
    path: '**',
    component: RouteDispatcherComponent,
    canActivate: [DirectLoginActivateGuard]
  }
];
 
@NgModule({
  imports: [RouterModule.forRoot(routes, {})],
  exports: [RouterModule],
  providers: [RouteDispatcherActivateGuard, DirectLoginActivateGuard,
    CodeInputComponentActivateGuard, AdminComponentActivateGuard,
    SuperAdminComponentActivateGuard, TestComponentActivateGuard,
    AdminOrSuperAdminComponentActivateGuard
  ]
})
export class AppRoutingModule { }