Skip to content

Commit

Permalink
Revert "URM-186084 Platform Angular upgrade - Handle Nacsis"
Browse files Browse the repository at this point in the history
This reverts commit 573e62e.
  • Loading branch information
avichai-exlibris committed Jan 23, 2023
1 parent 573e62e commit c0156c4
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 203 deletions.
81 changes: 41 additions & 40 deletions cloudapp/src/app/ILL/holdingSearch/holdingSearch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { HoldingsService, HoldingsSearch, NacsisHoldingRecord, DisplayHoldingResult, NacsisBookHoldingsListDetail, NacsisSerialHoldingsListDetail } from '../../service/holdings.service';
import { MatDialog } from '@angular/material/dialog';
import { AlertService, CloudAppStoreService } from '@exlibris/exl-cloudapp-angular-lib';
import { AlertService } from '@exlibris/exl-cloudapp-angular-lib';
import { AppRoutingState, ROUTING_STATE_KEY, RESULT_RECORD_LIST_ILL,SELECTED_RECORD_LIST_ILL, BaseService} from '../../service/base.service';
import { SelectionModel } from '@angular/cdk/collections';
import { MatTableDataSource } from '@angular/material/table';
Expand Down Expand Up @@ -99,8 +99,8 @@ export class HoldingSearchComponent implements OnInit, OnChanges {
private nacsis: HoldingsService,
private membersService: MembersService,
private alert: AlertService,
private _liveAnnouncer: LiveAnnouncer,
private storeService: CloudAppStoreService
private _liveAnnouncer: LiveAnnouncer

) {
this.owners = [
{ id: "0", name: "Holdings.ViewHoldings.All" },
Expand All @@ -118,19 +118,13 @@ export class HoldingSearchComponent implements OnInit, OnChanges {
this.form = holdingFormGroup(null);
this.selection = new SelectionModel<DisplayHoldingResult>(true, []);
this.isMaxRowSelected = false;
let lastResult = sessionStorage.getItem(RESULT_RECORD_LIST_ILL);
this.selected = "0";
this.storeService.get(RESULT_RECORD_LIST_ILL).subscribe({
next : (lastResult) => {
if(!this.illService.isEmpty(lastResult)){
this.holdings = JSON.parse(lastResult);
this.ngOnChanges(this.holdings);
this.panelState = false;
}
},
error : (err) => {
console.log(err);
}
})
if(!this.illService.isEmpty(lastResult)){
this.holdings = JSON.parse(lastResult);
this.ngOnChanges(this.holdings);
this.panelState = false;
}
this.initFieldsMap();
}

Expand Down Expand Up @@ -181,7 +175,7 @@ export class HoldingSearchComponent implements OnInit, OnChanges {
if (this.nacsisHoldingsResultList != null && this.nacsisHoldingsResultList.length > 0) {
this.holdings = this.setDisplayDetails(this.nacsisHoldingsResultList);
this.ngOnChanges(this.holdings);
this.storeService.set(RESULT_RECORD_LIST_ILL, JSON.stringify(this.holdings)).subscribe();
sessionStorage.setItem(RESULT_RECORD_LIST_ILL, JSON.stringify(this.holdings));
this.noHoldingRecords = false;
} else {
this.holdings = new Array();
Expand Down Expand Up @@ -607,28 +601,35 @@ export class HoldingSearchComponent implements OnInit, OnChanges {

onOwnerSelected() {
this.clearSelection();
this.storeService.set(this.nacsis.OwnerKey, this.selected).subscribe();
this.storeService.get(RESULT_RECORD_LIST_ILL).subscribe({
next : (value) => {
if(!this.illService.isEmpty(value)){
this.holdings = JSON.parse(value);
}else{
this.holdings = this.setDisplayDetails(this.nacsisHoldingsResultList);
}
if(this.selected === '0') {
this.noHoldingRecords = false;
this.ngOnChanges(this.holdings);
} else if (this.selected === '1') {
let localnacsisHoldingsResultList = this.holdings.filter(e => e.fano === this.localLibraryID);
this.holdings = localnacsisHoldingsResultList;
if (localnacsisHoldingsResultList.length == 0) {
this.noHoldingRecords = true;
}else{
this.ngOnChanges(localnacsisHoldingsResultList);
}
}
sessionStorage.setItem(this.nacsis.OwnerKey, this.selected);

if (this.selected === '0') {

this.noHoldingRecords = false;
if(!this.illService.isEmpty(sessionStorage.getItem(RESULT_RECORD_LIST_ILL))){
this.holdings = JSON.parse(sessionStorage.getItem(RESULT_RECORD_LIST_ILL));
}else{
this.holdings = this.setDisplayDetails(this.nacsisHoldingsResultList);
}
})

this.ngOnChanges(this.holdings);
} else if (this.selected === '1') {

if(!this.illService.isEmpty(sessionStorage.getItem(RESULT_RECORD_LIST_ILL))){
this.holdings = JSON.parse(sessionStorage.getItem(RESULT_RECORD_LIST_ILL));
}else{
this.holdings = this.setDisplayDetails(this.nacsisHoldingsResultList);
}

let localnacsisHoldingsResultList = this.holdings.filter(e => e.fano === this.localLibraryID);
this.holdings = localnacsisHoldingsResultList;
if (localnacsisHoldingsResultList.length == 0) {
this.noHoldingRecords = true;
}else{
this.ngOnChanges(localnacsisHoldingsResultList);
}
}

}

clearSelection() {
Expand Down Expand Up @@ -697,13 +698,13 @@ export class HoldingSearchComponent implements OnInit, OnChanges {
this.filterSelectVol(this.selecedData);
this.fillRowsTillFive(this.selecedData);
let object = JSON.stringify(this.selecedData);
this.storeService.set(SELECTED_RECORD_LIST_ILL, object).subscribe();
this.storeService.set(ROUTING_STATE_KEY, AppRoutingState.HoldingSearchMainPage).subscribe();
sessionStorage.setItem(SELECTED_RECORD_LIST_ILL, object);
sessionStorage.setItem(ROUTING_STATE_KEY, AppRoutingState.HoldingSearchMainPage);
this.router.navigate(['requestForm', this.nacsisId, this.mmsTitle, this.routerSearchType]);
}

backToSearchRecord() {
this.storeService.set(ROUTING_STATE_KEY, AppRoutingState.ILLBorrowingMainPage).subscribe();
sessionStorage.setItem(ROUTING_STATE_KEY, AppRoutingState.ILLBorrowingMainPage);
this.router.navigate(['searchRecord', 'back']);
}

Expand Down
27 changes: 11 additions & 16 deletions cloudapp/src/app/ILL/main/main.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Subscription, of, forkJoin} from 'rxjs';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { CloudAppEventsService, Entity, EntityType, CloudAppRestService, CloudAppStoreService } from '@exlibris/exl-cloudapp-angular-lib';
import { CloudAppEventsService, Entity, EntityType, CloudAppRestService } from '@exlibris/exl-cloudapp-angular-lib';
import { Router } from '@angular/router';
import { IllService,AlmaRecordsResults, IDisplayLines,BaseRecordInfo, AlmaRequestInfo, AlmaRecordInfo,AlmaRecord,AlmaRecordDisplay} from '../../service/ill.service';
import { catchError, tap } from 'rxjs/operators';
Expand Down Expand Up @@ -44,25 +44,20 @@ export class ILLBorrowingMainComponent implements OnInit, OnDestroy {
private illService: IllService,
private alert: AlertService,
private router: Router,
private storeService: CloudAppStoreService
) { }

ngOnInit() {

//sessionStorage.clear();
this,this.storeService.remove(REQUEST_EXTERNAL_ID).subscribe();
this,this.storeService.remove(ROUTING_STATE_KEY).subscribe();
this,this.storeService.remove(LIBRARY_ID_KEY).subscribe();
this,this.storeService.remove(LIBRARY_MEMBERINFO_KEY).subscribe();

sessionStorage.clear();
this.pageLoad$ = this.eventsService.onPageLoad(pageInfo => {
this.loading = true;
try{
this.almaApiService.getIntegrationProfile()
.subscribe( {
next : integrationProfile => {
this.integrationProfile = integrationProfile;
this.storeService.set(LIBRARY_ID_KEY ,integrationProfile.libraryID).subscribe();
this.integrationProfile = integrationProfile;

sessionStorage.setItem(LIBRARY_ID_KEY,integrationProfile.libraryID);
let rawBibs = (pageInfo.entities || []).filter(e => e.type == EntityType.BIB_MMS || e.type == EntityType.BORROWING_REQUEST );
let disCards: AlmaRequestInfo[] = new Array(rawBibs.length);

Expand Down Expand Up @@ -123,7 +118,7 @@ export class ILLBorrowingMainComponent implements OnInit, OnDestroy {
this.alert.error(e.message, { keepAfterRouteChange: true });
},
complete: () => {
this.storeService.set(LIBRARY_MEMBERINFO_KEY, JSON.stringify(obj)).subscribe();
sessionStorage.setItem(LIBRARY_MEMBERINFO_KEY, JSON.stringify(obj));
this.loading = false;
}
});
Expand Down Expand Up @@ -157,15 +152,15 @@ export class ILLBorrowingMainComponent implements OnInit, OnDestroy {
}

next(){
this.storeService.set(ROUTING_STATE_KEY, AppRoutingState.ILLBorrowingMainPage).subscribe();
this.loading = true;
this.storeService.set(REQUEST_EXTERNAL_ID, this.selected.record.exrernalId).subscribe();
this.router.navigate(['searchRecord',this.selected.record.nacsisId,this.selected.record.title,
sessionStorage.setItem(ROUTING_STATE_KEY, AppRoutingState.ILLBorrowingMainPage);
this.loading = true;
sessionStorage.setItem(REQUEST_EXTERNAL_ID, this.selected.record.exrernalId);
this.router.navigate(['searchRecord',this.selected.record.nacsisId,this.selected.record.title,
this.selected.record.isbn,this.selected.record.issn]);
}

newSearch(){
this.storeService.set(ROUTING_STATE_KEY, AppRoutingState.ILLBorrowingMainPage).subscribe();
sessionStorage.setItem(ROUTING_STATE_KEY, AppRoutingState.ILLBorrowingMainPage);
this.router.navigate(['searchRecord']);
}

Expand Down
29 changes: 11 additions & 18 deletions cloudapp/src/app/ILL/searchRecord/searchRecord.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Component, AfterViewInit, ViewChild, TemplateRef } from '@angular/core'
import { SearchType, SearchField, FieldSize, FieldName } from '../../user-controls/search-form/search-form-utils';
import { MatTabChangeEvent } from '@angular/material/tabs';
import { CatalogService } from '../../service/catalog.service';
import { AlertService, CloudAppStoreService } from '@exlibris/exl-cloudapp-angular-lib';
import { AlertService } from '@exlibris/exl-cloudapp-angular-lib';
import { TranslateService } from '@ngx-translate/core';
import { Router, ActivatedRoute } from '@angular/router';
import { PageEvent } from '@angular/material/paginator';
Expand Down Expand Up @@ -97,7 +97,6 @@ export class searchRecordComponent implements AfterViewInit {
private translate: TranslateService,
private illService: IllService,
private memberService : MembersService,
private storeService: CloudAppStoreService
) { }

ngAfterViewInit() {
Expand Down Expand Up @@ -256,13 +255,13 @@ export class searchRecordComponent implements AfterViewInit {

next() {

this.storeService.set(ROUTING_STATE_KEY, AppRoutingState.SearchRecordMainPage).subscribe();
sessionStorage.setItem(ROUTING_STATE_KEY, AppRoutingState.SearchRecordMainPage);
let title = this.selected.getFullRecordData().getSummaryView().TRD;
let nacsisID = this.selected.getFullRecordData().getSummaryView().ID;
let rawData = this.selected.getFullRecordData().getFullView();
let object = JSON.stringify(rawData);
this.storeService.set(SELECTED_RECORD_ILL, object).subscribe();
this.storeService.set(RESULT_RECORD_LIST_ILL, '').subscribe();
sessionStorage.setItem(SELECTED_RECORD_ILL, object);
sessionStorage.setItem(RESULT_RECORD_LIST_ILL, '');
this.loading = true;
this.router.navigate(['holdingSearch', nacsisID, title, this.currentSearchType]);
}
Expand Down Expand Up @@ -343,21 +342,15 @@ export class searchRecordComponent implements AfterViewInit {


ngOnInit() {
this.storeService.get(ROUTING_STATE_KEY).subscribe({
next(backSession) {
this.backSession = backSession;
if (backSession == "") {
this.illService.clearAllSearchResults();
} else {
this.onBackFromViewHolding();
}
},
error(err) {
console.log(err);
},
})
this.backSession = sessionStorage.getItem(ROUTING_STATE_KEY);
this.isBackFromHoldingSearch = this.route.snapshot.params['flagBack'];
this.fillInItemRecord();

if (sessionStorage.getItem(ROUTING_STATE_KEY) == "") {
this.illService.clearAllSearchResults();
} else {
this.onBackFromViewHolding();
}
}


Expand Down
28 changes: 8 additions & 20 deletions cloudapp/src/app/catalog/main/main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, AfterViewInit , ViewChild, TemplateRef } from '@angular/core
import { SearchType, SearchField, FieldSize, FieldName, stopWords } from '../../user-controls/search-form/search-form-utils';
import { MatTabChangeEvent } from '@angular/material/tabs';
import { CatalogService } from '../../service/catalog.service';
import { AlertService, CloudAppStoreService } from '@exlibris/exl-cloudapp-angular-lib';
import { AlertService } from '@exlibris/exl-cloudapp-angular-lib';
import { TranslateService } from '@ngx-translate/core';
import { Router } from '@angular/router';
import { PageEvent } from '@angular/material/paginator';
Expand All @@ -15,7 +15,6 @@ import { HoldingsService } from '../../service/holdings.service';
import { MembersService } from '../../service/members.service';



@Component({
selector: 'catalog-main',
templateUrl: './main.component.html',
Expand Down Expand Up @@ -84,23 +83,15 @@ export class CatalogMainComponent implements AfterViewInit {
private router: Router,
private alert: AlertService,
private translate: TranslateService,
private storeService: CloudAppStoreService
) { }


ngAfterViewInit(){
this.storeService.get(ROUTING_STATE_KEY).subscribe({
next : (stateKey) =>{
if(stateKey === "") {
this.catalogService.clearAllSearchResults();
} else {
this.onBackFromViewHolding();
}
},
error: e => {
console.log(e);
}
})
if(sessionStorage.getItem(ROUTING_STATE_KEY) == "") {
this.catalogService.clearAllSearchResults();
} else {
this.onBackFromViewHolding();
}
}


Expand Down Expand Up @@ -393,11 +384,8 @@ export class CatalogMainComponent implements AfterViewInit {
.subscribe({
next: (header) => {
if (header.status === this.holdingsService.OkStatus) {
this.storeService.set(ROUTING_STATE_KEY, AppRoutingState.CatalogSearchPage).subscribe
({next: (elment) => console.log()});
// Set holding owner as "Mine"
this.storeService.set(this.holdingsService.OwnerKey, "1").subscribe
({next: (elment) => console.log()});
sessionStorage.setItem(ROUTING_STATE_KEY, AppRoutingState.CatalogSearchPage);
sessionStorage.setItem(this.holdingsService.OwnerKey, "1"); // Set holding owner as "Mine"
this.catalogService.setCurrentSearchType(this.currentSearchType);
this.router.navigate(['/holdings', nacsisId, title]);
} else {
Expand Down
17 changes: 4 additions & 13 deletions cloudapp/src/app/holdings/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FormGroup, FormControl } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
import { HoldingsService, Holding, HoldingsBook, HoldingsSerial, Header } from '../../service/holdings.service';
import { holdingFormGroup } from './form-utils';
import { AlertService, CloudAppStoreService } from '@exlibris/exl-cloudapp-angular-lib';
import { AlertService } from '@exlibris/exl-cloudapp-angular-lib';
import { Action } from '../../user-controls/result-card/result-card.component';
import { MultiSearchField, SearchField, FieldName, FieldSize, SelectSearchField } from '../../user-controls/search-form/search-form-utils';
import { AlmaApiService } from '../../service/alma.api.service';
Expand Down Expand Up @@ -50,9 +50,7 @@ export class FormComponent implements OnInit {
private router: Router,
private translate: TranslateService,
private nacsis: HoldingsService,
private alert: AlertService,
private storeService: CloudAppStoreService

private alert: AlertService
) { }

public ACTIONS_MENU_LIST = new Array(
Expand All @@ -63,15 +61,8 @@ export class FormComponent implements OnInit {
this.mmsId = this.route.snapshot.params['mmsId'];
this.mmsTitle = this.route.snapshot.params['mmsTitle'];
this.holdingId = this.route.snapshot.params['holdingId'];
this.storeService.get(VOLUME_LIST).subscribe({
next : (joinedVolumeList) => {
this.volumeList = joinedVolumeList?.split(VOLUME_LIST_SEPARATOR);
},
error : () => {
console.log("joinedVolumeList is undefined");
}
});

let joinedVolumeList = sessionStorage.getItem(VOLUME_LIST);
this.volumeList = joinedVolumeList?.split(VOLUME_LIST_SEPARATOR);


this.type = this.nacsis.getHeader().type;
Expand Down
13 changes: 6 additions & 7 deletions cloudapp/src/app/holdings/main/main.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Subscription, of, forkJoin } from 'rxjs';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { CloudAppEventsService, Entity, EntityType, CloudAppRestService, CloudAppStoreService } from '@exlibris/exl-cloudapp-angular-lib';
import { CloudAppEventsService, Entity, EntityType, CloudAppRestService } from '@exlibris/exl-cloudapp-angular-lib';
import { Router } from '@angular/router';
import { HoldingsService } from '../../service/holdings.service';
import { TranslateService } from '@ngx-translate/core';
Expand Down Expand Up @@ -41,16 +41,15 @@ export class MainComponent implements OnInit, OnDestroy {
private nacsis: HoldingsService,
private translate: TranslateService,
private alert: AlertService,
private storeService: CloudAppStoreService,

private restService: CloudAppRestService,
private almaApiService: AlmaApiService,
private illService: IllService,
) { }

ngOnInit() {
this,this.storeService.remove(ROUTING_STATE_KEY).subscribe();
this,this.storeService.remove(VOLUME_LIST).subscribe();
//sessionStorage.clear();

sessionStorage.clear();
this.pageLoad$ = this.eventsService.onPageLoad(pageInfo => {

this.loading = true;
Expand Down Expand Up @@ -115,8 +114,8 @@ export class MainComponent implements OnInit, OnDestroy {
.subscribe({
next: (header) => {
if (header.status === this.nacsis.OkStatus) {
this.storeService.set(VOLUME_LIST,bib[0].volumes.join(VOLUME_LIST_SEPARATOR)).subscribe();
this.storeService.set(ROUTING_STATE_KEY, AppRoutingState.HoldingsMainPage).subscribe();
sessionStorage.setItem(VOLUME_LIST, bib[0].volumes.join(VOLUME_LIST_SEPARATOR))
sessionStorage.setItem(ROUTING_STATE_KEY, AppRoutingState.HoldingsMainPage);
this.router.navigate(['/holdings', this.selected, bib[0].title]);
} else {
this.alert.error(header.errorMessage, { keepAfterRouteChange: true });
Expand Down
Loading

0 comments on commit c0156c4

Please sign in to comment.