diff --git a/src/app/core/suggestion-notifications/qa/source/quality-assurance-source-data.service.ts b/src/app/core/suggestion-notifications/qa/source/quality-assurance-source-data.service.ts index 03a5da2e8c..130e7261d1 100644 --- a/src/app/core/suggestion-notifications/qa/source/quality-assurance-source-data.service.ts +++ b/src/app/core/suggestion-notifications/qa/source/quality-assurance-source-data.service.ts @@ -16,6 +16,7 @@ import { PaginatedList } from '../../../data/paginated-list.model'; import { FindListOptions } from '../../../data/find-list-options.model'; import { IdentifiableDataService } from '../../../data/base/identifiable-data.service'; import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data'; +import { SearchData, SearchDataImpl } from 'src/app/core/data/base/search-data'; /** * The service handling all Quality Assurance source REST requests. @@ -25,6 +26,9 @@ import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data'; export class QualityAssuranceSourceDataService extends IdentifiableDataService { private findAllData: FindAllData; + private searchAllData: SearchData; + + private searchByTargetMethod = 'byTarget'; /** * Initialize service variables @@ -43,6 +47,7 @@ export class QualityAssuranceSourceDataService extends IdentifiableDataService[]): Observable> { return this.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); } + + /** + * Retrieves a paginated list of QualityAssuranceSourceObject objects that are associated with a given target object. + * @param options The options for the search query. + * @param useCachedVersionIfAvailable Whether to use a cached version of the data if available. + * @param reRequestOnStale Whether to re-request the data if the cached version is stale. + * @param linksToFollow The links to follow to retrieve the data. + * @returns An observable that emits a RemoteData object containing the paginated list of QualityAssuranceSourceObject objects. + */ + public getSourcesByTarget(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig[]): Observable>> { + return this.searchAllData.searchBy(this.searchByTargetMethod, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); + } } diff --git a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.html b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.html index eb663fceb0..2e47916fd7 100644 --- a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.html +++ b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.html @@ -1,9 +1,14 @@ - -
- -
-
{{'item.qa-event-notification.check.notification-info' | translate : {num: (events$ | async)?.length} }}
- + + +
+ +
+
{{'item.qa-event-notification.check.notification-info' | translate : {num: + source.totalEvents } }}
+ +
-
+ diff --git a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.scss b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.scss index 1cc0db27c8..ab33b46fca 100644 --- a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.scss +++ b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.scss @@ -1,5 +1,5 @@ -.notify-logo { +.source-logo { max-height: var(--ds-header-logo-height); } diff --git a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.ts b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.ts index 0a26045e39..f85925373a 100644 --- a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.ts +++ b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.ts @@ -1,82 +1,50 @@ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { Item } from '../../../core/shared/item.model'; import { getFirstCompletedRemoteData, getPaginatedListPayload, getRemoteDataPayload } from '../../../core/shared/operators'; -import { QualityAssuranceEventDataService } from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-data.service'; -import { QualityAssuranceTopicDataService } from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-data.service'; -import { QualityAssuranceTopicObject } from '../../../core/suggestion-notifications/qa/models/quality-assurance-topic.model'; -import { Observable, concatMap, from, mergeMap } from 'rxjs'; -import { QualityAssuranceEventObject } from '../../../core/suggestion-notifications/qa/models/quality-assurance-event.model'; +import { Observable, tap } from 'rxjs'; import { AlertType } from '../../../shared/alert/aletr-type'; import { FindListOptions } from '../../../core/data/find-list-options.model'; import { RequestParam } from '../../../core/cache/models/request-param.model'; +import { QualityAssuranceSourceDataService } from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-data.service'; +import { QualityAssuranceSourceObject } from '../../../core/suggestion-notifications/qa/models/quality-assurance-source.model'; @Component({ selector: 'ds-qa-event-notification', templateUrl: './qa-event-notification.component.html', styleUrls: ['./qa-event-notification.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, - providers: [QualityAssuranceTopicDataService, QualityAssuranceEventDataService] + providers: [QualityAssuranceSourceDataService] }) /** * Component for displaying quality assurance event notifications for an item. */ -export class QaEventNotificationComponent implements OnInit { +export class QaEventNotificationComponent { /** * The item to display quality assurance event notifications for. */ @Input() item: Item; - /** - * An observable of quality assurance events for the item. - */ - events$: Observable; - /** * The type of alert to display for the notification. */ AlertTypeInfo = AlertType.Info; - /** - * The source of the quality assurance events. - */ - source = 'coar-notify'; - constructor( - private qualityAssuranceEventDataService: QualityAssuranceEventDataService, - private qualityAssuranceTopicDataService: QualityAssuranceTopicDataService, + private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService, ) { } - ngOnInit() { - this.getEventsByTopicsAndTarget(); - } - /** - * Retrieves quality assurance events by topics and target. - * First, it retrieves the topics by target and source. - * -> target: item.id - * -> source: 'coar-notify' - * Then, it retrieves the events by topic and target. + * Returns an Observable of QualityAssuranceSourceObject[] for the current item. + * @returns An Observable of QualityAssuranceSourceObject[] for the current item. + * Note: sourceId is composed as: id: "sourceName:" */ - getEventsByTopicsAndTarget() { + getQualityAssuranceSources$(): Observable { const findListTopicOptions: FindListOptions = { - searchParams: [new RequestParam('source', this.source), new RequestParam('target', this.item.id)] + searchParams: [new RequestParam('target', this.item.uuid)] }; - - this.events$ = this.qualityAssuranceTopicDataService.searchTopics(findListTopicOptions).pipe( - getFirstCompletedRemoteData(), - getRemoteDataPayload(), - getPaginatedListPayload(), - mergeMap((topics: QualityAssuranceTopicObject[]) => { - return from(topics).pipe( - concatMap((topic: QualityAssuranceTopicObject) => { - const findListEventOptions: FindListOptions = { - searchParams: [new RequestParam('topic', topic.name), new RequestParam('target', this.item.id)] - }; - return this.qualityAssuranceEventDataService.searchEventsByTopic(findListEventOptions); - } ) - ); - }), + return this.qualityAssuranceSourceDataService.getSourcesByTarget(findListTopicOptions) + .pipe( getFirstCompletedRemoteData(), getRemoteDataPayload(), getPaginatedListPayload(), diff --git a/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.html b/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.html index fb73cff905..baf90fdf53 100644 --- a/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.html +++ b/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.html @@ -1,10 +1,27 @@ - -
- + +
+
-
{{'item.qa-event-notification.check.notification-info' | translate : {num: source.totalEvents} }}
- +
+ {{ + "mydspace.qa-event-notification.check.notification-info" + | translate : { num: source.totalEvents } + }} +
+
diff --git a/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.scss b/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.scss index 1cc0db27c8..ab33b46fca 100644 --- a/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.scss +++ b/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.scss @@ -1,5 +1,5 @@ -.notify-logo { +.source-logo { max-height: var(--ds-header-logo-height); } diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 0f7871f7f9..6c9cf1c3b3 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -284,6 +284,7 @@ import { } from '../item-page/simple/field-components/specific-field/title/themed-item-page-field.component'; import { BitstreamListItemComponent } from './object-list/bitstream-list-item/bitstream-list-item.component'; import { NgxPaginationModule } from 'ngx-pagination'; +import { SplitPipe } from './utils/split.pipe'; const MODULES = [ CommonModule, @@ -323,7 +324,8 @@ const PIPES = [ ObjNgFor, BrowserOnlyPipe, MarkdownPipe, - ShortNumberPipe + ShortNumberPipe, + SplitPipe, ]; const COMPONENTS = [ diff --git a/src/app/shared/utils/split.pipe.ts b/src/app/shared/utils/split.pipe.ts new file mode 100644 index 0000000000..4da1b1323e --- /dev/null +++ b/src/app/shared/utils/split.pipe.ts @@ -0,0 +1,12 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'dsSplit' +}) +export class SplitPipe implements PipeTransform { + + transform(value: string, separator: string): string[] { + return value.split(separator); + } + +} diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 7e0eea931e..1b341d477c 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -2452,6 +2452,10 @@ "item.qa-event-notification-info.check.button": "Check", + "mydspace.qa-event-notification.check.notification-info": "There are {{num}} pending review to check", + + "mydspace.qa-event-notification-info.check.button": "Check", + "workflow-item.search.result.delete-supervision.modal.header": "Delete Supervision Order", "workflow-item.search.result.delete-supervision.modal.info": "Are you sure you want to delete Supervision Order", diff --git a/src/assets/i18n/it.json5 b/src/assets/i18n/it.json5 index 961fea3ae7..cc02b4739b 100644 --- a/src/assets/i18n/it.json5 +++ b/src/assets/i18n/it.json5 @@ -3731,6 +3731,14 @@ // TODO New key - Add a translation "item.qa-event-notification-info.check.button": "Check", + // "mydspace.qa-event-notification.check.notification-info": "There are {{num}} pending review to check", + // TODO New key - Add a translation + "mydspace.qa-event-notification.check.notification-info": "There are {{num}} pending review to check", + + // "mydspace.qa-event-notification-info.check.button": "Check", + // TODO New key - Add a translation + "mydspace.qa-event-notification-info.check.button": "Check", + // "workflow-item.search.result.delete-supervision.modal.header": "Delete Supervision Order", // TODO New key - Add a translation "workflow-item.search.result.delete-supervision.modal.header": "Delete Supervision Order", diff --git a/src/assets/images/qa-coar-notify-logo.png b/src/assets/images/qa-coar-notify-logo.png new file mode 100644 index 0000000000..0ba021dfd2 Binary files /dev/null and b/src/assets/images/qa-coar-notify-logo.png differ diff --git a/src/assets/images/qa-openaire-logo.png b/src/assets/images/qa-openaire-logo.png new file mode 100644 index 0000000000..359fd73b84 Binary files /dev/null and b/src/assets/images/qa-openaire-logo.png differ