mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-15 22:51:37 -07:00
NEWDEV_replace_preset_icon
This commit is contained in:
@@ -265,6 +265,34 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"function": "replace_preset_icon",
|
||||||
|
"type": {
|
||||||
|
"dataType": "boolean",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"elementType": "input",
|
||||||
|
"elementOptions": [{ "type": "checkbox" }],
|
||||||
|
"transformers": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"default_value": false,
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name", "description"],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Overwrite Preset Icon"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "If checked, the application replaces the preset icon in <code>NEWDEV_devIcon</code> with a pre-assigned vendor or device icon if found. If this is checked, avoid manually assigning this icon to devices, as it may be replaced."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"function": "devMac",
|
"function": "devMac",
|
||||||
"type": {
|
"type": {
|
||||||
|
|||||||
+8
-1
@@ -452,10 +452,17 @@ def update_devices_data_from_scan (db):
|
|||||||
|
|
||||||
# Guess ICONS
|
# Guess ICONS
|
||||||
recordsToUpdate = []
|
recordsToUpdate = []
|
||||||
|
|
||||||
|
default_icon = get_setting_value('NEWDEV_devIcon')
|
||||||
|
|
||||||
|
if get_setting_value('NEWDEV_replace_preset_icon'):
|
||||||
|
query = f"""SELECT * FROM Devices
|
||||||
|
WHERE devIcon in ('', 'null', '{default_icon}')
|
||||||
|
OR devIcon IS NULL"""
|
||||||
|
else:
|
||||||
query = """SELECT * FROM Devices
|
query = """SELECT * FROM Devices
|
||||||
WHERE devIcon in ('', 'null')
|
WHERE devIcon in ('', 'null')
|
||||||
OR devIcon IS NULL"""
|
OR devIcon IS NULL"""
|
||||||
default_icon = get_setting_value('NEWDEV_devIcon')
|
|
||||||
|
|
||||||
for device in sql.execute (query) :
|
for device in sql.execute (query) :
|
||||||
# Conditional logic for devIcon guessing
|
# Conditional logic for devIcon guessing
|
||||||
|
|||||||
Reference in New Issue
Block a user