mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-01-28 16:41:22 -05:00
feat: authoritative plugin fields
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -1216,12 +1216,14 @@ height: 50px;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
input[readonly] {
|
||||
/* Apply styles to the readonly input */
|
||||
background-color: #646566 !important;
|
||||
color: #e6e6e6;
|
||||
input[readonly],
|
||||
textarea[readonly],
|
||||
.form-control[readonly] {
|
||||
background-color: #f4f6f8;
|
||||
border-color: #d2d6de;
|
||||
color: #6b7280;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.interactable-option:hover::before {
|
||||
opacity: 1;
|
||||
@@ -1491,12 +1493,12 @@ input[readonly] {
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple
|
||||
{
|
||||
background-color:#606060 !important;
|
||||
background-color:#ffffff !important;
|
||||
}
|
||||
|
||||
.select2-container .select2-dropdown
|
||||
{
|
||||
background-color:#606060 !important;
|
||||
background-color:#ffffff !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--multiple,
|
||||
|
||||
@@ -509,11 +509,20 @@ div.dataTables_wrapper div.dataTables_length select {
|
||||
border: 1px solid #3d444b;
|
||||
}
|
||||
.form-control[disabled],
|
||||
.form-control[readonly],
|
||||
fieldset[disabled] .form-control {
|
||||
background-color: #353c42;
|
||||
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 {
|
||||
background-color: #4c5761;
|
||||
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(2) {background: #272c30}
|
||||
|
||||
.db_info_table {
|
||||
.db_info_table {
|
||||
display: table;
|
||||
border-spacing: 0em;
|
||||
font-weight: 400;
|
||||
@@ -746,7 +755,7 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
|
||||
.small-box:hover .icon {
|
||||
font-size: 3em;
|
||||
}
|
||||
.small-box .icon {
|
||||
.small-box .icon {
|
||||
top: 0.01em;
|
||||
font-size: 3.25em;
|
||||
}
|
||||
@@ -774,6 +783,11 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
|
||||
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
|
||||
{
|
||||
color: #bec5cb;
|
||||
@@ -791,7 +805,7 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
|
||||
|
||||
.thresholdFormControl
|
||||
{
|
||||
color:#000;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
.btn:hover
|
||||
|
||||
@@ -512,11 +512,19 @@
|
||||
border: 1px solid #3d444b;
|
||||
}
|
||||
.form-control[disabled],
|
||||
.form-control[readonly],
|
||||
fieldset[disabled] .form-control {
|
||||
background-color: #353c42;
|
||||
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 {
|
||||
background-color: #4c5761;
|
||||
color: #bec5cb;
|
||||
@@ -776,6 +784,11 @@
|
||||
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
|
||||
{
|
||||
color: #bec5cb;
|
||||
|
||||
@@ -278,7 +278,7 @@ function getDeviceData() {
|
||||
|
||||
// Add lock/unlock button for tracked fields (not for new devices)
|
||||
const fieldName = setting.setKey.replace('NEWDEV_', '');
|
||||
if (trackedFields[fieldName] && mac != "new") {
|
||||
if (trackedFields[fieldName] && fieldName !== "devFQDN" && mac != "new") {
|
||||
const sourceField = fieldName + "Source";
|
||||
const currentSource = deviceData[sourceField] || "N/A";
|
||||
const isLocked = currentSource === "LOCKED";
|
||||
@@ -291,6 +291,11 @@ function getDeviceData() {
|
||||
data-locked="${isLocked ? 1 : 0}">
|
||||
<i class="fa-solid ${lockIcon}"></i>
|
||||
</span>`;
|
||||
if (isLocked) {
|
||||
if (!disabledFields.includes(setting.setKey)) {
|
||||
disabledFields.push(setting.setKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add source indicator for tracked fields
|
||||
@@ -603,14 +608,22 @@ function toggleFieldLock(mac, fieldName) {
|
||||
// Update local source state
|
||||
deviceData[sourceField] = shouldLock ? "LOCKED" : "";
|
||||
|
||||
const fieldKey = `NEWDEV_${fieldName}`;
|
||||
const fieldInput = $(`#${fieldKey}`);
|
||||
fieldInput.prop("readonly", shouldLock);
|
||||
|
||||
// Update source indicator
|
||||
const sourceIndicator = lockBtn.next();
|
||||
if (sourceIndicator.hasClass("input-group-addon")) {
|
||||
const sourceValue = shouldLock ? "LOCKED" : "N/A";
|
||||
const sourceClass = shouldLock ? "input-group-addon text-danger" : "input-group-addon pointer text-muted";
|
||||
sourceIndicator.text(sourceValue);
|
||||
sourceIndicator.attr("class", sourceClass);
|
||||
sourceIndicator.attr("title", getString("FieldLock_Source_Label") + sourceValue);
|
||||
if (shouldLock) {
|
||||
const sourceValue = "LOCKED";
|
||||
const sourceClass = "input-group-addon pointer text-danger";
|
||||
sourceIndicator.text(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");
|
||||
|
||||
@@ -705,9 +705,17 @@ def create_new_devices(db):
|
||||
raw_name = str(cur_Name).strip() if cur_Name else ""
|
||||
raw_vendor = str(cur_Vendor).strip() if cur_Vendor 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_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 ""
|
||||
if raw_parent_port.lower() in ("null", "(unknown)"):
|
||||
raw_parent_port = ""
|
||||
|
||||
# Handle NoneType
|
||||
cur_Name = raw_name if raw_name else "(unknown)"
|
||||
@@ -732,6 +740,8 @@ def create_new_devices(db):
|
||||
|
||||
# Derive primary IP family values
|
||||
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
|
||||
|
||||
# Validate IPv6 addresses using format_ip_long for consistency (do not store integer result)
|
||||
|
||||
Reference in New Issue
Block a user