FE+BE+DOCS: lock fields, devVlan not saveable

Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
jokob-sk
2026-01-26 11:19:49 +11:00
parent 9d6004d23d
commit 54a481f459
26 changed files with 63 additions and 29 deletions

View File

@@ -1,6 +1,8 @@
# Quick Reference Guide - Device Field Lock/Unlock System # Quick Reference Guide - Device Field Lock/Unlock System
## One-Minute Overview ## Overview
![Field source and locks](./img/DEVICE_MANAGEMENT/field_sources_and_locks.png)
The device field lock/unlock system allows you to protect specific device fields from being automatically overwritten by scanning plugins. When you lock a field, NetAlertX remembers your choice and prevents plugins from changing that value until you unlock it. The device field lock/unlock system allows you to protect specific device fields from being automatically overwritten by scanning plugins. When you lock a field, NetAlertX remembers your choice and prevents plugins from changing that value until you unlock it.

View File

@@ -49,6 +49,8 @@ To speed up device population you can also copy data from an existing device. Th
## Field Locking (Preventing Plugin Overwrites) ## Field Locking (Preventing Plugin Overwrites)
![Field source and locks](./img/DEVICE_MANAGEMENT/field_sources_and_locks.png)
NetAlertX allows you to "lock" specific device fields to prevent plugins from automatically overwriting your custom values. This is useful when you've manually corrected information that might be discovered differently by discovery plugins. NetAlertX allows you to "lock" specific device fields to prevent plugins from automatically overwriting your custom values. This is useful when you've manually corrected information that might be discovered differently by discovery plugins.
### Quick Start ### Quick Start
@@ -64,7 +66,7 @@ The following 10 fields support locking:
### See Also ### See Also
- **For Users:** [Quick Reference - Device Field Lock/Unlock](QUICK_REFERENCE_FIELD_LOCK.md) - How to use field locking - **For Users:** [Quick Reference - Device Field Lock/Unlock](DEVICE_FIELD_LOCK.md) - How to use field locking
- **For Developers:** [API Device Field Lock Documentation](API_DEVICE_FIELD_LOCK.md) - Technical API reference - **For Developers:** [API Device Field Lock Documentation](API_DEVICE_FIELD_LOCK.md) - Technical API reference
- **For Plugin Developers:** [Plugin Field Configuration (SET_ALWAYS/SET_EMPTY)](PLUGINS_DEV_CONFIG.md) - Configure which fields plugins can update - **For Plugin Developers:** [Plugin Field Configuration (SET_ALWAYS/SET_EMPTY)](PLUGINS_DEV_CONFIG.md) - Configure which fields plugins can update

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -440,6 +440,7 @@ function setDeviceData(direction = '', refreshCallback = '') {
devSSID: $('#NEWDEV_devSSID').val(), devSSID: $('#NEWDEV_devSSID').val(),
devSite: $('#NEWDEV_devSite').val(), devSite: $('#NEWDEV_devSite').val(),
devVlan: $('#NEWDEV_devVlan').val(),
devStaticIP: ($('#NEWDEV_devStaticIP')[0].checked * 1), devStaticIP: ($('#NEWDEV_devStaticIP')[0].checked * 1),
devScan: 1, devScan: 1,
@@ -580,6 +581,12 @@ function toggleFieldLock(mac, fieldName) {
const currentSource = deviceData[sourceField] || "N/A"; const currentSource = deviceData[sourceField] || "N/A";
const shouldLock = currentSource !== "LOCKED"; const shouldLock = currentSource !== "LOCKED";
if(shouldLock && somethingChanged)
{
showMessage(getString("FieldLock_SaveBeforeLocking"), 5000, "modal_red");
return;
}
const payload = { const payload = {
fieldName: fieldName, fieldName: fieldName,
lock: shouldLock ? 1 : 0 lock: shouldLock ? 1 : 0

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "نظام", "settings_system_label": "نظام",
"settings_update_item_warning": "قم بتحديث القيمة أدناه. احرص على اتباع التنسيق السابق. <b>لم يتم إجراء التحقق.</b>", "settings_update_item_warning": "قم بتحديث القيمة أدناه. احرص على اتباع التنسيق السابق. <b>لم يتم إجراء التحقق.</b>",
"test_event_tooltip": "احفظ التغييرات أولاً قبل اختبار الإعدادات." "test_event_tooltip": "احفظ التغييرات أولاً قبل اختبار الإعدادات."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "Sistema", "settings_system_label": "Sistema",
"settings_update_item_warning": "Actualitza el valor sota. Sigues curós de seguir el format anterior. <b>No hi ha validació.</b>", "settings_update_item_warning": "Actualitza el valor sota. Sigues curós de seguir el format anterior. <b>No hi ha validació.</b>",
"test_event_tooltip": "Deseu els canvis primer abans de comprovar la configuració." "test_event_tooltip": "Deseu els canvis primer abans de comprovar la configuració."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",

View File

@@ -304,6 +304,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -855,4 +856,4 @@
"settings_system_label": "System", "settings_system_label": "System",
"settings_update_item_warning": "", "settings_update_item_warning": "",
"test_event_tooltip": "Speichere die Änderungen, bevor Sie die Einstellungen testen." "test_event_tooltip": "Speichere die Änderungen, bevor Sie die Einstellungen testen."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "Error updating field lock status", "FieldLock_Error": "Error updating field lock status",
"FieldLock_Lock_Tooltip": "Lock field (prevent plugin overwrites)", "FieldLock_Lock_Tooltip": "Lock field (prevent plugin overwrites)",
"FieldLock_Locked": "Field locked", "FieldLock_Locked": "Field locked",
"FieldLock_SaveBeforeLocking": "Save your changes before locking",
"FieldLock_Source_Label": "Source: ", "FieldLock_Source_Label": "Source: ",
"FieldLock_Unlock_Tooltip": "Unlock field (allow plugin overwrites)", "FieldLock_Unlock_Tooltip": "Unlock field (allow plugin overwrites)",
"FieldLock_Unlocked": "Field unlocked", "FieldLock_Unlocked": "Field unlocked",

View File

@@ -302,6 +302,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -853,4 +854,4 @@
"settings_system_label": "Sistema", "settings_system_label": "Sistema",
"settings_update_item_warning": "Actualice el valor a continuación. Tenga cuidado de seguir el formato anterior. <b>O la validación no se realiza.</b>", "settings_update_item_warning": "Actualice el valor a continuación. Tenga cuidado de seguir el formato anterior. <b>O la validación no se realiza.</b>",
"test_event_tooltip": "Guarda tus cambios antes de probar nuevos ajustes." "test_event_tooltip": "Guarda tus cambios antes de probar nuevos ajustes."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "Système", "settings_system_label": "Système",
"settings_update_item_warning": "Mettre à jour la valeur ci-dessous. Veillez à bien suivre le même format qu'auparavant. <b>Il n'y a pas de pas de contrôle.</b>", "settings_update_item_warning": "Mettre à jour la valeur ci-dessous. Veillez à bien suivre le même format qu'auparavant. <b>Il n'y a pas de pas de contrôle.</b>",
"test_event_tooltip": "Enregistrer d'abord vos modifications avant de tester vôtre paramétrage." "test_event_tooltip": "Enregistrer d'abord vos modifications avant de tester vôtre paramétrage."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "Errore durante l'aggiornamento dello stato di blocco del campo", "FieldLock_Error": "Errore durante l'aggiornamento dello stato di blocco del campo",
"FieldLock_Lock_Tooltip": "Blocca campo (impedisci sovrascrittura plugin)", "FieldLock_Lock_Tooltip": "Blocca campo (impedisci sovrascrittura plugin)",
"FieldLock_Locked": "Campo bloccato", "FieldLock_Locked": "Campo bloccato",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "Sorgente: ", "FieldLock_Source_Label": "Sorgente: ",
"FieldLock_Unlock_Tooltip": "Sblocca campo (consenti sovrascritture plugin)", "FieldLock_Unlock_Tooltip": "Sblocca campo (consenti sovrascritture plugin)",
"FieldLock_Unlocked": "Campo sbloccato", "FieldLock_Unlocked": "Campo sbloccato",
@@ -782,4 +783,4 @@
"settings_system_label": "Sistema", "settings_system_label": "Sistema",
"settings_update_item_warning": "Aggiorna il valore qui sotto. Fai attenzione a seguire il formato precedente. <b>La convalida non viene eseguita.</b>", "settings_update_item_warning": "Aggiorna il valore qui sotto. Fai attenzione a seguire il formato precedente. <b>La convalida non viene eseguita.</b>",
"test_event_tooltip": "Salva le modifiche prima di provare le nuove impostazioni." "test_event_tooltip": "Salva le modifiche prima di provare le nuove impostazioni."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "システム", "settings_system_label": "システム",
"settings_update_item_warning": "以下の値を更新してください。以前のフォーマットに従うよう注意してください。<b>検証は行われません。</b>", "settings_update_item_warning": "以下の値を更新してください。以前のフォーマットに従うよう注意してください。<b>検証は行われません。</b>",
"test_event_tooltip": "設定をテストする前に、まず変更を保存してください。" "test_event_tooltip": "設定をテストする前に、まず変更を保存してください。"
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "System", "settings_system_label": "System",
"settings_update_item_warning": "Oppdater verdien nedenfor. Pass på å følge forrige format. <b>Validering etterpå utføres ikke.</b>", "settings_update_item_warning": "Oppdater verdien nedenfor. Pass på å følge forrige format. <b>Validering etterpå utføres ikke.</b>",
"test_event_tooltip": "Lagre endringene først, før du tester innstillingene dine." "test_event_tooltip": "Lagre endringene først, før du tester innstillingene dine."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "System", "settings_system_label": "System",
"settings_update_item_warning": "Zaktualizuj wartość poniżej. Uważaj, aby zachować poprzedni format. <b>Walidacja nie jest wykonywana.</b>", "settings_update_item_warning": "Zaktualizuj wartość poniżej. Uważaj, aby zachować poprzedni format. <b>Walidacja nie jest wykonywana.</b>",
"test_event_tooltip": "Najpierw zapisz swoje zmiany, zanim przetestujesz ustawienia." "test_event_tooltip": "Najpierw zapisz swoje zmiany, zanim przetestujesz ustawienia."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "", "settings_system_label": "",
"settings_update_item_warning": "", "settings_update_item_warning": "",
"test_event_tooltip": "Guarde as alterações antes de testar as definições." "test_event_tooltip": "Guarde as alterações antes de testar as definições."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "", "settings_system_label": "",
"settings_update_item_warning": "", "settings_update_item_warning": "",
"test_event_tooltip": "Guarde as alterações antes de testar as definições." "test_event_tooltip": "Guarde as alterações antes de testar as definições."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "Ошибка при обновлении статуса блокировки поля", "FieldLock_Error": "Ошибка при обновлении статуса блокировки поля",
"FieldLock_Lock_Tooltip": "Заблокировать поле (предотвратить перезапись плагином)", "FieldLock_Lock_Tooltip": "Заблокировать поле (предотвратить перезапись плагином)",
"FieldLock_Locked": "Поле заблокировано", "FieldLock_Locked": "Поле заблокировано",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "Источник: ", "FieldLock_Source_Label": "Источник: ",
"FieldLock_Unlock_Tooltip": "Разблокировать поле (разрешить перезапись плагином)", "FieldLock_Unlock_Tooltip": "Разблокировать поле (разрешить перезапись плагином)",
"FieldLock_Unlocked": "Поле разблокировано", "FieldLock_Unlocked": "Поле разблокировано",
@@ -782,4 +783,4 @@
"settings_system_label": "Система", "settings_system_label": "Система",
"settings_update_item_warning": "Обновить значение ниже. Будьте осторожны, следуя предыдущему формату. <b>Проверка не выполняется.</b>", "settings_update_item_warning": "Обновить значение ниже. Будьте осторожны, следуя предыдущему формату. <b>Проверка не выполняется.</b>",
"test_event_tooltip": "Сначала сохраните изменения, прежде чем проверять настройки." "test_event_tooltip": "Сначала сохраните изменения, прежде чем проверять настройки."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "Sistem", "settings_system_label": "Sistem",
"settings_update_item_warning": "", "settings_update_item_warning": "",
"test_event_tooltip": "" "test_event_tooltip": ""
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "Помилка оновлення стану блокування поля", "FieldLock_Error": "Помилка оновлення стану блокування поля",
"FieldLock_Lock_Tooltip": "Заблокувати поле (запобігти перезапису плагіном)", "FieldLock_Lock_Tooltip": "Заблокувати поле (запобігти перезапису плагіном)",
"FieldLock_Locked": "Поле заблоковано", "FieldLock_Locked": "Поле заблоковано",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "Джерело: ", "FieldLock_Source_Label": "Джерело: ",
"FieldLock_Unlock_Tooltip": "Поле розблокування (дозволити перезапис плагіна)", "FieldLock_Unlock_Tooltip": "Поле розблокування (дозволити перезапис плагіна)",
"FieldLock_Unlocked": "Поле розблоковано", "FieldLock_Unlocked": "Поле розблоковано",
@@ -782,4 +783,4 @@
"settings_system_label": "Система", "settings_system_label": "Система",
"settings_update_item_warning": "Оновіть значення нижче. Слідкуйте за попереднім форматом. <b>Перевірка не виконана.</b>", "settings_update_item_warning": "Оновіть значення нижче. Слідкуйте за попереднім форматом. <b>Перевірка не виконана.</b>",
"test_event_tooltip": "Перш ніж перевіряти налаштування, збережіть зміни." "test_event_tooltip": "Перш ніж перевіряти налаштування, збережіть зміни."
} }

View File

@@ -300,6 +300,7 @@
"FieldLock_Error": "", "FieldLock_Error": "",
"FieldLock_Lock_Tooltip": "", "FieldLock_Lock_Tooltip": "",
"FieldLock_Locked": "", "FieldLock_Locked": "",
"FieldLock_SaveBeforeLocking": "",
"FieldLock_Source_Label": "", "FieldLock_Source_Label": "",
"FieldLock_Unlock_Tooltip": "", "FieldLock_Unlock_Tooltip": "",
"FieldLock_Unlocked": "", "FieldLock_Unlocked": "",
@@ -782,4 +783,4 @@
"settings_system_label": "系统", "settings_system_label": "系统",
"settings_update_item_warning": "更新下面的值。请注意遵循先前的格式。<b>未执行验证。</b>", "settings_update_item_warning": "更新下面的值。请注意遵循先前的格式。<b>未执行验证。</b>",
"test_event_tooltip": "在测试设置之前,请先保存更改。" "test_event_tooltip": "在测试设置之前,请先保存更改。"
} }

View File

@@ -76,7 +76,7 @@ nav:
- Custom Properties: CUSTOM_PROPERTIES.md - Custom Properties: CUSTOM_PROPERTIES.md
- Device Display Settings: DEVICE_DISPLAY_SETTINGS.md - Device Display Settings: DEVICE_DISPLAY_SETTINGS.md
- Session Info: SESSION_INFO.md - Session Info: SESSION_INFO.md
- Field Lock/Unlock: QUICK_REFERENCE_FIELD_LOCK.md - Field Lock/Unlock: DEVICE_FIELD_LOCK.md
- Icons and Topology: - Icons and Topology:
- Icons: ICONS.md - Icons: ICONS.md
- Network Topology: NETWORK_TREE.md - Network Topology: NETWORK_TREE.md

View File

@@ -429,7 +429,8 @@ class DeviceInstance:
"devDownAlerts": 0, "devDownAlerts": 0,
"devPresenceHours": 0, "devPresenceHours": 0,
"devFQDN": "", "devFQDN": "",
"devForceStatus" : "dont_force" "devForceStatus" : "dont_force",
"devVlan": ""
} }
return device_data return device_data
@@ -536,7 +537,8 @@ class DeviceInstance:
"devIsNew", "devIsNew",
"devIsArchived", "devIsArchived",
"devCustomProps", "devCustomProps",
"devForceStatus" "devForceStatus",
"devVlan"
} }
# Only mark USER for tracked fields that this method actually updates. # Only mark USER for tracked fields that this method actually updates.
@@ -586,8 +588,8 @@ class DeviceInstance:
devParentRelType, devReqNicsOnline, devSkipRepeated, devParentRelType, devReqNicsOnline, devSkipRepeated,
devIsNew, devIsArchived, devLastConnection, devIsNew, devIsArchived, devLastConnection,
devFirstConnection, devLastIP, devGUID, devCustomProps, devFirstConnection, devLastIP, devGUID, devCustomProps,
devSourcePlugin, devForceStatus devSourcePlugin, devForceStatus, devVlan
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""" """
values = ( values = (
@@ -621,6 +623,7 @@ class DeviceInstance:
data.get("devCustomProps") or "", data.get("devCustomProps") or "",
data.get("devSourcePlugin") or "DUMMY", data.get("devSourcePlugin") or "DUMMY",
data.get("devForceStatus") or "dont_force", data.get("devForceStatus") or "dont_force",
data.get("devVlan") or "",
) )
else: else:
@@ -631,7 +634,7 @@ class DeviceInstance:
devParentMAC=?, devParentPort=?, devSSID=?, devSite=?, devParentMAC=?, devParentPort=?, devSSID=?, devSite=?,
devStaticIP=?, devScan=?, devAlertEvents=?, devAlertDown=?, devStaticIP=?, devScan=?, devAlertEvents=?, devAlertDown=?,
devParentRelType=?, devReqNicsOnline=?, devSkipRepeated=?, devParentRelType=?, devReqNicsOnline=?, devSkipRepeated=?,
devIsNew=?, devIsArchived=?, devCustomProps=?, devForceStatus=? devIsNew=?, devIsArchived=?, devCustomProps=?, devForceStatus=?, devVlan=?
WHERE devMac=? WHERE devMac=?
""" """
values = ( values = (
@@ -659,6 +662,7 @@ class DeviceInstance:
data.get("devIsArchived") or 0, data.get("devIsArchived") or 0,
data.get("devCustomProps") or "", data.get("devCustomProps") or "",
data.get("devForceStatus") or "dont_force", data.get("devForceStatus") or "dont_force",
data.get("devVlan") or "",
normalized_mac, normalized_mac,
) )

View File

@@ -165,20 +165,20 @@ def test_scenario():
```python ```python
def test_scan_scenario(scan_db, mock_device_handlers): def test_scan_scenario(scan_db, mock_device_handlers):
cur = scan_db.cursor() cur = scan_db.cursor()
# Insert device with specific source # Insert device with specific source
cur.execute("INSERT INTO Devices ...") cur.execute("INSERT INTO Devices ...")
# Insert scan results # Insert scan results
cur.execute("INSERT INTO CurrentScan ...") cur.execute("INSERT INTO CurrentScan ...")
scan_db.commit() scan_db.commit()
# Run actual scan update # Run actual scan update
db = Mock() db = Mock()
db.sql_connection = scan_db db.sql_connection = scan_db
db.sql = cur db.sql = cur
device_handling.update_devices_data_from_scan(db) device_handling.update_devices_data_from_scan(db)
# Verify results # Verify results
row = cur.execute("SELECT ... FROM Devices") row = cur.execute("SELECT ... FROM Devices")
assert row["field"] == "expected_value" assert row["field"] == "expected_value"
@@ -246,7 +246,7 @@ All 10 lockable fields tested:
5. **Rule 5 (Default):** If current_source is empty/"NEWDEV" → Return `True`, else → Return `False` 5. **Rule 5 (Default):** If current_source is empty/"NEWDEV" → Return `True`, else → Return `False`
- Default behavior: only overwrite empty/unset fields - Default behavior: only overwrite empty/unset fields
**Key Principles:** **Key Principles:**
- **USER and LOCKED** = Absolute protection (cannot be overwritten, even with SET_ALWAYS) - **USER and LOCKED** = Absolute protection (cannot be overwritten, even with SET_ALWAYS)
- **SET_ALWAYS** = Allow overwrite of: own fields, other plugin fields, empty current values, NEWDEV fields - **SET_ALWAYS** = Allow overwrite of: own fields, other plugin fields, empty current values, NEWDEV fields
- **SET_EMPTY** = "Set only if empty" - fills empty fields only, won't overwrite existing plugin data - **SET_EMPTY** = "Set only if empty" - fills empty fields only, won't overwrite existing plugin data
@@ -257,7 +257,7 @@ All 10 lockable fields tested:
## Related Documentation ## Related Documentation
- **User Guide:** [QUICK_REFERENCE_FIELD_LOCK.md](../../docs/QUICK_REFERENCE_FIELD_LOCK.md) - User-friendly field locking instructions - **User Guide:** [DEVICE_FIELD_LOCK.md](../../docs/DEVICE_FIELD_LOCK.md) - User-friendly field locking instructions
- **API Documentation:** [API_DEVICE_FIELD_LOCK.md](../../docs/API_DEVICE_FIELD_LOCK.md) - Endpoint documentation - **API Documentation:** [API_DEVICE_FIELD_LOCK.md](../../docs/API_DEVICE_FIELD_LOCK.md) - Endpoint documentation
- **Plugin Configuration:** [PLUGINS_DEV_CONFIG.md](../../docs/PLUGINS_DEV_CONFIG.md) - SET_ALWAYS/SET_EMPTY configuration guide - **Plugin Configuration:** [PLUGINS_DEV_CONFIG.md](../../docs/PLUGINS_DEV_CONFIG.md) - SET_ALWAYS/SET_EMPTY configuration guide
- **Device Management:** [DEVICE_MANAGEMENT.md](../../docs/DEVICE_MANAGEMENT.md) - Device management admin guide - **Device Management:** [DEVICE_MANAGEMENT.md](../../docs/DEVICE_MANAGEMENT.md) - Device management admin guide