Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 79 additions & 6 deletions frontend/src/pages/Scans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,27 @@ import {
} from "../utils/date";
import Pagination from "../components/Pagination";

type Severity =
| 'critical'
| 'high'
| 'medium'
| 'low'
| 'informational';

type ScanStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';

type ExpectedFeatures = {
// best-effort: backend returns findings summary; exact shape depends on plugin parsers.
// keep loose typing for forward compatibility.
[key: string]: unknown;
};

interface Task {
task_id: string;
plugin_id: string;
tool: string;
target: string;
status: "queued" | "running" | "completed" | "failed" | "cancelled";
status: ScanStatus;
created_at: string;
started_at?: string;
completed_at?: string;
Expand All @@ -24,8 +39,14 @@ interface Task {
preset?: string;
queue_position?: number;
pending_count?: number;

// Filtering fields (optional; may be missing in older backend data)
severity?: Severity;
plugin_type?: string;
expected_features?: ExpectedFeatures | null;
}


const statusFilters = [
{ value: "all", label: "ALL_OPERATIONS" },
{ value: "running", label: "ACTIVE_EXECUTION" },
Expand Down Expand Up @@ -63,6 +84,10 @@ export default function Scans() {
const [total, setTotal] = useState(0);
const PAGE_LIMIT = 10;

const [severityFilter, setSeverityFilter] = useState("");
const [statusFilter, setStatusFilter] = useState("");
const [pluginFilter, setPluginFilter] = useState("");

// Ref so the visibilitychange handler always sees the current interval id
const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);

Expand Down Expand Up @@ -119,6 +144,14 @@ export default function Scans() {
}
}

const filteredScans = tasks.filter((scan) => {
return (
(severityFilter ? scan.severity === severityFilter : true) &&
(statusFilter ? scan.status === statusFilter : true) &&
(pluginFilter ? scan.plugin_type === pluginFilter : true)
);
});

function handleFilterChange(value: string) {
setFilter(value);
setPage(1);
Expand Down Expand Up @@ -322,19 +355,59 @@ export default function Scans() {
</section>

{/* Timeline Operations Feed */}
<section className="relative">
{/* Vertical Timeline Cable */}
<div className="absolute left-[39px] top-0 bottom-0 w-1 bg-silver-bright/5 hidden md:block"></div>
<section className="relative">
{/* Vertical Timeline Cable */}
<div className="absolute left-[39px] top-0 bottom-0 w-1 bg-silver-bright/5 hidden md:block"></div>

<div className="flex gap-4 mb-4">
<select
value={severityFilter}
onChange={(e) => setSeverityFilter(e.target.value)}
className="bg-charcoal-dark text-silver border-2 border-black px-4 py-2 text-[10px] font-black uppercase tracking-widest"
>
<option value="">All Severity</option>
<option value="critical">Critical</option>
<option value="high">High</option>
<option value="medium">Medium</option>
<option value="low">Low</option>
<option value="informational">Informational</option>
</select>

<select
value={statusFilter}
onChange={(e) => setStatusFilter(e.target.value)}
className="bg-charcoal-dark text-silver border-2 border-black px-4 py-2 text-[10px] font-black uppercase tracking-widest"
>
<option value="">All Status</option>
<option value="completed">Completed</option>
<option value="running">Running</option>
<option value="failed">Failed</option>
<option value="queued">Queued</option>
<option value="cancelled">Cancelled</option>
</select>

<select
value={pluginFilter}
onChange={(e) => setPluginFilter(e.target.value)}
className="bg-charcoal-dark text-silver border-2 border-black px-4 py-2 text-[10px] font-black uppercase tracking-widest"
>
<option value="">All Plugin Types</option>
<option value="amass">amass</option>
<option value="nmap">nmap</option>
<option value="nikto">nikto</option>
<option value="nuclei">nuclei</option>
</select>
</div>

<AnimatePresence mode="popLayout">
{tasks.length > 0 ? (
{filteredScans.length > 0 ? (
<motion.div
variants={containerVariants}
initial="hidden"
animate="visible"
className="space-y-8"
>
{tasks.map((task) => {
{filteredScans.map((task) => {
const createDate = parseDateSafe(task.created_at);
const startDate = task.started_at
? parseDateSafe(task.started_at)
Expand Down
Loading