diff --git a/Data/Server/WebUI/src/App.jsx b/Data/Server/WebUI/src/App.jsx index a57cc9b..948d9c8 100644 --- a/Data/Server/WebUI/src/App.jsx +++ b/Data/Server/WebUI/src/App.jsx @@ -27,6 +27,7 @@ import NavigationSidebar from "./Navigation_Sidebar"; import WorkflowList from "./Workflow_List"; import DeviceList from "./Device_List"; import ScriptList from "./Script_List"; +import ScheduledJobsList from "./Scheduled_Jobs_List"; import { io } from "socket.io-client"; @@ -140,6 +141,9 @@ export default function App() { case "devices": return ; + case "jobs": + return ; + case "workflows": return ( /Data/WebUI/src/Scheduled_Jobs_List.jsx + +import React, { useState, useMemo } from "react"; +import { + Paper, + Box, + Typography, + Button, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + TableSortLabel, + Switch +} from "@mui/material"; +import { Edit as EditIcon } from "@mui/icons-material"; + +export default function ScheduledJobsList() { + const [rows, setRows] = useState([]); + const [orderBy, setOrderBy] = useState("name"); + const [order, setOrder] = useState("asc"); + + const handleSort = (col) => { + if (orderBy === col) setOrder(order === "asc" ? "desc" : "asc"); + else { + setOrderBy(col); + setOrder("asc"); + } + }; + + const sorted = useMemo(() => { + const dir = order === "asc" ? 1 : -1; + return [...rows].sort((a, b) => { + const A = a[orderBy] || ""; + const B = b[orderBy] || ""; + return String(A).localeCompare(String(B)) * dir; + }); + }, [rows, orderBy, order]); + + const resultColor = (r) => + r === "Success" ? "#00d18c" : r === "Warning" ? "#ff8c00" : "#ff4f4f"; + + return ( + + + + Scheduled Jobs + + + List of automation jobs with schedules, results, and actions. + + + + + + {[ + ["name", "Name"], + ["scriptWorkflow", "Script / Workflow"], + ["target", "Target"], + ["occurrence", "Schedule Occurrence"], + ["lastRun", "Last Run"], + ["nextRun", "Next Run"], + ["result", "Result"], + ["enabled", "Enabled"], + ["edit", "Edit Job"] + ].map(([key, label]) => ( + + {key !== "edit" ? ( + handleSort(key)} + > + {label} + + ) : ( + label + )} + + ))} + + + + {sorted.map((r, i) => ( + + {r.name} + {r.scriptWorkflow} + {r.target} + {r.occurrence} + {r.lastRun} + {r.nextRun} + + + {r.result} + + + { + setRows((prev) => + prev.map((job, idx) => + idx === i ? { ...job, enabled: !job.enabled } : job + ) + ); + }} + size="small" + /> + + + + + + ))} + {sorted.length === 0 && ( + + + No scheduled jobs found. + + + )} + +
+
+ ); +}