/* Pi-hole: A black hole for Internet advertisements
* (c) 2023 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. */
/* global apiFailure:false, utils:false, apiUrl:false, initTable:false, updateFtlInfo:false */
var groups = [];
function populateGroupSelect(selectEl) {
if (selectEl.length === 0) {
// No select element found, return
return;
}
// Add all known groups
for (var i = 0; i < groups.length; i++) {
var dataSub = "";
if (!groups[i].enabled) {
dataSub = 'data-subtext="(disabled)"';
}
selectEl.append(
$("")
.val(groups[i].id)
.text(groups[i].name)
);
}
// Initialize selectpicker
selectEl.val([0]);
// Refresh selectpicker
selectEl.selectpicker("refresh");
}
// eslint-disable-next-line no-unused-vars
function getGroups(groupSelector) {
$.ajax({
url: apiUrl + "/groups",
type: "GET",
dataType: "json",
success: function (data) {
groups = data.groups;
// Get all all