Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(web): calm, honest SOC dashboard tiles

Alexandru Mateescu713e1a995b97
diff --git a/apps/web/src/components/dashboard/DashboardView.tsx b/apps/web/src/components/dashboard/DashboardView.tsx
index 33590bcda..c775f2a94 100644
--- a/apps/web/src/components/dashboard/DashboardView.tsx
+++ b/apps/web/src/components/dashboard/DashboardView.tsx
@@ -590,20 +590,20 @@ export function DashboardView() {
funnel strip above does publish real deltas. */}
<MetricCard
label="Active Alerts"
- value={metrics.alerts.total}
- sub={`${metrics.alerts.new} new today`}
+ value={metrics.alerts.active ?? metrics.alerts.total}
+ sub={`${metrics.alerts.total} total in period`}
color="blue"
/>
<MetricCard
- label="Critical"
- value={metrics.alerts.critical}
- sub="Require immediate action"
- color="red"
+ label="Critical Active"
+ value={metrics.alerts.criticalActive ?? metrics.alerts.critical}
+ sub={`${metrics.alerts.resolved ?? 0} resolved`}
+ color={metrics.alerts.criticalActive ? 'red' : 'gray'}
/>
<MetricCard
label="Open Cases"
value={metrics.cases.open}
- sub={`${metrics.cases.inProgress} in progress`}
+ sub={`${metrics.cases.inProgress} in progress · ${metrics.cases.openedThisWeek ?? 0} opened / ${metrics.cases.closedThisWeek ?? 0} closed (7d)`}
color="orange"
/>
{/* `mttr` is hours and this rendered it with an `m` suffix, so a
diff --git a/apps/web/src/components/dashboard/FunnelKpiBar.test.tsx b/apps/web/src/components/dashboard/FunnelKpiBar.test.tsx
index 588ad84d0..ad40f2a7a 100644
--- a/apps/web/src/components/dashboard/FunnelKpiBar.test.tsx
+++ b/apps/web/src/components/dashboard/FunnelKpiBar.test.tsx
@@ -116,6 +116,17 @@ describe('FunnelKpiBar', () => {
swrLoading.clear();
});
+ it('renders "no baseline" when the API reports a null delta', () => {
+ // Previous window empty -> API returns null (not a dressed-up 0.0, and
+ // never the double-scaled -9375% of the old fraction*100 rendering bug).
+ swrData.set(FUNNEL_KEY, {
+ ...SAMPLE_FUNNEL,
+ deltas: { ...SAMPLE_FUNNEL.deltas, events_of_interest: null },
+ });
+ render(<FunnelKpiBar period="24h" />);
+ expect(screen.getByText('no baseline')).toBeInTheDocument();
+ });
+
it('renders six tiles with formatted values and signed deltas', () => {
swrData.set(FUNNEL_KEY, SAMPLE_FUNNEL);
render(<FunnelKpiBar period="24h" />);
diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts
index 4ce23b1da..5e656829b 100644
--- a/apps/web/src/lib/api.ts
+++ b/apps/web/src/lib/api.ts
@@ -2265,6 +2265,12 @@ export interface DashboardMetrics {
low: number;
info?: number;
resolvedToday: number;
+ /** Unresolved alerts only (excludes resolved/closed). */
+ active?: number;
+ /** Unresolved critical alerts only. */
+ criticalActive?: number;
+ /** Alerts in resolved state (all time). */
+ resolved?: number;
/** Mean time to resolve, in **hours**, from closed cases. */
mttr: number;
/** Cases the mean was taken over. Zero means unmeasured, not zero hours. */
@@ -2274,6 +2280,10 @@ export interface DashboardMetrics {
open: number;
inProgress: number;
resolvedThisWeek: number;
+ /** Created within the rolling 7d window. */
+ openedThisWeek?: number;
+ /** Closed (closed_at set) within the rolling 7d window. */
+ closedThisWeek?: number;
};
sources: Array<{ name: string; count: number; status: string }>;
topMitre: Array<{ tactic: string; count: number }>;
@@ -2313,12 +2323,12 @@ export interface FunnelMetrics {
* The renderer believed the comment and scaled a second time.
*/
deltas: {
- events_of_interest: number;
- correlation_instances: number;
- alerts_generated: number;
- signal_to_noise: number;
- mttd_seconds: number;
- analyst_queue_depth: number;
+ events_of_interest: number | null;
+ correlation_instances: number | null;
+ alerts_generated: number | null;
+ signal_to_noise: number | null;
+ mttd_seconds: number | null;
+ analyst_queue_depth: number | null;
};
/** ISO-8601 server timestamp. */
generated_at: string;