Просмотр исходного кода

revert(devices): restore the small icon picker, keep the vacuum vendor tier

The picker was deliberately small so it stays usable. 89 icons in a scrollable grid without search makes choosing slower, and the weight was never the argument (+5 KB gzip).

The vacuum vendor tier and the rock-robo hostname rule stay: a Roborock announcing itself as ROCK-ROBO falling into generic iot is a classification bug, independent of how many icons the picker offers.

Refs #2074
gnacho 2 недель назад
Родитель
Сommit
0f47d62c47

+ 0 - 92
app/public/locales/en/translation.json

@@ -480,98 +480,6 @@
       "nameHint": "Empty = automatic name (DHCP hostname)",
       "type": "Type",
       "icon": "Icon",
-      "iconNames": {
-        "monitor": "Monitor",
-        "laptop": "Laptop",
-        "smartphone": "Smartphone",
-        "tablet": "Tablet",
-        "tv": "TV",
-        "gamepad": "Game console",
-        "camera": "Camera",
-        "cctv": "CCTV",
-        "vacuum": "Robot vacuum",
-        "doorbell": "Video doorbell",
-        "air-vent": "Air conditioning",
-        "heater": "Heater",
-        "circuit-board": "Dev board",
-        "speaker": "Speaker",
-        "router": "Router",
-        "server": "Server",
-        "watch": "Watch",
-        "car": "Car",
-        "home": "Home",
-        "printer": "Printer",
-        "plug": "Plug",
-        "shield": "Security",
-        "help-circle": "Unknown",
-        "wifi": "Wi-Fi",
-        "ethernet": "Ethernet",
-        "refrigerator": "Fridge",
-        "washing-machine": "Washer / dishwasher",
-        "microwave": "Microwave",
-        "cooking-pot": "Cooker",
-        "chef-hat": "Kitchen appliance",
-        "coffee": "Coffee maker",
-        "utensils-crossed": "Kitchenware",
-        "glass-water": "Water dispenser",
-        "shower-head": "Water heater",
-        "bath": "Bathroom heater",
-        "toilet": "Smart toilet",
-        "droplets": "Water purifier",
-        "flame": "Boiler / gas",
-        "flame-kindling": "Fireplace",
-        "thermometer": "Thermostat",
-        "fan": "Fan",
-        "snowflake": "Cooling",
-        "plug-zap": "Smart plug",
-        "battery-charging": "Charger / battery",
-        "solar-panel": "Solar panel",
-        "power": "Switch",
-        "lightbulb": "Bulb",
-        "lamp": "Lamp",
-        "lamp-desk": "Desk lamp",
-        "lamp-ceiling": "Ceiling light",
-        "lock-keyhole": "Smart lock",
-        "key-round": "Key",
-        "door-closed": "Door sensor",
-        "scan-face": "Face access",
-        "fingerprint": "Fingerprint",
-        "shield-check": "Security hub",
-        "webcam": "Webcam",
-        "siren": "Siren",
-        "paw-print": "Pet feeder",
-        "cat": "Cat",
-        "dog": "Dog",
-        "fish": "Aquarium",
-        "baby": "Baby care",
-        "scale": "Scale",
-        "heart-pulse": "Health device",
-        "projector": "Projector",
-        "cast": "Cast / screen",
-        "headphones": "Headphones",
-        "headset": "Headset",
-        "radio": "Radio",
-        "joystick": "Joystick",
-        "hard-drive": "Storage",
-        "database": "Database",
-        "cloud": "Cloud",
-        "cpu": "Compute",
-        "brain-circuit": "AI box",
-        "bot": "Robot",
-        "antenna": "Antenna",
-        "satellite-dish": "Satellite dish",
-        "blinds": "Blinds / screen",
-        "armchair": "Armchair",
-        "sofa": "Sofa",
-        "bed-double": "Bed",
-        "sprout": "Garden",
-        "flower-2": "Plants",
-        "wrench": "Tools",
-        "cog": "Machine",
-        "package": "Package",
-        "shirt": "Garment care",
-        "gauge": "Gauge"
-      },
       "notifyOffline": "Notify when offline",
       "auto": "Auto",
       "save": "Save",

+ 0 - 92
app/public/locales/es/translation.json

@@ -480,98 +480,6 @@
       "nameHint": "Vacío = nombre automático (hostname DHCP)",
       "type": "Tipo",
       "icon": "Icono",
-      "iconNames": {
-        "monitor": "Monitor",
-        "laptop": "Portátil",
-        "smartphone": "Móvil",
-        "tablet": "Tablet",
-        "tv": "TV",
-        "gamepad": "Consola",
-        "camera": "Cámara",
-        "cctv": "Videovigilancia",
-        "vacuum": "Aspirador",
-        "doorbell": "Videoportero",
-        "air-vent": "Aire acondicionado",
-        "heater": "Calefactor",
-        "circuit-board": "Placa",
-        "speaker": "Altavoz",
-        "router": "Router",
-        "server": "Servidor",
-        "watch": "Reloj",
-        "car": "Coche",
-        "home": "Hogar",
-        "printer": "Impresora",
-        "plug": "Enchufe",
-        "shield": "Seguridad",
-        "help-circle": "Desconocido",
-        "wifi": "Wi-Fi",
-        "ethernet": "Ethernet",
-        "refrigerator": "Frigorífico",
-        "washing-machine": "Lavadora / lavavajillas",
-        "microwave": "Microondas",
-        "cooking-pot": "Cocina",
-        "chef-hat": "Electrodoméstico de cocina",
-        "coffee": "Cafetera",
-        "utensils-crossed": "Menaje",
-        "glass-water": "Dispensador de agua",
-        "shower-head": "Termo / calentador",
-        "bath": "Calentador de baño",
-        "toilet": "Inodoro inteligente",
-        "droplets": "Purificador de agua",
-        "flame": "Caldera / gas",
-        "flame-kindling": "Chimenea",
-        "thermometer": "Termostato",
-        "fan": "Ventilador",
-        "snowflake": "Refrigeración",
-        "plug-zap": "Enchufe inteligente",
-        "battery-charging": "Cargador / batería",
-        "solar-panel": "Panel solar",
-        "power": "Interruptor",
-        "lightbulb": "Bombilla",
-        "lamp": "Lámpara",
-        "lamp-desk": "Lámpara de escritorio",
-        "lamp-ceiling": "Luz de techo",
-        "lock-keyhole": "Cerradura inteligente",
-        "key-round": "Llave",
-        "door-closed": "Sensor de puerta",
-        "scan-face": "Acceso facial",
-        "fingerprint": "Huella",
-        "shield-check": "Central de seguridad",
-        "webcam": "Webcam",
-        "siren": "Sirena",
-        "paw-print": "Comedero",
-        "cat": "Gato",
-        "dog": "Perro",
-        "fish": "Acuario",
-        "baby": "Bebé",
-        "scale": "Báscula",
-        "heart-pulse": "Dispositivo de salud",
-        "projector": "Proyector",
-        "cast": "Cast / pantalla",
-        "headphones": "Auriculares",
-        "headset": "Auriculares con micro",
-        "radio": "Radio",
-        "joystick": "Joystick",
-        "hard-drive": "Almacenamiento",
-        "database": "Base de datos",
-        "cloud": "Nube",
-        "cpu": "Cómputo",
-        "brain-circuit": "Caja de IA",
-        "bot": "Robot",
-        "antenna": "Antena",
-        "satellite-dish": "Antena parabólica",
-        "blinds": "Persianas / pantalla",
-        "armchair": "Sillón",
-        "sofa": "Sofá",
-        "bed-double": "Cama",
-        "sprout": "Jardín",
-        "flower-2": "Plantas",
-        "wrench": "Herramientas",
-        "cog": "Máquina",
-        "package": "Paquete",
-        "shirt": "Cuidado de ropa",
-        "gauge": "Medidor"
-      },
       "notifyOffline": "Avisar si se desconecta",
       "auto": "Auto",
       "save": "Guardar",

+ 2 - 2
app/src/components/DeviceEditSheet.tsx

@@ -242,7 +242,7 @@ export function DeviceEditSheet({
             {/* Icono */}
             <div className="space-y-2">
               <label className="text-label uppercase text-text-muted">{t('devices.edit.icon')}</label>
-              <div className="grid max-h-64 grid-cols-5 gap-2 overflow-y-auto pr-1">
+              <div className="grid grid-cols-5 gap-2">
                 <button
                   type="button"
                   onClick={() => setIcon('')}
@@ -260,7 +260,7 @@ export function DeviceEditSheet({
                     <button
                       key={n}
                       type="button"
-                      title={t(`devices.edit.iconNames.${n}`, { defaultValue: n })}
+                      title={n}
                       onClick={() => setIcon(n)}
                       disabled={saving}
                       className={cn(

+ 3 - 142
app/src/components/DeviceRow.tsx

@@ -1,98 +1,34 @@
 import {
   AirVent,
-  Antenna,
-  Armchair,
-  Baby,
-  Bath,
-  BatteryCharging,
-  BedDouble,
   BellRing,
-  Blinds,
-  Bot,
-  BrainCircuit,
   BrushCleaning,
-  Cable,
   Camera,
   Car,
-  Cast,
-  Cat,
-  Cctv,
-  ChefHat,
   CircuitBoard,
-  Cloud,
-  Coffee,
-  Cog,
-  CookingPot,
-  Cpu,
-  Database,
-  Dog,
-  DoorClosed,
-  Droplets,
-  Fan,
-  Fingerprint,
-  Fish,
-  Flame,
-  FlameKindling,
-  Flower2,
+  Cctv,
   Gamepad2,
-  Gauge,
-  GlassWater,
-  HardDrive,
-  Headphones,
-  Headset,
-  HeartPulse,
   Heater,
   Home,
-  Joystick,
-  KeyRound,
-  Lamp,
-  LampCeiling,
-  LampDesk,
   Laptop,
   Lightbulb,
-  LockKeyhole,
-  Microwave,
   Monitor,
   Network,
-  Package,
-  PawPrint,
+  Router,
   Plug,
-  PlugZap,
-  Power,
   Printer,
-  Projector,
-  Radio,
-  Refrigerator,
-  Router,
-  SatelliteDish,
-  Scale,
-  ScanFace,
   Server,
   Shield,
-  ShieldCheck,
-  Shirt,
-  ShowerHead,
   SignalHigh,
   SignalLow,
   SignalMedium,
   SignalZero,
-  Siren,
   Smartphone,
-  Snowflake,
-  Sofa,
-  SolarPanel,
   Speaker,
-  Sprout,
   Tablet,
-  Thermometer,
-  Toilet,
   Tv,
-  UtensilsCrossed,
-  WashingMachine,
   Watch,
-  Webcam,
   Wifi,
-  Wrench,
+  Cable,
 } from 'lucide-react'
 import type { LucideIcon } from 'lucide-react'
 import { useTranslation } from 'react-i18next'
@@ -150,81 +86,6 @@ export const ICON_OVERRIDES: Record<string, LucideIcon> = {
   'help-circle': CircuitBoard,
   wifi: Wifi,
   ethernet: Cable,
-  // Cocina y electrodomésticos: el cajón "iot" los escondía todos bajo una
-  // bombilla. Mismo lucide, mismo trazo, solo que ahora se pueden elegir.
-  refrigerator: Refrigerator,
-  'washing-machine': WashingMachine,
-  microwave: Microwave,
-  'cooking-pot': CookingPot,
-  'chef-hat': ChefHat,
-  coffee: Coffee,
-  'utensils-crossed': UtensilsCrossed,
-  'glass-water': GlassWater,
-  // Agua, calefacción y baño
-  'shower-head': ShowerHead,
-  bath: Bath,
-  toilet: Toilet,
-  droplets: Droplets,
-  flame: Flame,
-  'flame-kindling': FlameKindling,
-  thermometer: Thermometer,
-  fan: Fan,
-  snowflake: Snowflake,
-  // Energía
-  'plug-zap': PlugZap,
-  'battery-charging': BatteryCharging,
-  'solar-panel': SolarPanel,
-  power: Power,
-  // Iluminación
-  lightbulb: Lightbulb,
-  lamp: Lamp,
-  'lamp-desk': LampDesk,
-  'lamp-ceiling': LampCeiling,
-  // Acceso y seguridad
-  'lock-keyhole': LockKeyhole,
-  'key-round': KeyRound,
-  'door-closed': DoorClosed,
-  'scan-face': ScanFace,
-  fingerprint: Fingerprint,
-  'shield-check': ShieldCheck,
-  webcam: Webcam,
-  siren: Siren,
-  // Mascotas, familia y salud
-  'paw-print': PawPrint,
-  cat: Cat,
-  dog: Dog,
-  fish: Fish,
-  baby: Baby,
-  scale: Scale,
-  'heart-pulse': HeartPulse,
-  // Ocio
-  projector: Projector,
-  cast: Cast,
-  headphones: Headphones,
-  headset: Headset,
-  radio: Radio,
-  joystick: Joystick,
-  // Cómputo y red
-  'hard-drive': HardDrive,
-  database: Database,
-  cloud: Cloud,
-  cpu: Cpu,
-  'brain-circuit': BrainCircuit,
-  bot: Bot,
-  antenna: Antenna,
-  'satellite-dish': SatelliteDish,
-  // Hogar y varios
-  blinds: Blinds,
-  armchair: Armchair,
-  sofa: Sofa,
-  'bed-double': BedDouble,
-  sprout: Sprout,
-  'flower-2': Flower2,
-  wrench: Wrench,
-  cog: Cog,
-  package: Package,
-  shirt: Shirt,
-  gauge: Gauge,
 }
 
 export const ALLOWED_ICONS = Object.keys(ICON_OVERRIDES) as string[]

+ 2 - 2
app/src/components/OnboardingIntake.tsx

@@ -187,7 +187,7 @@ export function OnboardingIntake({ open, device, isDemo, onClose, onSaved }: Onb
           {/* Icono */}
           <div className="space-y-2">
             <label className="text-label uppercase text-text-muted">{t('devices.onboarding.iconLabel')}</label>
-            <div className="grid max-h-64 grid-cols-6 gap-2 overflow-y-auto pr-1">
+            <div className="grid grid-cols-6 gap-2">
               <button
                 type="button"
                 onClick={() => setIcon('')}
@@ -205,7 +205,7 @@ export function OnboardingIntake({ open, device, isDemo, onClose, onSaved }: Onb
                   <button
                     key={n}
                     type="button"
-                    title={t(`devices.edit.iconNames.${n}`, { defaultValue: n })}
+                    title={n}
                     onClick={() => setIcon(n)}
                     disabled={busy}
                     className={cn(

+ 0 - 21
server-go/internal/httpapi/device_overrides.go

@@ -54,27 +54,6 @@ func validateIcon(icon string) bool {
 		"router": true, "server": true, "watch": true, "car": true,
 		"home": true, "printer": true, "plug": true, "shield": true,
 		"help-circle": true, "wifi": true, "ethernet": true,
-		// Smart-home overrides (must stay in sync with ICON_OVERRIDES).
-		"refrigerator": true, "washing-machine": true, "microwave": true,
-		"cooking-pot": true, "chef-hat": true, "coffee": true,
-		"utensils-crossed": true, "glass-water": true,
-		"shower-head": true, "bath": true, "toilet": true, "droplets": true,
-		"flame": true, "flame-kindling": true, "thermometer": true,
-		"fan": true, "snowflake": true,
-		"plug-zap": true, "battery-charging": true, "solar-panel": true, "power": true,
-		"lightbulb": true, "lamp": true, "lamp-desk": true, "lamp-ceiling": true,
-		"lock-keyhole": true, "key-round": true, "door-closed": true,
-		"scan-face": true, "fingerprint": true, "shield-check": true,
-		"webcam": true, "siren": true,
-		"paw-print": true, "cat": true, "dog": true, "fish": true,
-		"baby": true, "scale": true, "heart-pulse": true,
-		"projector": true, "cast": true, "headphones": true, "headset": true,
-		"radio": true, "joystick": true,
-		"hard-drive": true, "database": true, "cloud": true, "cpu": true,
-		"brain-circuit": true, "bot": true, "antenna": true, "satellite-dish": true,
-		"blinds": true, "armchair": true, "sofa": true, "bed-double": true,
-		"sprout": true, "flower-2": true, "wrench": true, "cog": true,
-		"package": true, "shirt": true, "gauge": true,
 	}
 	return allowed[icon]
 }

+ 0 - 7
server-go/internal/httpapi/device_overrides_test.go

@@ -155,13 +155,6 @@ func TestDeviceOverrideValidation(t *testing.T) {
 	if rec := doOverridePut(t, s, mac, `{"type":"movil"}`); rec.Code != 200 {
 		t.Errorf("tipo válil debió dar 200, dio %d", rec.Code)
 	}
-	// Iconos smart-home nuevos: aceptados (la lista cerrada del server debe
-	// seguir a ICON_OVERRIDES del frontend).
-	for _, icon := range []string{"microwave", "refrigerator", "cooking-pot", "paw-print", "lock-keyhole", "projector"} {
-		if rec := doOverridePut(t, s, mac, `{"icon":"`+icon+`"}`); rec.Code != 200 {
-			t.Errorf("icon %q debió dar 200, dio %d", icon, rec.Code)
-		}
-	}
 }
 
 // #1145: DELETE /api/devices/{mac} borra la fila del registro y 404 si no