@@ -21,7 +21,7 @@ import {
2121 filter ,
2222 map ,
2323 mergeMap ,
24- switchMap ,
24+ switchMap , tap ,
2525} from 'rxjs/operators' ;
2626
2727import { COLLECTION_PAGE_LINKS_TO_FOLLOW } from '../../collection-page/collection-page.resolver' ;
@@ -92,7 +92,7 @@ export class ObjectAuditOverviewComponent implements OnInit, OnDestroy {
9292 */
9393 dateFormat = 'yyyy-MM-dd HH:mm:ss' ;
9494
95- owningCollection$ : Observable < Collection > ;
95+ objectId : string ;
9696
9797 dataNotAvailable = AUDIT_PERSON_NOT_AVAILABLE ;
9898
@@ -108,19 +108,9 @@ export class ObjectAuditOverviewComponent implements OnInit, OnDestroy {
108108
109109 ngOnInit ( ) : void {
110110 this . sub = this . route . paramMap . pipe (
111- switchMap ( ( paramMap : ParamMap ) => this . itemService . findById ( paramMap . get ( 'objectId' ) ) ) ,
112- getFirstCompletedRemoteData ( ) ,
113- ) . subscribe ( ( rd ) => {
114- this . object = rd . payload ;
115- this . owningCollection$ = this . collectionDataService . findOwningCollectionFor (
116- this . object ,
117- true ,
118- false ,
119- ...COLLECTION_PAGE_LINKS_TO_FOLLOW ,
120- ) . pipe (
121- getFirstCompletedRemoteData ( ) ,
122- map ( data => data ?. payload ) ,
123- ) ;
111+ map ( ( paramMap : ParamMap ) => paramMap . get ( 'objectId' ) ) ,
112+ ) . subscribe ( ( id ) => {
113+ this . objectId = id ;
124114 this . setAudits ( ) ;
125115 } ) ;
126116 }
@@ -136,15 +126,11 @@ export class ObjectAuditOverviewComponent implements OnInit, OnDestroy {
136126 */
137127 setAudits ( ) {
138128 const config$ = this . paginationService . getFindListOptions ( this . pageConfig . id , this . config ) ;
139- const parentCommunity$ = this . owningCollection$ . pipe (
140- switchMap ( collection => collection . parentCommunity ) ,
141- getFirstCompletedRemoteData ( ) ,
142- map ( data => data ?. payload ) ,
143- ) ;
144129
145- this . auditsRD$ = combineLatest ( [ config$ , this . owningCollection$ , parentCommunity$ ] ) . pipe (
146- switchMap ( ( [ config , owningCollection , parentCommunity ] ) =>
147- this . auditService . findByObject ( this . object . id , config , owningCollection . id , parentCommunity . id ) . pipe (
130+ this . auditsRD$ = config$ . pipe (
131+ tap ( console . log ) ,
132+ switchMap ( ( config ) =>
133+ this . auditService . findByObject ( this . objectId , config ) . pipe (
148134 getFirstCompletedRemoteData ( ) ,
149135 ) ,
150136 ) ,
@@ -160,7 +146,7 @@ export class ObjectAuditOverviewComponent implements OnInit, OnDestroy {
160146 const updatedAudits$ = auditsRD . payload . page . map ( audit => {
161147 return forkJoin ( {
162148 epersonName : this . auditService . getEpersonName ( audit ) ,
163- otherAuditObject : this . auditService . getOtherObject ( audit , this . object . id ) ,
149+ otherAuditObject : this . auditService . getOtherObject ( audit , this . objectId ) ,
164150 } ) . pipe (
165151 map ( ( { epersonName, otherAuditObject } ) =>
166152 Object . assign ( new Audit ( ) , audit , { epersonName, otherAuditObject } ) ,
0 commit comments