mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-09-11 07:48:43 -06:00
Fixed Device "Last Seen" Logic and Watchdog Behavior
This commit is contained in:
@@ -34,10 +34,10 @@ export default function DeviceDetails({ device, onBack }) {
|
||||
const tsSec = device?.lastSeen;
|
||||
if (!tsSec) return "Offline";
|
||||
const now = Date.now() / 1000;
|
||||
return now - tsSec <= 15 ? "Online" : "Offline";
|
||||
return now - tsSec <= 120 ? "Online" : "Offline";
|
||||
});
|
||||
|
||||
const statusFromHeartbeat = (tsSec, offlineAfter = 15) => {
|
||||
const statusFromHeartbeat = (tsSec, offlineAfter = 120) => {
|
||||
if (!tsSec) return "Offline";
|
||||
const now = Date.now() / 1000;
|
||||
return now - tsSec <= offlineAfter ? "Online" : "Offline";
|
||||
@@ -45,7 +45,7 @@ export default function DeviceDetails({ device, onBack }) {
|
||||
|
||||
const statusColor = (s) => (s === "Online" ? "#00d18c" : "#ff4f4f");
|
||||
|
||||
const formatLastSeen = (tsSec, offlineAfter = 15) => {
|
||||
const formatLastSeen = (tsSec, offlineAfter = 120) => {
|
||||
if (!tsSec) return "unknown";
|
||||
const now = Date.now() / 1000;
|
||||
if (now - tsSec <= offlineAfter) return "Currently Online";
|
||||
|
@@ -18,7 +18,7 @@ import {
|
||||
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
||||
import { DeleteDeviceDialog } from "../Dialogs.jsx";
|
||||
|
||||
function formatLastSeen(tsSec, offlineAfter = 15) {
|
||||
function formatLastSeen(tsSec, offlineAfter = 120) {
|
||||
if (!tsSec) return "unknown";
|
||||
const now = Date.now() / 1000;
|
||||
if (now - tsSec <= offlineAfter) return "Currently Online";
|
||||
@@ -35,7 +35,7 @@ function formatLastSeen(tsSec, offlineAfter = 15) {
|
||||
return `${date} @ ${time}`;
|
||||
}
|
||||
|
||||
function statusFromHeartbeat(tsSec, offlineAfter = 15) {
|
||||
function statusFromHeartbeat(tsSec, offlineAfter = 120) {
|
||||
if (!tsSec) return "Offline";
|
||||
const now = Date.now() / 1000;
|
||||
return now - tsSec <= offlineAfter ? "Online" : "Offline";
|
||||
|
Reference in New Issue
Block a user