Refactor image rendering in ResultGrid with CSS enhancements
Simplified image rendering logic in `ResultGrid` by removing hover state management within JavaScript. Added `SampleImage.css` to handle hover effects for images and tooltips with scalable zoom. Cleaned up unnecessary comments and improved code readability.
This commit is contained in:
parent
da79115ba4
commit
c3cf463f06
@ -49,6 +49,7 @@ const ResultGrid: React.FC<ResultGridProps> = ({ activePgroup }) => {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = () => {
|
||||
console.log("Fetching sample results for active_pgroup:", activePgroup);
|
||||
SamplesService.getSampleResultsSamplesResultsGet(activePgroup)
|
||||
.then((response: SampleResult[]) => {
|
||||
@ -56,10 +57,21 @@ const ResultGrid: React.FC<ResultGridProps> = ({ activePgroup }) => {
|
||||
setRows(response);
|
||||
})
|
||||
.catch((err: Error) => {
|
||||
console.error('Error fetching sample results:', err);
|
||||
console.error("Error fetching sample results:", err);
|
||||
});
|
||||
};
|
||||
|
||||
// Fetch data initially.
|
||||
fetchData();
|
||||
|
||||
// Set up an interval to refresh data every 15 seconds (adjust as needed)
|
||||
const intervalId = setInterval(fetchData, 15000);
|
||||
|
||||
// Clean up when component unmounts or activePgroup changes.
|
||||
return () => clearInterval(intervalId);
|
||||
}, [activePgroup]);
|
||||
|
||||
|
||||
const columns: GridColDef[] = [
|
||||
{ field: 'sample_id', headerName: 'ID', width: 70 },
|
||||
{ field: 'sample_name', headerName: 'Sample Name', width: 150 },
|
||||
|
Loading…
x
Reference in New Issue
Block a user