removing unnecessary lighthouse call during sync.

fixes #383
This commit is contained in:
Jason Kulatunga 2024-01-17 19:48:10 -08:00
parent 98b06df9a2
commit 9348a73984
No known key found for this signature in database
2 changed files with 8 additions and 5 deletions

View File

@ -52,7 +52,7 @@
Actions
</button>
<div ngbDropdownMenu aria-labelledby="dropdownManual">
<button *ngIf="modalSelectedSourceListItem?.source?.platform_type != 'manual'" ngbDropdownItem (click)="sourceSyncHandler(modalSelectedSourceListItem.source)" type="button" class="btn btn-indigo">Sync</button>
<button *ngIf="modalSelectedSourceListItem?.source?.platform_type != 'manual'" ngbDropdownItem (click)="sourceSyncHandler(modalSelectedSourceListItem?.source)" type="button" class="btn btn-indigo">Sync</button>
<button *ngIf="modalSelectedSourceListItem?.source?.platform_type != 'manual'" ngbDropdownItem (click)="sourceReconnectHandler(modalSelectedSourceListItem)" type="button" class="btn btn-danger">Reconnect</button>
<button ngbDropdownItem (click)="sourceDeleteHandler()" type="button" class="btn btn-danger">Delete</button>
</div>

View File

@ -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