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 //handle connected sources sources
const connectedSources = results as Source[] const connectedSources = results as Source[]
forkJoin(connectedSources.map((source) => { forkJoin(connectedSources.map((source) => {
//TODO: remove this, and similar code in explore.component.ts
if(source.platform_type == 'fasten' || source.platform_type == 'manual') { if(source.platform_type == 'fasten' || source.platform_type == 'manual') {
return this.lighthouseApi.getLighthouseCatalogBrand(source.platform_type) return this.lighthouseApi.getLighthouseCatalogBrand(source.platform_type)
} else { } else {

View File

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