mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-30 23:03:03 -07:00
BE+FE: Check if current mac != parent mac for network page setup #1513
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -479,7 +479,12 @@ function setDeviceData(direction = '', refreshCallback = '') {
|
||||
if (resp && resp.success) {
|
||||
showMessage(getString("Device_Saved_Success"));
|
||||
} else {
|
||||
showMessage(getString("Device_Saved_Unexpected"));
|
||||
|
||||
console.log(resp);
|
||||
|
||||
errorMessage = resp?.error;
|
||||
|
||||
showMessage(`${getString("Device_Saved_Unexpected")}: ${errorMessage}`, 5000, "modal_red");
|
||||
}
|
||||
|
||||
// Remove navigation prompt
|
||||
|
||||
@@ -14,6 +14,7 @@ from const import NULL_EQUIVALENTS_SQL # noqa: E402 [flake8 lint suppression]
|
||||
def get_device_conditions():
|
||||
network_dev_types = ",".join(f"'{v.replace('\'', '\'\'')}'" for v in get_setting_value("NETWORK_DEVICE_TYPES"))
|
||||
|
||||
# DO NOT CHANGE ORDER
|
||||
conditions = {
|
||||
"all": "WHERE devIsArchived=0",
|
||||
"my": "WHERE devIsArchived=0",
|
||||
@@ -27,6 +28,7 @@ def get_device_conditions():
|
||||
"network_devices_down": f"WHERE devIsArchived=0 AND devType in ({network_dev_types}) AND devPresentLastScan=0",
|
||||
"unknown": f"WHERE devIsArchived=0 AND devName in ({NULL_EQUIVALENTS_SQL})",
|
||||
"known": f"WHERE devIsArchived=0 AND devName not in ({NULL_EQUIVALENTS_SQL})",
|
||||
"favorites_offline": "WHERE devIsArchived=0 AND devFavorite=1 AND devPresentLastScan=0",
|
||||
}
|
||||
|
||||
return conditions
|
||||
|
||||
@@ -536,6 +536,12 @@ class DeviceInstance:
|
||||
normalized_mac = normalize_mac(mac)
|
||||
normalized_parent_mac = normalize_mac(data.get("devParentMAC") or "")
|
||||
|
||||
if normalized_mac == normalized_parent_mac:
|
||||
return {
|
||||
"success": False,
|
||||
"error": "Can't set current node as the node parent."
|
||||
}
|
||||
|
||||
fields_updated_by_set_device_data = {
|
||||
"devName",
|
||||
"devOwner",
|
||||
|
||||
Reference in New Issue
Block a user