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:
parent
4a2d9bd1fc
commit
f855930340
@ -58,11 +58,13 @@ const SampleTracker: React.FC = () => {
|
|||||||
const hasLost = events.some((e) => e.event_type === 'Lost');
|
const hasLost = events.some((e) => e.event_type === 'Lost');
|
||||||
const hasFailed = events.some((e) => e.event_type === 'Failed');
|
const hasFailed = events.some((e) => e.event_type === 'Failed');
|
||||||
|
|
||||||
if (hasFailed) return 'red';
|
// Logic for status colors
|
||||||
if (hasLost) return 'orange';
|
if (hasFailed) return 'red'; // Failed samples: red
|
||||||
if (hasMounted && hasUnmounted) return 'green';
|
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[] = []) => {
|
const getSampleStatus = (events: Event[] = []) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user