mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-15 22:51:37 -07:00
feat: authoritative plugin fields
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ Please follow tips 1 - 4 to get a more detailed error.
|
|||||||
|
|
||||||
## 1. More Logging
|
## 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'`
|
`LOG_LEVEL='trace'`
|
||||||
|
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ function getDeviceData() {
|
|||||||
const fieldName = setting.setKey.replace('NEWDEV_', '');
|
const fieldName = setting.setKey.replace('NEWDEV_', '');
|
||||||
if (trackedFields[fieldName] && mac != "new") {
|
if (trackedFields[fieldName] && mac != "new") {
|
||||||
const sourceField = fieldName + "Source";
|
const sourceField = fieldName + "Source";
|
||||||
const currentSource = deviceData[sourceField] || "";
|
const currentSource = deviceData[sourceField] || "UNKNOWN";
|
||||||
const isLocked = currentSource === "LOCKED";
|
const isLocked = currentSource === "LOCKED";
|
||||||
const lockIcon = isLocked ? "fa-lock" : "fa-lock-open";
|
const lockIcon = isLocked ? "fa-lock" : "fa-lock-open";
|
||||||
const lockTitle = isLocked ? getString("FieldLock_Unlock_Tooltip") : getString("FieldLock_Lock_Tooltip");
|
const lockTitle = isLocked ? getString("FieldLock_Unlock_Tooltip") : getString("FieldLock_Lock_Tooltip");
|
||||||
@@ -292,7 +292,7 @@ function getDeviceData() {
|
|||||||
const fieldName2 = setting.setKey.replace('NEWDEV_', '');
|
const fieldName2 = setting.setKey.replace('NEWDEV_', '');
|
||||||
if (trackedFields[fieldName2] && mac != "new") {
|
if (trackedFields[fieldName2] && mac != "new") {
|
||||||
const sourceField = fieldName2 + "Source";
|
const sourceField = fieldName2 + "Source";
|
||||||
const currentSource = deviceData[sourceField] || "NEWDEV";
|
const currentSource = deviceData[sourceField] || "UNKNOWN";
|
||||||
const sourceTitle = getString("FieldLock_Source_Label") + currentSource;
|
const sourceTitle = getString("FieldLock_Source_Label") + currentSource;
|
||||||
const sourceColor = currentSource === "USER" ? "text-warning" : (currentSource === "LOCKED" ? "text-danger" : "text-muted");
|
const sourceColor = currentSource === "USER" ? "text-warning" : (currentSource === "LOCKED" ? "text-danger" : "text-muted");
|
||||||
inlineControl += `<span class="input-group-addon pointer ${sourceColor}" title="${sourceTitle}">
|
inlineControl += `<span class="input-group-addon pointer ${sourceColor}" title="${sourceTitle}">
|
||||||
@@ -561,7 +561,7 @@ function toggleFieldLock(mac, fieldName) {
|
|||||||
|
|
||||||
// Get current source value
|
// Get current source value
|
||||||
const sourceField = fieldName + "Source";
|
const sourceField = fieldName + "Source";
|
||||||
const currentSource = deviceData[sourceField] || "NEWDEV";
|
const currentSource = deviceData[sourceField] || "UNKNOWN";
|
||||||
const shouldLock = currentSource !== "LOCKED";
|
const shouldLock = currentSource !== "LOCKED";
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
@@ -600,7 +600,7 @@ function toggleFieldLock(mac, fieldName) {
|
|||||||
// Update source indicator
|
// Update source indicator
|
||||||
const sourceIndicator = lockBtn.next();
|
const sourceIndicator = lockBtn.next();
|
||||||
if (sourceIndicator.hasClass("input-group-addon")) {
|
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";
|
const sourceClass = shouldLock ? "input-group-addon text-danger" : "input-group-addon text-muted";
|
||||||
sourceIndicator.text(sourceValue);
|
sourceIndicator.text(sourceValue);
|
||||||
sourceIndicator.attr("class", sourceClass);
|
sourceIndicator.attr("class", sourceClass);
|
||||||
|
|||||||
@@ -91,14 +91,14 @@ class Device(ObjectType):
|
|||||||
devParentRelType = String(description="Relationship type to parent")
|
devParentRelType = String(description="Relationship type to parent")
|
||||||
devReqNicsOnline = Int(description="Required NICs online flag")
|
devReqNicsOnline = Int(description="Required NICs online flag")
|
||||||
devMacSource = String(description="Source tracking for devMac (USER, LOCKED, NEWDEV, or plugin prefix)")
|
devMacSource = String(description="Source tracking for devMac (USER, LOCKED, NEWDEV, or plugin prefix)")
|
||||||
devNameSource = String(description="Source tracking for devName")
|
devNameSource = String(description="Source tracking for devName (USER, LOCKED, NEWDEV, or plugin prefix)")
|
||||||
devFqdnSource = String(description="Source tracking for devFQDN")
|
devFqdnSource = String(description="Source tracking for devFQDN (USER, LOCKED, NEWDEV, or plugin prefix)")
|
||||||
devLastIpSource = String(description="Source tracking for devLastIP")
|
devLastIpSource = String(description="Source tracking for devLastIP (USER, LOCKED, NEWDEV, or plugin prefix)")
|
||||||
devVendorSource = String(description="Source tracking for devVendor")
|
devVendorSource = String(description="Source tracking for devVendor (USER, LOCKED, NEWDEV, or plugin prefix)")
|
||||||
devSsidSource = String(description="Source tracking for devSSID")
|
devSsidSource = String(description="Source tracking for devSSID (USER, LOCKED, NEWDEV, or plugin prefix)")
|
||||||
devParentMacSource = String(description="Source tracking for devParentMAC")
|
devParentMacSource = String(description="Source tracking for devParentMAC (USER, LOCKED, NEWDEV, or plugin prefix)")
|
||||||
devParentPortSource = String(description="Source tracking for devParentPort")
|
devParentPortSource = String(description="Source tracking for devParentPort (USER, LOCKED, NEWDEV, or plugin prefix)")
|
||||||
devParentRelTypeSource = String(description="Source tracking for devParentRelType")
|
devParentRelTypeSource = String(description="Source tracking for devParentRelType (USER, LOCKED, NEWDEV, or plugin prefix)")
|
||||||
devVlanSource = String(description="Source tracking for devVlan")
|
devVlanSource = String(description="Source tracking for devVlan")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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]
|
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 = [
|
EXPECTED_DEVICES_COLUMNS = [
|
||||||
"devMac",
|
"devMac",
|
||||||
"devName",
|
"devName",
|
||||||
|
|||||||
+1
-1
@@ -189,7 +189,7 @@ def get_setting(key):
|
|||||||
SETTINGS_LASTCACHEDATE = fileModifiedTime
|
SETTINGS_LASTCACHEDATE = fileModifiedTime
|
||||||
|
|
||||||
if key not in SETTINGS_CACHE:
|
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 None
|
||||||
|
|
||||||
return SETTINGS_CACHE[key]
|
return SETTINGS_CACHE[key]
|
||||||
|
|||||||
Reference in New Issue
Block a user