Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix device seen status sometimes shows "never" even though has #1762

Merged
merged 4 commits into from
Mar 2, 2023

Conversation

Steve-Mcl
Copy link
Contributor

Description

Device seen "friendly" text would sometimes show "never" even though just moments ago it said "xx seconds ago"
There are several places in the UI code where a timestamp retrieved from DB is being compared to the browsers Date.now(). Any differences in time between client and server will result in anomalous values.

This PR adds server side computed time device last seen as a milliseconds value. This is transmitted with the device view and can then be safely converted into human readable time period at the frontend.

Related Issue(s)

#1723

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on flowforge/helm to update ConfigMap Template
    • Issue/PR raised on flowforge/CloudProject to update values for Staging/Production

Labels

  • [-] Backport needed? -> add the backport label
  • [-] Includes a DB migration? -> add the area:migration label

@Steve-Mcl
Copy link
Contributor Author

Steve-Mcl commented Feb 28, 2023

@joepavitt, could you do a "pre-review" to ensure the approach is ok with you & if so, I will add unit tests to cover the new data prop lastSeenMs returned by device view?

@joepavitt
Copy link
Contributor

Looks good to me @Steve-Mcl

@Steve-Mcl
Copy link
Contributor Author

Thanks @joepavitt will get test written later today and re-request for you to check + merge.

@Steve-Mcl Steve-Mcl requested a review from joepavitt March 1, 2023 17:33
@Steve-Mcl
Copy link
Contributor Author

@joepavitt updated test to ensure new property is present.

Good to go (once tests complete)

@Steve-Mcl
Copy link
Contributor Author

PG test fails were (it seems) due to GH actions not the code.

3rd time was the charm

Ready for review.

@joepavitt joepavitt merged commit 5ac9492 into main Mar 2, 2023
@joepavitt joepavitt deleted the fix-device-seen-status-1723 branch March 2, 2023 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Device "Last Seen" status shows "never" even though it has previously been seen
2 participants