Icon cleanup

This commit is contained in:
jokob-sk
2024-12-06 07:38:51 +11:00
parent a77dcb5809
commit 80e8cb3f74
3 changed files with 30 additions and 2 deletions

View File

@@ -1260,6 +1260,11 @@ input[readonly] {
display: flex; display: flex;
} }
.iconColumn
{
max-height: 25px;
}
.iconPreviewSelector svg .iconPreviewSelector svg
{ {
width:40px; 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 .info-icon-nav
{ {
top: -6px; top: -6px;

View File

@@ -561,9 +561,10 @@ function initializeDatatable (status) {
'columnDefs' : [ 'columnDefs' : [
{visible: false, targets: tableColumnHide }, {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: '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) }, {orderData: [mapIndx(12)], targets: mapIndx(8) },
// Device Name // Device Name

View File

@@ -454,6 +454,8 @@ def update_devices_data_from_scan (db):
recordsToUpdate = [] recordsToUpdate = []
default_icon = get_setting_value('NEWDEV_devIcon') default_icon = get_setting_value('NEWDEV_devIcon')
if get_setting_value('NEWDEV_replace_preset_icon'): if get_setting_value('NEWDEV_replace_preset_icon'):
query = f"""SELECT * FROM Devices 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) devIcon = guess_icon(device['devVendor'], device['devMac'], device['devLastIP'], device['devName'], default_icon)
recordsToUpdate.append ([devIcon, device['devMac']]) recordsToUpdate.append ([devIcon, device['devMac']])
mylog('debug',f'[Update Devices] recordsToUpdate: {recordsToUpdate}')
if len(recordsToUpdate) > 0: if len(recordsToUpdate) > 0:
sql.executemany ("UPDATE Devices SET devIcon = ? WHERE devMac = ? ", recordsToUpdate ) 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") result = icons.get("google")
elif 'desktop' in name: elif 'desktop' in name:
result = icons.get("desktop") result = icons.get("desktop")
elif 'raspberry' in name:
result = icons.get("raspberry")
# Guess icon based on IP address ranges # Guess icon based on IP address ranges
elif ip.startswith("192.168.1."): elif ip.startswith("192.168.1."):