mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-30 23:03:03 -07:00
feat: authoritative plugin fields
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -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'`
|
||||
|
||||
|
||||
@@ -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 += `<span class="input-group-addon pointer ${sourceColor}" title="${sourceTitle}">
|
||||
@@ -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);
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user