mirror of
https://github.com/pi-hole/web.git
synced 2026-04-24 02:39:25 +01:00
Merge development into new/simple-dhcp-static-leases and address review feedback
Resolve merge conflict in style/pi-hole.css (keep both StaticDHCPTable styles and DNSSEC query log styles). Address outstanding reviewer feedback: - Change save button icon from floppy-disk to checkmark to clarify it confirms the row edit, not a final save - Update hint text to mention "Save & Apply" is still needed - Add hostname validation on the hostname cell (rejects spaces, commas, and other characters invalid in DNS names) Signed-off-by: Dominik <dl6er@dl6er.de>
This commit is contained in:
@@ -361,7 +361,7 @@ $(document).on("focus input", "#StaticDHCPTable td[contenteditable]", function (
|
||||
if (!row.next().hasClass("edit-hint-row")) {
|
||||
row.next(".edit-hint-row").remove(); // Remove any existing hint
|
||||
row.after(
|
||||
'<tr class="edit-hint-row"><td colspan="4" class="text-info" style="font-style:italic;">Please save this line before editing another or leaving the page, otherwise your changes will be lost.</td></tr>'
|
||||
'<tr class="edit-hint-row"><td colspan="4" class="text-info" style="font-style:italic;">Please confirm changes using the green button, then click "Save & Apply" before leaving the page.</td></tr>'
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -398,10 +398,10 @@ function renderStaticDHCPTable() {
|
||||
$("<td></td>")
|
||||
.append(
|
||||
$(
|
||||
'<button type="button" class="btn btn-success btn-xs save-static-row"><i class="fa fa-fw fa-floppy-disk"></i></button>'
|
||||
'<button type="button" class="btn btn-success btn-xs save-static-row"><i class="fa fa-fw fa-check"></i></button>'
|
||||
)
|
||||
.attr("data-row", idx)
|
||||
.attr("title", "Save changes to this line")
|
||||
.attr("title", "Confirm changes to this line")
|
||||
.attr("data-toggle", "tooltip")
|
||||
)
|
||||
.append(" ")
|
||||
@@ -518,3 +518,17 @@ $(document).on("input blur paste", "#StaticDHCPTable td.static-ipaddr", function
|
||||
$(this).attr("title", "");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("input blur paste", "#StaticDHCPTable td.static-hostname", function () {
|
||||
const val = $(this).text().trim();
|
||||
// Hostnames must not contain spaces, commas, or characters invalid in DNS names
|
||||
const hostnameValidator = /^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/v;
|
||||
if (val && !hostnameValidator.test(val)) {
|
||||
$(this).addClass("table-danger");
|
||||
$(this).removeClass("table-success");
|
||||
$(this).attr("title", "Invalid hostname: only letters, digits, hyphens, and dots allowed");
|
||||
} else {
|
||||
$(this).removeClass("table-danger table-success");
|
||||
$(this).attr("title", "");
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user