Commit Graph
45 Commits
Author SHA1 Message Date
yubiuser d4518cfc65 Re-Implement updating toasts
Signed-off-by: yubiuser <github@yubiuser.dev>
2026-08-07 22:25:15 +02:00
yubiuser 9573b72d5a Remove code to update existing toasts. It made the code very complex and was used only in two places
Signed-off-by: yubiuser <github@yubiuser.dev>
2026-08-07 09:05:54 +02:00
RD WebDesignandGitHub 6bf0fb3571 Merge branch 'development' into new/adminLTE4
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-07-29 16:15:24 -03:00
RD WebDesign af53bf7108 Fix typo in the validation regex (static DHCP lease table)
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-07-29 00:14:48 -03:00
Adam Warner 72d682c284 Fix xo lint errors surfaced after rebasing onto development
This branch's code predates development's xo 2 -> 3 upgrade and hadn't been checked against its stricter ruleset. Fix the new violations: drop unnecessary globalThis prefixes on location/matchMedia, prefer location.assign() over href assignment, use early returns instead of wrapping onDropdownClose bodies in an if, fix a parameter shadow in getGroups, and use {capture: true} instead of a bare boolean for addEventListener.

Signed-off-by: Adam Warner <github@promofaux.dev>
2026-07-17 22:48:48 +01:00
0153772cf5 Swap remaining jQuery plugins for Bootstrap 5-compatible versions
- DataTables: replace the combined BS3 download-builder bundles with
  the official core + Bootstrap 5 styling-adapter package pairs
  (datatables.net(-buttons/-select) + datatables.net-bs5/-buttons-bs5/
  -select-bs5), loaded core-then-adapter.
- bootstrap-select -> Tom Select: bootstrap-select has no Bootstrap 5
  build. Add utils.createGroupSelect(), a small wrapper around Tom
  Select that recreates bootstrap-select's actionsBox (Select all/
  Select none) via a couple of buttons injected into the dropdown, and
  use it for all four "assign to group(s)" multi-selects (groups,
  groups/clients, groups/domains, groups/lists). Two behavioral fixes
  were needed to match the old widget: `hideSelected: false` (Tom
  Select refuses to open its dropdown once every option is already
  selected, which made the actions box unreachable) and
  `dropdownParent: "body"` (otherwise the dropdown is clipped by the
  surrounding .table-responsive/.card ancestors' overflow, same reason
  bootstrap-select was configured with container: "body").
- bootstrap-toggle -> bootstrap5-toggle: drop-in replacement, same
  $.fn.bootstrapToggle() API and onstyle/offstyle option names (all
  call sites already used Bootstrap 5-valid color names).
- select2: bump to 4.1.0 and add the select2-bootstrap-5-theme package
  for correct Bootstrap 5 styling; wire theme: "bootstrap-5" into both
  call sites.
- Remove now-dead bootstrap-select cleanup code (the
  "$('body > .bootstrap-select.dropdown').remove()" DataTables
  drawCallback lines across 8 files) and dead icheck/bootstrap-select
  CSS in pi-hole.css.

Also fixed a Phase 1 regression surfaced by this pass: utils.js's
loadingOverlay() still targeted the old ".wrapper" class instead of
".app-wrapper", throwing whenever a settings page triggered the
Save & Apply overlay.

Verified against a live container: groups/clients' per-row Tom Select
multiselect (open dropdown, Select all/none, Apply, restore-on-cancel),
bootstrap5-toggle switches on groups, select2 filters on the query log,
and DataTables' select/export button row on groups/lists all work with
zero console errors. Settings pages' Save & Apply overlay confirmed
fixed and no longer throwing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-07-17 22:39:57 +01:00
3149820eb4 Convert box/panel markup to Bootstrap 5 cards across all pages
Convert the remaining 20 .lp templates from AdminLTE 2's .box/.panel
component family to Bootstrap 5 .card markup, matching the pattern
established in index.lp/queries.lp during the layout migration:
box/box-header/box-title/box-body/box-footer -> card equivalents,
box-info/-danger/-warning etc. -> card-info/-danger/-warning +
card-outline for the non-solid variant, collapsed-box + data-widget
-> collapsed-card + data-lte-toggle="card-collapse" with the dual
expand/collapse icon AdminLTE 4 expects. Also renames the accompanying
Bootstrap-3-isms throughout (col-xs-*, pull-left/right, input-group-addon,
data-toggle/-dismiss/-backdrop/-keyboard, label -> badge, btn-default,
BS3 modal close-button markup).

Fix the JS-side selectors that referenced the old markup and would have
silently broken once the classes changed: charts.js's tooltip anchor
lookup, footer.js's "no visible cards" redirect check, login.js's
2FA/forgot-password card color swap (plus made both boxes consistently
non-solid so the swap doesn't need to touch card-outline), and
settings-advanced.js's dynamically generated settings cards and its
manual Bootstrap 3 "in"/"active" tab-pane class toggling (Bootstrap 5
renamed .in to .show). Rewrite settings-dhcp.js's jQuery-plugin tooltip
delegation (`$("body").tooltip(...)`, `.tooltip("hide")`) as a small
lazily-instantiating delegated listener plus direct bootstrap.Tooltip
calls, since Bootstrap 5 dropped jQuery integration entirely and the
DHCP lease action buttons are added to the DOM dynamically. Restore
Bootstrap 3's .has-error/.has-warning/.has-success form-validation
color feedback in pi-hole.css, since Bootstrap 5 dropped those classes
in favor of .is-invalid/.is-valid and a couple of pages still toggle
the old class names for simple color-coded feedback.

Refresh package-lock.json for the admin-lte/bootstrap version bump from
the previous commit.

Verified against a live container: dashboard, query log (incl. the
collapsible advanced-filter card and populated DataTable), groups/lists,
groups/domains, and settings/dns all render correctly with zero console
errors; card-collapse toggling confirmed working on the query log's
filter card. Plugin-styled elements (select2/bootstrap-select dropdowns,
DataTables chrome, icheck checkboxes, bootstrap-toggle switches, nav-tabs)
still look wrong until the JS-plugin-swap phase lands, as expected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-07-17 22:38:11 +01:00
yubiuser ceb07fcaea Fix settings-dhcp.js
Signed-off-by: yubiuser <github@yubiuser.dev>
2026-07-07 20:30:09 +02:00
yubiuser 39504966a6 Use xo --fix to fix huge load of fixable issues, revert fixes to regex for manual inspection
Signed-off-by: yubiuser <github@yubiuser.dev>
2026-07-07 16:30:05 +02:00
DL6ER bb86afbec1 Don't discard unsaved table edits on programmatic textarea input
Signed-off-by: DL6ER <dl6er@dl6er.de>
2026-06-13 17:39:06 +02:00
RD WebDesign 5eef250a4d Use regex flag "u" to fix errors after merging development branch
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-05-19 17:57:07 -03:00
RD WebDesign a88b579abf Accept invalid values ​​and let the table highlight the errors
Now we allow invalid values on the table and highlight them.
This will allow users to find errors in data already saved on pihole.toml.

New parsing rules added - The line is also considered as "advanced" if:
  - the line contains an asterisk;
  - more than one IP is found;
  - more than one Mac Address is found;
  - more than one hostname is found.

The table also highlights invalid data onload, before a row is clicked.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-05-07 21:29:10 -03:00
RD WebDesign e6fe47c2e9 Register event listeners on document scope to call updateLineNumbers()
Also fix 2 issues on validation functions:
- better regex for validateMAC()
- make sure validateIPv6Brackets() correctly trims the value before
  validation

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-05-06 00:09:51 -03:00
RD WebDesign 62132c8565 Use a different parse function to check the line
This function tries to use a simplified version of the dnsmasq code used
to parse dhcp-host options.

Also, use the parse function when we cancel edit operation on a line

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-05-05 22:44:10 -03:00
RD WebDesign f981871d2d Use the correct tags for icons
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-29 19:57:52 -03:00
RD WebDesign f06cc5291c Add cancel button, to allow restore edited unsaved table rows
When editing a row, two new buttons will be visible: Confirm and Cancel

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-29 19:05:34 -03:00
RD WebDesign bc01113163 Enforce hostname and IPv6 validation on the static DHCP table
Only accept valid hostnames:
  Previously, invalid hostnames were trigerring the cell highlighting,
  but invalid entries were still accepted when using the green "save"
  button. Now, hostnames are saved only if they pass the validation,
  like other values.

Only allow IPv6 enclosed in square brackets:
  The previous validation function used to validate IPv6 didn't accept
  brackets, resulting in errors when an IPv6 was typed directly on the
  table cell. A new function was created to validate IPv6 enclosed in
  brackets.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-24 15:10:06 -03:00
RD WebDesign 9cdf3830d0 Fix tooltips on dynamically created buttons (Static DHCP lease table)
Dinamically created buttons were not showing bootstrap tooltips because
the event listener was created too early, before the buttons were
created (only previuosly existing buttons would show a tooltip).

Now, tooptip() function is called once, on the body element.

This attaches an event listener to the body. Every dynamically created
button will display the tooltip, without the need to call tooltip()
function. We need to manually call .tooltip("hide"), to remove tooltips
when buttons are clicked.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-24 15:09:58 -03:00
RD WebDesign b985503e6f Use CSS to show confirmation message when editing static DHCP table rows
Remove the javascript code used to add and remove "hints" and replace it
with a single CSS pseudo-element after the table, instead of one message
per line. Also, adjust LCARS message position.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-22 19:33:41 -03:00
RD WebDesign 9ec6c529fc Disable the textarea during table editing to prevent loss of unsaved data
If enabled, the textarea can be edited, which triggers a table rewrite,
resulting in the loss of all unsaved changes made to the table rows.

This commit keeps the textarea disabled until all edited rows are saved.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-22 19:33:41 -03:00
RD WebDesign 81cec5dde5 Use a different approach to update .dhcp-hosts height
- replace DOMContentLoaded listener with a function and call it when needed
- use javascript to update the CSS variable `--num-lines`
- use CSS to calculate the elements height

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-22 18:32:34 -03:00
RD WebDesign 04d76f865d Adjust DHCP "edit-hint" and action buttons
- only show save button when needed
- use fixed size and right aligned text for button column
- highlight cells only on error and remove the highlight when is fixed
- replace a few inline CSS styles with proper HTML tags
- adjust CSS on specific themes

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-22 18:30:44 -03:00
RD WebDesign 82033d0936 Group both "on click" functions for save-static-row button
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-22 16:19:11 -03:00
RD WebDesign 6d50dc552e Fix prettier complaints after merging development
Fix regex adding `v` flag and fix line breaks to respect maximum lenght

Note: these issues were not previously reported because there was a
previous merge conflict. The prettier test was executed only after the
merge conflict was resolved.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-04-22 16:17:44 -03:00
RD WebDesign a23462fd2c Add buttons to lines containing "advanced" settings
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-03-28 22:43:03 -03:00
RD WebDesignandGitHub bd173da6b7 Fix regex for hostname validation in DHCP settings
When using the `v` flag, hyphens need to be escaped inside a character class.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-03-26 23:02:04 -03:00
Dominik 79c4c14a21 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>
2026-03-25 07:23:10 +01:00
DL6ER ce2a4501c6 Better synchronize lines numbers and textarea
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-24 06:21:34 +02:00
DL6ER 9959791c31 Reject saving if there are still validation errors in the table
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-20 20:40:24 +02:00
DL6ER 3489ddf284 Validate hwaddr and IP address while typing
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-20 20:33:35 +02:00
DL6ER e7d70559c3 Add line numbers to dhcp.hosts textarea
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-16 08:28:51 +02:00
DL6ER 69b461ae8e Add IPv6 support for static DHCP lease management
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-15 20:16:30 +02:00
DL6ER 320c8d9973 Allow "-" as separator for MAC addresses
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-15 16:00:09 +02:00
DL6ER f1ddb23825 Bind data attributes instead of inlining them for security (to prevent any possibility for code injection)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-15 13:02:55 +02:00
DL6ER 416468f233 Remove unused code
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-15 12:48:22 +02:00
DL6ER 937cd04734 Add tooltips to the action buttons
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-15 12:41:01 +02:00
DL6ER 2495a8e175 Add copy from current to static DHCP leases button
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-15 12:30:08 +02:00
DL6ER fbed99b338 Add static DHCP lease editing table fully synced with the advanced textarea below
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-07-15 11:55:29 +02:00
XhmikosR f69df08a08 Fix deprecated ready function
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-05-15 18:17:31 +03:00
XhmikosR 756239a6dd xo: enable strict mode
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-04-23 20:50:12 +03:00
XhmikosR f8a0a1d4ec Tighten xo rules
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-04-23 07:53:13 +03:00
XhmikosR addad5495a Replace remaining i element cases with em
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-04-03 07:59:44 +03:00
DL6ER b524a2f4b6 Always use document.body.dataset.apiurl instead of the intermediate const apiUrl
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-03-31 22:00:16 +02:00
DL6ER a7f1ca7800 Allow path prefix multiplexing the dashboard and API. See https://github.com/pi-hole/FTL/pull/2319 for further details
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-03-02 20:20:10 +01:00
yubiuser 1e922a8b29 Move all files from /scripts/pi-hole/ to /scripts/
Signed-off-by: yubiuser <github@yubiuser.dev>
2024-10-28 20:22:09 +01:00