2020-11-23 13:28:46 +01:00
|
|
|
import {NgModule} from '@angular/core';
|
2022-02-18 15:58:47 +01:00
|
|
|
import {Router, RouterModule, Routes} from '@angular/router';
|
2020-11-23 13:28:46 +01:00
|
|
|
import {OpenaireErrorPageComponent} from './error/errorPage.component';
|
2022-02-18 15:58:47 +01:00
|
|
|
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
|
2019-05-23 15:38:44 +02:00
|
|
|
|
|
|
|
const routes: Routes = [
|
2021-07-14 13:47:56 +02:00
|
|
|
{path: '', loadChildren: () => import('./home/home.module').then(m => m.HomeModule)},
|
2020-11-23 13:28:46 +01:00
|
|
|
{
|
|
|
|
path: 'search/result',
|
2022-05-03 15:53:37 +02:00
|
|
|
loadChildren: () => import('./landingPages/result/libResult.module').then(m => m.LibResultModule), data: { showHeader: true}
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/publication',
|
2022-05-03 15:53:37 +02:00
|
|
|
loadChildren: () => import('./landingPages/publication/libPublication.module').then(m => m.LibPublicationModule), data: { showHeader: true}
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/dataset',
|
2022-05-03 15:53:37 +02:00
|
|
|
loadChildren: () => import('./landingPages/dataset/libDataset.module').then(m => m.LibDatasetModule), data: { showHeader: true}
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/software',
|
2022-05-03 15:53:37 +02:00
|
|
|
loadChildren: () => import('./landingPages/software/libSoftware.module').then(m => m.LibSoftwareModule), data: { showHeader: true}
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/other',
|
2022-05-03 15:53:37 +02:00
|
|
|
loadChildren: () => import('./landingPages/orp/libOrp.module').then(m => m.LibOrpModule), data: { showHeader: true}
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/project',
|
2022-05-03 15:53:37 +02:00
|
|
|
loadChildren: () => import('./landingPages/project/libProject.module').then(m => m.LibProjectModule), data: { showHeader: true}
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/dataprovider',
|
2022-05-03 15:53:37 +02:00
|
|
|
loadChildren: () => import('./landingPages/dataProvider/libDataProvider.module').then(m => m.LibDataProviderModule), data: { showHeader: true}
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/organization',
|
2022-05-03 15:53:37 +02:00
|
|
|
loadChildren: () => import('./landingPages/organization/libOrganization.module').then(m => m.LibOrganizationModule), data: { showHeader: true}
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/find',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./searchPages/find/libSearch.module').then(m => m.LibMainSearchModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/find/research-outcomes',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./searchPages/simple/searchResearchResults.module').then(m => m.OpenaireSearchResearchResultsModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/find/projects',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./searchPages/simple/searchProjects.module').then(m => m.LibSearchProjectsModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/find/dataproviders',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./searchPages/simple/searchDataProviders.module').then(m => m.LibSearchDataProvidersModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/find/organizations',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./searchPages/simple/searchOrganizations.module').then(m => m.LibSearchOrganizationsModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/advanced/research-outcomes',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./searchPages/advanced/searchResearchResults.module').then(m => m.OpenaireAdvancedSearchResearchResultsModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/advanced/organizations',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./searchPages/advanced/advancedSearchOrganizations.module').then(m => m.LibAdvancedSearchOrganizationsModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/advanced/dataproviders',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./searchPages/advanced/advancedSearchDataProviders.module').then(m => m.LibAdvancedSearchDataProvidersModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'search/advanced/projects',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./searchPages/advanced/advancedSearchProjects.module').then(m => m.LibAdvancedSearchProjectsModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'project-report',
|
2021-07-14 13:47:56 +02:00
|
|
|
loadChildren: () => import('./landingPages/htmlProjectReport/libHtmlProjectReport.module').then(m => m.LibHtmlProjectReportModule)
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
2022-02-18 15:58:47 +01:00
|
|
|
|
2021-07-14 13:47:56 +02:00
|
|
|
{path: 'user-info', loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule)},
|
2020-11-23 13:28:46 +01:00
|
|
|
{path: 'error', component: OpenaireErrorPageComponent},
|
|
|
|
{path: '**', pathMatch: 'full', component: OpenaireErrorPageComponent}
|
2019-05-23 15:38:44 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
@NgModule({
|
2021-04-21 14:36:46 +02:00
|
|
|
imports: [RouterModule.forRoot(routes, {
|
|
|
|
onSameUrlNavigation: "reload",
|
|
|
|
})],
|
2021-04-01 16:59:03 +02:00
|
|
|
exports: [RouterModule]
|
2019-05-23 15:38:44 +02:00
|
|
|
})
|
2020-11-23 13:28:46 +01:00
|
|
|
export class AppRoutingModule {
|
2022-02-18 15:58:47 +01:00
|
|
|
subs = [];
|
|
|
|
routes =[];
|
|
|
|
ngOnDestroy() {
|
|
|
|
for (let sub of this.subs) {
|
|
|
|
sub.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
constructor( private config: ConfigurationService, private router: Router){
|
|
|
|
this.subs.push(this.config.communityInformationState.subscribe(data => {
|
|
|
|
if (data) {
|
|
|
|
if (data['pages']) {
|
|
|
|
for (var i = 0; i < data['pages'].length; i++) {
|
|
|
|
this.routes[data['pages'][i]['route']] = data['pages'][i]['isEnabled'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.getRoutes();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error => {
|
|
|
|
// this.handleError('Error getting community information (e.g. pages,entities) for community with id: ' + this.communityId, error);
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
getRoutes(){
|
|
|
|
let optionalRoutes = [
|
|
|
|
// Deposit Pages
|
|
|
|
{ path: 'participate/deposit-datasets', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
|
|
|
|
{ path: 'participate/deposit-datasets-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
|
|
|
|
{ path: 'participate/deposit-subject-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
|
|
|
|
{ path: 'participate/deposit-publications', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
|
|
|
|
{ path: 'participate/deposit-publications-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
|
|
|
|
|
|
|
|
{ path: 'participate/deposit/learn-how', loadChildren: () => import('./deposit/deposit.module').then(m => m.LibDepositModule)},
|
|
|
|
{ path: 'participate/deposit/search', loadChildren: () => import('./deposit/searchDataprovidersToDeposit.module').then(m => m.LibSearchDataprovidersToDepositModule)},
|
|
|
|
// Linking Pages
|
|
|
|
{ path: 'myclaims', loadChildren: () => import('./claims/myClaims/myClaims.module').then(m => m.LibMyClaimsModule)},
|
|
|
|
{ path: 'participate/claim', loadChildren: () => import('./claims/linking/linkingGeneric.module').then(m => m.LibLinkingGenericModule)},
|
|
|
|
{ path: 'participate/direct-claim', loadChildren: () => import('./claims/directLinking/directLinking.module').then(m => m.LibDirectLinkingModule)},
|
|
|
|
{path: 'develop', loadChildren: () => import('./develop/develop.module').then(m => m.DevelopModule)}
|
|
|
|
];
|
|
|
|
|
|
|
|
for (var i = 0; i <optionalRoutes.length; i++) {
|
|
|
|
if(this.routes["/"+optionalRoutes[i].path]){
|
|
|
|
this.router.config.push(optionalRoutes[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return routes;
|
|
|
|
}
|
2020-11-23 13:28:46 +01:00
|
|
|
}
|