From 11d25e66997d99bd1cb932c057feff3f8dc30e70 Mon Sep 17 00:00:00 2001 From: Luca Giamminonni Date: Wed, 4 May 2022 13:16:13 +0200 Subject: [PATCH] [CST-5249] Fixed suggestion page --- .../admin-sidebar/admin-sidebar.component.ts | 2 +- src/app/core/core.module.ts | 2 +- .../openaire-suggestion-source.model.ts | 2 +- .../openaire-suggestion-target.model.ts | 2 +- .../models/openaire-suggestion.model.ts | 2 +- .../openaire-suggestions-data.service.ts | 5 +- .../submission/workspaceitem-data.service.ts | 8 +- src/app/openaire/openaire.module.ts | 2 +- .../openaire/reciter-suggestions/selectors.ts | 2 +- .../suggestion-targets.actions.ts | 1 + .../suggestion-targets.effects.ts | 6 +- .../suggestions.service.ts | 4 +- .../dso-selector-modal-wrapper.component.ts | 24 +- src/app/shared/mocks/openaire.mock.ts | 445 ------------------ .../suggestions-page.component.ts | 4 +- src/assets/i18n/en.json5 | 1 + src/config/app-config.interface.ts | 2 +- src/config/default-app-config.ts | 2 +- src/environments/environment.test.ts | 8 + 19 files changed, 55 insertions(+), 469 deletions(-) diff --git a/src/app/admin/admin-sidebar/admin-sidebar.component.ts b/src/app/admin/admin-sidebar/admin-sidebar.component.ts index b770e3d675..c13599be9d 100644 --- a/src/app/admin/admin-sidebar/admin-sidebar.component.ts +++ b/src/app/admin/admin-sidebar/admin-sidebar.component.ts @@ -39,7 +39,7 @@ import { CSSVariableService } from '../../shared/sass-helper/sass-helper.service import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service'; import { FeatureID } from '../../core/data/feature-authorization/feature-id'; import { Router, ActivatedRoute } from '@angular/router'; -import {NOTIFICATIONS_RECITER_SUGGESTION_PATH} from "../admin-notifications/admin-notifications-routing-paths"; +import {NOTIFICATIONS_RECITER_SUGGESTION_PATH} from '../admin-notifications/admin-notifications-routing-paths'; import { MenuID } from '../../shared/menu/menu-id.model'; import { MenuItemType } from '../../shared/menu/menu-item-type.model'; diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index 7273996401..879ba76c7d 100644 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -168,7 +168,7 @@ import { OpenaireSuggestionSource } from './openaire/reciter-suggestions/models/ import { ResearcherProfileService } from './profile/researcher-profile.service'; import { ProfileClaimService } from '../profile-page/profile-claim/profile-claim.service'; import { ResearcherProfile } from './profile/model/researcher-profile.model'; -import {SubmissionAccessesModel} from "./config/models/config-submission-accesses.model"; +import {SubmissionAccessesModel} from './config/models/config-submission-accesses.model'; /** * When not in production, endpoint responses can be mocked for testing purposes diff --git a/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion-source.model.ts b/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion-source.model.ts index d71b49b913..00f5f11936 100644 --- a/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion-source.model.ts +++ b/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion-source.model.ts @@ -5,7 +5,7 @@ import { excludeFromEquals } from '../../../utilities/equals.decorators'; import { ResourceType } from '../../../shared/resource-type'; import { HALLink } from '../../../shared/hal-link.model'; import { typedObject } from '../../../cache/builders/build-decorators'; -import {CacheableObject} from "../../../cache/cacheable-object.model"; +import {CacheableObject} from '../../../cache/cacheable-object.model'; /** * The interface representing the Suggestion Source model diff --git a/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion-target.model.ts b/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion-target.model.ts index 06f85ea5b3..96a43c9654 100644 --- a/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion-target.model.ts +++ b/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion-target.model.ts @@ -5,7 +5,7 @@ import { excludeFromEquals } from '../../../utilities/equals.decorators'; import { ResourceType } from '../../../shared/resource-type'; import { HALLink } from '../../../shared/hal-link.model'; import { typedObject } from '../../../cache/builders/build-decorators'; -import {CacheableObject} from "../../../cache/cacheable-object.model"; +import {CacheableObject} from '../../../cache/cacheable-object.model'; /** * The interface representing the Suggestion Target model diff --git a/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion.model.ts b/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion.model.ts index 2d28ccf9bc..0f84072c6b 100644 --- a/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion.model.ts +++ b/src/app/core/openaire/reciter-suggestions/models/openaire-suggestion.model.ts @@ -6,7 +6,7 @@ import { ResourceType } from '../../../shared/resource-type'; import { HALLink } from '../../../shared/hal-link.model'; import { typedObject } from '../../../cache/builders/build-decorators'; import { MetadataMap, MetadataMapSerializer } from '../../../shared/metadata.models'; -import {CacheableObject} from "../../../cache/cacheable-object.model"; +import {CacheableObject} from '../../../cache/cacheable-object.model'; export interface SuggestionEvidences { [sectionId: string]: { diff --git a/src/app/core/openaire/reciter-suggestions/openaire-suggestions-data.service.ts b/src/app/core/openaire/reciter-suggestions/openaire-suggestions-data.service.ts index 7454caa1d9..3c1d04c040 100644 --- a/src/app/core/openaire/reciter-suggestions/openaire-suggestions-data.service.ts +++ b/src/app/core/openaire/reciter-suggestions/openaire-suggestions-data.service.ts @@ -1,3 +1,4 @@ +/* eslint-disable max-classes-per-file */ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Store } from '@ngrx/store'; @@ -22,8 +23,8 @@ import { OpenaireSuggestionTarget } from './models/openaire-suggestion-target.mo import { OpenaireSuggestion } from './models/openaire-suggestion.model'; import { RequestParam } from '../../cache/models/request-param.model'; import { NoContent } from '../../shared/NoContent.model'; -import {CoreState} from "../../core-state.model"; -import {FindListOptions} from "../../data/find-list-options.model"; +import {CoreState} from '../../core-state.model'; +import {FindListOptions} from '../../data/find-list-options.model'; /* tslint:disable:max-classes-per-file */ diff --git a/src/app/core/submission/workspaceitem-data.service.ts b/src/app/core/submission/workspaceitem-data.service.ts index a4dbaab6ca..6c0e909bb4 100644 --- a/src/app/core/submission/workspaceitem-data.service.ts +++ b/src/app/core/submission/workspaceitem-data.service.ts @@ -17,10 +17,10 @@ import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { RequestParam } from '../cache/models/request-param.model'; import { CoreState } from '../core-state.model'; import { FindListOptions } from '../data/find-list-options.model'; -import {HttpOptions} from "../dspace-rest/dspace-rest.service"; -import {find, map} from "rxjs/operators"; -import {PostRequest} from "../data/request.models"; -import {hasValue} from "../../shared/empty.util"; +import {HttpOptions} from '../dspace-rest/dspace-rest.service'; +import {find, map} from 'rxjs/operators'; +import {PostRequest} from '../data/request.models'; +import {hasValue} from '../../shared/empty.util'; /** * A service that provides methods to make REST requests with workspaceitems endpoint. diff --git a/src/app/openaire/openaire.module.ts b/src/app/openaire/openaire.module.ts index ace4622190..8ae52b27f4 100644 --- a/src/app/openaire/openaire.module.ts +++ b/src/app/openaire/openaire.module.ts @@ -18,7 +18,7 @@ import { SuggestionsPopupComponent } from './reciter-suggestions/suggestions-pop import { SuggestionsNotificationComponent } from './reciter-suggestions/suggestions-notification/suggestions-notification.component'; import { TranslateModule } from '@ngx-translate/core'; import { SearchModule } from '../shared/search/search.module'; -import {openaireEffects} from "./openaire.effects"; +import {openaireEffects} from './openaire.effects'; const MODULES = [ CommonModule, diff --git a/src/app/openaire/reciter-suggestions/selectors.ts b/src/app/openaire/reciter-suggestions/selectors.ts index 292e63472a..cfbb36d4c2 100644 --- a/src/app/openaire/reciter-suggestions/selectors.ts +++ b/src/app/openaire/reciter-suggestions/selectors.ts @@ -2,7 +2,7 @@ import {createFeatureSelector, createSelector, MemoizedSelector} from '@ngrx/sto import { openaireSelector, OpenaireState } from '../openaire.reducer'; import { OpenaireSuggestionTarget } from '../../core/openaire/reciter-suggestions/models/openaire-suggestion-target.model'; import { SuggestionTargetState } from './suggestion-targets/suggestion-targets.reducer'; -import {subStateSelector} from "../../submission/selectors"; +import {subStateSelector} from '../../submission/selectors'; /** * Returns the Reciter Suggestion Target state. diff --git a/src/app/openaire/reciter-suggestions/suggestion-targets/suggestion-targets.actions.ts b/src/app/openaire/reciter-suggestions/suggestion-targets/suggestion-targets.actions.ts index 6c44d40b91..33dfb1474b 100644 --- a/src/app/openaire/reciter-suggestions/suggestion-targets/suggestion-targets.actions.ts +++ b/src/app/openaire/reciter-suggestions/suggestion-targets/suggestion-targets.actions.ts @@ -1,3 +1,4 @@ +/* eslint-disable max-classes-per-file */ import { Action } from '@ngrx/store'; import { type } from '../../../shared/ngrx/type'; import { OpenaireSuggestionTarget } from '../../../core/openaire/reciter-suggestions/models/openaire-suggestion-target.model'; diff --git a/src/app/openaire/reciter-suggestions/suggestion-targets/suggestion-targets.effects.ts b/src/app/openaire/reciter-suggestions/suggestion-targets/suggestion-targets.effects.ts index 9a007fab21..29672ad49b 100644 --- a/src/app/openaire/reciter-suggestions/suggestion-targets/suggestion-targets.effects.ts +++ b/src/app/openaire/reciter-suggestions/suggestion-targets/suggestion-targets.effects.ts @@ -78,10 +78,10 @@ export class SuggestionTargetsEffects { @Effect() refreshUserTargets$ = this.actions$.pipe( ofType(SuggestionTargetActionTypes.REFRESH_USER_SUGGESTIONS), switchMap((action: RefreshUserSuggestionsAction) => { - return this.store$.select((state: any) => state.core.auth.user) + return this.store$.select((state: any) => state.core.auth.userId) .pipe( - switchMap((user: EPerson) => { - return this.suggestionsService.retrieveCurrentUserSuggestions(user.uuid) + switchMap((userId: string) => { + return this.suggestionsService.retrieveCurrentUserSuggestions(userId) .pipe( map((suggestionTargets: OpenaireSuggestionTarget[]) => new AddUserSuggestionsAction(suggestionTargets)), catchError((errors) => of(errors)) diff --git a/src/app/openaire/reciter-suggestions/suggestions.service.ts b/src/app/openaire/reciter-suggestions/suggestions.service.ts index 5908c8c6bf..67b496b903 100644 --- a/src/app/openaire/reciter-suggestions/suggestions.service.ts +++ b/src/app/openaire/reciter-suggestions/suggestions.service.ts @@ -25,8 +25,8 @@ import { TranslateService } from '@ngx-translate/core'; import { NoContent } from '../../core/shared/NoContent.model'; import { environment } from '../../../environments/environment'; import { WorkspaceItem } from '../../core/submission/models/workspaceitem.model'; -import {FindListOptions} from "../../core/data/find-list-options.model"; -import {SuggestionConfig} from "../../../config/layout-config.interfaces"; +import {FindListOptions} from '../../core/data/find-list-options.model'; +import {SuggestionConfig} from '../../../config/layout-config.interfaces'; export interface SuggestionBulkResult { success: number; diff --git a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts index ca8343cfad..3b3ef59ae5 100644 --- a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import { ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { RemoteData } from '../../../core/data/remote-data'; @@ -21,11 +21,22 @@ export enum SelectorActionType { template: '' }) export abstract class DSOSelectorModalWrapperComponent implements OnInit { + + /** + * The discovery configuration. + */ + @Input() configuration = 'default'; + /** * The current page's DSO */ @Input() dsoRD: RemoteData; + /** + * Representing if component should emit value of selected entries or navigate + */ + @Input() emitOnly = false; + /** * Optional header to display above the selection list * Supports i18n keys @@ -47,6 +58,11 @@ export abstract class DSOSelectorModalWrapperComponent implements OnInit { */ action: SelectorActionType; + /** + * Event emitted when a DSO entry is selected if emitOnly is set to true + */ + @Output() select: EventEmitter = new EventEmitter(); + constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute) { } @@ -85,7 +101,11 @@ export abstract class DSOSelectorModalWrapperComponent implements OnInit { */ selectObject(dso: DSpaceObject) { this.close(); - this.navigate(dso); + if (this.emitOnly) { + this.select.emit(dso); + } else { + this.navigate(dso); + } } /** diff --git a/src/app/shared/mocks/openaire.mock.ts b/src/app/shared/mocks/openaire.mock.ts index 95ea871727..d6c50510cd 100644 --- a/src/app/shared/mocks/openaire.mock.ts +++ b/src/app/shared/mocks/openaire.mock.ts @@ -1,17 +1,5 @@ -import { of as observableOf } from 'rxjs'; -import { ResourceType } from '../../core/shared/resource-type'; -import { OpenaireBrokerTopicObject } from '../../core/openaire/broker/models/openaire-broker-topic.model'; -import { OpenaireBrokerEventObject } from '../../core/openaire/broker/models/openaire-broker-event.model'; -import { OpenaireBrokerTopicRestService } from '../../core/openaire/broker/topics/openaire-broker-topic-rest.service'; -import { OpenaireBrokerEventRestService } from '../../core/openaire/broker/events/openaire-broker-event-rest.service'; import { DSpaceObject } from '../../core/shared/dspace-object.model'; -import { OpenaireStateService } from '../../openaire/openaire-state.service'; import { Item } from '../../core/shared/item.model'; -import { - createNoContentRemoteDataObject$, - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../remote-data.utils'; import { SearchResult } from '../search/models/search-result.model'; import { SuggestionsService } from '../../openaire/reciter-suggestions/suggestions.service'; @@ -1330,414 +1318,6 @@ export const OpenaireMockDspaceObject: SearchResult = Object.assig } ); -// Topics -// ------------------------------------------------------------------------------- - -export const openaireBrokerTopicObjectMorePid: OpenaireBrokerTopicObject = { - type: new ResourceType('nbtopic'), - id: 'ENRICH!MORE!PID', - name: 'ENRICH/MORE/PID', - lastEvent: '2020/10/09 10:11 UTC', - totalEvents: 33, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbtopics/ENRICH!MORE!PID' - } - } -}; - -export const openaireBrokerTopicObjectMoreAbstract: OpenaireBrokerTopicObject = { - type: new ResourceType('nbtopic'), - id: 'ENRICH!MORE!ABSTRACT', - name: 'ENRICH/MORE/ABSTRACT', - lastEvent: '2020/09/08 21:14 UTC', - totalEvents: 5, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbtopics/ENRICH!MORE!ABSTRACT' - } - } -}; - -export const openaireBrokerTopicObjectMissingPid: OpenaireBrokerTopicObject = { - type: new ResourceType('nbtopic'), - id: 'ENRICH!MISSING!PID', - name: 'ENRICH/MISSING/PID', - lastEvent: '2020/10/01 07:36 UTC', - totalEvents: 4, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbtopics/ENRICH!MISSING!PID' - } - } -}; - -export const openaireBrokerTopicObjectMissingAbstract: OpenaireBrokerTopicObject = { - type: new ResourceType('nbtopic'), - id: 'ENRICH!MISSING!ABSTRACT', - name: 'ENRICH/MISSING/ABSTRACT', - lastEvent: '2020/10/08 16:14 UTC', - totalEvents: 71, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbtopics/ENRICH!MISSING!ABSTRACT' - } - } -}; - -export const openaireBrokerTopicObjectMissingAcm: OpenaireBrokerTopicObject = { - type: new ResourceType('nbtopic'), - id: 'ENRICH!MISSING!SUBJECT!ACM', - name: 'ENRICH/MISSING/SUBJECT/ACM', - lastEvent: '2020/09/21 17:51 UTC', - totalEvents: 18, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbtopics/ENRICH!MISSING!SUBJECT!ACM' - } - } -}; - -export const openaireBrokerTopicObjectMissingProject: OpenaireBrokerTopicObject = { - type: new ResourceType('nbtopic'), - id: 'ENRICH!MISSING!PROJECT', - name: 'ENRICH/MISSING/PROJECT', - lastEvent: '2020/09/17 10:28 UTC', - totalEvents: 6, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbtopics/ENRICH!MISSING!PROJECT' - } - } -}; - -// Events -// ------------------------------------------------------------------------------- - -export const openaireBrokerEventObjectMissingPid: OpenaireBrokerEventObject = { - id: '123e4567-e89b-12d3-a456-426614174001', - uuid: '123e4567-e89b-12d3-a456-426614174001', - type: new ResourceType('nbevent'), - originalId: 'oai:www.openstarts.units.it:10077/21486', - title: 'Index nominum et rerum', - trust: 0.375, - eventDate: '2020/10/09 10:11 UTC', - status: 'PENDING', - message: { - type: 'doi', - value: '10.18848/1447-9494/cgp/v15i09/45934', - abstract: null, - openaireId: null, - acronym: null, - code: null, - funder: null, - fundingProgram: null, - jurisdiction: null, - title: null - }, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174001', - }, - target: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174001/target' - }, - related: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174001/related' - } - }, - target: observableOf(createSuccessfulRemoteDataObject(ItemMockPid1)), - related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) -}; - -export const openaireBrokerEventObjectMissingPid2: OpenaireBrokerEventObject = { - id: '123e4567-e89b-12d3-a456-426614174004', - uuid: '123e4567-e89b-12d3-a456-426614174004', - type: new ResourceType('openaireBrokerEvent'), - originalId: 'oai:www.openstarts.units.it:10077/21486', - title: 'UNA NUOVA RILETTURA DELL\u0027 ARISTOTELE DI FRANZ BRENTANO ALLA LUCE DI ALCUNI INEDITI', - trust: 1.0, - eventDate: '2020/10/09 10:11 UTC', - status: 'PENDING', - message: { - type: 'urn', - value: 'http://thesis2.sba.units.it/store/handle/item/12238', - abstract: null, - openaireId: null, - acronym: null, - code: null, - funder: null, - fundingProgram: null, - jurisdiction: null, - title: null - }, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174004' - }, - target: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174004/target' - }, - related: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174004/related' - } - }, - target: observableOf(createSuccessfulRemoteDataObject(ItemMockPid2)), - related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) -}; - -export const openaireBrokerEventObjectMissingPid3: OpenaireBrokerEventObject = { - id: '123e4567-e89b-12d3-a456-426614174005', - uuid: '123e4567-e89b-12d3-a456-426614174005', - type: new ResourceType('openaireBrokerEvent'), - originalId: 'oai:www.openstarts.units.it:10077/554', - title: 'Sustainable development', - trust: 0.375, - eventDate: '2020/10/09 10:11 UTC', - status: 'PENDING', - message: { - type: 'doi', - value: '10.4324/9780203408889', - abstract: null, - openaireId: null, - acronym: null, - code: null, - funder: null, - fundingProgram: null, - jurisdiction: null, - title: null - }, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174005' - }, - target: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174005/target' - }, - related: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174005/related' - } - }, - target: observableOf(createSuccessfulRemoteDataObject(ItemMockPid3)), - related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) -}; - -export const openaireBrokerEventObjectMissingPid4: OpenaireBrokerEventObject = { - id: '123e4567-e89b-12d3-a456-426614174006', - uuid: '123e4567-e89b-12d3-a456-426614174006', - type: new ResourceType('openaireBrokerEvent'), - originalId: 'oai:www.openstarts.units.it:10077/10787', - title: 'Reply to Critics', - trust: 1.0, - eventDate: '2020/10/09 10:11 UTC', - status: 'PENDING', - message: { - type: 'doi', - value: '10.1080/13698230.2018.1430104', - abstract: null, - openaireId: null, - acronym: null, - code: null, - funder: null, - fundingProgram: null, - jurisdiction: null, - title: null - }, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174006' - }, - target: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174006/target' - }, - related: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174006/related' - } - }, - target: observableOf(createSuccessfulRemoteDataObject(ItemMockPid4)), - related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) -}; - -export const openaireBrokerEventObjectMissingPid5: OpenaireBrokerEventObject = { - id: '123e4567-e89b-12d3-a456-426614174007', - uuid: '123e4567-e89b-12d3-a456-426614174007', - type: new ResourceType('openaireBrokerEvent'), - originalId: 'oai:www.openstarts.units.it:10077/11339', - title: 'PROGETTAZIONE, SINTESI E VALUTAZIONE DELL\u0027ATTIVITA\u0027 ANTIMICOBATTERICA ED ANTIFUNGINA DI NUOVI DERIVATI ETEROCICLICI', - trust: 0.375, - eventDate: '2020/10/09 10:11 UTC', - status: 'PENDING', - message: { - type: 'urn', - value: 'http://thesis2.sba.units.it/store/handle/item/12477', - abstract: null, - openaireId: null, - acronym: null, - code: null, - funder: null, - fundingProgram: null, - jurisdiction: null, - title: null - }, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174007' - }, - target: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174007/target' - }, - related: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174007/related' - } - }, - target: observableOf(createSuccessfulRemoteDataObject(ItemMockPid5)), - related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) -}; - -export const openaireBrokerEventObjectMissingPid6: OpenaireBrokerEventObject = { - id: '123e4567-e89b-12d3-a456-426614174008', - uuid: '123e4567-e89b-12d3-a456-426614174008', - type: new ResourceType('openaireBrokerEvent'), - originalId: 'oai:www.openstarts.units.it:10077/29860', - title: 'Donald Davidson', - trust: 0.375, - eventDate: '2020/10/09 10:11 UTC', - status: 'PENDING', - message: { - type: 'doi', - value: '10.1111/j.1475-4975.2004.00098.x', - abstract: null, - openaireId: null, - acronym: null, - code: null, - funder: null, - fundingProgram: null, - jurisdiction: null, - title: null - }, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174008' - }, - target: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174008/target' - }, - related: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174008/related' - } - }, - target: observableOf(createSuccessfulRemoteDataObject(ItemMockPid6)), - related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) -}; - -export const openaireBrokerEventObjectMissingAbstract: OpenaireBrokerEventObject = { - id: '123e4567-e89b-12d3-a456-426614174009', - uuid: '123e4567-e89b-12d3-a456-426614174009', - type: new ResourceType('openaireBrokerEvent'), - originalId: 'oai:www.openstarts.units.it:10077/21110', - title: 'Missing abstract article', - trust: 0.751, - eventDate: '2020/10/09 10:11 UTC', - status: 'PENDING', - message: { - type: null, - value: null, - abstract: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla scelerisque vestibulum tellus sed lacinia. Aenean vitae sapien a quam congue ultrices. Sed vehicula sollicitudin ligula, vitae lacinia velit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla scelerisque vestibulum tellus sed lacinia. Aenean vitae sapien a quam congue ultrices. Sed vehicula sollicitudin ligula, vitae lacinia velit.', - openaireId: null, - acronym: null, - code: null, - funder: null, - fundingProgram: null, - jurisdiction: null, - title: null - }, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174009' - }, - target: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174009/target' - }, - related: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174009/related' - } - }, - target: observableOf(createSuccessfulRemoteDataObject(ItemMockPid7)), - related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) -}; - -export const openaireBrokerEventObjectMissingProjectFound: OpenaireBrokerEventObject = { - id: '123e4567-e89b-12d3-a456-426614174002', - uuid: '123e4567-e89b-12d3-a456-426614174002', - type: new ResourceType('openaireBrokerEvent'), - originalId: 'oai:www.openstarts.units.it:10077/21838', - title: 'Egypt, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature', - trust: 1.0, - eventDate: '2020/10/09 10:11 UTC', - status: 'PENDING', - message: { - type: null, - value: null, - abstract: null, - openaireId: null, - acronym: 'PAThs', - code: '687567', - funder: 'EC', - fundingProgram: 'H2020', - jurisdiction: 'EU', - title: 'Tracking Papyrus and Parchment Paths: An Archaeological Atlas of Coptic Literature.\nLiterary Texts in their Geographical Context: Production, Copying, Usage, Dissemination and Storage' - }, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174002' - }, - target: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174002/target' - }, - related: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174002/related' - } - }, - target: createSuccessfulRemoteDataObject$(ItemMockPid8), - related: createSuccessfulRemoteDataObject$(ItemMockPid10) -}; - -export const openaireBrokerEventObjectMissingProjectNotFound: OpenaireBrokerEventObject = { - id: '123e4567-e89b-12d3-a456-426614174003', - uuid: '123e4567-e89b-12d3-a456-426614174003', - type: new ResourceType('openaireBrokerEvent'), - originalId: 'oai:www.openstarts.units.it:10077/21838', - title: 'Morocco, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature', - trust: 1.0, - eventDate: '2020/10/09 10:11 UTC', - status: 'PENDING', - message: { - type: null, - value: null, - abstract: null, - openaireId: null, - acronym: 'PAThs', - code: '687567B', - funder: 'EC', - fundingProgram: 'H2021', - jurisdiction: 'EU', - title: 'Tracking Unknown Papyrus and Parchment Paths: An Archaeological Atlas of Coptic Literature.\nLiterary Texts in their Geographical Context: Production, Copying, Usage, Dissemination and Storage' - }, - _links: { - self: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174003' - }, - target: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174003/target' - }, - related: { - href: 'https://rest.api/rest/api/integration/nbevents/123e4567-e89b-12d3-a456-426614174003/related' - } - }, - target: createSuccessfulRemoteDataObject$(ItemMockPid9), - related: createNoContentRemoteDataObject$() -}; - // Classes // ------------------------------------------------------------------------------- @@ -1757,31 +1337,6 @@ export function getMockOpenaireStateService(): any { dispatchMarkUserSuggestionsAsVisitedAction: jasmine.createSpy('dispatchMarkUserSuggestionsAsVisitedAction') }); } - -/** - * Mock for [[OpenaireBrokerTopicRestService]] - */ -export function getMockOpenaireBrokerTopicRestService(): OpenaireBrokerTopicRestService { - return jasmine.createSpyObj('OpenaireBrokerTopicRestService', { - getTopics: jasmine.createSpy('getTopics'), - getTopic: jasmine.createSpy('getTopic'), - }); -} - -/** - * Mock for [[OpenaireBrokerEventRestService]] - */ -export function getMockOpenaireBrokerEventRestService(): OpenaireBrokerEventRestService { - return jasmine.createSpyObj('OpenaireBrokerEventRestService', { - getEventsByTopic: jasmine.createSpy('getEventsByTopic'), - getEvent: jasmine.createSpy('getEvent'), - patchEvent: jasmine.createSpy('patchEvent'), - boundProject: jasmine.createSpy('boundProject'), - removeProject: jasmine.createSpy('removeProject'), - clearFindByTopicRequests: jasmine.createSpy('.clearFindByTopicRequests') - }); -} - /** * Mock for [[OpenaireBrokerEventRestService]] */ diff --git a/src/app/suggestions-page/suggestions-page.component.ts b/src/app/suggestions-page/suggestions-page.component.ts index 850a30da22..3d6ced5ef5 100644 --- a/src/app/suggestions-page/suggestions-page.component.ts +++ b/src/app/suggestions-page/suggestions-page.component.ts @@ -20,8 +20,8 @@ import { SuggestionTargetsStateService } from '../openaire/reciter-suggestions/s import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.service'; import { PaginationService } from '../core/pagination/pagination.service'; import { WorkspaceItem } from '../core/submission/models/workspaceitem.model'; -import {FindListOptions} from "../core/data/find-list-options.model"; -import {redirectOn4xx} from "../core/shared/authorized.operators"; +import {FindListOptions} from '../core/data/find-list-options.model'; +import {redirectOn4xx} from '../core/shared/authorized.operators'; @Component({ selector: 'ds-suggestion-page', diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index fbc04033d6..f79cf799e5 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -3033,6 +3033,7 @@ "reciter.suggestion.totalScore": "Total Score", + "reciter.suggestion.type.oaire": "OpenAIRE", "register-email.title": "New user registration", diff --git a/src/config/app-config.interface.ts b/src/config/app-config.interface.ts index 6446e7f127..fbd84fae84 100644 --- a/src/config/app-config.interface.ts +++ b/src/config/app-config.interface.ts @@ -14,7 +14,7 @@ import { AuthConfig } from './auth-config.interfaces'; import { UIServerConfig } from './ui-server-config.interface'; import { MediaViewerConfig } from './media-viewer-config.interface'; import { BrowseByConfig } from './browse-by-config.interface'; -import {SuggestionConfig} from "./layout-config.interfaces"; +import {SuggestionConfig} from './layout-config.interfaces'; interface AppConfig extends Config { ui: UIServerConfig; diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index aea29fc819..9def4849f5 100644 --- a/src/config/default-app-config.ts +++ b/src/config/default-app-config.ts @@ -14,7 +14,7 @@ import { ServerConfig } from './server-config.interface'; import { SubmissionConfig } from './submission-config.interface'; import { ThemeConfig } from './theme.model'; import { UIServerConfig } from './ui-server-config.interface'; -import {SuggestionConfig} from "./layout-config.interfaces"; +import {SuggestionConfig} from './layout-config.interfaces'; export class DefaultAppConfig implements AppConfig { production = false; diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index 7c24ef8f05..6bf3a9ab8f 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -2,6 +2,7 @@ import { BuildConfig } from 'src/config/build-config.interface'; import { RestRequestMethod } from '../app/core/data/rest-request-method'; import { NotificationAnimationsType } from '../app/shared/notifications/models/notification-animations-type'; +import {SuggestionConfig} from '../config/layout-config.interfaces'; export const environment: BuildConfig = { production: false, @@ -203,6 +204,13 @@ export const environment: BuildConfig = { undoTimeout: 10000 // 10 seconds } }, + suggestion: [ + // { + // // Use this configuration to map a suggestion import to a specific collection based on the suggestion type. + // source: 'suggestionSource', + // collectionId: 'collectionUUID' + // } + ], themes: [ { name: 'full-item-page-theme',