From 422a0488061cf072078cb1936c435828c3828cf8 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Thu, 22 Jan 2026 11:17:46 +1100 Subject: [PATCH] feat: authoritative plugin fields Signed-off-by: jokob-sk --- docs/DEBUG_TIPS.md | 2 +- front/deviceDetailsEdit.php | 8 ++++---- server/api_server/graphql_endpoint.py | 16 ++++++++-------- server/db/db_upgrade.py | 2 +- server/helper.py | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/DEBUG_TIPS.md b/docs/DEBUG_TIPS.md index 75821542..1a439eab 100755 --- a/docs/DEBUG_TIPS.md +++ b/docs/DEBUG_TIPS.md @@ -4,7 +4,7 @@ Please follow tips 1 - 4 to get a more detailed error. ## 1. More Logging -When debugging an issue always set the highest log level: +When debugging an issue always set the highest log level in **Settings -> Core**: `LOG_LEVEL='trace'` diff --git a/front/deviceDetailsEdit.php b/front/deviceDetailsEdit.php index e4fd3f16..a4d787f3 100755 --- a/front/deviceDetailsEdit.php +++ b/front/deviceDetailsEdit.php @@ -275,7 +275,7 @@ function getDeviceData() { const fieldName = setting.setKey.replace('NEWDEV_', ''); if (trackedFields[fieldName] && mac != "new") { const sourceField = fieldName + "Source"; - const currentSource = deviceData[sourceField] || ""; + const currentSource = deviceData[sourceField] || "UNKNOWN"; const isLocked = currentSource === "LOCKED"; const lockIcon = isLocked ? "fa-lock" : "fa-lock-open"; const lockTitle = isLocked ? getString("FieldLock_Unlock_Tooltip") : getString("FieldLock_Lock_Tooltip"); @@ -292,7 +292,7 @@ function getDeviceData() { const fieldName2 = setting.setKey.replace('NEWDEV_', ''); if (trackedFields[fieldName2] && mac != "new") { const sourceField = fieldName2 + "Source"; - const currentSource = deviceData[sourceField] || "NEWDEV"; + const currentSource = deviceData[sourceField] || "UNKNOWN"; const sourceTitle = getString("FieldLock_Source_Label") + currentSource; const sourceColor = currentSource === "USER" ? "text-warning" : (currentSource === "LOCKED" ? "text-danger" : "text-muted"); inlineControl += ` @@ -561,7 +561,7 @@ function toggleFieldLock(mac, fieldName) { // Get current source value const sourceField = fieldName + "Source"; - const currentSource = deviceData[sourceField] || "NEWDEV"; + const currentSource = deviceData[sourceField] || "UNKNOWN"; const shouldLock = currentSource !== "LOCKED"; const payload = { @@ -600,7 +600,7 @@ function toggleFieldLock(mac, fieldName) { // Update source indicator const sourceIndicator = lockBtn.next(); if (sourceIndicator.hasClass("input-group-addon")) { - const sourceValue = shouldLock ? "LOCKED" : "NEWDEV"; + const sourceValue = shouldLock ? "LOCKED" : "UNKNOWN"; const sourceClass = shouldLock ? "input-group-addon text-danger" : "input-group-addon text-muted"; sourceIndicator.text(sourceValue); sourceIndicator.attr("class", sourceClass); diff --git a/server/api_server/graphql_endpoint.py b/server/api_server/graphql_endpoint.py index 10fb7eab..458ba51c 100755 --- a/server/api_server/graphql_endpoint.py +++ b/server/api_server/graphql_endpoint.py @@ -91,14 +91,14 @@ class Device(ObjectType): devParentRelType = String(description="Relationship type to parent") devReqNicsOnline = Int(description="Required NICs online flag") devMacSource = String(description="Source tracking for devMac (USER, LOCKED, NEWDEV, or plugin prefix)") - devNameSource = String(description="Source tracking for devName") - devFqdnSource = String(description="Source tracking for devFQDN") - devLastIpSource = String(description="Source tracking for devLastIP") - devVendorSource = String(description="Source tracking for devVendor") - devSsidSource = String(description="Source tracking for devSSID") - devParentMacSource = String(description="Source tracking for devParentMAC") - devParentPortSource = String(description="Source tracking for devParentPort") - devParentRelTypeSource = String(description="Source tracking for devParentRelType") + devNameSource = String(description="Source tracking for devName (USER, LOCKED, NEWDEV, or plugin prefix)") + devFqdnSource = String(description="Source tracking for devFQDN (USER, LOCKED, NEWDEV, or plugin prefix)") + devLastIpSource = String(description="Source tracking for devLastIP (USER, LOCKED, NEWDEV, or plugin prefix)") + devVendorSource = String(description="Source tracking for devVendor (USER, LOCKED, NEWDEV, or plugin prefix)") + devSsidSource = String(description="Source tracking for devSSID (USER, LOCKED, NEWDEV, or plugin prefix)") + devParentMacSource = String(description="Source tracking for devParentMAC (USER, LOCKED, NEWDEV, or plugin prefix)") + devParentPortSource = String(description="Source tracking for devParentPort (USER, LOCKED, NEWDEV, or plugin prefix)") + devParentRelTypeSource = String(description="Source tracking for devParentRelType (USER, LOCKED, NEWDEV, or plugin prefix)") devVlanSource = String(description="Source tracking for devVlan") diff --git a/server/db/db_upgrade.py b/server/db/db_upgrade.py index f21827e5..590c49c2 100755 --- a/server/db/db_upgrade.py +++ b/server/db/db_upgrade.py @@ -9,7 +9,7 @@ from logger import mylog # noqa: E402 [flake8 lint suppression] from messaging.in_app import write_notification # noqa: E402 [flake8 lint suppression] -# Define the expected Devices table columns (hardcoded base schema) [v25.5.24] +# Define the expected Devices table columns (hardcoded base schema) [v26.1/2.XX] EXPECTED_DEVICES_COLUMNS = [ "devMac", "devName", diff --git a/server/helper.py b/server/helper.py index 6eb21f8a..4565dcd5 100755 --- a/server/helper.py +++ b/server/helper.py @@ -189,7 +189,7 @@ def get_setting(key): SETTINGS_LASTCACHEDATE = fileModifiedTime if key not in SETTINGS_CACHE: - mylog("none", [f"[Settings] ⚠ ERROR - setting_missing - {key} not in {settingsFile}"],) + mylog("verbose", [f"[Settings] INFO - setting_missing - {key} not in {settingsFile}"],) return None return SETTINGS_CACHE[key]