mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 12:53:32 +00:00
feat(network): add session status card
Display server health metrics from the unused /session endpoint: - Connected clients count (live from useClientStore) - Server uptime since last restart - Last client connection time (relative) - Last integration request time (relative) - Server timezone - Cloud latency (Docker only) with warning threshold Adds useSessionStats hook with 60s refetch interval, new NetworkStatus component as first card in Network panel, and navigation menu entries for Server status and Network interfaces sections. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NrhcEgY8mqaxZi8veMPrrx
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { SessionStats } from 'ontime-types';
|
||||
|
||||
import { queryRefetchInterval } from '../../ontimeConfig';
|
||||
import { SESSION_STATS } from '../api/constants';
|
||||
import { getSessionStats } from '../api/session';
|
||||
|
||||
export default function useSessionStats() {
|
||||
const { data, status, isError, refetch } = useQuery<SessionStats>({
|
||||
queryKey: SESSION_STATS,
|
||||
queryFn: ({ signal }) => getSessionStats({ signal }),
|
||||
placeholderData: (previousData, _previousQuery) => previousData,
|
||||
refetchInterval: queryRefetchInterval,
|
||||
});
|
||||
|
||||
return { data, status, isError, refetch };
|
||||
}
|
||||
Reference in New Issue
Block a user