Skip to content

Commit

Permalink
adding display information for manual source.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Oct 14, 2023
1 parent 3cd3448 commit a486f91
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
<div class="card-footer text-center p-1" style="width:100%">
<small class="tx-gray-700">
{{sourceInfo?.metadata.display}}
{{sourceInfo?.metadata?.display || getSourceDisplayName(sourceInfo)}}
</small>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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"
}

}
2 changes: 2 additions & 0 deletions frontend/src/app/models/fasten/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a486f91

Please sign in to comment.