Skip to content

Commit 2acc180

Browse files
committed
feat: authoritative plugin fields
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
2 parents be38148 + cafa36f commit 2acc180

File tree

5 files changed

+71
-19
lines changed

5 files changed

+71
-19
lines changed

front/css/app.css

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,12 +1216,14 @@ height: 50px;
12161216
width: 20%;
12171217
}
12181218

1219-
input[readonly] {
1220-
/* Apply styles to the readonly input */
1221-
background-color: #646566 !important;
1222-
color: #e6e6e6;
1219+
input[readonly],
1220+
textarea[readonly],
1221+
.form-control[readonly] {
1222+
background-color: #f4f6f8;
1223+
border-color: #d2d6de;
1224+
color: #6b7280;
12231225
cursor: not-allowed;
1224-
}
1226+
}
12251227

12261228
.interactable-option:hover::before {
12271229
opacity: 1;
@@ -1491,12 +1493,12 @@ input[readonly] {
14911493
}
14921494
.select2-container--default .select2-selection--multiple
14931495
{
1494-
background-color:#606060 !important;
1496+
background-color:#ffffff !important;
14951497
}
14961498

14971499
.select2-container .select2-dropdown
14981500
{
1499-
background-color:#606060 !important;
1501+
background-color:#ffffff !important;
15001502
}
15011503

15021504
.select2-container--default .select2-selection--multiple,

front/css/dark-patch.css

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,20 @@ div.dataTables_wrapper div.dataTables_length select {
509509
border: 1px solid #3d444b;
510510
}
511511
.form-control[disabled],
512-
.form-control[readonly],
513512
fieldset[disabled] .form-control {
514513
background-color: #353c42;
515514
opacity: 1;
516515
}
516+
input[readonly],
517+
textarea[readonly],
518+
.form-control[readonly] {
519+
background-color: #545659 !important;
520+
border-color: #3d444b;
521+
color: #888a8c;
522+
cursor: not-allowed;
523+
opacity: 1;
524+
}
525+
517526
.navbar-custom-menu > .navbar-nav > li > .dropdown-menu {
518527
background-color: #4c5761;
519528
color: #bec5cb;
@@ -682,7 +691,7 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
682691
.db_tools_table_cell_b:nth-child(1) {background: #272c30}
683692
.db_tools_table_cell_b:nth-child(2) {background: #272c30}
684693

685-
.db_info_table {
694+
.db_info_table {
686695
display: table;
687696
border-spacing: 0em;
688697
font-weight: 400;
@@ -746,7 +755,7 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
746755
.small-box:hover .icon {
747756
font-size: 3em;
748757
}
749-
.small-box .icon {
758+
.small-box .icon {
750759
top: 0.01em;
751760
font-size: 3.25em;
752761
}
@@ -774,6 +783,11 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
774783
border-color: #3d444b !important;
775784
}
776785

786+
.select2-container--default .select2-selection--multiple {
787+
background-color: #353c42 !important;
788+
color: #bec5cb;
789+
}
790+
777791
.select2-container--default .select2-selection--single .select2-selection__rendered .custom-chip
778792
{
779793
color: #bec5cb;
@@ -791,7 +805,7 @@ table.dataTable tbody tr.selected, table.dataTable tbody tr .selected
791805

792806
.thresholdFormControl
793807
{
794-
color:#000;
808+
color:#000;
795809
}
796810

797811
.btn:hover

front/css/system-dark-patch.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,19 @@
512512
border: 1px solid #3d444b;
513513
}
514514
.form-control[disabled],
515-
.form-control[readonly],
516515
fieldset[disabled] .form-control {
517516
background-color: #353c42;
518517
opacity: 1;
519518
}
519+
input[readonly],
520+
textarea[readonly],
521+
.form-control[readonly] {
522+
background-color: #2f353b !important;
523+
border-color: #3d444b;
524+
color: #c7cdd3;
525+
cursor: not-allowed;
526+
opacity: 1;
527+
}
520528
.navbar-custom-menu > .navbar-nav > li > .dropdown-menu {
521529
background-color: #4c5761;
522530
color: #bec5cb;
@@ -776,6 +784,11 @@
776784
border-color: #3d444b !important;
777785
}
778786

787+
.select2-container--default .select2-selection--multiple {
788+
background-color: #353c42 !important;
789+
color: #bec5cb;
790+
}
791+
779792
.select2-container--default .select2-selection--single .select2-selection__rendered .custom-chip
780793
{
781794
color: #bec5cb;

front/deviceDetailsEdit.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ function getDeviceData() {
278278

279279
// Add lock/unlock button for tracked fields (not for new devices)
280280
const fieldName = setting.setKey.replace('NEWDEV_', '');
281-
if (trackedFields[fieldName] && mac != "new") {
281+
if (trackedFields[fieldName] && fieldName !== "devFQDN" && mac != "new") {
282282
const sourceField = fieldName + "Source";
283283
const currentSource = deviceData[sourceField] || "N/A";
284284
const isLocked = currentSource === "LOCKED";
@@ -291,6 +291,11 @@ function getDeviceData() {
291291
data-locked="${isLocked ? 1 : 0}">
292292
<i class="fa-solid ${lockIcon}"></i>
293293
</span>`;
294+
if (isLocked) {
295+
if (!disabledFields.includes(setting.setKey)) {
296+
disabledFields.push(setting.setKey);
297+
}
298+
}
294299
}
295300

296301
// Add source indicator for tracked fields
@@ -603,14 +608,22 @@ function toggleFieldLock(mac, fieldName) {
603608
// Update local source state
604609
deviceData[sourceField] = shouldLock ? "LOCKED" : "";
605610

611+
const fieldKey = `NEWDEV_${fieldName}`;
612+
const fieldInput = $(`#${fieldKey}`);
613+
fieldInput.prop("readonly", shouldLock);
614+
606615
// Update source indicator
607616
const sourceIndicator = lockBtn.next();
608617
if (sourceIndicator.hasClass("input-group-addon")) {
609-
const sourceValue = shouldLock ? "LOCKED" : "N/A";
610-
const sourceClass = shouldLock ? "input-group-addon text-danger" : "input-group-addon pointer text-muted";
611-
sourceIndicator.text(sourceValue);
612-
sourceIndicator.attr("class", sourceClass);
613-
sourceIndicator.attr("title", getString("FieldLock_Source_Label") + sourceValue);
618+
if (shouldLock) {
619+
const sourceValue = "LOCKED";
620+
const sourceClass = "input-group-addon pointer text-danger";
621+
sourceIndicator.text(sourceValue);
622+
sourceIndicator.attr("class", sourceClass);
623+
sourceIndicator.attr("title", getString("FieldLock_Source_Label") + sourceValue);
624+
} else {
625+
sourceIndicator.remove();
626+
}
614627
}
615628

616629
showMessage(shouldLock ? getString("FieldLock_Locked") : getString("FieldLock_Unlocked"), 3000, "modal_green");

server/scan/device_handling.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,17 @@ def create_new_devices(db):
705705
raw_name = str(cur_Name).strip() if cur_Name else ""
706706
raw_vendor = str(cur_Vendor).strip() if cur_Vendor else ""
707707
raw_ip = str(cur_IP).strip() if cur_IP else ""
708+
if raw_ip.lower() in ("null", "(unknown)"):
709+
raw_ip = ""
708710
raw_ssid = str(cur_SSID).strip() if cur_SSID else ""
709-
raw_parent_mac = cur_NetworkNodeMAC.strip() if cur_NetworkNodeMAC else ""
711+
if raw_ssid.lower() in ("null", "(unknown)"):
712+
raw_ssid = ""
713+
raw_parent_mac = str(cur_NetworkNodeMAC).strip() if cur_NetworkNodeMAC else ""
714+
if raw_parent_mac.lower() in ("null", "(unknown)"):
715+
raw_parent_mac = ""
710716
raw_parent_port = str(cur_PORT).strip() if cur_PORT else ""
717+
if raw_parent_port.lower() in ("null", "(unknown)"):
718+
raw_parent_port = ""
711719

712720
# Handle NoneType
713721
cur_Name = raw_name if raw_name else "(unknown)"
@@ -732,6 +740,8 @@ def create_new_devices(db):
732740

733741
# Derive primary IP family values
734742
cur_IP = raw_ip
743+
cur_SSID = raw_ssid
744+
cur_PORT = raw_parent_port
735745
cur_IP_normalized = check_IP_format(cur_IP) if ":" not in cur_IP else cur_IP
736746

737747
# Validate IPv6 addresses using format_ip_long for consistency (do not store integer result)

0 commit comments

Comments
 (0)