feat: device detail drill-down modal + smart domain/app display

- Add DeviceDetailModal with 8 tabs (Info, Flows, Apps, Encryption,
  Servers, Password Leaks, IP Reputation, VPN & Events)
- Make device cards in AgentDetailModal clickable (nested modal drill-down)
- Expand fetchDeviceDetails backend to query all 10 correlated tables
  (devices, flows, intel_device_discovery, intel_encryption_audit,
   intel_server_discovery, intel_unencrypted_passwords, intel_ip_reputation,
   intel_vpn_detection, events, mac_bandwidth)
- Smart combined app/domain display: prioritize actual domain names over
  port-only labels (Port 443 -> scontent.fcgk42-1.fna.fbcdn.net)
- Update Flows tab: domain shown in teal monospace, protocols in purple,
  port-only entries muted
- Add 10 new TypeScript interfaces for device detail data types
- Add MAC address fallback queries (by MAC when IP yields no results)
- Fix fmtBytes for very large values
This commit is contained in:
vanne committed 2026-06-30 23:58:04 +07:00
1 parent bba75c7dc6
commit 26179a0270
8 files changed
+2171 -400

No files matched your search

+233 -8
View File
@@ -505,6 +505,122 @@ export interface AgentSummary {
bandwidth_up: number;
}
export interface AgentEncryptionItem {
ip_address: string | null;
mac_address: string | null;
device_label: string | null;
encrypted_pct: number | null;
unencrypted: number | null;
encrypted: number | null;
total: number | null;
risk_level: string | null;
detected_at: string | null;
}
export interface AgentInsecureProtocolItem {
ip_address: string | null;
mac_address: string | null;
protocol: string | null;
risk: string | null;
app_label: string | null;
dst_ip: string | null;
dst_port: number | null;
download: number;
upload: number;
detected_at: string | null;
}
export interface AgentUnencryptedPwdItem {
ip_address: string | null;
mac_address: string | null;
dst_ip: string | null;
dst_port: number | null;
protocol: string | null;
username: string | null;
severity: string | null;
download: number;
upload: number;
detected_at: string | null;
}
export interface AgentIpReputationItem {
ip_address: string | null;
local_ip: string | null;
mac_address: string | null;
reputation: string | null;
score: number | null;
country: string | null;
app_label: string | null;
blacklisted: number | boolean;
download: number;
upload: number;
detected_at: string | null;
}
export interface AgentTorItem {
ip_address: string | null;
mac_address: string | null;
exit_node: string | null;
circuit_id: string | null;
country: string | null;
download: number;
upload: number;
detected_at: string | null;
}
export interface AgentVpnItem {
ip_address: string | null;
mac_address: string | null;
vpn_type: string | null;
remote_ip: string | null;
protocol: string | null;
country: string | null;
confidence: number | null;
download: number;
upload: number;
detected_at: string | null;
}
export interface AgentSecurity {
encryption_audit: AgentEncryptionItem[];
insecure_protocols: AgentInsecureProtocolItem[];
unencrypted_passwords: AgentUnencryptedPwdItem[];
ip_reputation: AgentIpReputationItem[];
tor_detections: AgentTorItem[];
vpn_detections: AgentVpnItem[];
}
export interface AgentEventItem {
event_id: string | null;
event_type: string | null;
severity: string | null;
ip_address: string | null;
mac_address: string | null;
description: string | null;
event_at: string | null;
}
export interface AgentMacBandwidthItem {
mac_address: string;
manufacturer: string | null;
download: number;
upload: number;
total: number;
}
export interface AgentServerDiscoveryItem {
ip_address: string | null;
mac_address: string | null;
server_type: string | null;
hostname: string | null;
port: number | null;
protocol: string | null;
os_label: string | null;
download: number;
upload: number;
detected_at: string | null;
}
export interface AgentDetails {
agent_uuid: string;
agent_label: string;
@@ -512,6 +628,10 @@ export interface AgentDetails {
devices: AgentDeviceItem[];
flows: AgentFlowItem[];
top_apps: AgentAppItem[];
security: AgentSecurity | null;
events: AgentEventItem[];
mac_bandwidth: AgentMacBandwidthItem[];
server_discovery: AgentServerDiscoveryItem[];
}
export interface DeviceFlowItem {
@@ -540,16 +660,121 @@ export interface SecurityInfo {
blacklisted: boolean;
}
export interface DeviceDetails {
ip: string;
total_download: number;
total_upload: number;
flow_count: number;
top_apps: AgentAppItem[];
flows: DeviceFlowItem[];
security_info: SecurityInfo | null;
export interface DeviceInfo {
device_label : string | null;
device_type : string | null;
os_label : string | null;
manufacturer : string | null;
mac_address : string | null;
is_new : number | null;
}
export interface DeviceAppItem {
label : string; // domain name OR protocol name
sub_label : string | null; // protocol when label is domain; null otherwise
type : 'domain' | 'protocol' | 'port';
download : number;
upload : number;
flow_count : number;
}
export interface DeviceDomainItem {
domain : string;
download : number;
upload : number;
flow_count : number;
}
export interface DeviceEncryption {
encrypted_pct : number | null;
encrypted_bytes : number | null;
unencrypted_bytes: number | null;
total_bytes : number | null;
risk_level : string | null;
}
export interface DeviceServerItem {
server_type : string | null;
hostname : string | null;
port : number | null;
protocol : string | null;
os_label : string | null;
download : number;
upload : number;
detected_at : string | null;
}
export interface DevicePwdItem {
dst_ip : string | null;
dst_port : number | null;
protocol : string | null;
username : string | null;
severity : string | null;
download : number;
upload : number;
detected_at : string | null;
}
export interface DeviceReputationItem {
remote_ip : string | null;
local_ip : string | null;
reputation : string | null;
score : number | null;
country : string | null;
app_label : string | null;
blacklisted : boolean;
download : number;
upload : number;
}
export interface DeviceVpnItem {
vpn_type : string | null;
remote_ip : string | null;
protocol : string | null;
country : string | null;
confidence : number | null;
download : number;
upload : number;
detected_at : string | null;
}
export interface DeviceEventItem {
event_type : string | null;
severity : string | null;
ip_address : string | null;
mac_address : string | null;
description : string | null;
event_at : string | null;
}
export interface DeviceMacBandwidth {
mac_address : string;
manufacturer : string | null;
download : number;
upload : number;
total : number;
}
export interface DeviceDetails {
ip : string;
mac_address : string | null;
total_download : number;
total_upload : number;
flow_count : number;
device_info : DeviceInfo;
top_apps : DeviceAppItem[];
top_domains : DeviceDomainItem[];
flows : DeviceFlowItem[];
encryption : DeviceEncryption | null;
server_discovery : DeviceServerItem[];
unencrypted_passwords: DevicePwdItem[];
ip_reputation : DeviceReputationItem[];
vpn_detections : DeviceVpnItem[];
events : DeviceEventItem[];
mac_bandwidth : DeviceMacBandwidth | null;
}
export interface AppAgentItem {
agent_uuid: string | null;
agent_label: string;