removing unnecessary lighthouse call during sync.

fixes #383
This commit is contained in:
Jason Kulatunga 2024-01-17 20:06:19 -08:00
parent 9348a73984
commit 57cd4c3f0c
No known key found for this signature in database
2 changed files with 15 additions and 10 deletions

View File

@ -48,6 +48,7 @@ export class MedicalSourcesConnectedComponent implements OnInit {
//handle connected sources sources
const connectedSources = results as Source[]
forkJoin(connectedSources.map((source) => {
//TODO: remove this, and similar code in explore.component.ts
if(source.platform_type == 'fasten' || source.platform_type == 'manual') {
return this.lighthouseApi.getLighthouseCatalogBrand(source.platform_type)
} else {

View File

@ -2,16 +2,13 @@ import { Component, OnInit } from '@angular/core';
import {FastenApiService} from '../../services/fasten-api.service';
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
import {Source} from '../../models/fasten/source';
import {forkJoin} from 'rxjs';
import {forkJoin, of} from 'rxjs';
import {LighthouseService} from '../../services/lighthouse.service';
import {Router} from '@angular/router';
import {LighthouseBrandListDisplayItem} from '../../models/lighthouse/lighthouse-source-search';
import {LighthouseSourceMetadata} from '../../models/lighthouse/lighthouse-source-metadata';
import {SourceListItem} from '../medical-sources/medical-sources.component';
export class SourceListItem {
source?: Source
metadata: LighthouseSourceMetadata
}
@Component({
selector: 'app-explore',
@ -33,9 +30,16 @@ export class ExploreComponent implements OnInit {
//handle connected sources sources
const connectedSources = results as Source[]
forkJoin(connectedSources.map((source) => this.lighthouseApi.getLighthouseSource(source.endpoint_id))).subscribe((connectedMetadata) => {
forkJoin(connectedSources.map((source) => {
//TODO: remove this, and similar code in medical-sources-card.component.ts
if(source.platform_type == 'fasten' || source.platform_type == 'manual') {
return this.lighthouseApi.getLighthouseCatalogBrand(source.platform_type)
} else {
return of(null)
}
})).subscribe((connectedMetadata) => {
for(const ndx in connectedSources){
this.connectedSources.push({source: connectedSources[ndx], metadata: connectedMetadata[ndx]})
this.connectedSources.push({source: connectedSources[ndx], brand: connectedMetadata[ndx]})
}
this.loading = false
})