From 9348a73984f5ced6bbad2e1682fb73afec7b8885 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Wed, 17 Jan 2024 19:48:10 -0800 Subject: [PATCH] removing unnecessary lighthouse call during sync. fixes #383 --- .../medical-sources-connected.component.html | 2 +- .../medical-sources-connected.component.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.html b/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.html index d19037c9..ca48cb2b 100644 --- a/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.html +++ b/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.html @@ -52,7 +52,7 @@ Actions
- +
diff --git a/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.ts b/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.ts index 7264bc6c..90835822 100644 --- a/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.ts +++ b/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.ts @@ -3,7 +3,7 @@ import {Source} from '../../models/fasten/source'; import {SourceListItem} from '../../pages/medical-sources/medical-sources.component'; import {ModalDismissReasons, NgbModal} from '@ng-bootstrap/ng-bootstrap'; import {FastenApiService} from '../../services/fasten-api.service'; -import {forkJoin} from 'rxjs'; +import {forkJoin, of} from 'rxjs'; import {LighthouseService} from '../../services/lighthouse.service'; import {LighthouseSourceMetadata} from '../../models/lighthouse/lighthouse-source-metadata'; import {ToastNotification, ToastType} from '../../models/fasten/toast'; @@ -51,7 +51,7 @@ export class MedicalSourcesConnectedComponent implements OnInit { if(source.platform_type == 'fasten' || source.platform_type == 'manual') { return this.lighthouseApi.getLighthouseCatalogBrand(source.platform_type) } else { - return this.lighthouseApi.getLighthouseCatalogBrand(source.brand_id) + return of(null) } })) .subscribe((connectedBrand) => { @@ -296,10 +296,13 @@ export class MedicalSourcesConnectedComponent implements OnInit { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public openModal(contentModalRef, sourceListItem: SourceListItem) { + let brandId = sourceListItem?.source?.brand_id || sourceListItem?.brand?.id + + if( - (this.status[sourceListItem.brand.id] && this.status[sourceListItem.brand.id] != 'failed') //if this source type is currently "loading" dont open the modal window + (this.status[brandId] && this.status[brandId] != 'failed') //if this source type is currently "loading" dont open the modal window || !sourceListItem.source //if there's no connected source, dont open the modal window - || (this.status[sourceListItem.source.id] && this.status[sourceListItem.source.id] != 'failed') //if this source type is currently "loading" dont open the modal window + || (this.status[sourceListItem?.source?.id] && this.status[sourceListItem?.source?.id] != 'failed') //if this source type is currently "loading" dont open the modal window ){ //if this source is currently "loading" dont open the modal window return