Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit e070fd46 authored by GotthardG's avatar GotthardG
Browse files

Add Image models and clean up test code structure

Introduced `ImageCreate` and `Image` models to handle image-related data in the backend. Improved the organization and readability of the testing notebook by consolidating and formatting code into distinct sections with markdown cells.
parent 21d41818
No related branches found
No related tags found
No related merge requests found
Pipeline #50754 failed
...@@ -23,6 +23,7 @@ interface ResultGridProps { ...@@ -23,6 +23,7 @@ interface ResultGridProps {
const ResultGrid: React.FC<ResultGridProps> = ({ activePgroup }) => { const ResultGrid: React.FC<ResultGridProps> = ({ activePgroup }) => {
const [rows, setRows] = useState<SampleResult[]>([]); const [rows, setRows] = useState<SampleResult[]>([]);
const [basePath, setBasePath] = React.useState(""); const [basePath, setBasePath] = React.useState("");
const [hoveredImageUrl, setHoveredImageUrl] = useState<string | null>(null);
useEffect(() => { useEffect(() => {
// Detect the current environment // Detect the current environment
...@@ -86,8 +87,17 @@ const ResultGrid: React.FC<ResultGridProps> = ({ activePgroup }) => { ...@@ -86,8 +87,17 @@ const ResultGrid: React.FC<ResultGridProps> = ({ activePgroup }) => {
<img <img
src={imageUrl} src={imageUrl}
alt="sample" alt="sample"
style={{width: 50, height: 50, marginRight: 5, borderRadius: 4}} style={{ width: 50, height: 50, marginRight: 5, borderRadius: 4, cursor: 'pointer' }}
onMouseEnter={() => {
console.log("Mouse entered image");
setHoveredImageUrl(imageUrl);
}}
onMouseLeave={() => {
console.log("Mouse left image");
setHoveredImageUrl(null);
}}
/> />
{imageList.length > 1 && ( {imageList.length > 1 && (
<div className="tooltip" style={{position: 'relative', cursor: 'pointer'}}> <div className="tooltip" style={{position: 'relative', cursor: 'pointer'}}>
<span>+{imageList.length - 1}</span> <span>+{imageList.length - 1}</span>
...@@ -126,14 +136,37 @@ const ResultGrid: React.FC<ResultGridProps> = ({ activePgroup }) => { ...@@ -126,14 +136,37 @@ const ResultGrid: React.FC<ResultGridProps> = ({ activePgroup }) => {
}, },
]; ];
// Map each row so that DataGrid can use a unique "id" prop; here we use sample_id. // Map each row so that DataGrid can use a unique "id" prop; here we use sample_id.
const gridRows = rows.map((row) => ({ ...row, id: row.sample_id })); const gridRows = rows.map((row) => ({ ...row, id: row.sample_id }));
return ( return (
<div style={{ height: 500, width: '100%' }}> <div style={{ position: 'relative' }}>
<DataGrid rows={gridRows} columns={columns} pageSize={5} /> <div style={{ height: 600, width: '100%' }}>
</div> <DataGrid rows={gridRows} columns={columns} pageSize={10} />
); </div>
{hoveredImageUrl && (
<div
style={{
position: 'fixed',
top: '20%',
left: '50%',
transform: 'translate(-50%, -50%)',
zIndex: 2000,
border: '2px solid #ccc',
background: '#fff',
padding: '10px',
borderRadius: '4px',
pointerEvents: 'none', // Ensures hover stays on the image
}}
>
<img src={hoveredImageUrl} alt="large preview" style={{ maxWidth: '400px', maxHeight: '400px' }} />
</div>
)}
</div>
);
}; };
export default ResultGrid; export default ResultGrid;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment