lighthouse will provide available sources and metadata.
This commit is contained in:
parent
d4773371b2
commit
7c3fa21d9b
|
@ -20,7 +20,7 @@ jobs:
|
|||
go-version: '1.18.3'
|
||||
- run: go version
|
||||
- run: |
|
||||
make frontend-test
|
||||
make frontend-dep
|
||||
cd frontend
|
||||
yarn run build -- --configuration sandbox --output-path=../dist
|
||||
# env:
|
||||
|
|
|
@ -16,7 +16,6 @@ export class AuthSignupComponent implements OnInit {
|
|||
errorMsg: string = ""
|
||||
|
||||
constructor(
|
||||
// private fastenApi: FastenApiService,
|
||||
private fastenDb: FastenDbService,
|
||||
private router: Router,
|
||||
private toastService: ToastService
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {FastenApiService} from '../../services/fasten-api.service';
|
||||
import {Source} from '../../../lib/models/database/source';
|
||||
import {Router} from '@angular/router';
|
||||
import {ResourceFhir} from '../../../lib/models/database/resource_fhir';
|
||||
|
@ -8,6 +7,7 @@ import {MetadataSource} from '../../models/fasten/metadata-source';
|
|||
import {FastenDbService} from '../../services/fasten-db.service';
|
||||
import {Summary} from '../../../lib/models/fasten/summary';
|
||||
import {Base64} from '../../../lib/utils/base64';
|
||||
import {LighthouseService} from '../../services/lighthouse.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dashboard',
|
||||
|
@ -24,7 +24,7 @@ export class DashboardComponent implements OnInit {
|
|||
metadataSource: { [name: string]: MetadataSource }
|
||||
|
||||
constructor(
|
||||
private fastenApi: FastenApiService,
|
||||
private lighthouseApi: LighthouseService,
|
||||
private fastenDb: FastenDbService,
|
||||
private router: Router
|
||||
) { }
|
||||
|
@ -49,7 +49,7 @@ export class DashboardComponent implements OnInit {
|
|||
// })
|
||||
// })
|
||||
|
||||
forkJoin([this.fastenDb.GetSummary(), this.fastenApi.GetMetadataSources()]).subscribe(results => {
|
||||
forkJoin([this.fastenDb.GetSummary(), this.lighthouseApi.getLighthouseSourceMetadataMap()]).subscribe(results => {
|
||||
let summary = results[0] as Summary
|
||||
let metadataSource = results[1] as { [name: string]: MetadataSource }
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {LighthouseService} from '../../services/lighthouse.service';
|
||||
import {FastenApiService} from '../../services/fasten-api.service';
|
||||
import {FastenDbService} from '../../services/fasten-db.service';
|
||||
import {LighthouseSourceMetadata} from '../../../lib/models/lighthouse/lighthouse-source-metadata';
|
||||
import {Source} from '../../../lib/models/database/source';
|
||||
|
@ -35,7 +34,6 @@ export class MedicalSourcesComponent implements OnInit {
|
|||
|
||||
constructor(
|
||||
private lighthouseApi: LighthouseService,
|
||||
private fastenApi: FastenApiService,
|
||||
private fastenDb: FastenDbService,
|
||||
private modalService: NgbModal,
|
||||
private route: ActivatedRoute,
|
||||
|
@ -57,7 +55,7 @@ export class MedicalSourcesComponent implements OnInit {
|
|||
modalSelectedSourceListItem:SourceListItem = null;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.fastenApi.GetMetadataSources().subscribe((metadataSources: {[name:string]: MetadataSource}) => {
|
||||
this.lighthouseApi.getLighthouseSourceMetadataMap().subscribe((metadataSources: {[name:string]: MetadataSource}) => {
|
||||
this.metadataSources = metadataSources
|
||||
|
||||
const callbackSourceType = this.route.snapshot.paramMap.get('source_type')
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FastenApiService } from './fasten-api.service';
|
||||
import {HttpClientTestingModule} from '@angular/common/http/testing';
|
||||
|
||||
|
||||
describe('FastenApiService', () => {
|
||||
let service: FastenApiService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ HttpClientTestingModule ],
|
||||
});
|
||||
service = TestBed.inject(FastenApiService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -1,29 +0,0 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import {Observable} from 'rxjs';
|
||||
import {map} from 'rxjs/operators';
|
||||
import {ResponseWrapper} from '../models/response-wrapper';
|
||||
import {MetadataSource} from '../models/fasten/metadata-source';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FastenApiService {
|
||||
|
||||
constructor(private _httpClient: HttpClient) {
|
||||
}
|
||||
|
||||
private getBasePath(): string {
|
||||
return window.location.pathname.split('/web').slice(0, 1)[0];
|
||||
}
|
||||
|
||||
public GetMetadataSources(): Observable<{[name: string]: MetadataSource}> {
|
||||
return this._httpClient.get<ResponseWrapper>(`${this.getBasePath()}/api/metadata/source`)
|
||||
.pipe(
|
||||
map((response: ResponseWrapper) => {
|
||||
console.log("Metadata RESPONSE", response)
|
||||
return response.data as {[name: string]: MetadataSource}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import {ResponseWrapper} from '../models/response-wrapper';
|
|||
import {LighthouseSourceMetadata} from '../../lib/models/lighthouse/lighthouse-source-metadata';
|
||||
import * as Oauth from '@panva/oauth4webapi';
|
||||
import {SourceState} from '../models/fasten/source-state';
|
||||
import {MetadataSource} from '../models/fasten/metadata-source';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -16,6 +17,16 @@ export class LighthouseService {
|
|||
constructor(private _httpClient: HttpClient) {
|
||||
}
|
||||
|
||||
public getLighthouseSourceMetadataMap(): Observable<{[name: string]: MetadataSource}> {
|
||||
return this._httpClient.get<ResponseWrapper>(`${environment.lighthouse_api_endpoint_base}/list`)
|
||||
.pipe(
|
||||
map((response: ResponseWrapper) => {
|
||||
console.log("Metadata RESPONSE", response)
|
||||
return response.data as {[name: string]: MetadataSource}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
async getLighthouseSource(sourceType: string): Promise<LighthouseSourceMetadata> {
|
||||
return this._httpClient.get<any>(`${environment.lighthouse_api_endpoint_base}/connect/${sourceType}`)
|
||||
.pipe(
|
||||
|
|
Loading…
Reference in New Issue