feat: authoritative plugin fields

Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
jokob-sk
2026-01-24 16:24:43 +11:00
5 changed files with 71 additions and 19 deletions

View File

@@ -1216,12 +1216,14 @@ height: 50px;
width: 20%; width: 20%;
} }
input[readonly] { input[readonly],
/* Apply styles to the readonly input */ textarea[readonly],
background-color: #646566 !important; .form-control[readonly] {
color: #e6e6e6; background-color: #f4f6f8;
border-color: #d2d6de;
color: #6b7280;
cursor: not-allowed; cursor: not-allowed;
} }
.interactable-option:hover::before { .interactable-option:hover::before {
opacity: 1; opacity: 1;
@@ -1491,12 +1493,12 @@ input[readonly] {
} }
.select2-container--default .select2-selection--multiple .select2-container--default .select2-selection--multiple
{ {
background-color:#606060 !important; background-color:#ffffff !important;
} }
.select2-container .select2-dropdown .select2-container .select2-dropdown
{ {
background-color:#606060 !important; background-color:#ffffff !important;
} }
.select2-container--default .select2-selection--multiple, .select2-container--default .select2-selection--multiple,

View File

@@ -509,11 +509,20 @@ div.dataTables_wrapper div.dataTables_length select {
border: 1px solid #3d444b; border: 1px solid #3d444b;
} }
.form-control[disabled], .form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control { fieldset[disabled] .form-control {
background-color: #353c42; background-color: #353c42;
opacity: 1; opacity: 1;
} }
input[readonly],
textarea[readonly],
.form-control[readonly] {
background-color: #545659 !important;
border-color: #3d444b;
color: #888a8c;
cursor: not-allowed;
opacity: 1;
}
.navbar-custom-menu > .navbar-nav > li > .dropdown-menu { .navbar-custom-menu > .navbar-nav > li > .dropdown-menu {
background-color: #4c5761; background-color: #4c5761;
color: #bec5cb; color: #bec5cb;
@@ -682,7 +691,7 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
.db_tools_table_cell_b:nth-child(1) {background: #272c30} .db_tools_table_cell_b:nth-child(1) {background: #272c30}
.db_tools_table_cell_b:nth-child(2) {background: #272c30} .db_tools_table_cell_b:nth-child(2) {background: #272c30}
.db_info_table { .db_info_table {
display: table; display: table;
border-spacing: 0em; border-spacing: 0em;
font-weight: 400; font-weight: 400;
@@ -746,7 +755,7 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
.small-box:hover .icon { .small-box:hover .icon {
font-size: 3em; font-size: 3em;
} }
.small-box .icon { .small-box .icon {
top: 0.01em; top: 0.01em;
font-size: 3.25em; font-size: 3.25em;
} }
@@ -774,6 +783,11 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
border-color: #3d444b !important; border-color: #3d444b !important;
} }
.select2-container--default .select2-selection--multiple {
background-color: #353c42 !important;
color: #bec5cb;
}
.select2-container--default .select2-selection--single .select2-selection__rendered .custom-chip .select2-container--default .select2-selection--single .select2-selection__rendered .custom-chip
{ {
color: #bec5cb; color: #bec5cb;
@@ -791,7 +805,7 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
.thresholdFormControl .thresholdFormControl
{ {
color:#000; color:#000;
} }
.btn:hover .btn:hover

View File

@@ -512,11 +512,19 @@
border: 1px solid #3d444b; border: 1px solid #3d444b;
} }
.form-control[disabled], .form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control { fieldset[disabled] .form-control {
background-color: #353c42; background-color: #353c42;
opacity: 1; opacity: 1;
} }
input[readonly],
textarea[readonly],
.form-control[readonly] {
background-color: #2f353b !important;
border-color: #3d444b;
color: #c7cdd3;
cursor: not-allowed;
opacity: 1;
}
.navbar-custom-menu > .navbar-nav > li > .dropdown-menu { .navbar-custom-menu > .navbar-nav > li > .dropdown-menu {
background-color: #4c5761; background-color: #4c5761;
color: #bec5cb; color: #bec5cb;
@@ -776,6 +784,11 @@
border-color: #3d444b !important; border-color: #3d444b !important;
} }
.select2-container--default .select2-selection--multiple {
background-color: #353c42 !important;
color: #bec5cb;
}
.select2-container--default .select2-selection--single .select2-selection__rendered .custom-chip .select2-container--default .select2-selection--single .select2-selection__rendered .custom-chip
{ {
color: #bec5cb; color: #bec5cb;

View File

@@ -278,7 +278,7 @@ function getDeviceData() {
// Add lock/unlock button for tracked fields (not for new devices) // Add lock/unlock button for tracked fields (not for new devices)
const fieldName = setting.setKey.replace('NEWDEV_', ''); const fieldName = setting.setKey.replace('NEWDEV_', '');
if (trackedFields[fieldName] && mac != "new") { if (trackedFields[fieldName] && fieldName !== "devFQDN" && mac != "new") {
const sourceField = fieldName + "Source"; const sourceField = fieldName + "Source";
const currentSource = deviceData[sourceField] || "N/A"; const currentSource = deviceData[sourceField] || "N/A";
const isLocked = currentSource === "LOCKED"; const isLocked = currentSource === "LOCKED";
@@ -291,6 +291,11 @@ function getDeviceData() {
data-locked="${isLocked ? 1 : 0}"> data-locked="${isLocked ? 1 : 0}">
<i class="fa-solid ${lockIcon}"></i> <i class="fa-solid ${lockIcon}"></i>
</span>`; </span>`;
if (isLocked) {
if (!disabledFields.includes(setting.setKey)) {
disabledFields.push(setting.setKey);
}
}
} }
// Add source indicator for tracked fields // Add source indicator for tracked fields
@@ -603,14 +608,22 @@ function toggleFieldLock(mac, fieldName) {
// Update local source state // Update local source state
deviceData[sourceField] = shouldLock ? "LOCKED" : ""; deviceData[sourceField] = shouldLock ? "LOCKED" : "";
const fieldKey = `NEWDEV_${fieldName}`;
const fieldInput = $(`#${fieldKey}`);
fieldInput.prop("readonly", shouldLock);
// 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" : "N/A"; if (shouldLock) {
const sourceClass = shouldLock ? "input-group-addon text-danger" : "input-group-addon pointer text-muted"; const sourceValue = "LOCKED";
sourceIndicator.text(sourceValue); const sourceClass = "input-group-addon pointer text-danger";
sourceIndicator.attr("class", sourceClass); sourceIndicator.text(sourceValue);
sourceIndicator.attr("title", getString("FieldLock_Source_Label") + sourceValue); sourceIndicator.attr("class", sourceClass);
sourceIndicator.attr("title", getString("FieldLock_Source_Label") + sourceValue);
} else {
sourceIndicator.remove();
}
} }
showMessage(shouldLock ? getString("FieldLock_Locked") : getString("FieldLock_Unlocked"), 3000, "modal_green"); showMessage(shouldLock ? getString("FieldLock_Locked") : getString("FieldLock_Unlocked"), 3000, "modal_green");

View File

@@ -705,9 +705,17 @@ def create_new_devices(db):
raw_name = str(cur_Name).strip() if cur_Name else "" raw_name = str(cur_Name).strip() if cur_Name else ""
raw_vendor = str(cur_Vendor).strip() if cur_Vendor else "" raw_vendor = str(cur_Vendor).strip() if cur_Vendor else ""
raw_ip = str(cur_IP).strip() if cur_IP else "" raw_ip = str(cur_IP).strip() if cur_IP else ""
if raw_ip.lower() in ("null", "(unknown)"):
raw_ip = ""
raw_ssid = str(cur_SSID).strip() if cur_SSID else "" raw_ssid = str(cur_SSID).strip() if cur_SSID else ""
raw_parent_mac = cur_NetworkNodeMAC.strip() if cur_NetworkNodeMAC else "" if raw_ssid.lower() in ("null", "(unknown)"):
raw_ssid = ""
raw_parent_mac = str(cur_NetworkNodeMAC).strip() if cur_NetworkNodeMAC else ""
if raw_parent_mac.lower() in ("null", "(unknown)"):
raw_parent_mac = ""
raw_parent_port = str(cur_PORT).strip() if cur_PORT else "" raw_parent_port = str(cur_PORT).strip() if cur_PORT else ""
if raw_parent_port.lower() in ("null", "(unknown)"):
raw_parent_port = ""
# Handle NoneType # Handle NoneType
cur_Name = raw_name if raw_name else "(unknown)" cur_Name = raw_name if raw_name else "(unknown)"
@@ -732,6 +740,8 @@ def create_new_devices(db):
# Derive primary IP family values # Derive primary IP family values
cur_IP = raw_ip cur_IP = raw_ip
cur_SSID = raw_ssid
cur_PORT = raw_parent_port
cur_IP_normalized = check_IP_format(cur_IP) if ":" not in cur_IP else cur_IP cur_IP_normalized = check_IP_format(cur_IP) if ":" not in cur_IP else cur_IP
# Validate IPv6 addresses using format_ip_long for consistency (do not store integer result) # Validate IPv6 addresses using format_ip_long for consistency (do not store integer result)