Introduce status field to Device model for better representation of state#7828
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7828 +/- ##
=======================================
Coverage 75.09% 75.10%
=======================================
Files 430 430
Lines 22838 22844 +6
Branches 6052 6054 +2
=======================================
+ Hits 17151 17157 +6
Misses 5687 5687
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
odd - unrelated UI test error Re-running |
andypalmi
left a comment
There was a problem hiding this comment.
Looks good to me. Good job on the new test
|
I was expecting this to include updates to the Device Views to include this new field - I assumed the MCP stuff would be accessing things via the external platform API. If that isn't going to get covered here, please add a note to the UI issue you raised to point out the UI doesn't yet have visibility of the new field. |
For MCP stuff, no FE (or views) are required so no, not done in this one. I'll tip a wink to the requirement for views in the 2nd sub-task (which is small enough to be a single PR or broken down further into FE and BE tasks) |
Description
This pull request adds a new virtual
statusfield to theDevicemodel and introduces comprehensive unit tests to verify its behavior. The main goal is to provide a simple way to determine if a device is "online", "offline", or "not-seen" based on thelastSeenAttimestamp.Device model enhancements:
statusfield to theDevicemodel, which returns"not-seen"if the device has never been seen,"online"if seen within the last 30 minutes, and"offline"otherwise.Testing improvements:
statusvirtual field inDevice_spec.js, covering all possible status values ("not-seen", "online", "offline") based on differentlastSeenAtvalues.Related Issue(s)
closes #7826
Checklist
flowforge.yml?FlowFuse/helmto update ConfigMap TemplateFlowFuse/CloudProjectto update values for Staging/ProductionLabels
area:migrationlabel