105 lines
2.8 KiB
TypeScript
105 lines
2.8 KiB
TypeScript
import { Routes } from '@angular/router';
|
|
import { userGuard } from './shared/guards/user.guard';
|
|
import { collaborationNetworkResolver } from './resolvers/collaboration-network.resolver';
|
|
|
|
export const routes: Routes = [
|
|
{
|
|
path: 'login',
|
|
loadComponent: () =>
|
|
import('./modules/app-login/app-login.component').then(
|
|
(mod) => mod.AppLoginComponent,
|
|
),
|
|
},
|
|
{
|
|
path: 'dashboard',
|
|
canActivate: [userGuard],
|
|
loadComponent: () =>
|
|
import('./modules/dashboard/dashboard.component').then(
|
|
(mod) => mod.DashboardComponent,
|
|
),
|
|
},
|
|
{
|
|
path: 'persons',
|
|
canActivate: [userGuard],
|
|
loadComponent: () =>
|
|
import('./modules/person-list/person-list.component').then(
|
|
(mod) => mod.PersonListComponent,
|
|
),
|
|
},
|
|
{
|
|
path: 'publication/:publicationId',
|
|
canActivate: [userGuard],
|
|
loadComponent: () =>
|
|
import('./modules/publication-detail/publication-detail.component').then(
|
|
(mod) => mod.PublicationDetailComponent,
|
|
),
|
|
},
|
|
{
|
|
path: 'person/:id',
|
|
canActivate: [userGuard],
|
|
loadComponent: () =>
|
|
import('./modules/person/person.component').then(
|
|
(mod) => mod.PersonComponent,
|
|
),
|
|
children: [
|
|
{
|
|
path: '',
|
|
pathMatch: 'full',
|
|
redirectTo: 'overview',
|
|
},
|
|
{
|
|
path: 'overview',
|
|
loadComponent: () =>
|
|
import('./modules/person-overview/person-overview.component').then(
|
|
(mod) => mod.PersonOverviewComponent,
|
|
),
|
|
},
|
|
{
|
|
path: 'network',
|
|
loadComponent: () =>
|
|
import('./modules/person-network/person-network.component').then(
|
|
(mod) => mod.PersonNetworkComponent,
|
|
),
|
|
resolve: {
|
|
collaborationNetwork: collaborationNetworkResolver,
|
|
},
|
|
runGuardsAndResolvers: (to, from) => {
|
|
// No need to re-run for different table view or search term
|
|
const keys = [
|
|
'start_year',
|
|
'end_year',
|
|
'minimum_collaborators',
|
|
'maximum_collaborators',
|
|
'minimum_collaborations',
|
|
'maximum_collaborations',
|
|
'institutions',
|
|
'topics',
|
|
];
|
|
|
|
return keys.some(
|
|
(key) => to.queryParamMap.get(key) !== from.queryParamMap.get(key),
|
|
);
|
|
},
|
|
},
|
|
{
|
|
path: 'publications',
|
|
loadComponent: () =>
|
|
import('./modules/person-publications/person-publications.component').then(
|
|
(mod) => mod.PersonPublicationsComponent,
|
|
),
|
|
},
|
|
{
|
|
path: 'funding',
|
|
loadComponent: () =>
|
|
import('./modules/person-funding/person-funding.component').then(
|
|
(mod) => mod.PersonFundingComponent,
|
|
),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: '**',
|
|
redirectTo: 'login',
|
|
},
|
|
];
|