mirror of
https://github.com/pi-hole/web.git
synced 2026-08-23 14:51:12 +01:00
- 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>
88 lines
3.2 KiB
Lua
88 lines
3.2 KiB
Lua
<? --[[
|
|
* Pi-hole: A black hole for Internet advertisements
|
|
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
|
* Network-wide ad blocking via your own hardware.
|
|
*
|
|
* This file is copyright under the latest version of the EUPL.
|
|
* Please see LICENSE file for your rights under this license.
|
|
--]]
|
|
|
|
mg.include('scripts/lua/header_authenticated.lp','r')
|
|
?>
|
|
|
|
<!-- Title -->
|
|
<div class="page-header">
|
|
<h1>Group management</h1>
|
|
</div>
|
|
|
|
<!-- Group Input -->
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card" id="add-group">
|
|
<!-- /.card-header -->
|
|
<div class="card-header">
|
|
<h3 class="card-title">
|
|
Add a new group
|
|
</h3>
|
|
</div>
|
|
<!-- /.card-header -->
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="form-group col-md-6">
|
|
<label for="new_name">Name:</label>
|
|
<input id="new_name" type="text" class="form-control" placeholder="Group name">
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="new_comment">Comment:</label>
|
|
<input id="new_comment" type="text" class="form-control" placeholder="Group comment (optional)">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-footer">
|
|
<strong>Hints:</strong>
|
|
<ol>
|
|
<li>Multiple groups can be added by separating each group name with a space or comma</li>
|
|
<li>Group names can have spaces if entered in quotes. e.g "My New Group"</li>
|
|
</ol>
|
|
<button type="button" id="btnAdd" class="btn btn-primary float-end">Add</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card" id="groups-list">
|
|
<div class="card-header">
|
|
<h3 class="card-title">
|
|
List of groups
|
|
</h3>
|
|
</div>
|
|
<!-- /.card-header -->
|
|
<div class="card-body">
|
|
<table id="groupsTable" class="table table-striped table-bordered" width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th></th>
|
|
<th>Name</th>
|
|
<th>Status</th>
|
|
<th>Comment</th>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
<button type="button" id="resetButton" class="btn btn-secondary btn-sm text-red hidden">Reset sorting</button>
|
|
</div>
|
|
<!-- /.card-body -->
|
|
</div>
|
|
<!-- /.card -->
|
|
</div>
|
|
</div>
|
|
|
|
<script src="<?=pihole.fileversion('vendor/tom-select/tom-select.complete.min.js')?>"></script>
|
|
<script src="<?=pihole.fileversion('vendor/bootstrap5-toggle/bootstrap5-toggle.jquery.min.js')?>"></script>
|
|
<script src="<?=pihole.fileversion('scripts/js/groups-common.js')?>"></script>
|
|
<script src="<?=pihole.fileversion('scripts/js/groups.js')?>"></script>
|
|
|
|
<? mg.include('scripts/lua/footer.lp','r')?>
|