Watch
1
0
Fork
You've already forked RedFlag
0

device-type: layered detection + laptop/vm/container types

Replaces the flat battery x display matrix (which misclassified laptops
as phones) with layered detection: container -> vm -> SMBIOS chassis ->
ARM fallback. Adds laptop, vm, container device types across agent,
migration 062, server validation, web icons/types.
This commit is contained in:
Fimeg 2026-07-12 14:55:04 -04:00
commit 1f75bfd23a
9 changed files with 374 additions and 29 deletions

View file

@ -1,5 +1,5 @@
import React from 'react';
import { Server, Monitor, Smartphone, Tablet, Computer } from 'lucide-react';
import { Server, Monitor, Laptop, Smartphone, Tablet, Box, Container, Computer } from 'lucide-react';
import { cn } from '@/lib/utils';
// DeviceTypeIcon — consistent form-factor rendering (WEB-001).
@ -9,19 +9,26 @@ import { cn } from '@/lib/utils';
const DEVICE_ICONS: Record<string, React.ComponentType<{ className?: string }>> = {
server: Server,
desktop: Monitor,
laptop: Laptop,
phone: Smartphone,
tablet: Tablet,
vm: Box,
container: Container,
};
const DEVICE_BADGE_CLASSES: Record<string, string> = {
server: 'bg-gray-100 text-gray-700',
desktop: 'bg-slate-100 text-slate-700',
laptop: 'bg-sky-100 text-sky-700',
phone: 'bg-emerald-100 text-emerald-700',
tablet: 'bg-violet-100 text-violet-700',
vm: 'bg-amber-100 text-amber-700',
container: 'bg-cyan-100 text-cyan-700',
};
export const deviceTypeLabel = (type?: string): string => {
if (!type) return 'Unknown';
if (type === 'vm') return 'VM';
return type.charAt(0).toUpperCase() + type.slice(1);
};

View file

@ -31,7 +31,7 @@ export interface Agent {
updating_to_version?: string;
update_available?: boolean;
// Device classification (DEVICE-001/SERVER-001)
device_type?: string; // agent-detected: server | desktop | phone | tablet
device_type?: string; // agent-detected: server | desktop | laptop | phone | tablet | vm | container
device_type_manual?: string; // operator override, absent = use auto
device_model?: string; // "Google Pixel 3", "Dell PowerEdge R740"
os_distro?: string; // /etc/os-release ID: "arch", "fedora"
@ -39,9 +39,9 @@ export interface Agent {
// Note: ip_address not available from API yet
}
export type DeviceType = 'server' | 'desktop' | 'phone' | 'tablet';
export type DeviceType = 'server' | 'desktop' | 'laptop' | 'phone' | 'tablet' | 'vm' | 'container';
export const DEVICE_TYPES: DeviceType[] = ['server', 'desktop', 'phone', 'tablet'];
export const DEVICE_TYPES: DeviceType[] = ['server', 'desktop', 'laptop', 'phone', 'tablet', 'vm', 'container'];
export interface AgentSpec {
id: string;