- {#if reconnecting}
+ {#if reconnecting || isLoading}
-
Reconnecting...
+
{reconnecting ? 'Reconnecting...' : 'Loading...'}
{:else if connected}
Live updates active
- {:else if error}
-
-
Connection error
{:else}
Not connected
@@ -71,29 +68,9 @@
class="ml-2 px-3 py-1 text-xs font-medium rounded-md transition-colors
{connected ? 'bg-gray-100 hover:bg-gray-200 text-gray-700' : 'bg-blue-100 hover:bg-blue-200 text-blue-700'}"
onclick={handleReconnect}
- disabled={reconnecting}
+ disabled={reconnecting || isLoading}
>
{connected ? 'Reconnect' : 'Connect'}
-
- {#if !compact}
-
- {/if}
- {#each Object.entries(getConnectionQualityInfo()) as [key, value]}
-
- {key}:
- {value}
-
- {/each}
-
- {/if}
-{/if}
\ No newline at end of file
+{/if}
diff --git a/web-frontend/src/lib/JobStateManager.ts b/web-frontend/src/lib/JobStateManager.ts
index ffda6b3..c8c96e7 100644
--- a/web-frontend/src/lib/JobStateManager.ts
+++ b/web-frontend/src/lib/JobStateManager.ts
@@ -1,8 +1,9 @@
/**
- * Centralized Job State Manager
- *
- * Single source of truth for all job data and updates.
- * Manages WebSocket, polling, caching, and state synchronization.
+ * Simplified Job State Manager
+ *
+ * Single reactive store for all job data.
+ * Backend handles all caching - frontend just fetches and displays.
+ * WebSocket provides real-time updates, simple refetch on disconnect.
*/
import { writable, derived, get, type Readable } from 'svelte/store';
@@ -27,26 +28,9 @@ import {
// Types
// ============================================================================
-type DataSource = 'websocket' | 'api' | 'cache' | 'manual';
-type JobState = 'PD' | 'R' | 'CD' | 'F' | 'CA' | 'TO' | 'UNKNOWN';
-type UpdatePriority = 'realtime' | 'high' | 'normal' | 'low';
-
-interface JobUpdate {
- jobId: string;
- hostname: string;
- job: JobInfo;
- source: DataSource;
- timestamp: number;
- priority: UpdatePriority;
- messageType?: string; // Track message type for better deduplication
-}
-
-interface JobCacheEntry {
+interface JobEntry {
job: JobInfo;
lastUpdated: number;
- lastSource: DataSource;
- output?: any;
- outputTimestamp?: number;
}
interface HostState {
@@ -55,121 +39,36 @@ interface HostState {
lastSync: number;
errorCount: number;
lastError?: string;
- lastErrorTime?: number;
isTimeout?: boolean;
- jobs: Map