From 1bb995d76f39fab2c2408e2168fe551b3602d3d1 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Tue, 23 Jan 2024 11:27:18 +0100 Subject: [PATCH] improve code display --- src/components/JobList.jsx | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/components/JobList.jsx b/src/components/JobList.jsx index 7cbd9d9..de49fc9 100644 --- a/src/components/JobList.jsx +++ b/src/components/JobList.jsx @@ -18,7 +18,13 @@ import { TableRow, Tooltip, } from "@mui/material"; -import { RestartAlt as RestartIcon } from "@mui/icons-material"; +import { + RestartAlt as RestartIcon, + Code as CodeIcon, + GitHub as GitHubIcon, + Archive as ArchiveIcon, + Folder as FolderIcon, +} from "@mui/icons-material"; import StatusChip from "./StatusChip"; @@ -49,6 +55,27 @@ function filterJobs(jobs, statusFilter, hardwareFilter, tagFilter) { return filteredJobs; } +function formatCode(code) { + const style = { display: "inline-flex", verticalAlign: "middle", color: "lightgray" }; + let icon = ; + if (code.includes("github")) { + icon = ; + } else if (code.startsWith("http")) { + icon = ; + } else if (code.startsWith("collab:")) { + icon = ; + } else if (code.startsWith("drive:")) { + icon = ; + } + + return ( + + {icon}   + {code.trim().slice(0, 60).replaceAll("\n", "⏎")} + + ); +} + function LinkedTableCell(props) { return ( @@ -196,7 +223,7 @@ function JobList(props) { {job.hardware_platform} - {job.code.slice(0, 60)} + {formatCode(job.code)} {timeFormat(job.timestamp_submission)}