diff --git a/frontend/src/app/pages/resource-detail/resource-detail.component.html b/frontend/src/app/pages/resource-detail/resource-detail.component.html index 2d53fbd5..045f17dc 100644 --- a/frontend/src/app/pages/resource-detail/resource-detail.component.html +++ b/frontend/src/app/pages/resource-detail/resource-detail.component.html @@ -2,6 +2,7 @@
+ {{sourceName}} Resource {{resource?.source_resource_type}} {{resource?.source_resource_id}} diff --git a/frontend/src/app/pages/resource-detail/resource-detail.component.ts b/frontend/src/app/pages/resource-detail/resource-detail.component.ts index 25554256..7b325184 100644 --- a/frontend/src/app/pages/resource-detail/resource-detail.component.ts +++ b/frontend/src/app/pages/resource-detail/resource-detail.component.ts @@ -10,7 +10,8 @@ import {Base64} from '../../../lib/utils/base64'; styleUrls: ['./resource-detail.component.scss'] }) export class ResourceDetailComponent implements OnInit { - + sourceId: string = "" + sourceName: string = "" resource: ResourceFhir = null constructor(private fastenDb: FastenDbService, private router: Router, private route: ActivatedRoute) { @@ -18,10 +19,18 @@ export class ResourceDetailComponent implements OnInit { ngOnInit(): void { //always request the resource by id - this.fastenDb.GetResource(Base64.Decode(this.route.snapshot.paramMap.get('resource_id'))) - .then((resourceFhir) => { - this.resource = resourceFhir; - }); + let resourceId = Base64.Decode(this.route.snapshot.paramMap.get('resource_id')) + if (resourceId){ + this.fastenDb.GetResource(resourceId) + .then((resourceFhir) => { + this.resource = resourceFhir; + }); + this.sourceId = resourceId.split(":")[1] + this.sourceName = Base64.Decode(this.sourceId).split(":")[1] + } else { + console.log("invalid or missing resource id") + } + } }