/* 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, initTable:false, updateFtlInfo:false */
"use strict";
let groups = [];
function populateGroupSelect(selectEl) {
if (selectEl.length === 0) {
// No select element found, return
return;
}
// Add all known groups
for (const group of groups) {
const label = group.enabled ? group.name : group.name + " (disabled)";
selectEl.append($("").val(group.id).text(label));
}
// Default Group is preselected
selectEl.val(["0"]);
utils.createGroupSelect(selectEl);
}
// eslint-disable-next-line no-unused-vars
function getGroups() {
$.ajax({
url: document.body.dataset.apiurl + "/groups",
type: "GET",
dataType: "json",
success(data) {
groups = data.groups;
// Get all