Skip to content

Commit

Permalink
Network zones
Browse files Browse the repository at this point in the history
  • Loading branch information
veniware committed Dec 6, 2023
1 parent 0c9e7b4 commit 8e09164
Show file tree
Hide file tree
Showing 29 changed files with 458 additions and 321 deletions.
8 changes: 4 additions & 4 deletions Protest/Front/addressbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ class AddressBook extends Window {
if (json.error) throw(json.error);

json = json.sort((a, b)=> {
if (a.hasOwnProperty("title") && b.hasOwnProperty("title")) return a.title.toLowerCase() > b.title.toLowerCase();
if (!a.hasOwnProperty("title") && !b.hasOwnProperty("title")) return 0;
if (!a.hasOwnProperty("title")) return -1;
if (!b.hasOwnProperty("title")) return 1;
if (a.title && b.title) return a.title.toLowerCase() > b.title.toLowerCase();
if (!a.title && !b.title) return 0;
if (!a.title) return -1;
if (!b.title) return 1;
});

this.contacts = json;
Expand Down
2 changes: 1 addition & 1 deletion Protest/Front/automation.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Automation extends List {
this.startButton.disabled = true;
this.stopButton.disabled = true;

if (!this.link.data.hasOwnProperty(this.params.select)) {
if (!(this.params.select in this.link.data)) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions Protest/Front/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ class Chat extends Window {
}

HandleMessage(message) {
if (this.outdoing.hasOwnProperty(message.id)) {
if (message.id in this.outdoing) {
this.outdoing[message.id].style.color = "var(--clr-dark)";
this.outdoing[message.id].style.backgroundColor = "var(--clr-pane)";
this.outdoing[message.id].style.boxShadow = "none";
Expand Down Expand Up @@ -516,7 +516,7 @@ class Chat extends Window {
bubble.innerHTML = text;

if (direction === "out") {
if (id && !this.outdoing.hasOwnProperty(id)) {
if (id && !(id in this.outdoing)) {
this.outdoing[id] = bubble;
}
}
Expand Down Expand Up @@ -545,7 +545,7 @@ class Chat extends Window {
}

if (direction === "out") {
if (id && !this.outdoing.hasOwnProperty(id)) {
if (id && !(id in this.outdoing)) {
this.outdoing[id] = bubble;
}
}
Expand Down
12 changes: 6 additions & 6 deletions Protest/Front/debitnotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class DebitNotes extends Window {
if (Object.keys(DebitNotes.MODELS) > 0 && !force) return;

for (let file in LOADER.devices.data) {
if (!LOADER.devices.data[file].hasOwnProperty("type")) continue;
if (!LOADER.devices.data[file].type) continue;
let type = LOADER.devices.data[file]["type"].v;
if (type.length == 0) continue;

Expand All @@ -292,7 +292,7 @@ class DebitNotes extends Window {
let description = (manufacturer + " " + type).trim();
let serial = LOADER.devices.data[file]["serial number"] ? LOADER.devices.data[file]["serial number"].v : "";

if (description && !DebitNotes.MODELS.hasOwnProperty(description)) {
if (description && !(description in DebitNotes.MODELS)) {
DebitNotes.MODELS[description] = [];
const option = document.createElement("option");
option.value = description;
Expand All @@ -302,7 +302,7 @@ class DebitNotes extends Window {
DebitNotes.MODELS[description].push(model);
}

if (model && !DebitNotes.MODELS.hasOwnProperty(model)) {
if (model && !(model in DebitNotes.MODELS)) {
DebitNotes.SERIAL_NUMBERS[model] = [];
}
if (model && serial && !DebitNotes.SERIAL_NUMBERS[model].includes(serial)) {
Expand Down Expand Up @@ -805,7 +805,7 @@ class DebitNotes extends Window {
txtSerialNo.setAttribute("list", serialId);

txtDescription.onchange = txtDescription.oninput = ()=> {
if (!DebitNotes.MODELS.hasOwnProperty(txtDescription.value)) return;
if (!(txtDescription.value in DebitNotes.MODELS)) return;

if (DebitNotes.MODELS[txtDescription.value].length == 1) {
txtModel.value = DebitNotes.MODELS[txtDescription.value][0];
Expand All @@ -824,7 +824,7 @@ class DebitNotes extends Window {
};

txtModel.onchange = txtModel.oninput = ()=> {
if (!DebitNotes.SERIAL_NUMBERS.hasOwnProperty(txtModel.value)) return;
if (!(txtModel.value in DebitNotes.SERIAL_NUMBERS)) return;

if (DebitNotes.SERIAL_NUMBERS[txtModel.value].length == 1) {
txtSerialNo.value = DebitNotes.SERIAL_NUMBERS[txtModel.value][0];
Expand Down Expand Up @@ -953,7 +953,7 @@ class DebitNotes extends Window {
element.appendChild(icon);

for (let i=0; i<usersColumns.length; i++) {
if (!LOADER.users.data[file].hasOwnProperty(usersColumns[i])) continue;
if (!(usersColumns[i] in LOADER.users.data[file])) continue;
const newLabel = document.createElement("div");
newLabel.textContent = LOADER.users.data[file][usersColumns[i]].v;
newLabel.style.left = i===0 ? `calc(28px + ${i * 100 / usersColumns.length}%)` : `${i * 100 / usersColumns.length}%`;
Expand Down
2 changes: 1 addition & 1 deletion Protest/Front/deviceslist.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DevicesList extends List {
InflateElement(element, entry, type) { //override
const icon = document.createElement("div");
icon.className = "list-element-icon";
icon.style.backgroundImage = `url(${LOADER.deviceIcons.hasOwnProperty(type) ? LOADER.deviceIcons[type] : "mono/gear.svg"})`;
icon.style.backgroundImage = `url(${type in LOADER.deviceIcons ? LOADER.deviceIcons[type] : "mono/gear.svg"})`;
element.appendChild(icon);

super.InflateElement(element, entry, type);
Expand Down
Loading

0 comments on commit 8e09164

Please sign in to comment.