tftsr-devops_investigation/src/pages/NewIssue/index.tsx

144 lines
4.2 KiB
TypeScript
Raw Normal View History

feat: initial implementation of TFTSR IT Triage & RCA application Implements Phases 1-8 of the TFTSR implementation plan. Rust backend (Tauri 2.x, src-tauri/): - Multi-provider AI: OpenAI-compatible, Anthropic, Gemini, Mistral, Ollama - PII detection engine: 11 regex patterns with overlap resolution - SQLCipher AES-256 encrypted database with 10 versioned migrations - 28 Tauri IPC commands for triage, analysis, document, and system ops - Ollama: hardware probe, model recommendations, pull/delete with events - RCA and blameless post-mortem Markdown document generators - PDF export via printpdf - Audit log: SHA-256 hash of every external data send - Integration stubs for Confluence, ServiceNow, Azure DevOps (v0.2) Frontend (React 18 + TypeScript + Vite, src/): - 9 pages: full triage workflow NewIssue→LogUpload→Triage→Resolution→RCA→Postmortem→History+Settings - 7 components: ChatWindow, TriageProgress, PiiDiffViewer, DocEditor, HardwareReport, ModelSelector, UI primitives - 3 Zustand stores: session, settings (persisted), history - Type-safe tauriCommands.ts matching Rust backend types exactly - 8 IT domain system prompts (Linux, Windows, Network, K8s, DB, Virt, HW, Obs) DevOps: - .woodpecker/test.yml: rustfmt, clippy, cargo test, tsc, vitest on every push - .woodpecker/release.yml: linux/amd64 + linux/arm64 builds, Gogs release upload Verified: - cargo check: zero errors - tsc --noEmit: zero errors - vitest run: 13/13 unit tests passing Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 03:36:25 +00:00
import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
import {
Terminal,
Monitor,
Network,
Container,
Database,
Server,
HardDrive,
BarChart3,
} from "lucide-react";
import {
Card,
CardContent,
Button,
Input,
Label,
Select,
SelectTrigger,
SelectValue,
SelectContent,
SelectItem,
} from "@/components/ui";
import { DOMAINS } from "@/lib/domainPrompts";
import { createIssueCmd } from "@/lib/tauriCommands";
import { useSessionStore } from "@/stores/sessionStore";
const iconMap: Record<string, React.ElementType> = {
Terminal,
Monitor,
Network,
Container,
Database,
Server,
HardDrive,
BarChart3,
};
export default function NewIssue() {
const navigate = useNavigate();
const startSession = useSessionStore((s) => s.startSession);
const [selectedDomain, setSelectedDomain] = useState<string | null>(null);
const [title, setTitle] = useState("");
const [severity, setSeverity] = useState("P3");
const [isSubmitting, setIsSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
const handleStartTriage = async () => {
if (!selectedDomain || !title.trim()) return;
setIsSubmitting(true);
setError(null);
try {
const issue = await createIssueCmd({ title: title.trim(), domain: selectedDomain, severity });
startSession(issue);
navigate(`/issue/${issue.id}/triage`);
feat: initial implementation of TFTSR IT Triage & RCA application Implements Phases 1-8 of the TFTSR implementation plan. Rust backend (Tauri 2.x, src-tauri/): - Multi-provider AI: OpenAI-compatible, Anthropic, Gemini, Mistral, Ollama - PII detection engine: 11 regex patterns with overlap resolution - SQLCipher AES-256 encrypted database with 10 versioned migrations - 28 Tauri IPC commands for triage, analysis, document, and system ops - Ollama: hardware probe, model recommendations, pull/delete with events - RCA and blameless post-mortem Markdown document generators - PDF export via printpdf - Audit log: SHA-256 hash of every external data send - Integration stubs for Confluence, ServiceNow, Azure DevOps (v0.2) Frontend (React 18 + TypeScript + Vite, src/): - 9 pages: full triage workflow NewIssue→LogUpload→Triage→Resolution→RCA→Postmortem→History+Settings - 7 components: ChatWindow, TriageProgress, PiiDiffViewer, DocEditor, HardwareReport, ModelSelector, UI primitives - 3 Zustand stores: session, settings (persisted), history - Type-safe tauriCommands.ts matching Rust backend types exactly - 8 IT domain system prompts (Linux, Windows, Network, K8s, DB, Virt, HW, Obs) DevOps: - .woodpecker/test.yml: rustfmt, clippy, cargo test, tsc, vitest on every push - .woodpecker/release.yml: linux/amd64 + linux/arm64 builds, Gogs release upload Verified: - cargo check: zero errors - tsc --noEmit: zero errors - vitest run: 13/13 unit tests passing Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 03:36:25 +00:00
} catch (err) {
setError(String(err));
setIsSubmitting(false);
}
};
return (
<div className="p-6 space-y-6">
<div>
<h1 className="text-3xl font-bold">New Issue</h1>
<p className="text-muted-foreground mt-1">
Select a domain, describe the issue, and begin triage.
</p>
</div>
{/* Domain selection grid */}
<div>
<Label className="text-sm font-medium mb-3 block">Select Domain</Label>
<div className="grid grid-cols-2 md:grid-cols-4 gap-3">
{DOMAINS.map((domain) => {
const Icon = iconMap[domain.icon] ?? Terminal;
const isSelected = selectedDomain === domain.id;
return (
<Card
key={domain.id}
className={`cursor-pointer transition-colors hover:border-primary ${
isSelected ? "border-primary bg-primary/5 ring-2 ring-primary" : ""
}`}
onClick={() => setSelectedDomain(domain.id)}
>
<CardContent className="p-4 text-center">
<Icon className={`w-8 h-8 mx-auto mb-2 ${isSelected ? "text-primary" : "text-muted-foreground"}`} />
<p className="text-sm font-medium">{domain.label}</p>
<p className="text-xs text-muted-foreground mt-1">{domain.description}</p>
</CardContent>
</Card>
);
})}
</div>
</div>
{/* Title */}
<div className="space-y-2">
<Label htmlFor="title">Issue Title</Label>
<Input
id="title"
value={title}
onChange={(e) => setTitle(e.target.value)}
placeholder="Brief description of the issue..."
/>
</div>
{/* Severity */}
<div className="space-y-2">
<Label>Severity</Label>
<Select value={severity} onValueChange={setSeverity}>
<SelectTrigger>
<SelectValue placeholder="Select severity" />
</SelectTrigger>
<SelectContent>
<SelectItem value="P1">P1 - Critical</SelectItem>
<SelectItem value="P2">P2 - High</SelectItem>
<SelectItem value="P3">P3 - Medium</SelectItem>
<SelectItem value="P4">P4 - Low</SelectItem>
</SelectContent>
</Select>
</div>
{/* Error */}
{error && (
<div className="text-sm text-destructive bg-destructive/10 rounded-md p-3">
{error}
</div>
)}
{/* Submit */}
<Button
onClick={handleStartTriage}
disabled={!selectedDomain || !title.trim() || isSubmitting}
className="w-full"
size="lg"
>
{isSubmitting ? "Creating..." : "Start Triage"}
</Button>
</div>
);
}