-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPilotDiagnosticsSection.tsx
More file actions
59 lines (53 loc) · 1.71 KB
/
PilotDiagnosticsSection.tsx
File metadata and controls
59 lines (53 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { useCallback, useEffect, useState } from "react";
import { invoke } from "@tauri-apps/api/core";
import { PilotDashboard, PilotQueryTester } from "../Pilot";
interface PilotLoggingPolicy {
enabled: boolean;
retention_days: number;
max_rows: number;
}
export function PilotDiagnosticsSection() {
const [refreshKey, setRefreshKey] = useState(0);
const [policy, setPolicy] = useState<PilotLoggingPolicy | null>(null);
const pilotLoggingEnabled = policy?.enabled ?? false;
useEffect(() => {
invoke<PilotLoggingPolicy>("get_pilot_logging_policy")
.then(setPolicy)
.catch(() =>
setPolicy({ enabled: false, retention_days: 14, max_rows: 500 }),
);
}, []);
const handleQueryLogged = useCallback(() => {
setRefreshKey((current) => current + 1);
}, []);
return (
<section
className="analytics-section-surface analytics-section-surface-pilot"
aria-label="Pilot diagnostics"
>
<div className="analytics-panel-card">
<div className="analytics-panel-header">
<div>
<div className="section-title">Pilot Diagnostics</div>
<p className="analytics-panel-subtitle">
Validate query quality, pilot logging posture, and raw-log
evidence without a separate Pilot tab.
</p>
</div>
</div>
<PilotQueryTester
pilotLoggingEnabled={pilotLoggingEnabled}
policy={policy}
onQueryLogged={handleQueryLogged}
/>
</div>
<div className="analytics-panel-card">
<PilotDashboard
key={refreshKey}
pilotLoggingEnabled={pilotLoggingEnabled}
policy={policy}
/>
</div>
</section>
);
}