[CST-5249] Removed Openaire prefix on Suggestion classes

This commit is contained in:
Luca Giamminonni
2022-07-07 17:09:48 +02:00
parent 708cfd1577
commit 63bba677bb
29 changed files with 138 additions and 137 deletions

View File

@@ -87,6 +87,7 @@ import { SourceDataResolver } from './admin-quality-assurance-source-page-compon
I18nBreadcrumbsService, I18nBreadcrumbsService,
AdminNotificationsSuggestionTargetsPageResolver, AdminNotificationsSuggestionTargetsPageResolver,
SourceDataResolver, SourceDataResolver,
AdminQualityAssuranceSourcePageResolver,
AdminQualityAssuranceTopicsPageResolver, AdminQualityAssuranceTopicsPageResolver,
AdminQualityAssuranceEventsPageResolver, AdminQualityAssuranceEventsPageResolver,
] ]

View File

@@ -166,9 +166,9 @@ import { SearchConfig } from './shared/search/search-filters/search-config.model
import { SequenceService } from './shared/sequence.service'; import { SequenceService } from './shared/sequence.service';
import { CoreState } from './core-state.model'; import { CoreState } from './core-state.model';
import { GroupDataService } from './eperson/group-data.service'; import { GroupDataService } from './eperson/group-data.service';
import { OpenaireSuggestionTarget } from './suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from './suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
import { OpenaireSuggestion } from './suggestion-notifications/reciter-suggestions/models/openaire-suggestion.model'; import { Suggestion } from './suggestion-notifications/reciter-suggestions/models/suggestion.model';
import { OpenaireSuggestionSource } from './suggestion-notifications/reciter-suggestions/models/openaire-suggestion-source.model'; import { SuggestionSource } from './suggestion-notifications/reciter-suggestions/models/suggestion-source.model';
import { ResearcherProfileService } from './profile/researcher-profile.service'; import { ResearcherProfileService } from './profile/researcher-profile.service';
import { ProfileClaimService } from '../profile-page/profile-claim/profile-claim.service'; import { ProfileClaimService } from '../profile-page/profile-claim/profile-claim.service';
import { ResearcherProfile } from './profile/model/researcher-profile.model'; import { ResearcherProfile } from './profile/model/researcher-profile.model';
@@ -372,9 +372,9 @@ export const models =
ShortLivedToken, ShortLivedToken,
Registration, Registration,
UsageReport, UsageReport,
OpenaireSuggestion, Suggestion,
OpenaireSuggestionTarget, SuggestionTarget,
OpenaireSuggestionSource, SuggestionSource,
QualityAssuranceTopicObject, QualityAssuranceTopicObject,
QualityAssuranceEventObject, QualityAssuranceEventObject,
Root, Root,

View File

@@ -1,6 +1,6 @@
import { autoserialize, deserialize } from 'cerialize'; import { autoserialize, deserialize } from 'cerialize';
import { SUGGESTION_SOURCE } from './openaire-suggestion-objects.resource-type'; import { SUGGESTION_SOURCE } from './suggestion-objects.resource-type';
import { excludeFromEquals } from '../../../utilities/equals.decorators'; import { excludeFromEquals } from '../../../utilities/equals.decorators';
import { ResourceType } from '../../../shared/resource-type'; import { ResourceType } from '../../../shared/resource-type';
import { HALLink } from '../../../shared/hal-link.model'; import { HALLink } from '../../../shared/hal-link.model';
@@ -11,7 +11,7 @@ import {CacheableObject} from '../../../cache/cacheable-object.model';
* The interface representing the Suggestion Source model * The interface representing the Suggestion Source model
*/ */
@typedObject @typedObject
export class OpenaireSuggestionSource implements CacheableObject { export class SuggestionSource implements CacheableObject {
/** /**
* A string representing the kind of object, e.g. community, item, * A string representing the kind of object, e.g. community, item,
*/ */

View File

@@ -1,6 +1,6 @@
import { autoserialize, deserialize } from 'cerialize'; import { autoserialize, deserialize } from 'cerialize';
import { SUGGESTION_TARGET } from './openaire-suggestion-objects.resource-type'; import { SUGGESTION_TARGET } from './suggestion-objects.resource-type';
import { excludeFromEquals } from '../../../utilities/equals.decorators'; import { excludeFromEquals } from '../../../utilities/equals.decorators';
import { ResourceType } from '../../../shared/resource-type'; import { ResourceType } from '../../../shared/resource-type';
import { HALLink } from '../../../shared/hal-link.model'; import { HALLink } from '../../../shared/hal-link.model';
@@ -11,7 +11,7 @@ import {CacheableObject} from '../../../cache/cacheable-object.model';
* The interface representing the Suggestion Target model * The interface representing the Suggestion Target model
*/ */
@typedObject @typedObject
export class OpenaireSuggestionTarget implements CacheableObject { export class SuggestionTarget implements CacheableObject {
/** /**
* A string representing the kind of object, e.g. community, item, * A string representing the kind of object, e.g. community, item,
*/ */

View File

@@ -1,6 +1,6 @@
import { autoserialize, autoserializeAs, deserialize } from 'cerialize'; import { autoserialize, autoserializeAs, deserialize } from 'cerialize';
import { SUGGESTION } from './openaire-suggestion-objects.resource-type'; import { SUGGESTION } from './suggestion-objects.resource-type';
import { excludeFromEquals } from '../../../utilities/equals.decorators'; import { excludeFromEquals } from '../../../utilities/equals.decorators';
import { ResourceType } from '../../../shared/resource-type'; import { ResourceType } from '../../../shared/resource-type';
import { HALLink } from '../../../shared/hal-link.model'; import { HALLink } from '../../../shared/hal-link.model';
@@ -18,7 +18,7 @@ export interface SuggestionEvidences {
* The interface representing the Suggestion Source model * The interface representing the Suggestion Source model
*/ */
@typedObject @typedObject
export class OpenaireSuggestion implements CacheableObject { export class Suggestion implements CacheableObject {
/** /**
* A string representing the kind of object, e.g. community, item, * A string representing the kind of object, e.g. community, item,
*/ */

View File

@@ -15,12 +15,12 @@ import { DataService } from '../../data/data.service';
import { ChangeAnalyzer } from '../../data/change-analyzer'; import { ChangeAnalyzer } from '../../data/change-analyzer';
import { DefaultChangeAnalyzer } from '../../data/default-change-analyzer.service'; import { DefaultChangeAnalyzer } from '../../data/default-change-analyzer.service';
import { RemoteData } from '../../data/remote-data'; import { RemoteData } from '../../data/remote-data';
import { SUGGESTION_TARGET } from './models/openaire-suggestion-objects.resource-type'; import { SUGGESTION_TARGET } from './models/suggestion-objects.resource-type';
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
import { PaginatedList } from '../../data/paginated-list.model'; import { PaginatedList } from '../../data/paginated-list.model';
import { OpenaireSuggestionSource } from './models/openaire-suggestion-source.model'; import { SuggestionSource } from './models/suggestion-source.model';
import { OpenaireSuggestionTarget } from './models/openaire-suggestion-target.model'; import { SuggestionTarget } from './models/suggestion-target.model';
import { OpenaireSuggestion } from './models/openaire-suggestion.model'; import { Suggestion } from './models/suggestion.model';
import { RequestParam } from '../../cache/models/request-param.model'; import { RequestParam } from '../../cache/models/request-param.model';
import { NoContent } from '../../shared/NoContent.model'; import { NoContent } from '../../shared/NoContent.model';
import {CoreState} from '../../core-state.model'; import {CoreState} from '../../core-state.model';
@@ -31,7 +31,7 @@ import {FindListOptions} from '../../data/find-list-options.model';
/** /**
* A private DataService implementation to delegate specific methods to. * A private DataService implementation to delegate specific methods to.
*/ */
class SuggestionDataServiceImpl extends DataService<OpenaireSuggestion> { class SuggestionDataServiceImpl extends DataService<Suggestion> {
/** /**
* The REST endpoint. * The REST endpoint.
*/ */
@@ -46,7 +46,7 @@ class SuggestionDataServiceImpl extends DataService<OpenaireSuggestion> {
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {ChangeAnalyzer<OpenaireSuggestion>} comparator * @param {ChangeAnalyzer<Suggestion>} comparator
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -56,7 +56,7 @@ class SuggestionDataServiceImpl extends DataService<OpenaireSuggestion> {
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparator: ChangeAnalyzer<OpenaireSuggestion>) { protected comparator: ChangeAnalyzer<Suggestion>) {
super(); super();
} }
} }
@@ -64,7 +64,7 @@ class SuggestionDataServiceImpl extends DataService<OpenaireSuggestion> {
/** /**
* A private DataService implementation to delegate specific methods to. * A private DataService implementation to delegate specific methods to.
*/ */
class SuggestionTargetsDataServiceImpl extends DataService<OpenaireSuggestionTarget> { class SuggestionTargetsDataServiceImpl extends DataService<SuggestionTarget> {
/** /**
* The REST endpoint. * The REST endpoint.
*/ */
@@ -79,7 +79,7 @@ class SuggestionTargetsDataServiceImpl extends DataService<OpenaireSuggestionTar
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {ChangeAnalyzer<OpenaireSuggestionTarget>} comparator * @param {ChangeAnalyzer<SuggestionTarget>} comparator
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -89,7 +89,7 @@ class SuggestionTargetsDataServiceImpl extends DataService<OpenaireSuggestionTar
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparator: ChangeAnalyzer<OpenaireSuggestionTarget>) { protected comparator: ChangeAnalyzer<SuggestionTarget>) {
super(); super();
} }
} }
@@ -97,7 +97,7 @@ class SuggestionTargetsDataServiceImpl extends DataService<OpenaireSuggestionTar
/** /**
* A private DataService implementation to delegate specific methods to. * A private DataService implementation to delegate specific methods to.
*/ */
class SuggestionSourcesDataServiceImpl extends DataService<OpenaireSuggestionSource> { class SuggestionSourcesDataServiceImpl extends DataService<SuggestionSource> {
/** /**
* The REST endpoint. * The REST endpoint.
*/ */
@@ -112,7 +112,7 @@ class SuggestionSourcesDataServiceImpl extends DataService<OpenaireSuggestionSou
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {ChangeAnalyzer<OpenaireSuggestionSource>} comparator * @param {ChangeAnalyzer<SuggestionSource>} comparator
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -122,7 +122,7 @@ class SuggestionSourcesDataServiceImpl extends DataService<OpenaireSuggestionSou
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparator: ChangeAnalyzer<OpenaireSuggestionSource>) { protected comparator: ChangeAnalyzer<SuggestionSource>) {
super(); super();
} }
} }
@@ -132,7 +132,7 @@ class SuggestionSourcesDataServiceImpl extends DataService<OpenaireSuggestionSou
*/ */
@Injectable() @Injectable()
@dataService(SUGGESTION_TARGET) @dataService(SUGGESTION_TARGET)
export class OpenaireSuggestionsDataService { export class SuggestionsDataService {
protected searchFindBySourceMethod = 'findBySource'; protected searchFindBySourceMethod = 'findBySource';
protected searchFindByTargetMethod = 'findByTarget'; protected searchFindByTargetMethod = 'findByTarget';
protected searchFindByTargetAndSourceMethod = 'findByTargetAndSource'; protected searchFindByTargetAndSourceMethod = 'findByTargetAndSource';
@@ -160,9 +160,9 @@ export class OpenaireSuggestionsDataService {
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {DefaultChangeAnalyzer<OpenaireSuggestion>} comparatorSuggestions * @param {DefaultChangeAnalyzer<Suggestion>} comparatorSuggestions
* @param {DefaultChangeAnalyzer<OpenaireSuggestionSource>} comparatorSources * @param {DefaultChangeAnalyzer<SuggestionSource>} comparatorSources
* @param {DefaultChangeAnalyzer<OpenaireSuggestionTarget>} comparatorTargets * @param {DefaultChangeAnalyzer<SuggestionTarget>} comparatorTargets
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -171,9 +171,9 @@ export class OpenaireSuggestionsDataService {
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparatorSuggestions: DefaultChangeAnalyzer<OpenaireSuggestion>, protected comparatorSuggestions: DefaultChangeAnalyzer<Suggestion>,
protected comparatorSources: DefaultChangeAnalyzer<OpenaireSuggestionSource>, protected comparatorSources: DefaultChangeAnalyzer<SuggestionSource>,
protected comparatorTargets: DefaultChangeAnalyzer<OpenaireSuggestionTarget>, protected comparatorTargets: DefaultChangeAnalyzer<SuggestionTarget>,
) { ) {
this.suggestionsDataService = new SuggestionDataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparatorSuggestions); this.suggestionsDataService = new SuggestionDataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparatorSuggestions);
this.suggestionSourcesDataService = new SuggestionSourcesDataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparatorSources); this.suggestionSourcesDataService = new SuggestionSourcesDataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparatorSources);
@@ -185,10 +185,10 @@ export class OpenaireSuggestionsDataService {
* *
* @param options * @param options
* Find list options object. * Find list options object.
* @return Observable<RemoteData<PaginatedList<OpenaireSuggestionSource>>> * @return Observable<RemoteData<PaginatedList<SuggestionSource>>>
* The list of Suggestion Sources. * The list of Suggestion Sources.
*/ */
public getSources(options: FindListOptions = {}): Observable<RemoteData<PaginatedList<OpenaireSuggestionSource>>> { public getSources(options: FindListOptions = {}): Observable<RemoteData<PaginatedList<SuggestionSource>>> {
return this.suggestionSourcesDataService.findAll(options); return this.suggestionSourcesDataService.findAll(options);
} }
@@ -201,14 +201,14 @@ export class OpenaireSuggestionsDataService {
* Find list options object. * Find list options object.
* @param linksToFollow * @param linksToFollow
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
* @return Observable<RemoteData<PaginatedList<OpenaireSuggestionTarget>>> * @return Observable<RemoteData<PaginatedList<SuggestionTarget>>>
* The list of Suggestion Target. * The list of Suggestion Target.
*/ */
public getTargets( public getTargets(
source: string, source: string,
options: FindListOptions = {}, options: FindListOptions = {},
...linksToFollow: FollowLinkConfig<OpenaireSuggestionTarget>[] ...linksToFollow: FollowLinkConfig<SuggestionTarget>[]
): Observable<RemoteData<PaginatedList<OpenaireSuggestionTarget>>> { ): Observable<RemoteData<PaginatedList<SuggestionTarget>>> {
options.searchParams = [new RequestParam('source', source)]; options.searchParams = [new RequestParam('source', source)];
return this.suggestionTargetsDataService.searchBy(this.searchFindBySourceMethod, options, true, true, ...linksToFollow); return this.suggestionTargetsDataService.searchBy(this.searchFindBySourceMethod, options, true, true, ...linksToFollow);
@@ -223,14 +223,14 @@ export class OpenaireSuggestionsDataService {
* Find list options object. * Find list options object.
* @param linksToFollow * @param linksToFollow
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
* @return Observable<RemoteData<PaginatedList<OpenaireSuggestionTarget>>> * @return Observable<RemoteData<PaginatedList<SuggestionTarget>>>
* The list of Suggestion Target. * The list of Suggestion Target.
*/ */
public getTargetsByUser( public getTargetsByUser(
userId: string, userId: string,
options: FindListOptions = {}, options: FindListOptions = {},
...linksToFollow: FollowLinkConfig<OpenaireSuggestionTarget>[] ...linksToFollow: FollowLinkConfig<SuggestionTarget>[]
): Observable<RemoteData<PaginatedList<OpenaireSuggestionTarget>>> { ): Observable<RemoteData<PaginatedList<SuggestionTarget>>> {
options.searchParams = [new RequestParam('target', userId)]; options.searchParams = [new RequestParam('target', userId)];
return this.suggestionTargetsDataService.searchBy(this.searchFindByTargetMethod, options, true, true, ...linksToFollow); return this.suggestionTargetsDataService.searchBy(this.searchFindByTargetMethod, options, true, true, ...linksToFollow);
@@ -242,10 +242,10 @@ export class OpenaireSuggestionsDataService {
* @param targetId * @param targetId
* The target id to retrieve. * The target id to retrieve.
* *
* @return Observable<RemoteData<OpenaireSuggestionTarget>> * @return Observable<RemoteData<SuggestionTarget>>
* The list of Suggestion Target. * The list of Suggestion Target.
*/ */
public getTargetById(targetId: string): Observable<RemoteData<OpenaireSuggestionTarget>> { public getTargetById(targetId: string): Observable<RemoteData<SuggestionTarget>> {
return this.suggestionTargetsDataService.findById(targetId); return this.suggestionTargetsDataService.findById(targetId);
} }
@@ -261,7 +261,7 @@ export class OpenaireSuggestionsDataService {
* Used to fetch Suggestion notification for user * Used to fetch Suggestion notification for user
* @suggestionId * @suggestionId
*/ */
public getSuggestion(suggestionId: string, ...linksToFollow: FollowLinkConfig<OpenaireSuggestion>[]): Observable<RemoteData<OpenaireSuggestion>> { public getSuggestion(suggestionId: string, ...linksToFollow: FollowLinkConfig<Suggestion>[]): Observable<RemoteData<Suggestion>> {
return this.suggestionsDataService.findById(suggestionId, true, true, ...linksToFollow); return this.suggestionsDataService.findById(suggestionId, true, true, ...linksToFollow);
} }
@@ -276,15 +276,15 @@ export class OpenaireSuggestionsDataService {
* Find list options object. * Find list options object.
* @param linksToFollow * @param linksToFollow
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
* @return Observable<RemoteData<PaginatedList<OpenaireSuggestion>>> * @return Observable<RemoteData<PaginatedList<Suggestion>>>
* The list of Suggestion. * The list of Suggestion.
*/ */
public getSuggestionsByTargetAndSource( public getSuggestionsByTargetAndSource(
target: string, target: string,
source: string, source: string,
options: FindListOptions = {}, options: FindListOptions = {},
...linksToFollow: FollowLinkConfig<OpenaireSuggestion>[] ...linksToFollow: FollowLinkConfig<Suggestion>[]
): Observable<RemoteData<PaginatedList<OpenaireSuggestion>>> { ): Observable<RemoteData<PaginatedList<Suggestion>>> {
options.searchParams = [ options.searchParams = [
new RequestParam('target', target), new RequestParam('target', target),
new RequestParam('source', source) new RequestParam('source', source)

View File

@@ -1,9 +1,9 @@
import { ResourceType } from '../../core/shared/resource-type'; import { ResourceType } from '../../core/shared/resource-type';
import { OpenaireSuggestionTarget } from '../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
// REST Mock --------------------------------------------------------------------- // REST Mock ---------------------------------------------------------------------
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
export const mockSuggestionTargetsObjectOne: OpenaireSuggestionTarget = { export const mockSuggestionTargetsObjectOne: SuggestionTarget = {
type: new ResourceType('suggestiontarget'), type: new ResourceType('suggestiontarget'),
id: 'reciter:gf3d657-9d6d-4a87-b905-fef0f8cae26', id: 'reciter:gf3d657-9d6d-4a87-b905-fef0f8cae26',
display: 'Bollini, Andrea', display: 'Bollini, Andrea',
@@ -22,7 +22,7 @@ export const mockSuggestionTargetsObjectOne: OpenaireSuggestionTarget = {
} }
}; };
export const mockSuggestionTargetsObjectTwo: OpenaireSuggestionTarget = { export const mockSuggestionTargetsObjectTwo: SuggestionTarget = {
type: new ResourceType('suggestiontarget'), type: new ResourceType('suggestiontarget'),
id: 'reciter:nhy567-9d6d-ty67-b905-fef0f8cae26', id: 'reciter:nhy567-9d6d-ty67-b905-fef0f8cae26',
display: 'Digilio, Andrea', display: 'Digilio, Andrea',

View File

@@ -2,10 +2,10 @@
// REST Mock --------------------------------------------------------------------- // REST Mock ---------------------------------------------------------------------
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
import { OpenaireSuggestion } from '../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion.model'; import { Suggestion } from '../../core/suggestion-notifications/reciter-suggestions/models/suggestion.model';
import { SUGGESTION } from '../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-objects.resource-type'; import { SUGGESTION } from '../../core/suggestion-notifications/reciter-suggestions/models/suggestion-objects.resource-type';
export const mockSuggestionPublicationOne: OpenaireSuggestion = { export const mockSuggestionPublicationOne: Suggestion = {
id: '24694772', id: '24694772',
display: 'publication one', display: 'publication one',
source: 'reciter', source: 'reciter',
@@ -107,7 +107,7 @@ export const mockSuggestionPublicationOne: OpenaireSuggestion = {
} }
}; };
export const mockSuggestionPublicationTwo: OpenaireSuggestion = { export const mockSuggestionPublicationTwo: Suggestion = {
id: '24694772', id: '24694772',
display: 'publication two', display: 'publication two',
source: 'reciter', source: 'reciter',

View File

@@ -1,6 +1,6 @@
import {createFeatureSelector, createSelector, MemoizedSelector} from '@ngrx/store'; import {createFeatureSelector, createSelector, MemoizedSelector} from '@ngrx/store';
import { suggestionNotificationsSelector, SuggestionNotificationsState } from '../suggestion-notifications.reducer'; import { suggestionNotificationsSelector, SuggestionNotificationsState } from '../suggestion-notifications.reducer';
import { OpenaireSuggestionTarget } from '../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
import { SuggestionTargetState } from './suggestion-targets/suggestion-targets.reducer'; import { SuggestionTargetState } from './suggestion-targets/suggestion-targets.reducer';
import {subStateSelector} from '../../submission/selectors'; import {subStateSelector} from '../../submission/selectors';
@@ -10,7 +10,7 @@ import {subStateSelector} from '../../submission/selectors';
* @param {AppState} state Top level state. * @param {AppState} state Top level state.
* @return {SuggestionNotificationsState} * @return {SuggestionNotificationsState}
*/ */
const _getReciterSuggestionTargetState = createFeatureSelector<SuggestionNotificationsState>('openaire'); const _getReciterSuggestionTargetState = createFeatureSelector<SuggestionNotificationsState>('suggestion-notifications');
// Reciter Suggestion Targets // Reciter Suggestion Targets
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -29,8 +29,8 @@ export function reciterSuggestionTargetStateSelector(): MemoizedSelector<Suggest
* @function reciterSuggestionTargetObjectSelector * @function reciterSuggestionTargetObjectSelector
* @return {OpenaireReciterSuggestionTarget[]} * @return {OpenaireReciterSuggestionTarget[]}
*/ */
export function reciterSuggestionTargetObjectSelector(): MemoizedSelector<SuggestionNotificationsState, OpenaireSuggestionTarget[]> { export function reciterSuggestionTargetObjectSelector(): MemoizedSelector<SuggestionNotificationsState, SuggestionTarget[]> {
return subStateSelector<SuggestionNotificationsState, OpenaireSuggestionTarget[]>(reciterSuggestionTargetStateSelector(), 'targets'); return subStateSelector<SuggestionNotificationsState, SuggestionTarget[]>(reciterSuggestionTargetStateSelector(), 'targets');
} }
/** /**
@@ -81,7 +81,7 @@ export const getreciterSuggestionTargetTotalsSelector = createSelector(_getRecit
/** /**
* Returns Suggestion Targets for the current user. * Returns Suggestion Targets for the current user.
* @function getCurrentUserReciterSuggestionTargetSelector * @function getCurrentUserReciterSuggestionTargetSelector
* @return {OpenaireSuggestionTarget[]} * @return {SuggestionTarget[]}
*/ */
export const getCurrentUserSuggestionTargetsSelector = createSelector(_getReciterSuggestionTargetState, export const getCurrentUserSuggestionTargetsSelector = createSelector(_getReciterSuggestionTargetState,
(state: SuggestionNotificationsState) => state.suggestionTarget.currentUserTargets (state: SuggestionNotificationsState) => state.suggestionTarget.currentUserTargets

View File

@@ -1,7 +1,7 @@
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ItemType } from '../../../core/shared/item-relationships/item-type.model'; import { ItemType } from '../../../core/shared/item-relationships/item-type.model';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { OpenaireSuggestion } from '../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion.model'; import { Suggestion } from '../../../core/suggestion-notifications/reciter-suggestions/models/suggestion.model';
import { SuggestionApproveAndImport } from '../suggestion-list-element/suggestion-list-element.component'; import { SuggestionApproveAndImport } from '../suggestion-list-element/suggestion-list-element.component';
import { Collection } from '../../../core/shared/collection.model'; import { Collection } from '../../../core/shared/collection.model';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
@@ -14,7 +14,7 @@ import { CreateItemParentSelectorComponent } from '../../../shared/dso-selector/
}) })
export class SuggestionActionsComponent { export class SuggestionActionsComponent {
@Input() object: OpenaireSuggestion; @Input() object: Suggestion;
@Input() isBulk = false; @Input() isBulk = false;

View File

@@ -1,6 +1,6 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { fadeIn } from '../../../../shared/animations/fade'; import { fadeIn } from '../../../../shared/animations/fade';
import { SuggestionEvidences } from '../../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion.model'; import { SuggestionEvidences } from '../../../../core/suggestion-notifications/reciter-suggestions/models/suggestion.model';
@Component({ @Component({
selector: 'ds-suggestion-evidences', selector: 'ds-suggestion-evidences',

View File

@@ -3,12 +3,12 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { fadeIn } from '../../../shared/animations/fade'; import { fadeIn } from '../../../shared/animations/fade';
import { OpenaireSuggestion } from '../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion.model'; import { Suggestion } from '../../../core/suggestion-notifications/reciter-suggestions/models/suggestion.model';
import { Item } from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
import { isNotEmpty } from '../../../shared/empty.util'; import { isNotEmpty } from '../../../shared/empty.util';
export interface SuggestionApproveAndImport { export interface SuggestionApproveAndImport {
suggestion: OpenaireSuggestion; suggestion: Suggestion;
collectionId: string; collectionId: string;
} }
@@ -20,7 +20,7 @@ export interface SuggestionApproveAndImport {
}) })
export class SuggestionListElementComponent implements OnInit { export class SuggestionListElementComponent implements OnInit {
@Input() object: OpenaireSuggestion; @Input() object: Suggestion;
@Input() isSelected = false; @Input() isSelected = false;

View File

@@ -1,7 +1,7 @@
/* eslint-disable max-classes-per-file */ /* eslint-disable max-classes-per-file */
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { type } from '../../../shared/ngrx/type'; import { type } from '../../../shared/ngrx/type';
import { OpenaireSuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
/** /**
* For each action type in an action group, make a simple * For each action type in an action group, make a simple
@@ -66,7 +66,7 @@ export class RetrieveAllTargetsErrorAction implements Action {
export class AddTargetAction implements Action { export class AddTargetAction implements Action {
type = SuggestionTargetActionTypes.ADD_TARGETS; type = SuggestionTargetActionTypes.ADD_TARGETS;
payload: { payload: {
targets: OpenaireSuggestionTarget[]; targets: SuggestionTarget[];
totalPages: number; totalPages: number;
currentPage: number; currentPage: number;
totalElements: number; totalElements: number;
@@ -84,7 +84,7 @@ export class AddTargetAction implements Action {
* @param totalElements * @param totalElements
* the total available Suggestion Targets * the total available Suggestion Targets
*/ */
constructor(targets: OpenaireSuggestionTarget[], totalPages: number, currentPage: number, totalElements: number) { constructor(targets: SuggestionTarget[], totalPages: number, currentPage: number, totalElements: number) {
this.payload = { this.payload = {
targets, targets,
totalPages, totalPages,
@@ -102,7 +102,7 @@ export class AddTargetAction implements Action {
export class AddUserSuggestionsAction implements Action { export class AddUserSuggestionsAction implements Action {
type = SuggestionTargetActionTypes.ADD_USER_SUGGESTIONS; type = SuggestionTargetActionTypes.ADD_USER_SUGGESTIONS;
payload: { payload: {
suggestionTargets: OpenaireSuggestionTarget[]; suggestionTargets: SuggestionTarget[];
}; };
/** /**
@@ -111,7 +111,7 @@ export class AddUserSuggestionsAction implements Action {
* @param suggestionTargets * @param suggestionTargets
* the user suggestions target * the user suggestions target
*/ */
constructor(suggestionTargets: OpenaireSuggestionTarget[]) { constructor(suggestionTargets: SuggestionTarget[]) {
this.payload = { suggestionTargets }; this.payload = { suggestionTargets };
} }

View File

@@ -4,7 +4,7 @@ import { Router } from '@angular/router';
import { Observable, Subscription } from 'rxjs'; import { Observable, Subscription } from 'rxjs';
import { distinctUntilChanged, take } from 'rxjs/operators'; import { distinctUntilChanged, take } from 'rxjs/operators';
import { OpenaireSuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
import { hasValue } from '../../../shared/empty.util'; import { hasValue } from '../../../shared/empty.util';
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
import { SuggestionTargetsStateService } from './suggestion-targets.state.service'; import { SuggestionTargetsStateService } from './suggestion-targets.state.service';
@@ -39,7 +39,7 @@ export class SuggestionTargetsComponent implements OnInit {
/** /**
* The Suggestion Target list. * The Suggestion Target list.
*/ */
public targets$: Observable<OpenaireSuggestionTarget[]>; public targets$: Observable<SuggestionTarget[]>;
/** /**
* The total number of Suggestion Targets. * The total number of Suggestion Targets.
*/ */
@@ -144,7 +144,7 @@ export class SuggestionTargetsComponent implements OnInit {
}); });
} }
public getTargetUuid(target: OpenaireSuggestionTarget) { public getTargetUuid(target: SuggestionTarget) {
return this.suggestionService.getTargetUuid(target); return this.suggestionService.getTargetUuid(target);
} }
} }

View File

@@ -18,7 +18,7 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
import { SuggestionsService } from '../suggestions.service'; import { SuggestionsService } from '../suggestions.service';
import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { AuthActionTypes, RetrieveAuthenticatedEpersonSuccessAction } from '../../../core/auth/auth.actions'; import { AuthActionTypes, RetrieveAuthenticatedEpersonSuccessAction } from '../../../core/auth/auth.actions';
import { OpenaireSuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
import { EPerson } from '../../../core/eperson/models/eperson.model'; import { EPerson } from '../../../core/eperson/models/eperson.model';
/** /**
@@ -38,7 +38,7 @@ export class SuggestionTargetsEffects {
action.payload.elementsPerPage, action.payload.elementsPerPage,
action.payload.currentPage action.payload.currentPage
).pipe( ).pipe(
map((targets: PaginatedList<OpenaireSuggestionTarget>) => map((targets: PaginatedList<SuggestionTarget>) =>
new AddTargetAction(targets.page, targets.totalPages, targets.currentPage, targets.totalElements) new AddTargetAction(targets.page, targets.totalPages, targets.currentPage, targets.totalElements)
), ),
catchError((error: Error) => { catchError((error: Error) => {
@@ -68,7 +68,7 @@ export class SuggestionTargetsEffects {
ofType(AuthActionTypes.RETRIEVE_AUTHENTICATED_EPERSON_SUCCESS), ofType(AuthActionTypes.RETRIEVE_AUTHENTICATED_EPERSON_SUCCESS),
switchMap((action: RetrieveAuthenticatedEpersonSuccessAction) => { switchMap((action: RetrieveAuthenticatedEpersonSuccessAction) => {
return this.suggestionsService.retrieveCurrentUserSuggestions(action.payload).pipe( return this.suggestionsService.retrieveCurrentUserSuggestions(action.payload).pipe(
map((suggestionTargets: OpenaireSuggestionTarget[]) => new AddUserSuggestionsAction(suggestionTargets)) map((suggestionTargets: SuggestionTarget[]) => new AddUserSuggestionsAction(suggestionTargets))
); );
})); }));
@@ -83,7 +83,7 @@ export class SuggestionTargetsEffects {
switchMap((userId: string) => { switchMap((userId: string) => {
return this.suggestionsService.retrieveCurrentUserSuggestions(userId) return this.suggestionsService.retrieveCurrentUserSuggestions(userId)
.pipe( .pipe(
map((suggestionTargets: OpenaireSuggestionTarget[]) => new AddUserSuggestionsAction(suggestionTargets)), map((suggestionTargets: SuggestionTarget[]) => new AddUserSuggestionsAction(suggestionTargets)),
catchError((errors) => of(errors)) catchError((errors) => of(errors))
); );
}), }),

View File

@@ -1,17 +1,17 @@
import { SuggestionTargetActionTypes, SuggestionTargetsActions } from './suggestion-targets.actions'; import { SuggestionTargetActionTypes, SuggestionTargetsActions } from './suggestion-targets.actions';
import { OpenaireSuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
/** /**
* The interface representing the OpenAIRE suggestion targets state. * The interface representing the OpenAIRE suggestion targets state.
*/ */
export interface SuggestionTargetState { export interface SuggestionTargetState {
targets: OpenaireSuggestionTarget[]; targets: SuggestionTarget[];
processing: boolean; processing: boolean;
loaded: boolean; loaded: boolean;
totalPages: number; totalPages: number;
currentPage: number; currentPage: number;
totalElements: number; totalElements: number;
currentUserTargets: OpenaireSuggestionTarget[]; currentUserTargets: SuggestionTarget[];
currentUserTargetsVisited: boolean; currentUserTargetsVisited: boolean;
} }

View File

@@ -13,7 +13,7 @@ import {
isreciterSuggestionTargetProcessingSelector, isreciterSuggestionTargetProcessingSelector,
reciterSuggestionTargetObjectSelector reciterSuggestionTargetObjectSelector
} from '../selectors'; } from '../selectors';
import { OpenaireSuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
import { import {
ClearSuggestionTargetsAction, ClearSuggestionTargetsAction,
MarkUserSuggestionsAsVisitedAction, MarkUserSuggestionsAsVisitedAction,
@@ -40,7 +40,7 @@ export class SuggestionTargetsStateService {
* @return Observable<OpenaireReciterSuggestionTarget> * @return Observable<OpenaireReciterSuggestionTarget>
* The list of Reciter Suggestion Targets. * The list of Reciter Suggestion Targets.
*/ */
public getReciterSuggestionTargets(): Observable<OpenaireSuggestionTarget[]> { public getReciterSuggestionTargets(): Observable<SuggestionTarget[]> {
return this.store.pipe(select(reciterSuggestionTargetObjectSelector())); return this.store.pipe(select(reciterSuggestionTargetObjectSelector()));
} }
@@ -127,7 +127,7 @@ export class SuggestionTargetsStateService {
* @return Observable<OpenaireReciterSuggestionTarget> * @return Observable<OpenaireReciterSuggestionTarget>
* The Reciter Suggestion Targets object. * The Reciter Suggestion Targets object.
*/ */
public getCurrentUserSuggestionTargets(): Observable<OpenaireSuggestionTarget[]> { public getCurrentUserSuggestionTargets(): Observable<SuggestionTarget[]> {
return this.store.pipe(select(getCurrentUserSuggestionTargetsSelector)); return this.store.pipe(select(getCurrentUserSuggestionTargetsSelector));
} }

View File

@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { OpenaireSuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { SuggestionTargetsStateService } from '../suggestion-targets/suggestion-targets.state.service'; import { SuggestionTargetsStateService } from '../suggestion-targets/suggestion-targets.state.service';
import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
@@ -18,7 +18,7 @@ export class SuggestionsNotificationComponent implements OnInit {
/** /**
* The user suggestion targets. * The user suggestion targets.
*/ */
suggestionsRD$: Observable<OpenaireSuggestionTarget[]>; suggestionsRD$: Observable<SuggestionTarget[]>;
constructor( constructor(
private translateService: TranslateService, private translateService: TranslateService,
@@ -35,7 +35,7 @@ export class SuggestionsNotificationComponent implements OnInit {
* Interpolated params to build the notification suggestions notification. * Interpolated params to build the notification suggestions notification.
* @param suggestionTarget * @param suggestionTarget
*/ */
public getNotificationSuggestionInterpolation(suggestionTarget: OpenaireSuggestionTarget): any { public getNotificationSuggestionInterpolation(suggestionTarget: SuggestionTarget): any {
return this.suggestionsService.getNotificationSuggestionInterpolation(suggestionTarget); return this.suggestionsService.getNotificationSuggestionInterpolation(suggestionTarget);
} }

View File

@@ -4,7 +4,7 @@ import { SuggestionTargetsStateService } from '../suggestion-targets/suggestion-
import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { SuggestionsService } from '../suggestions.service'; import { SuggestionsService } from '../suggestions.service';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { OpenaireSuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
import { isNotEmpty } from '../../../shared/empty.util'; import { isNotEmpty } from '../../../shared/empty.util';
import { combineLatest, Subject } from 'rxjs'; import { combineLatest, Subject } from 'rxjs';
@@ -38,7 +38,7 @@ export class SuggestionsPopupComponent implements OnInit, OnDestroy {
]).pipe(takeUntil(notifier)).subscribe(([suggestions, visited]) => { ]).pipe(takeUntil(notifier)).subscribe(([suggestions, visited]) => {
if (isNotEmpty(suggestions)) { if (isNotEmpty(suggestions)) {
if (!visited) { if (!visited) {
suggestions.forEach((suggestionTarget: OpenaireSuggestionTarget) => this.showNotificationForNewSuggestions(suggestionTarget)); suggestions.forEach((suggestionTarget: SuggestionTarget) => this.showNotificationForNewSuggestions(suggestionTarget));
this.reciterSuggestionStateService.dispatchMarkUserSuggestionsAsVisitedAction(); this.reciterSuggestionStateService.dispatchMarkUserSuggestionsAsVisitedAction();
notifier.next(null); notifier.next(null);
notifier.complete(); notifier.complete();
@@ -52,7 +52,7 @@ export class SuggestionsPopupComponent implements OnInit, OnDestroy {
* @param suggestionTarget * @param suggestionTarget
* @private * @private
*/ */
private showNotificationForNewSuggestions(suggestionTarget: OpenaireSuggestionTarget): void { private showNotificationForNewSuggestions(suggestionTarget: SuggestionTarget): void {
const content = this.translateService.instant(this.labelPrefix + 'notification.suggestion', const content = this.translateService.instant(this.labelPrefix + 'notification.suggestion',
this.suggestionsService.getNotificationSuggestionInterpolation(suggestionTarget)); this.suggestionsService.getNotificationSuggestionInterpolation(suggestionTarget));
this.notificationsService.success('', content, {timeOut:0}, true); this.notificationsService.success('', content, {timeOut:0}, true);

View File

@@ -3,11 +3,11 @@ import { Injectable } from '@angular/core';
import { of, forkJoin, Observable } from 'rxjs'; import { of, forkJoin, Observable } from 'rxjs';
import { catchError, map, mergeMap, take } from 'rxjs/operators'; import { catchError, map, mergeMap, take } from 'rxjs/operators';
import { OpenaireSuggestionsDataService } from '../../core/suggestion-notifications/reciter-suggestions/openaire-suggestions-data.service'; import { SuggestionsDataService } from '../../core/suggestion-notifications/reciter-suggestions/suggestions-data.service';
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
import { RemoteData } from '../../core/data/remote-data'; import { RemoteData } from '../../core/data/remote-data';
import { PaginatedList } from '../../core/data/paginated-list.model'; import { PaginatedList } from '../../core/data/paginated-list.model';
import { OpenaireSuggestionTarget } from '../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
import { ResearcherProfileService } from '../../core/profile/researcher-profile.service'; import { ResearcherProfileService } from '../../core/profile/researcher-profile.service';
import { AuthService } from '../../core/auth/auth.service'; import { AuthService } from '../../core/auth/auth.service';
import { EPerson } from '../../core/eperson/models/eperson.model'; import { EPerson } from '../../core/eperson/models/eperson.model';
@@ -19,7 +19,7 @@ import {
getFirstSucceededRemoteDataPayload, getFirstSucceededRemoteDataPayload,
getFirstSucceededRemoteListPayload getFirstSucceededRemoteListPayload
} from '../../core/shared/operators'; } from '../../core/shared/operators';
import { OpenaireSuggestion } from '../../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion.model'; import { Suggestion } from '../../core/suggestion-notifications/reciter-suggestions/models/suggestion.model';
import { WorkspaceitemDataService } from '../../core/submission/workspaceitem-data.service'; import { WorkspaceitemDataService } from '../../core/submission/workspaceitem-data.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { NoContent } from '../../core/shared/NoContent.model'; import { NoContent } from '../../core/shared/NoContent.model';
@@ -43,12 +43,12 @@ export class SuggestionsService {
* Initialize the service variables. * Initialize the service variables.
* @param {AuthService} authService * @param {AuthService} authService
* @param {ResearcherProfileService} researcherProfileService * @param {ResearcherProfileService} researcherProfileService
* @param {OpenaireSuggestionsDataService} suggestionsDataService * @param {SuggestionsDataService} suggestionsDataService
*/ */
constructor( constructor(
private authService: AuthService, private authService: AuthService,
private researcherProfileService: ResearcherProfileService, private researcherProfileService: ResearcherProfileService,
private suggestionsDataService: OpenaireSuggestionsDataService, private suggestionsDataService: SuggestionsDataService,
private translateService: TranslateService private translateService: TranslateService
) { ) {
} }
@@ -65,7 +65,7 @@ export class SuggestionsService {
* @return Observable<PaginatedList<OpenaireReciterSuggestionTarget>> * @return Observable<PaginatedList<OpenaireReciterSuggestionTarget>>
* The list of Suggestion Targets. * The list of Suggestion Targets.
*/ */
public getTargets(source, elementsPerPage, currentPage): Observable<PaginatedList<OpenaireSuggestionTarget>> { public getTargets(source, elementsPerPage, currentPage): Observable<PaginatedList<SuggestionTarget>> {
const sortOptions = new SortOptions('display', SortDirection.ASC); const sortOptions = new SortOptions('display', SortDirection.ASC);
const findListOptions: FindListOptions = { const findListOptions: FindListOptions = {
@@ -77,7 +77,7 @@ export class SuggestionsService {
return this.suggestionsDataService.getTargets(source, findListOptions).pipe( return this.suggestionsDataService.getTargets(source, findListOptions).pipe(
getFinishedRemoteData(), getFinishedRemoteData(),
take(1), take(1),
map((rd: RemoteData<PaginatedList<OpenaireSuggestionTarget>>) => { map((rd: RemoteData<PaginatedList<SuggestionTarget>>) => {
if (rd.hasSucceeded) { if (rd.hasSucceeded) {
return rd.payload; return rd.payload;
} else { } else {
@@ -98,10 +98,10 @@ export class SuggestionsService {
* The page number to retrieve * The page number to retrieve
* @param sortOptions * @param sortOptions
* The sort options * The sort options
* @return Observable<RemoteData<PaginatedList<OpenaireSuggestion>>> * @return Observable<RemoteData<PaginatedList<Suggestion>>>
* The list of Suggestion. * The list of Suggestion.
*/ */
public getSuggestions(targetId: string, elementsPerPage, currentPage, sortOptions: SortOptions): Observable<PaginatedList<OpenaireSuggestion>> { public getSuggestions(targetId: string, elementsPerPage, currentPage, sortOptions: SortOptions): Observable<PaginatedList<Suggestion>> {
const [source, target] = targetId.split(':'); const [source, target] = targetId.split(':');
const findListOptions: FindListOptions = { const findListOptions: FindListOptions = {
@@ -145,7 +145,7 @@ export class SuggestionsService {
* @param userUuid * @param userUuid
* The EPerson id for which to retrieve suggestion targets * The EPerson id for which to retrieve suggestion targets
*/ */
public retrieveCurrentUserSuggestions(userUuid: string): Observable<OpenaireSuggestionTarget[]> { public retrieveCurrentUserSuggestions(userUuid: string): Observable<SuggestionTarget[]> {
return this.researcherProfileService.findById(userUuid).pipe( return this.researcherProfileService.findById(userUuid).pipe(
getFirstSucceededRemoteDataPayload(), getFirstSucceededRemoteDataPayload(),
mergeMap((profile: ResearcherProfile) => { mergeMap((profile: ResearcherProfile) => {
@@ -173,7 +173,7 @@ export class SuggestionsService {
* @private * @private
*/ */
public approveAndImport(workspaceitemService: WorkspaceitemDataService, public approveAndImport(workspaceitemService: WorkspaceitemDataService,
suggestion: OpenaireSuggestion, suggestion: Suggestion,
collectionId: string): Observable<WorkspaceItem> { collectionId: string): Observable<WorkspaceItem> {
const resolvedCollectionId = this.resolveCollectionId(suggestion, collectionId); const resolvedCollectionId = this.resolveCollectionId(suggestion, collectionId);
@@ -201,10 +201,10 @@ export class SuggestionsService {
* @param collectionId the collectionId * @param collectionId the collectionId
*/ */
public approveAndImportMultiple(workspaceitemService: WorkspaceitemDataService, public approveAndImportMultiple(workspaceitemService: WorkspaceitemDataService,
suggestions: OpenaireSuggestion[], suggestions: Suggestion[],
collectionId: string): Observable<SuggestionBulkResult> { collectionId: string): Observable<SuggestionBulkResult> {
return forkJoin(suggestions.map((suggestion: OpenaireSuggestion) => return forkJoin(suggestions.map((suggestion: Suggestion) =>
this.approveAndImport(workspaceitemService, suggestion, collectionId))) this.approveAndImport(workspaceitemService, suggestion, collectionId)))
.pipe(map((results: WorkspaceItem[]) => { .pipe(map((results: WorkspaceItem[]) => {
return { return {
@@ -218,8 +218,8 @@ export class SuggestionsService {
* Perform a bulk notMine operation. * Perform a bulk notMine operation.
* @param suggestions the array containing the suggestions * @param suggestions the array containing the suggestions
*/ */
public notMineMultiple(suggestions: OpenaireSuggestion[]): Observable<SuggestionBulkResult> { public notMineMultiple(suggestions: Suggestion[]): Observable<SuggestionBulkResult> {
return forkJoin(suggestions.map((suggestion: OpenaireSuggestion) => this.notMine(suggestion.id))) return forkJoin(suggestions.map((suggestion: Suggestion) => this.notMine(suggestion.id)))
.pipe(map((results: RemoteData<NoContent>[]) => { .pipe(map((results: RemoteData<NoContent>[]) => {
return { return {
success: results.filter((result) => result != null).length, success: results.filter((result) => result != null).length,
@@ -234,7 +234,7 @@ export class SuggestionsService {
* @param target * @param target
* @return the researchUuid * @return the researchUuid
*/ */
public getTargetUuid(target: OpenaireSuggestionTarget): string { public getTargetUuid(target: SuggestionTarget): string {
const tokens = target.id.split(':'); const tokens = target.id.split(':');
return tokens.length === 2 ? tokens[1] : null; return tokens.length === 2 ? tokens[1] : null;
} }
@@ -243,7 +243,7 @@ export class SuggestionsService {
* Interpolated params to build the notification suggestions notification. * Interpolated params to build the notification suggestions notification.
* @param suggestionTarget * @param suggestionTarget
*/ */
public getNotificationSuggestionInterpolation(suggestionTarget: OpenaireSuggestionTarget): any { public getNotificationSuggestionInterpolation(suggestionTarget: SuggestionTarget): any {
return { return {
count: suggestionTarget.total, count: suggestionTarget.total,
source: this.translateService.instant(this.translateSuggestionSource(suggestionTarget.source)), source: this.translateService.instant(this.translateSuggestionSource(suggestionTarget.source)),
@@ -266,7 +266,7 @@ export class SuggestionsService {
* @param suggestion * @param suggestion
* @param collectionId * @param collectionId
*/ */
public resolveCollectionId(suggestion: OpenaireSuggestion, collectionId): string { public resolveCollectionId(suggestion: Suggestion, collectionId): string {
if (hasValue(collectionId)) { if (hasValue(collectionId)) {
return collectionId; return collectionId;
} }
@@ -280,13 +280,13 @@ export class SuggestionsService {
* in the configuration. * in the configuration.
* @param suggestions * @param suggestions
*/ */
public isCollectionFixed(suggestions: OpenaireSuggestion[]): boolean { public isCollectionFixed(suggestions: Suggestion[]): boolean {
return this.getFixedCollectionIds(suggestions).length === 1; return this.getFixedCollectionIds(suggestions).length === 1;
} }
private getFixedCollectionIds(suggestions: OpenaireSuggestion[]): string[] { private getFixedCollectionIds(suggestions: Suggestion[]): string[] {
const collectionIds = {}; const collectionIds = {};
suggestions.forEach((suggestion: OpenaireSuggestion) => { suggestions.forEach((suggestion: Suggestion) => {
const conf = environment.suggestion.find((suggestionConf: SuggestionConfig) => suggestionConf.source === suggestion.source); const conf = environment.suggestion.find((suggestionConf: SuggestionConfig) => suggestionConf.source === suggestion.source);
if (hasValue(conf)) { if (hasValue(conf)) {
collectionIds[conf.collectionId] = true; collectionIds[conf.collectionId] = true;

View File

@@ -12,7 +12,7 @@ import { QualityAssuranceSourceObject } from '../core/suggestion-notifications/q
* @param {AppState} state Top level state. * @param {AppState} state Top level state.
* @return {SuggestionNotificationsState} * @return {SuggestionNotificationsState}
*/ */
const _getNotificationsState = createFeatureSelector<SuggestionNotificationsState>('notifications'); const _getNotificationsState = createFeatureSelector<SuggestionNotificationsState>('suggestion-notifications');
// Quality Assurance topics // Quality Assurance topics
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -34,13 +34,13 @@ import {SuggestionActionsComponent} from './reciter-suggestions/suggestion-actio
import {SuggestionTargetsComponent} from './reciter-suggestions/suggestion-targets/suggestion-targets.component'; import {SuggestionTargetsComponent} from './reciter-suggestions/suggestion-targets/suggestion-targets.component';
import {SuggestionTargetsStateService} from './reciter-suggestions/suggestion-targets/suggestion-targets.state.service'; import {SuggestionTargetsStateService} from './reciter-suggestions/suggestion-targets/suggestion-targets.state.service';
import {SuggestionsService} from './reciter-suggestions/suggestions.service'; import {SuggestionsService} from './reciter-suggestions/suggestions.service';
import {OpenaireSuggestionsDataService} from '../core/suggestion-notifications/reciter-suggestions/openaire-suggestions-data.service'; import {SuggestionsDataService} from '../core/suggestion-notifications/reciter-suggestions/suggestions-data.service';
const MODULES = [ const MODULES = [
CommonModule, CommonModule,
SharedModule, SharedModule,
CoreModule.forRoot(), CoreModule.forRoot(),
StoreModule.forFeature('notifications', suggestionNotificationsReducers, storeModuleConfig as StoreConfig<SuggestionNotificationsState, Action>), StoreModule.forFeature('suggestion-notifications', suggestionNotificationsReducers, storeModuleConfig as StoreConfig<SuggestionNotificationsState, Action>),
EffectsModule.forFeature(suggestionNotificationsEffects), EffectsModule.forFeature(suggestionNotificationsEffects),
TranslateModule TranslateModule
]; ];
@@ -72,7 +72,7 @@ const PROVIDERS = [
QualityAssuranceEventRestService, QualityAssuranceEventRestService,
SuggestionTargetsStateService, SuggestionTargetsStateService,
SuggestionsService, SuggestionsService,
OpenaireSuggestionsDataService SuggestionsDataService
]; ];
@NgModule({ @NgModule({

View File

@@ -21,4 +21,4 @@ export const suggestionNotificationsReducers: ActionReducerMap<SuggestionNotific
suggestionTarget: SuggestionTargetsReducer suggestionTarget: SuggestionTargetsReducer
}; };
export const suggestionNotificationsSelector = createFeatureSelector<SuggestionNotificationsState>('notifications'); export const suggestionNotificationsSelector = createFeatureSelector<SuggestionNotificationsState>('suggestion-notifications');

View File

@@ -9,9 +9,9 @@ import { of as observableOf } from 'rxjs';
import { SuggestionsPageComponent } from './suggestions-page.component'; import { SuggestionsPageComponent } from './suggestions-page.component';
import { SuggestionListElementComponent } from '../suggestion-notifications/reciter-suggestions/suggestion-list-element/suggestion-list-element.component'; import { SuggestionListElementComponent } from '../suggestion-notifications/reciter-suggestions/suggestion-list-element/suggestion-list-element.component';
import { SuggestionsService } from '../suggestion-notifications/reciter-suggestions/suggestions.service'; import { SuggestionsService } from '../suggestion-notifications/reciter-suggestions/suggestions.service';
import { getMockSuggestionNotificationsStateService, getMockSuggestionsService } from '../shared/mocks/openaire.mock'; import { getMockSuggestionNotificationsStateService, getMockSuggestionsService } from '../shared/mocks/suggestion.mock';
import { buildPaginatedList, PaginatedList } from '../core/data/paginated-list.model'; import { buildPaginatedList, PaginatedList } from '../core/data/paginated-list.model';
import { OpenaireSuggestion } from '../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion.model'; import { Suggestion } from '../core/suggestion-notifications/reciter-suggestions/models/suggestion.model';
import { mockSuggestionPublicationOne, mockSuggestionPublicationTwo } from '../shared/mocks/reciter-suggestion.mock'; import { mockSuggestionPublicationOne, mockSuggestionPublicationTwo } from '../shared/mocks/reciter-suggestion.mock';
import { SuggestionEvidencesComponent } from '../suggestion-notifications/reciter-suggestions/suggestion-list-element/suggestion-evidences/suggestion-evidences.component'; import { SuggestionEvidencesComponent } from '../suggestion-notifications/reciter-suggestions/suggestion-list-element/suggestion-evidences/suggestion-evidences.component';
import { ObjectKeysPipe } from '../shared/utils/object-keys-pipe'; import { ObjectKeysPipe } from '../shared/utils/object-keys-pipe';
@@ -38,7 +38,7 @@ describe('SuggestionPageComponent', () => {
let scheduler: TestScheduler; let scheduler: TestScheduler;
const mockSuggestionsService = getMockSuggestionsService(); const mockSuggestionsService = getMockSuggestionsService();
const mockSuggestionsTargetStateService = getMockSuggestionNotificationsStateService(); const mockSuggestionsTargetStateService = getMockSuggestionNotificationsStateService();
const suggestionTargetsList: PaginatedList<OpenaireSuggestion> = buildPaginatedList(new PageInfo(), [mockSuggestionPublicationOne, mockSuggestionPublicationTwo]); const suggestionTargetsList: PaginatedList<Suggestion> = buildPaginatedList(new PageInfo(), [mockSuggestionPublicationOne, mockSuggestionPublicationTwo]);
const router = new RouterStub(); const router = new RouterStub();
const routeStub = { const routeStub = {
data: observableOf({ data: observableOf({

View File

@@ -11,8 +11,8 @@ import { RemoteData } from '../core/data/remote-data';
import { getFirstSucceededRemoteDataPayload } from '../core/shared/operators'; import { getFirstSucceededRemoteDataPayload } from '../core/shared/operators';
import { SuggestionBulkResult, SuggestionsService } from '../suggestion-notifications/reciter-suggestions/suggestions.service'; import { SuggestionBulkResult, SuggestionsService } from '../suggestion-notifications/reciter-suggestions/suggestions.service';
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model'; import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
import { OpenaireSuggestion } from '../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion.model'; import { Suggestion } from '../core/suggestion-notifications/reciter-suggestions/models/suggestion.model';
import { OpenaireSuggestionTarget } from '../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
import { AuthService } from '../core/auth/auth.service'; import { AuthService } from '../core/auth/auth.service';
import { SuggestionApproveAndImport } from '../suggestion-notifications/reciter-suggestions/suggestion-list-element/suggestion-list-element.component'; import { SuggestionApproveAndImport } from '../suggestion-notifications/reciter-suggestions/suggestion-list-element/suggestion-list-element.component';
import { NotificationsService } from '../shared/notifications/notifications.service'; import { NotificationsService } from '../shared/notifications/notifications.service';
@@ -56,18 +56,18 @@ export class SuggestionsPageComponent implements OnInit {
/** /**
* A list of remote data objects of suggestions * A list of remote data objects of suggestions
*/ */
suggestionsRD$: BehaviorSubject<PaginatedList<OpenaireSuggestion>> = new BehaviorSubject<PaginatedList<OpenaireSuggestion>>({} as any); suggestionsRD$: BehaviorSubject<PaginatedList<Suggestion>> = new BehaviorSubject<PaginatedList<Suggestion>>({} as any);
targetRD$: Observable<RemoteData<OpenaireSuggestionTarget>>; targetRD$: Observable<RemoteData<SuggestionTarget>>;
targetId$: Observable<string>; targetId$: Observable<string>;
suggestionTarget: OpenaireSuggestionTarget; suggestionTarget: SuggestionTarget;
suggestionId: any; suggestionId: any;
suggestionSource: any; suggestionSource: any;
researcherName: any; researcherName: any;
researcherUuid: any; researcherUuid: any;
selectedSuggestions: { [id: string]: OpenaireSuggestion } = {}; selectedSuggestions: { [id: string]: Suggestion } = {};
isBulkOperationPending = false; isBulkOperationPending = false;
constructor( constructor(
@@ -85,17 +85,17 @@ export class SuggestionsPageComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.targetRD$ = this.route.data.pipe( this.targetRD$ = this.route.data.pipe(
map((data: Data) => data.suggestionTargets as RemoteData<OpenaireSuggestionTarget>), map((data: Data) => data.suggestionTargets as RemoteData<SuggestionTarget>),
redirectOn4xx(this.router, this.authService) redirectOn4xx(this.router, this.authService)
); );
this.targetId$ = this.targetRD$.pipe( this.targetId$ = this.targetRD$.pipe(
getFirstSucceededRemoteDataPayload(), getFirstSucceededRemoteDataPayload(),
map((target: OpenaireSuggestionTarget) => target.id) map((target: SuggestionTarget) => target.id)
); );
this.targetRD$.pipe( this.targetRD$.pipe(
getFirstSucceededRemoteDataPayload() getFirstSucceededRemoteDataPayload()
).subscribe((suggestionTarget: OpenaireSuggestionTarget) => { ).subscribe((suggestionTarget: SuggestionTarget) => {
this.suggestionTarget = suggestionTarget; this.suggestionTarget = suggestionTarget;
this.suggestionId = suggestionTarget.id; this.suggestionId = suggestionTarget.id;
this.researcherName = suggestionTarget.display; this.researcherName = suggestionTarget.display;
@@ -135,7 +135,7 @@ export class SuggestionsPageComponent implements OnInit {
); );
}), }),
take(1) take(1)
).subscribe((results: PaginatedList<OpenaireSuggestion>) => { ).subscribe((results: PaginatedList<Suggestion>) => {
this.processing$.next(false); this.processing$.next(false);
this.suggestionsRD$.next(results); this.suggestionsRD$.next(results);
this.suggestionService.clearSuggestionRequests(); this.suggestionService.clearSuggestionRequests();
@@ -232,7 +232,7 @@ export class SuggestionsPageComponent implements OnInit {
* @param object the suggestions * @param object the suggestions
* @param selected the new selected value for the suggestion * @param selected the new selected value for the suggestion
*/ */
onSelected(object: OpenaireSuggestion, selected: boolean) { onSelected(object: Suggestion, selected: boolean) {
if (selected) { if (selected) {
this.selectedSuggestions[object.id] = object; this.selectedSuggestions[object.id] = object;
} else { } else {
@@ -244,7 +244,7 @@ export class SuggestionsPageComponent implements OnInit {
* When Toggle Select All occurs. * When Toggle Select All occurs.
* @param suggestions all the visible suggestions inside the page * @param suggestions all the visible suggestions inside the page
*/ */
onToggleSelectAll(suggestions: OpenaireSuggestion[]) { onToggleSelectAll(suggestions: Suggestion[]) {
if ( this.getSelectedSuggestionsCount() > 0) { if ( this.getSelectedSuggestionsCount() > 0) {
this.selectedSuggestions = {}; this.selectedSuggestions = {};
} else { } else {
@@ -265,7 +265,7 @@ export class SuggestionsPageComponent implements OnInit {
* Return true if all the suggestion are configured with the same fixed collection in the configuration. * Return true if all the suggestion are configured with the same fixed collection in the configuration.
* @param suggestions * @param suggestions
*/ */
isCollectionFixed(suggestions: OpenaireSuggestion[]): boolean { isCollectionFixed(suggestions: Suggestion[]): boolean {
return this.suggestionService.isCollectionFixed(suggestions); return this.suggestionService.isCollectionFixed(suggestions);
} }

View File

@@ -5,7 +5,7 @@ import { SuggestionsPageComponent } from './suggestions-page.component';
import { SharedModule } from '../shared/shared.module'; import { SharedModule } from '../shared/shared.module';
import { SuggestionsPageRoutingModule } from './suggestions-page-routing.module'; import { SuggestionsPageRoutingModule } from './suggestions-page-routing.module';
import { SuggestionsService } from '../suggestion-notifications/reciter-suggestions/suggestions.service'; import { SuggestionsService } from '../suggestion-notifications/reciter-suggestions/suggestions.service';
import { OpenaireSuggestionsDataService } from '../core/suggestion-notifications/reciter-suggestions/openaire-suggestions-data.service'; import { SuggestionsDataService } from '../core/suggestion-notifications/reciter-suggestions/suggestions-data.service';
import {SuggestionNotificationsModule} from '../suggestion-notifications/suggestion-notifications.module'; import {SuggestionNotificationsModule} from '../suggestion-notifications/suggestion-notifications.module';
@NgModule({ @NgModule({
@@ -17,7 +17,7 @@ import {SuggestionNotificationsModule} from '../suggestion-notifications/suggest
SuggestionsPageRoutingModule SuggestionsPageRoutingModule
], ],
providers: [ providers: [
OpenaireSuggestionsDataService, SuggestionsDataService,
SuggestionsService SuggestionsService
] ]
}) })

View File

@@ -6,15 +6,15 @@ import { find } from 'rxjs/operators';
import { RemoteData } from '../core/data/remote-data'; import { RemoteData } from '../core/data/remote-data';
import { hasValue } from '../shared/empty.util'; import { hasValue } from '../shared/empty.util';
import { OpenaireSuggestionsDataService } from '../core/suggestion-notifications/reciter-suggestions/openaire-suggestions-data.service'; import { SuggestionsDataService } from '../core/suggestion-notifications/reciter-suggestions/suggestions-data.service';
import { OpenaireSuggestionTarget } from '../core/suggestion-notifications/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTarget } from '../core/suggestion-notifications/reciter-suggestions/models/suggestion-target.model';
/** /**
* This class represents a resolver that requests a specific collection before the route is activated * This class represents a resolver that requests a specific collection before the route is activated
*/ */
@Injectable() @Injectable()
export class SuggestionsPageResolver implements Resolve<RemoteData<OpenaireSuggestionTarget>> { export class SuggestionsPageResolver implements Resolve<RemoteData<SuggestionTarget>> {
constructor(private suggestionsDataService: OpenaireSuggestionsDataService) { constructor(private suggestionsDataService: SuggestionsDataService) {
} }
/** /**
@@ -24,7 +24,7 @@ export class SuggestionsPageResolver implements Resolve<RemoteData<OpenaireSugge
* @returns Observable<<RemoteData<Collection>> Emits the found collection based on the parameters in the current route, * @returns Observable<<RemoteData<Collection>> Emits the found collection based on the parameters in the current route,
* or an error if something went wrong * or an error if something went wrong
*/ */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<OpenaireSuggestionTarget>> { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<SuggestionTarget>> {
return this.suggestionsDataService.getTargetById(route.params.targetId).pipe( return this.suggestionsDataService.getTargetById(route.params.targetId).pipe(
find((RD) => hasValue(RD.hasFailed) || RD.hasSucceeded), find((RD) => hasValue(RD.hasFailed) || RD.hasSucceeded),
); );