Skip to content

Commit

Permalink
Monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
veniware committed Mar 6, 2024
1 parent f8c630b commit bc7a26d
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions Protest/Front/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,8 @@ class Monitor extends Window {
min: 0,
max: 100,
value: "PercentIdleTime".toLowerCase(),
isComplement: true
isComplement: true,
showPeakInput: true
}
));

Expand All @@ -611,6 +612,7 @@ class Monitor extends Window {
max: 100,
value: "PercentIdleTime".toLowerCase(),
isComplement: true,
showPeakInput: true
}
));

Expand All @@ -627,6 +629,7 @@ class Monitor extends Window {
max: "TotalVisibleMemorySize".toLowerCase(),
value: "FreePhysicalMemory".toLowerCase(),
isComplement: true,
showPeakInput: true
}
));

Expand All @@ -643,6 +646,7 @@ class Monitor extends Window {
max: 100,
value: "PercentIdleTime".toLowerCase(),
isComplement: true,
showPeakInput: true
}
));

Expand All @@ -660,6 +664,7 @@ class Monitor extends Window {
value: "BytesReceivedPersec".toLowerCase(),
isDynamic: true,
isComplement: false,
showPeakInput: true
}
));

Expand All @@ -677,6 +682,7 @@ class Monitor extends Window {
value: "BytesSentPersec".toLowerCase(),
isDynamic: true,
isComplement: false,
showPeakInput: true
}
));

Expand All @@ -688,7 +694,8 @@ class Monitor extends Window {
{
format: "Ping",
prefix: "RTT",
unit: "ms"
unit: "ms",
showPeakInput: true
}
));

Expand All @@ -706,9 +713,9 @@ class Monitor extends Window {
"Battery",
"mono/battery.svg",
"wmi",
"SELECT * FROM Win32_Battery",
"SELECT TimeOnBattery FROM Win32_Battery",
{
format: "List",
format: "Single value",
prefix: "Usage",
unit: "%"
}
Expand Down Expand Up @@ -947,7 +954,7 @@ class Monitor extends Window {
okButton.onclick = ()=> {
let options = {
protocol: templateOptions.protocol,
prefix : isCustomized ? "" : templateOptions.prefix,
prefix : isCustomized ? "" : `${templateOptions.prefix}:`,
name : nameInput.value,
format : formatInput.value,
unit : unitInput.value,
Expand Down Expand Up @@ -1087,14 +1094,14 @@ class Monitor extends Window {
}

if (data < 0) {
valueLabel.textContent = `${options.prefix}: --`;
valueLabel.textContent = `${options.prefix} --\n`;
}
else {
valueLabel.textContent = `${options.prefix}: ${data}${options.unit}`;
valueLabel.textContent = `${options.prefix} ${data}${options.unit}\n`;
}

if (peak >=0 && valley !== peak) {
valueLabel.textContent += `\nPeak: ${peak}${options.unit}`;
if (options.showPeak && peak >=0 && valley !== peak) {
valueLabel.textContent += `Peak: ${peak}${options.unit}\n`;
}

DrawGraph();
Expand Down Expand Up @@ -1172,7 +1179,11 @@ class Monitor extends Window {
if (list.length * gap > canvas.width) list.shift();
list.push(value);

valueLabel.textContent = `${options.prefix}: ${this.FormatUnits(value, options.unit)}`;
valueLabel.textContent = `${options.prefix} ${this.FormatUnits(value, options.unit)}\n`;

if (options.showPeak && valley !== peak) {
valueLabel.textContent += `Peak: ${peak}${options.unit}\n`;
}

DrawGraph();
};
Expand Down Expand Up @@ -1272,7 +1283,11 @@ class Monitor extends Window {
if (list.length * gap > 400) list.shift();
list.push(array.map(v=>v * 100 / spectrum));

valueLabel.textContent = `\nPeak: ${this.FormatUnits(peak, options.unit)}`;
valueLabel.textContent = `Peak: ${this.FormatUnits(peak, options.unit)}\n`;

if (options.showPeak && valley !== peak) {
valueLabel.textContent += `Peak: ${peak}${options.unit}\n`;
}

DrawGraph();
};
Expand Down Expand Up @@ -1352,7 +1367,7 @@ class Monitor extends Window {
if (list.length * gap > canvas.width) list.shift();
list.push(delta);

valueLabel.textContent = `${options.prefix}: ${this.FormatUnits(value, options.unit)}`;
valueLabel.textContent = `${options.prefix} ${this.FormatUnits(value, options.unit)}\n`;

DrawGraph();

Expand Down

0 comments on commit bc7a26d

Please sign in to comment.