highlight last updated dates when more than 2 weeks or 1 month.

This commit is contained in:
Jason Kulatunga
2022-05-06 17:02:56 -07:00
parent f39628efc3
commit 0cee744c29
2 changed files with 21 additions and 2 deletions
@@ -196,6 +196,26 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
}
}
classDeviceLastUpdatedOn(deviceSummary){
if (deviceSummary.device.device_status !== 0) {
return 'text-red' // if the device has failed, always highlight in red
} else if(deviceSummary.device.device_status === 0 && deviceSummary.smart){
if(moment().subtract(14, 'd').isBefore(deviceSummary.smart.collector_date)){
// this device was updated in the last 2 weeks.
return 'text-green'
} else if(moment().subtract(1, 'm').isBefore(deviceSummary.smart.collector_date)){
// this device was updated in the last month
return 'text-yellow'
} else{
// last updated more than a month ago.
return 'text-red'
}
} else {
return ''
}
}
/**
* Track by function for ngFor loops
*