adding display information for manual source.

This commit is contained in:
Jason Kulatunga 2023-10-14 13:57:20 -07:00
parent 3cd3448fa5
commit a486f917e4
No known key found for this signature in database
3 changed files with 14 additions and 1 deletions

View File

@ -13,7 +13,7 @@
</div> </div>
<div class="card-footer text-center p-1" style="width:100%"> <div class="card-footer text-center p-1" style="width:100%">
<small class="tx-gray-700"> <small class="tx-gray-700">
{{sourceInfo?.metadata.display}} {{sourceInfo?.metadata?.display || getSourceDisplayName(sourceInfo)}}
</small> </small>
</div> </div>
</div> </div>

View File

@ -1,5 +1,6 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {SourceListItem} from '../../pages/medical-sources/medical-sources.component'; import {SourceListItem} from '../../pages/medical-sources/medical-sources.component';
import moment from 'moment/moment';
@Component({ @Component({
selector: 'app-medical-sources-card', selector: 'app-medical-sources-card',
@ -22,4 +23,14 @@ export class MedicalSourcesCardComponent implements OnInit {
this.onClick.emit(this.sourceInfo) 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"
}
} }

View File

@ -3,6 +3,8 @@ import {BackgroundJob} from './background-job';
export class Source extends LighthouseSourceMetadata{ export class Source extends LighthouseSourceMetadata{
id?: string id?: string
created_at?: string
updated_at?: string
user_id?: number user_id?: number
source_type: string source_type: string
latest_background_job?: BackgroundJob latest_background_job?: BackgroundJob