From 80e8cb3f74211191338993cde00f0ea75a1cb646 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Fri, 6 Dec 2024 07:38:51 +1100 Subject: [PATCH] Icon cleanup --- front/css/app.css | 20 ++++++++++++++++++++ front/devices.php | 5 +++-- server/device.py | 7 +++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/front/css/app.css b/front/css/app.css index 65b9f168..23b50a7e 100755 --- a/front/css/app.css +++ b/front/css/app.css @@ -1260,6 +1260,11 @@ input[readonly] { display: flex; } +.iconColumn +{ + max-height: 25px; +} + .iconPreviewSelector svg { width:40px; @@ -1277,6 +1282,21 @@ input[readonly] { } +#tableDevices .fab +{ + font-size: 1.5em; +} + +#tableDevices .fa +{ + font-size: 1.0em; +} + +#tableDevices tbody tr +{ + height: 1.5em; +} + .info-icon-nav { top: -6px; diff --git a/front/devices.php b/front/devices.php index 74865b73..73af3858 100755 --- a/front/devices.php +++ b/front/devices.php @@ -561,9 +561,10 @@ function initializeDatatable (status) { 'columnDefs' : [ {visible: false, targets: tableColumnHide }, - {className: 'text-center', targets: [mapIndx(3), mapIndx(4), mapIndx(9), mapIndx(10), mapIndx(15), mapIndx(18)] }, + {className: 'text-center', targets: [mapIndx(4), mapIndx(9), mapIndx(10), mapIndx(15), mapIndx(18)] }, + {className: 'iconColumn text-center', targets: [mapIndx(3)]}, {width: '80px', targets: [mapIndx(6), mapIndx(7), mapIndx(15)] }, - {width: '30px', targets: [mapIndx(10), mapIndx(13), mapIndx(18)] }, + {width: '30px', targets: [mapIndx(3), mapIndx(10), mapIndx(13), mapIndx(18)] }, {orderData: [mapIndx(12)], targets: mapIndx(8) }, // Device Name diff --git a/server/device.py b/server/device.py index c5ce47c6..0350d895 100755 --- a/server/device.py +++ b/server/device.py @@ -454,6 +454,8 @@ def update_devices_data_from_scan (db): recordsToUpdate = [] default_icon = get_setting_value('NEWDEV_devIcon') + + if get_setting_value('NEWDEV_replace_preset_icon'): query = f"""SELECT * FROM Devices @@ -469,6 +471,9 @@ def update_devices_data_from_scan (db): devIcon = guess_icon(device['devVendor'], device['devMac'], device['devLastIP'], device['devName'], default_icon) recordsToUpdate.append ([devIcon, device['devMac']]) + + + mylog('debug',f'[Update Devices] recordsToUpdate: {recordsToUpdate}') if len(recordsToUpdate) > 0: sql.executemany ("UPDATE Devices SET devIcon = ? WHERE devMac = ? ", recordsToUpdate ) @@ -708,6 +713,8 @@ def guess_icon(vendor, mac, ip, name, default): result = icons.get("google") elif 'desktop' in name: result = icons.get("desktop") + elif 'raspberry' in name: + result = icons.get("raspberry") # Guess icon based on IP address ranges elif ip.startswith("192.168.1."):