mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[CST-12145] parial commit
This commit is contained in:
@@ -17,6 +17,7 @@ import { dataService } from '../../../data/base/data-service.decorator';
|
||||
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from '../models/quality-assurance-topic-object.resource-type';
|
||||
import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
|
||||
import { hasValue } from 'src/app/shared/empty.util';
|
||||
import { SearchData, SearchDataImpl } from 'src/app/core/data/base/search-data';
|
||||
|
||||
/**
|
||||
* The service handling all Quality Assurance topic REST requests.
|
||||
@@ -26,6 +27,9 @@ import { hasValue } from 'src/app/shared/empty.util';
|
||||
export class QualityAssuranceTopicDataService extends IdentifiableDataService<QualityAssuranceTopicObject> {
|
||||
|
||||
private findAllData: FindAllData<QualityAssuranceTopicObject>;
|
||||
private searchData: SearchData<QualityAssuranceTopicObject>;
|
||||
|
||||
private searchByTargetMethod = 'byTarget';
|
||||
|
||||
/**
|
||||
* Initialize service variables
|
||||
@@ -44,6 +48,7 @@ export class QualityAssuranceTopicDataService extends IdentifiableDataService<Qu
|
||||
) {
|
||||
super('qualityassurancetopics', requestService, rdbService, objectCache, halService);
|
||||
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
|
||||
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +93,7 @@ export class QualityAssuranceTopicDataService extends IdentifiableDataService<Qu
|
||||
});
|
||||
}
|
||||
|
||||
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
return this.searchData.searchBy(this.searchByTargetMethod, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1 +1,5 @@
|
||||
<p>qa-event-notification works!</p>
|
||||
<ng-container *ngIf="events.length > 0">
|
||||
asdfasdf
|
||||
<ds-alert [type]="AlertTypeInfo" [content]="'asdf' | translate"></ds-alert>
|
||||
</ng-container>
|
||||
asfasdfasdf
|
||||
|
@@ -1,8 +1,12 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
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 'src/app/core/suggestion-notifications/qa/models/quality-assurance-topic.model';
|
||||
import { Observable, concatMap, from, map, mergeMap, of, switchMap, tap } from 'rxjs';
|
||||
import { QualityAssuranceEventObject } from 'src/app/core/suggestion-notifications/qa/models/quality-assurance-event.model';
|
||||
import { AlertType } from 'src/app/shared/alert/aletr-type';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-qa-event-notification',
|
||||
@@ -15,20 +19,40 @@ export class QaEventNotificationComponent {
|
||||
|
||||
@Input() item: Item;
|
||||
|
||||
events: QualityAssuranceEventObject[] = [];
|
||||
|
||||
AlertTypeInfo = AlertType.Info;
|
||||
|
||||
constructor(
|
||||
protected qualityAssuranceEventDataService: QualityAssuranceEventDataService,
|
||||
protected qualityAssuranceTopicDataService: QualityAssuranceTopicDataService,
|
||||
private qualityAssuranceEventDataService: QualityAssuranceEventDataService,
|
||||
private qualityAssuranceTopicDataService: QualityAssuranceTopicDataService,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getTopics();
|
||||
this.getEventsByTopicsAndTarget();
|
||||
}
|
||||
|
||||
getTopics(): void {
|
||||
this.qualityAssuranceTopicDataService.getTopicsByTargetAndSource(this.item.id, 'coar-notify', {}, true, true).pipe(
|
||||
getEventsByTopicsAndTarget(): void {
|
||||
// TODO: add source 'coar-notify'
|
||||
this.qualityAssuranceTopicDataService.getTopicsByTargetAndSource(this.item.id).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
).subscribe((topics) => {
|
||||
console.log(topics);
|
||||
});
|
||||
getRemoteDataPayload(),
|
||||
getPaginatedListPayload(),
|
||||
tap((topics: QualityAssuranceTopicObject[]) => console.log(topics, 'topics')),
|
||||
mergeMap((topics: QualityAssuranceTopicObject[]) => {
|
||||
return from(topics).pipe(
|
||||
concatMap((topic: QualityAssuranceTopicObject) => {
|
||||
return this.qualityAssuranceEventDataService.getEventsByTopicAndTarget(topic.name, this.item.id).pipe(
|
||||
tap((events: any) => console.log(events, 'events')),
|
||||
);
|
||||
} )
|
||||
);
|
||||
}),
|
||||
getFirstCompletedRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
getPaginatedListPayload(),
|
||||
).subscribe((events: QualityAssuranceEventObject[]) => {
|
||||
this.events = events;
|
||||
console.log(events, 'events2')});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user