feat: auto-detect OS from description; expand OS_LIST to 51 distros

- Remove os field from Device API and form — OS is now detected
  automatically from name/description via detectOs() in brandIcons.js
- Expand OS_LIST from 20 to 51 entries covering all major distros
  (Debian/Ubuntu flavours, Red Hat, SUSE, Arch, BSD, security distros,
  Windows/macOS/iOS/Android, generic Linux/BSD catch-alls)
- Display detected OS icon in IpAddressing.vue description column
- Fix virt_type validator to normalise empty string to null

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-22 08:52:53 +02:00
parent 954b5cefa6
commit fd289cc00f
8 changed files with 139 additions and 175 deletions
+14
View File
@@ -146,6 +146,19 @@ def _migrate_users():
conn.commit()
def _migrate_device_os():
"""Ajoute la colonne os sur devices si absente."""
with engine.connect() as conn:
if not conn.execute(text(
"SELECT name FROM sqlite_master WHERE type='table' AND name='devices'"
)).fetchone():
return
cols = [row[1] for row in conn.execute(text("PRAGMA table_info(devices)")).fetchall()]
if 'os' not in cols:
conn.execute(text("ALTER TABLE devices ADD COLUMN os VARCHAR"))
conn.commit()
def _migrate_drop_links_table():
"""Supprime la table links (fonctionnalité retirée en phase 3). Idempotent."""
with engine.connect() as conn:
@@ -162,6 +175,7 @@ def _migrate_drop_links_table():
_migrate_vlan_nullable()
_migrate_device_virt_type()
_migrate_device_url()
_migrate_device_os()
_migrate_users_must_change_password()
_migrate_users_token_version()
_migrate_force_admin_password_change()