forked from 4Science/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DSpace#1562 from 4Science/CST-5337
Enrich local data via the OpenAIRE Graph
- Loading branch information
Showing
82 changed files
with
8,147 additions
and
4 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/app/admin/admin-notifications/admin-notifications-routing-paths.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { URLCombiner } from '../../core/url-combiner/url-combiner'; | ||
import { getNotificationsModuleRoute } from '../admin-routing-paths'; | ||
|
||
export const QUALITY_ASSURANCE_EDIT_PATH = 'quality-assurance'; | ||
|
||
export function getQualityAssuranceRoute(id: string) { | ||
return new URLCombiner(getNotificationsModuleRoute(), QUALITY_ASSURANCE_EDIT_PATH, id).toString(); | ||
} |
87 changes: 87 additions & 0 deletions
87
src/app/admin/admin-notifications/admin-notifications-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
import { AuthenticatedGuard } from '../../core/auth/authenticated.guard'; | ||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver'; | ||
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service'; | ||
import { QUALITY_ASSURANCE_EDIT_PATH } from './admin-notifications-routing-paths'; | ||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component'; | ||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component'; | ||
import { AdminQualityAssuranceTopicsPageResolver } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service'; | ||
import { AdminQualityAssuranceEventsPageResolver } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.resolver'; | ||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component'; | ||
import { AdminQualityAssuranceSourcePageResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service'; | ||
import { QualityAssuranceBreadcrumbResolver } from '../../core/breadcrumbs/quality-assurance-breadcrumb.resolver'; | ||
import { QualityAssuranceBreadcrumbService } from '../../core/breadcrumbs/quality-assurance-breadcrumb.service'; | ||
import { | ||
SourceDataResolver | ||
} from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.resolver'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild([ | ||
{ | ||
canActivate: [ AuthenticatedGuard ], | ||
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`, | ||
component: AdminQualityAssuranceTopicsPageComponent, | ||
pathMatch: 'full', | ||
resolve: { | ||
breadcrumb: QualityAssuranceBreadcrumbResolver, | ||
openaireQualityAssuranceTopicsParams: AdminQualityAssuranceTopicsPageResolver | ||
}, | ||
data: { | ||
title: 'admin.quality-assurance.page.title', | ||
breadcrumbKey: 'admin.quality-assurance', | ||
showBreadcrumbsFluid: false | ||
} | ||
}, | ||
{ | ||
canActivate: [ AuthenticatedGuard ], | ||
path: `${QUALITY_ASSURANCE_EDIT_PATH}`, | ||
component: AdminQualityAssuranceSourcePageComponent, | ||
pathMatch: 'full', | ||
resolve: { | ||
breadcrumb: I18nBreadcrumbResolver, | ||
openaireQualityAssuranceSourceParams: AdminQualityAssuranceSourcePageResolver, | ||
sourceData: SourceDataResolver | ||
}, | ||
data: { | ||
title: 'admin.notifications.source.breadcrumbs', | ||
breadcrumbKey: 'admin.notifications.source', | ||
showBreadcrumbsFluid: false | ||
} | ||
}, | ||
{ | ||
canActivate: [ AuthenticatedGuard ], | ||
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`, | ||
component: AdminQualityAssuranceEventsPageComponent, | ||
pathMatch: 'full', | ||
resolve: { | ||
breadcrumb: QualityAssuranceBreadcrumbResolver, | ||
openaireQualityAssuranceEventsParams: AdminQualityAssuranceEventsPageResolver | ||
}, | ||
data: { | ||
title: 'admin.notifications.event.page.title', | ||
breadcrumbKey: 'admin.notifications.event', | ||
showBreadcrumbsFluid: false | ||
} | ||
} | ||
]) | ||
], | ||
providers: [ | ||
I18nBreadcrumbResolver, | ||
I18nBreadcrumbsService, | ||
SourceDataResolver, | ||
AdminQualityAssuranceTopicsPageResolver, | ||
AdminQualityAssuranceEventsPageResolver, | ||
AdminQualityAssuranceSourcePageResolver, | ||
QualityAssuranceBreadcrumbResolver, | ||
QualityAssuranceBreadcrumbService | ||
] | ||
}) | ||
/** | ||
* Routing module for the Notifications section of the admin sidebar | ||
*/ | ||
export class AdminNotificationsRoutingModule { | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/app/admin/admin-notifications/admin-notifications.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { CoreModule } from '../../core/core.module'; | ||
import { SharedModule } from '../../shared/shared.module'; | ||
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module'; | ||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component'; | ||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component'; | ||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component'; | ||
import {NotificationsModule} from '../../notifications/notifications.module'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
SharedModule, | ||
CoreModule.forRoot(), | ||
AdminNotificationsRoutingModule, | ||
NotificationsModule | ||
], | ||
declarations: [ | ||
AdminQualityAssuranceTopicsPageComponent, | ||
AdminQualityAssuranceEventsPageComponent, | ||
AdminQualityAssuranceSourcePageComponent | ||
], | ||
entryComponents: [] | ||
}) | ||
/** | ||
* This module handles all components related to the notifications pages | ||
*/ | ||
export class AdminNotificationsModule { | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
...ns/admin-quality-assurance-events-page/admin-quality-assurance-events-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<ds-quality-assurance-events></ds-quality-assurance-events> |
26 changes: 26 additions & 0 deletions
26
...admin-quality-assurance-events-page/admin-quality-assurance-events-page.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { NO_ERRORS_SCHEMA } from '@angular/core'; | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page.component'; | ||
|
||
describe('AdminQualityAssuranceEventsPageComponent', () => { | ||
let component: AdminQualityAssuranceEventsPageComponent; | ||
let fixture: ComponentFixture<AdminQualityAssuranceEventsPageComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ AdminQualityAssuranceEventsPageComponent ], | ||
schemas: [NO_ERRORS_SCHEMA] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AdminQualityAssuranceEventsPageComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create AdminQualityAssuranceEventsPageComponent', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
...ions/admin-quality-assurance-events-page/admin-quality-assurance-events-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
/** | ||
* Component for the page that show the QA events related to a specific topic. | ||
*/ | ||
@Component({ | ||
selector: 'ds-quality-assurance-events-page', | ||
templateUrl: './admin-quality-assurance-events-page.component.html' | ||
}) | ||
export class AdminQualityAssuranceEventsPageComponent { | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...tions/admin-quality-assurance-events-page/admin-quality-assurance-events-page.resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; | ||
|
||
/** | ||
* Interface for the route parameters. | ||
*/ | ||
export interface AdminQualityAssuranceEventsPageParams { | ||
pageId?: string; | ||
pageSize?: number; | ||
currentPage?: number; | ||
} | ||
|
||
/** | ||
* This class represents a resolver that retrieve the route data before the route is activated. | ||
*/ | ||
@Injectable() | ||
export class AdminQualityAssuranceEventsPageResolver implements Resolve<AdminQualityAssuranceEventsPageParams> { | ||
|
||
/** | ||
* Method for resolving the parameters in the current route. | ||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot | ||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot | ||
* @returns AdminQualityAssuranceEventsPageParams Emits the route parameters | ||
*/ | ||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminQualityAssuranceEventsPageParams { | ||
return { | ||
pageId: route.queryParams.pageId, | ||
pageSize: parseInt(route.queryParams.pageSize, 10), | ||
currentPage: parseInt(route.queryParams.page, 10) | ||
}; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...n-quality-assurance-source-page-component/admin-quality-assurance-source-data.resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot, Router } from '@angular/router'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
import { PaginatedList } from '../../../core/data/paginated-list.model'; | ||
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model'; | ||
import { QualityAssuranceSourceService } from '../../../notifications/qa/source/quality-assurance-source.service'; | ||
import {environment} from '../../../../environments/environment'; | ||
/** | ||
* This class represents a resolver that retrieve the route data before the route is activated. | ||
*/ | ||
@Injectable() | ||
export class SourceDataResolver implements Resolve<Observable<QualityAssuranceSourceObject[]>> { | ||
private pageSize = environment.qualityAssuranceConfig.pageSize; | ||
/** | ||
* Initialize the effect class variables. | ||
* @param {QualityAssuranceSourceService} qualityAssuranceSourceService | ||
*/ | ||
constructor( | ||
private qualityAssuranceSourceService: QualityAssuranceSourceService, | ||
private router: Router | ||
) { } | ||
/** | ||
* Method for resolving the parameters in the current route. | ||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot | ||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot | ||
* @returns Observable<QualityAssuranceSourceObject[]> | ||
*/ | ||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<QualityAssuranceSourceObject[]> { | ||
return this.qualityAssuranceSourceService.getSources(this.pageSize, 0).pipe( | ||
map((sources: PaginatedList<QualityAssuranceSourceObject>) => { | ||
if (sources.page.length === 1) { | ||
this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]); | ||
} | ||
return sources.page; | ||
})); | ||
} | ||
|
||
/** | ||
* | ||
* @param route url path | ||
* @returns url path | ||
*/ | ||
getResolvedUrl(route: ActivatedRouteSnapshot): string { | ||
return route.pathFromRoot.map(v => v.url.map(segment => segment.toString()).join('/')).join('/'); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...y-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router'; | ||
|
||
/** | ||
* Interface for the route parameters. | ||
*/ | ||
export interface AdminQualityAssuranceSourcePageParams { | ||
pageId?: string; | ||
pageSize?: number; | ||
currentPage?: number; | ||
} | ||
|
||
/** | ||
* This class represents a resolver that retrieve the route data before the route is activated. | ||
*/ | ||
@Injectable() | ||
export class AdminQualityAssuranceSourcePageResolver implements Resolve<AdminQualityAssuranceSourcePageParams> { | ||
|
||
/** | ||
* Method for resolving the parameters in the current route. | ||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot | ||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot | ||
* @returns AdminQualityAssuranceSourcePageParams Emits the route parameters | ||
*/ | ||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminQualityAssuranceSourcePageParams { | ||
return { | ||
pageId: route.queryParams.pageId, | ||
pageSize: parseInt(route.queryParams.pageSize, 10), | ||
currentPage: parseInt(route.queryParams.page, 10) | ||
}; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...uality-assurance-source-page-component/admin-quality-assurance-source-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<ds-quality-assurance-source></ds-quality-assurance-source> |
27 changes: 27 additions & 0 deletions
27
...ity-assurance-source-page-component/admin-quality-assurance-source-page.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { NO_ERRORS_SCHEMA } from '@angular/core'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page.component'; | ||
|
||
describe('AdminQualityAssuranceSourcePageComponent', () => { | ||
let component: AdminQualityAssuranceSourcePageComponent; | ||
let fixture: ComponentFixture<AdminQualityAssuranceSourcePageComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ AdminQualityAssuranceSourcePageComponent ], | ||
schemas: [NO_ERRORS_SCHEMA] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AdminQualityAssuranceSourcePageComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create AdminQualityAssuranceSourcePageComponent', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
...-quality-assurance-source-page-component/admin-quality-assurance-source-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
/** | ||
* Component for the page that show the QA sources. | ||
*/ | ||
@Component({ | ||
selector: 'ds-admin-quality-assurance-source-page-component', | ||
templateUrl: './admin-quality-assurance-source-page.component.html', | ||
}) | ||
export class AdminQualityAssuranceSourcePageComponent {} |
32 changes: 32 additions & 0 deletions
32
...min-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router'; | ||
|
||
/** | ||
* Interface for the route parameters. | ||
*/ | ||
export interface AdminQualityAssuranceTopicsPageParams { | ||
pageId?: string; | ||
pageSize?: number; | ||
currentPage?: number; | ||
} | ||
|
||
/** | ||
* This class represents a resolver that retrieve the route data before the route is activated. | ||
*/ | ||
@Injectable() | ||
export class AdminQualityAssuranceTopicsPageResolver implements Resolve<AdminQualityAssuranceTopicsPageParams> { | ||
|
||
/** | ||
* Method for resolving the parameters in the current route. | ||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot | ||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot | ||
* @returns AdminQualityAssuranceTopicsPageParams Emits the route parameters | ||
*/ | ||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminQualityAssuranceTopicsPageParams { | ||
return { | ||
pageId: route.queryParams.pageId, | ||
pageSize: parseInt(route.queryParams.pageSize, 10), | ||
currentPage: parseInt(route.queryParams.page, 10) | ||
}; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ns/admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<ds-quality-assurance-topic></ds-quality-assurance-topic> |
26 changes: 26 additions & 0 deletions
26
...admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { NO_ERRORS_SCHEMA } from '@angular/core'; | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page.component'; | ||
|
||
describe('AdminQualityAssuranceTopicsPageComponent', () => { | ||
let component: AdminQualityAssuranceTopicsPageComponent; | ||
let fixture: ComponentFixture<AdminQualityAssuranceTopicsPageComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ AdminQualityAssuranceTopicsPageComponent ], | ||
schemas: [NO_ERRORS_SCHEMA] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AdminQualityAssuranceTopicsPageComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create AdminQualityAssuranceTopicsPageComponent', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.