Skip to content

Commit bc7a26d

Browse files
committed
Monitor
1 parent f8c630b commit bc7a26d

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

Protest/Front/monitor.js

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,8 @@ class Monitor extends Window {
594594
min: 0,
595595
max: 100,
596596
value: "PercentIdleTime".toLowerCase(),
597-
isComplement: true
597+
isComplement: true,
598+
showPeakInput: true
598599
}
599600
));
600601

@@ -611,6 +612,7 @@ class Monitor extends Window {
611612
max: 100,
612613
value: "PercentIdleTime".toLowerCase(),
613614
isComplement: true,
615+
showPeakInput: true
614616
}
615617
));
616618

@@ -627,6 +629,7 @@ class Monitor extends Window {
627629
max: "TotalVisibleMemorySize".toLowerCase(),
628630
value: "FreePhysicalMemory".toLowerCase(),
629631
isComplement: true,
632+
showPeakInput: true
630633
}
631634
));
632635

@@ -643,6 +646,7 @@ class Monitor extends Window {
643646
max: 100,
644647
value: "PercentIdleTime".toLowerCase(),
645648
isComplement: true,
649+
showPeakInput: true
646650
}
647651
));
648652

@@ -660,6 +664,7 @@ class Monitor extends Window {
660664
value: "BytesReceivedPersec".toLowerCase(),
661665
isDynamic: true,
662666
isComplement: false,
667+
showPeakInput: true
663668
}
664669
));
665670

@@ -677,6 +682,7 @@ class Monitor extends Window {
677682
value: "BytesSentPersec".toLowerCase(),
678683
isDynamic: true,
679684
isComplement: false,
685+
showPeakInput: true
680686
}
681687
));
682688

@@ -688,7 +694,8 @@ class Monitor extends Window {
688694
{
689695
format: "Ping",
690696
prefix: "RTT",
691-
unit: "ms"
697+
unit: "ms",
698+
showPeakInput: true
692699
}
693700
));
694701

@@ -706,9 +713,9 @@ class Monitor extends Window {
706713
"Battery",
707714
"mono/battery.svg",
708715
"wmi",
709-
"SELECT * FROM Win32_Battery",
716+
"SELECT TimeOnBattery FROM Win32_Battery",
710717
{
711-
format: "List",
718+
format: "Single value",
712719
prefix: "Usage",
713720
unit: "%"
714721
}
@@ -947,7 +954,7 @@ class Monitor extends Window {
947954
okButton.onclick = ()=> {
948955
let options = {
949956
protocol: templateOptions.protocol,
950-
prefix : isCustomized ? "" : templateOptions.prefix,
957+
prefix : isCustomized ? "" : `${templateOptions.prefix}:`,
951958
name : nameInput.value,
952959
format : formatInput.value,
953960
unit : unitInput.value,
@@ -1087,14 +1094,14 @@ class Monitor extends Window {
10871094
}
10881095

10891096
if (data < 0) {
1090-
valueLabel.textContent = `${options.prefix}: --`;
1097+
valueLabel.textContent = `${options.prefix} --\n`;
10911098
}
10921099
else {
1093-
valueLabel.textContent = `${options.prefix}: ${data}${options.unit}`;
1100+
valueLabel.textContent = `${options.prefix} ${data}${options.unit}\n`;
10941101
}
10951102

1096-
if (peak >=0 && valley !== peak) {
1097-
valueLabel.textContent += `\nPeak: ${peak}${options.unit}`;
1103+
if (options.showPeak && peak >=0 && valley !== peak) {
1104+
valueLabel.textContent += `Peak: ${peak}${options.unit}\n`;
10981105
}
10991106

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

1175-
valueLabel.textContent = `${options.prefix}: ${this.FormatUnits(value, options.unit)}`;
1182+
valueLabel.textContent = `${options.prefix} ${this.FormatUnits(value, options.unit)}\n`;
1183+
1184+
if (options.showPeak && valley !== peak) {
1185+
valueLabel.textContent += `Peak: ${peak}${options.unit}\n`;
1186+
}
11761187

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

1275-
valueLabel.textContent = `\nPeak: ${this.FormatUnits(peak, options.unit)}`;
1286+
valueLabel.textContent = `Peak: ${this.FormatUnits(peak, options.unit)}\n`;
1287+
1288+
if (options.showPeak && valley !== peak) {
1289+
valueLabel.textContent += `Peak: ${peak}${options.unit}\n`;
1290+
}
12761291

12771292
DrawGraph();
12781293
};
@@ -1352,7 +1367,7 @@ class Monitor extends Window {
13521367
if (list.length * gap > canvas.width) list.shift();
13531368
list.push(delta);
13541369

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

13571372
DrawGraph();
13581373

0 commit comments

Comments
 (0)