mirror of
https://github.com/pi-hole/web.git
synced 2026-07-10 08:24:03 +01:00
Apply Copilot's suggestions II
Signed-off-by: yubiuser <github@yubiuser.dev>
This commit is contained in:
@@ -130,7 +130,7 @@ function parseLines(outputElement, text) {
|
||||
return closingTags;
|
||||
}
|
||||
|
||||
if (ansiMappings[match] === true) {
|
||||
if (Object.hasOwn(ansiMappings, match)) {
|
||||
// Opening span
|
||||
spanCount++;
|
||||
return `<span class="${ansiMappings[match]}">`;
|
||||
|
||||
@@ -121,7 +121,7 @@ function findMasterInterface({ iface, masterInterfaces, interfacesData }) {
|
||||
}
|
||||
|
||||
const masterName = masterObj.name;
|
||||
if (masterInterfaces[masterName] === true) {
|
||||
if (Array.isArray(masterInterfaces[masterName])) {
|
||||
masterInterfaces[masterName].push(iface.name);
|
||||
} else {
|
||||
masterInterfaces[masterName] = [iface.name];
|
||||
@@ -485,7 +485,7 @@ function sortInterfaces(interfaces, masterInterfaces) {
|
||||
|
||||
// Add slave interfaces next to master interfaces
|
||||
for (const master of interfaceList) {
|
||||
if (masterInterfaces[master] === true) {
|
||||
if (Array.isArray(masterInterfaces[master])) {
|
||||
for (const slave of masterInterfaces[master]) {
|
||||
ifaces.splice(ifaces.indexOf(slave), 1);
|
||||
interfaceList.splice(interfaceList.indexOf(master) + 1, 0, slave);
|
||||
|
||||
@@ -510,8 +510,12 @@ function parseFilters() {
|
||||
}
|
||||
|
||||
function filterOn(param, dict) {
|
||||
if (!Object.hasOwn(dict, param)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const typ = typeof dict[param];
|
||||
return dict[param] && (typ === "number" || (typ === "string" && dict[param].length > 0));
|
||||
return typ === "number" || (typ === "string" && dict[param].length > 0);
|
||||
}
|
||||
|
||||
function getAPIURL(queryFilters) {
|
||||
|
||||
Reference in New Issue
Block a user