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
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI Suite Validation

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
validate-client:
name: Client Lint and Build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: client/package-lock.json

- name: Install Client Dependencies
run: |
cd client
npm ci

- name: Run ESLint Checks
run: |
cd client
npm run lint

- name: Build Next.js Application
run: |
cd client
npm run build

validate-server:
name: Server Syntax and Environment Check
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: Server/requirements.txt

- name: Install Python Dependencies
run: |
cd Server
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Validate Python Syntax and Imports
run: |
cd Server
python -m py_compile main.py security.py graph_engine.py
49 changes: 46 additions & 3 deletions client/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { exportCasesToCSV } from "../../lib/csvExport";
import Footer from "@/components/Footer";
import ThemeToggle from "@/components/ThemeToggle";
import ToolModal from "@/components/ToolModal";
import BackToTop from "@/components/BackToTop";
import {
Search,
Activity,
Expand Down Expand Up @@ -641,6 +640,7 @@ export default function DashboardPage() {
fetchHistory();
}, [analysisResult]);

const runAutomatedFlow = () => {
const runAutomatedFlow = async () => {
const input = document.createElement("input");
input.type = "file";
Expand Down Expand Up @@ -679,6 +679,46 @@ export default function DashboardPage() {
const formData = new FormData();
formData.append("file", file);

const xhr = new XMLHttpRequest();

xhr.upload.onprogress = (event) => {
if (event.lengthComputable) {
const pct = Math.round((event.loaded / event.total) * 100);
setUploadProgress(Math.min(pct, 95));
}
};

xhr.onload = async () => {
if (xhr.status >= 200 && xhr.status < 300) {
try {
const data: AnalysisResult = JSON.parse(xhr.responseText);
setUploadProgress(100);
const { error } = await supabase.from("cases").insert([
{
case_id: data.id,
filename: file.name,
hash_value: data.hash,
investigator: session?.user?.email || "Unknown Agent",
status: "Verified",
},
]);
if (!error) {
setAnalysisResult(data);
setSelectedCaseId(data.id);
}
} catch {
triggerFallback(file);
}
} else {
triggerFallback(file);
}
};

xhr.onerror = () => {
triggerFallback(file);
};

const triggerFallback = (file: File) => {
try {
const response = await fetch("/api/analyze", {
method: "POST",
Expand Down Expand Up @@ -750,7 +790,10 @@ export default function DashboardPage() {
setFetchError("Analyzing via offline local engine (fast path).");
} finally {
setTimeout(() => setIsAnalyzing(false), 1500);
}
};

xhr.open("POST", `/api/analyze`);
xhr.send(formData);
};
input.click();
};
Expand Down Expand Up @@ -1494,7 +1537,7 @@ export default function DashboardPage() {
>
No cases found matching &quot;{searchQuery}&quot;
</motion.div>
))}
)}
</AnimatePresence>
</div>
</motion.section>
Expand Down
Loading
Loading