diff --git a/src/app/core/record-affiliations/record-affiliations.service.ts b/src/app/core/record-affiliations/record-affiliations.service.ts index ff06e26ae0..9de5213cb4 100644 --- a/src/app/core/record-affiliations/record-affiliations.service.ts +++ b/src/app/core/record-affiliations/record-affiliations.service.ts @@ -219,4 +219,18 @@ export class RecordAffiliationService { tap(() => this.getAffiliations({ forceReload: true })) ) } + + updatePreferredSource(putCode: string): Observable { + return this._http + .get( + environment.API_WEB + 'affiliations/updateToMaxDisplay.json?putCode=' + putCode + ) + .pipe( + retry(3), + catchError((error) => this._errorHandler.handleError(error)), + tap(() => + this.getAffiliations({ forceReload: true }) + ) + ) + } } diff --git a/src/app/core/record-fundings/record-fundings.service.ts b/src/app/core/record-fundings/record-fundings.service.ts index f3757d56a0..9c206845f8 100644 --- a/src/app/core/record-fundings/record-fundings.service.ts +++ b/src/app/core/record-fundings/record-fundings.service.ts @@ -189,4 +189,18 @@ export class RecordFundingsService { environment.API_WEB + 'workspace/retrieve-funding-import-wizards.json' ) } + + updatePreferredSource(putCode: string): Observable { + return this._http + .get( + environment.API_WEB + 'fundings/updateToMaxDisplay.json?putCode=' + putCode + ) + .pipe( + retry(3), + catchError((error) => this._errorHandler.handleError(error)), + tap(() => + this.getFundings({ forceReload: true }) + ) + ) + } } diff --git a/src/app/core/record-peer-review/record-peer-review.service.ts b/src/app/core/record-peer-review/record-peer-review.service.ts index e0188117e8..3327d8ae28 100644 --- a/src/app/core/record-peer-review/record-peer-review.service.ts +++ b/src/app/core/record-peer-review/record-peer-review.service.ts @@ -118,4 +118,18 @@ export class RecordPeerReviewService { tap(() => this.getPeerReviewGroups({ forceReload: true })) ) } + + updatePreferredSource(putCode: string): Observable { + return this._http + .get( + environment.API_WEB + 'peer-reviews/updateToMaxDisplay.json?putCode=' + putCode + ) + .pipe( + retry(3), + catchError((error) => this._errorHandler.handleError(error)), + tap(() => + this.getPeerReviewGroups({ forceReload: true }) + ) + ) + } } diff --git a/src/app/core/record-research-resource/record-research-resource.service.ts b/src/app/core/record-research-resource/record-research-resource.service.ts index 12295f4bc0..dadcc47fa2 100644 --- a/src/app/core/record-research-resource/record-research-resource.service.ts +++ b/src/app/core/record-research-resource/record-research-resource.service.ts @@ -151,4 +151,18 @@ export class RecordResearchResourceService { tap(() => this.getResearchResourcePage({ forceReload: true })) ) } + + updatePreferredSource(putCode: string): Observable { + return this._http + .get( + environment.API_WEB + 'research-resources/updateToMaxDisplay.json?putCode=' + putCode + ) + .pipe( + retry(3), + catchError((error) => this._errorHandler.handleError(error)), + tap(() => + this.getResearchResourcePage({ forceReload: true }) + ) + ) + } } diff --git a/src/app/record/components/affiliation-stack/affiliation-stack.component.ts b/src/app/record/components/affiliation-stack/affiliation-stack.component.ts index c1f784170a..e9ec30d3f7 100644 --- a/src/app/record/components/affiliation-stack/affiliation-stack.component.ts +++ b/src/app/record/components/affiliation-stack/affiliation-stack.component.ts @@ -165,8 +165,7 @@ export class AffiliationStackComponent implements OnInit { } makePrimaryCard(affiliation: Affiliation) { - // TODO - console.warn(this.stackPanelsDisplay) + this._affiliationService.updatePreferredSource(affiliation.putCode.value).subscribe() } changeTopPanelOfTheStack(affiliation: Affiliation) { diff --git a/src/app/record/components/funding-stack/funding-stack.component.ts b/src/app/record/components/funding-stack/funding-stack.component.ts index ff0f56ac8c..a0ecc6a229 100644 --- a/src/app/record/components/funding-stack/funding-stack.component.ts +++ b/src/app/record/components/funding-stack/funding-stack.component.ts @@ -151,8 +151,7 @@ export class FundingStackComponent implements OnInit { } makePrimaryCard(funding: Funding) { - // TODO - console.debug(this.stackPanelsDisplay) + this._fundingService.updatePreferredSource(funding.putCode.value).subscribe() } changeTopPanelOfTheStack(funding: Funding) { diff --git a/src/app/record/components/peer-review-stack/peer-review-stack.component.ts b/src/app/record/components/peer-review-stack/peer-review-stack.component.ts index d495b87dbb..c44615a673 100644 --- a/src/app/record/components/peer-review-stack/peer-review-stack.component.ts +++ b/src/app/record/components/peer-review-stack/peer-review-stack.component.ts @@ -136,7 +136,7 @@ export class PeerReviewStackComponent implements OnInit { } makePrimaryCard(peerReview: PeerReview) { - // TODO + this._recordPeerReviewService.updatePreferredSource(peerReview.putCode.value).subscribe() } changeTopPanelOfTheStack(peerReview: PeerReview) { diff --git a/src/app/record/components/research-resource-stack/research-resource-stack.component.ts b/src/app/record/components/research-resource-stack/research-resource-stack.component.ts index cf40295fa5..7026a2604b 100644 --- a/src/app/record/components/research-resource-stack/research-resource-stack.component.ts +++ b/src/app/record/components/research-resource-stack/research-resource-stack.component.ts @@ -5,6 +5,7 @@ import { ResearchResourcesGroup, } from '../../../types/record-research-resources.endpoint' import { PlatformInfo, PlatformInfoService } from '../../../cdk/platform-info' +import { RecordResearchResourceService } from '../../../core/record-research-resource/record-research-resource.service' @Component({ selector: 'app-research-resource-stack', @@ -49,7 +50,10 @@ export class ResearchResourceStackComponent implements OnInit { isMobile: boolean platform: PlatformInfo - constructor(private _platformInfo: PlatformInfoService) { + constructor( + private _platformInfo: PlatformInfoService, + private _recordResearchResourceService: RecordResearchResourceService + ) { this._platformInfo.get().subscribe((platformInfo) => { this.platform = platformInfo }) @@ -109,7 +113,7 @@ export class ResearchResourceStackComponent implements OnInit { } makePrimaryCard(researchResource: ResearchResource) { - // TODO + this._recordResearchResourceService.updatePreferredSource(researchResource.putCode).subscribe() } changeTopPanelOfTheStack(researchResource: ResearchResource) {