From ee0bd6d86f65b73953484b293b2bfa0e8a6805c6 Mon Sep 17 00:00:00 2001 From: Daniel Palafox Date: Mon, 20 Sep 2021 19:29:08 -0500 Subject: [PATCH] fix: mark as missing primary source functionality in activities (#1152) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: mark as missing primary source functionality in activities see the issue for details fixes issue #1142 * 🤖 GITHUB ACTIONS: formatting 🤖 --- .../record-affiliations.service.ts | 14 ++++++++++++++ .../record-fundings/record-fundings.service.ts | 14 ++++++++++++++ .../record-peer-review.service.ts | 14 ++++++++++++++ .../record-research-resource.service.ts | 14 ++++++++++++++ .../affiliation-stack.component.ts | 5 +++-- .../funding-stack/funding-stack.component.ts | 5 +++-- .../peer-review-stack.component.ts | 4 +++- .../research-resource-stack.component.ts | 10 ++++++++-- 8 files changed, 73 insertions(+), 7 deletions(-) diff --git a/src/app/core/record-affiliations/record-affiliations.service.ts b/src/app/core/record-affiliations/record-affiliations.service.ts index ff06e26ae0..0a01687544 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..3823694b66 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..bd01255829 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..1e66dc9c92 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..6fca779ab8 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,9 @@ 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..d60d40b8d0 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,9 @@ 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..8da7c2566b 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,9 @@ 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..1c0afa3d32 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,9 @@ export class ResearchResourceStackComponent implements OnInit { } makePrimaryCard(researchResource: ResearchResource) { - // TODO + this._recordResearchResourceService + .updatePreferredSource(researchResource.putCode) + .subscribe() } changeTopPanelOfTheStack(researchResource: ResearchResource) {