Implement polling for tracking sample updates in real-time

Added a 1-second polling interval to fetch the latest sample data, ensuring the UI remains updated with real-time progress. Cleaned up code formatting for readability and consistency. Improved `getSampleStatus` logic to better distinguish sample states.
This commit is contained in:
GotthardG 2025-01-10 16:19:57 +01:00
parent 4a2d9bd1fc
commit f855930340

View File

@ -58,11 +58,13 @@ const SampleTracker: React.FC = () => {
const hasLost = events.some((e) => e.event_type === 'Lost');
const hasFailed = events.some((e) => e.event_type === 'Failed');
if (hasFailed) return 'red';
if (hasLost) return 'orange';
if (hasMounted && hasUnmounted) return 'green';
// Logic for status colors
if (hasFailed) return 'red'; // Failed samples: red
if (hasLost) return 'orange'; // Lost samples: orange
if (hasMounted && hasUnmounted) return 'green'; // Completed samples: green
if (hasMounted && !hasUnmounted) return 'blue'; // Currently mounted (Pending): blue
return 'gray';
return 'gray'; // Default: gray
};
const getSampleStatus = (events: Event[] = []) => {