Skip to content

Commit

Permalink
Revert the CZ integration
Browse files Browse the repository at this point in the history
  • Loading branch information
avichai-exlibris committed Jun 7, 2023
1 parent da63a89 commit 58f7031
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 31 deletions.
29 changes: 4 additions & 25 deletions cloudapp/src/app/main/main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ export class MainComponent implements OnInit, OnDestroy {
private baseUrl : string = "https://jcr.clarivate.com/jcr-jp/journal-profile?journal=";
private yearParam : string = "&year=";
private OkStatus: string = 'OK';
private izRecordsParam : string = 'mms_id';
private nzRecordsParam : string = 'proxy_nz_mms_id';
private czRecordsParam : string = 'proxy_cz_mms_id';

public isSlideChecked: boolean = false;
public isIncitesEnabled : boolean = false;
Expand Down Expand Up @@ -83,13 +80,10 @@ export class MainComponent implements OnInit, OnDestroy {

getAllPageRecords(entities: any[]) {
this.alert.clear();
//Get the scope - it's needed for the query param
const queryParam = this.getQueryParamByScope(entities[0].link);
const mmsIds = entities.map(entity => entity.id);

this.almaService.getBibsDetailsByMmsId(mmsIds, queryParam).pipe(
this.almaService.getBibsDetailsByMmsId(mmsIds).pipe(
mergeMap(records => {
return this.clarivateServise.getSearchResultsFromClarivate(records.bib);
return this.clarivateServise.getSearchResultsFromClarivate(records);
})
).subscribe({
next: (response) => {
Expand All @@ -104,7 +98,8 @@ export class MainComponent implements OnInit, OnDestroy {
} else {
this.alert.error(response.errorMessage);

}
}

},
error: e => {
this.loading = false;
Expand Down Expand Up @@ -178,20 +173,4 @@ export class MainComponent implements OnInit, OnDestroy {
}
});
}

getQueryParamByScope(link : string) {
if(link.toUpperCase().includes('CZ')) {
return this.czRecordsParam;
}
else if(link.toUpperCase().includes('NZ')) {
return this.nzRecordsParam;
}
return this.izRecordsParam;
}
}

export enum Scope {
IZ = "IZ",
NZ = "NZ",
CZ = "CZ",
}
14 changes: 8 additions & 6 deletions cloudapp/src/app/service/alma.api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ import { forkJoin } from 'rxjs/internal/observable/forkJoin';
})
export class AlmaApiService {

private baseUrl : string = "/almaws/v1/bibs?";



constructor(
private restService: CloudAppRestService,
) { }

getBibsDetailsByMmsId (mmsIds, scope) {
let url : string = this.baseUrl + scope + "=";
return this.restService.call(url + mmsIds)
getBibsDetailsByMmsId (mmsIds) {
// forkJoin run the function inside on each entity seperatly
return forkJoin(mmsIds.map(mmsId => this.getRecord(mmsId)));
}

getRecord(mmsId: string) {
let url : string = "/almaws/v1/bibs/";
return this.restService.call(url + mmsId)
}
}

0 comments on commit 58f7031

Please sign in to comment.