From a486f917e496dd0b9798b8eacd8cc78c54b70425 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sat, 14 Oct 2023 13:57:20 -0700 Subject: [PATCH] adding display information for manual source. --- .../medical-sources-card.component.html | 2 +- .../medical-sources-card.component.ts | 11 +++++++++++ frontend/src/app/models/fasten/source.ts | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/medical-sources-card/medical-sources-card.component.html b/frontend/src/app/components/medical-sources-card/medical-sources-card.component.html index c982e07a..212bf223 100644 --- a/frontend/src/app/components/medical-sources-card/medical-sources-card.component.html +++ b/frontend/src/app/components/medical-sources-card/medical-sources-card.component.html @@ -13,7 +13,7 @@ diff --git a/frontend/src/app/components/medical-sources-card/medical-sources-card.component.ts b/frontend/src/app/components/medical-sources-card/medical-sources-card.component.ts index 52a79ecc..740774ae 100644 --- a/frontend/src/app/components/medical-sources-card/medical-sources-card.component.ts +++ b/frontend/src/app/components/medical-sources-card/medical-sources-card.component.ts @@ -1,5 +1,6 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {SourceListItem} from '../../pages/medical-sources/medical-sources.component'; +import moment from 'moment/moment'; @Component({ selector: 'app-medical-sources-card', @@ -22,4 +23,14 @@ export class MedicalSourcesCardComponent implements OnInit { this.onClick.emit(this.sourceInfo) } + getSourceDisplayName(sourceItem: SourceListItem): string { + if(sourceItem.metadata?.display) { + return sourceItem.metadata?.display + } + if(sourceItem.source?.source_type == 'manual') { + return 'Uploaded ' + moment(sourceItem.source?.created_at).format('MMM DD, YYYY') + } + return "Unknown" + } + } diff --git a/frontend/src/app/models/fasten/source.ts b/frontend/src/app/models/fasten/source.ts index 722e7130..0bd2bf8f 100644 --- a/frontend/src/app/models/fasten/source.ts +++ b/frontend/src/app/models/fasten/source.ts @@ -3,6 +3,8 @@ import {BackgroundJob} from './background-job'; export class Source extends LighthouseSourceMetadata{ id?: string + created_at?: string + updated_at?: string user_id?: number source_type: string latest_background_job?: BackgroundJob