summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-07-11 03:01:24 +0300
committerDevaev Maxim <[email protected]>2020-07-11 03:01:24 +0300
commit2512c6448c76a2a78dfdf96852f57e8c643b5f35 (patch)
tree20c5cff14aa7a5cc51883044511c405064582f03 /web
parent01fee4992bdc1a464a68ef10f7faf68bbba05a38 (diff)
notify about health
Diffstat (limited to 'web')
-rw-r--r--web/kvm/index.html60
-rw-r--r--web/share/css/menu.css4
-rw-r--r--web/share/js/kvm/session.js12
-rw-r--r--web/share/svg/led-overheating.svg65
-rw-r--r--web/share/svg/led-undervoltage.svg65
5 files changed, 204 insertions, 2 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html
index 77db8726..17959783 100644
--- a/web/kvm/index.html
+++ b/web/kvm/index.html
@@ -66,6 +66,66 @@
</a>
</li>
+ <div id="hw-health-dropdown" class="hidden">
+ <li class="menu-left-items">
+ <a class="menu-item" href="#">
+ <img data-dont-hide-menu id="hw-health-undervoltage-led" class="hidden" src="../share/svg/led-undervoltage.svg" />
+ <img data-dont-hide-menu id="hw-health-overheating-led" class="hidden" src="../share/svg/led-overheating.svg" />
+ &#8628;
+ </a>
+ <div data-dont-hide-menu class="menu-item-content">
+ <div class="menu-item-content-text">
+ <table>
+ <tr>
+ <td><img class="sign" src="../share/svg/warning.svg" /></td>
+ <td>
+ <b>Raspberry Pi's health is at risk</b><br><br>
+ <sup>
+ This is not a drill! A red icon indicates a current issue,<br>
+ a yellow one that was observed since the device booted up.
+ </sup>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="hw-health-message-undervoltage" class="hidden">
+ <hr>
+ <div class="menu-item-content-text">
+ <table>
+ <tr>
+ <td><img class="sign led-gray" src="../share/svg/led-undervoltage.svg" /></td>
+ <td>
+ <b>Undervoltage detected</b><br><br>
+ <sup>
+ Make sure your power supply and cabling are providing<br>
+ enough power to the Raspberry Pi (3A minimum).
+ </sup>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ <div id="hw-health-message-overheating" class="hidden">
+ <hr>
+ <div class="menu-item-content-text">
+ <table>
+ <tr>
+ <td><img class="sign led-gray" src="../share/svg/led-overheating.svg" /></td>
+ <td>
+ <b>Overheating detected</b><br><br>
+ <sup>
+ Frequency capping due to overheating.<br>
+ Improve cooling of the Raspberry Pi.
+ </sup>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </li>
+ </div>
+
<li class="menu-right-items">
<a class="menu-item" href="#">
<img data-dont-hide-menu id="link-led" class="led-gray" src="../share/svg/led-link.svg" />
diff --git a/web/share/css/menu.css b/web/share/css/menu.css
index b5d14dd9..0a84b303 100644
--- a/web/share/css/menu.css
+++ b/web/share/css/menu.css
@@ -34,10 +34,12 @@ ul#menu {
}
ul#menu li.menu-right-items {
+ border-left: var(--border-menu-thin);
float: right;
}
ul#menu li.menu-left-items {
+ border-right: var(--border-menu-thin);
float: left;
}
@@ -45,7 +47,6 @@ ul#menu li a#menu-logo {
line-height: 50px;
outline: none;
cursor: pointer;
- border-right: var(--border-menu-thin);
display: inline-block;
color: var(--cs-menu-default-fg);
padding-left: 16px;
@@ -68,7 +69,6 @@ ul#menu li a.menu-item {
line-height: 50px;
outline: none;
cursor: pointer;
- border-left: var(--border-menu-thin);
display: inline-block;
color: var(--cs-menu-default-fg);
padding-left: 16px;
diff --git a/web/share/js/kvm/session.js b/web/share/js/kvm/session.js
index ec7a34bd..72b68151 100644
--- a/web/share/js/kvm/session.js
+++ b/web/share/js/kvm/session.js
@@ -86,6 +86,18 @@ export function Session() {
Throttling:
${__formatThrottling(state.health.throttling)}
`;
+
+ if (state.health.throttling !== null) {
+ let flags = state.health.throttling.parsed_flags;
+ let undervoltage = (flags.undervoltage.now || flags.undervoltage.past);
+ let freq_capped = (flags.freq_capped.now || flags.freq_capped.past);
+
+ tools.setHiddenVisible($("hw-health-dropdown"), (undervoltage || freq_capped));
+ $("hw-health-undervoltage-led").className = (undervoltage ? (flags.undervoltage.now ? "led-red" : "led-yellow") : "hidden");
+ $("hw-health-overheating-led").className = (freq_capped ? (flags.freq_capped.now ? "led-red" : "led-yellow") : "hidden");
+ tools.setHiddenVisible($("hw-health-message-undervoltage"), undervoltage);
+ tools.setHiddenVisible($("hw-health-message-overheating"), freq_capped);
+ }
};
var __formatTemp = function(temp) {
diff --git a/web/share/svg/led-overheating.svg b/web/share/svg/led-overheating.svg
new file mode 100644
index 00000000..f17d6ff3
--- /dev/null
+++ b/web/share/svg/led-overheating.svg
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210.00002mm"
+ height="210.00003mm"
+ viewBox="0 0 210.00002 210.00003"
+ version="1.1"
+ id="svg1125"
+ inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
+ sodipodi:docname="led-overheating.svg">
+ <defs
+ id="defs1119" />
+ <sodipodi:namedview
+ fit-margin-bottom="0"
+ fit-margin-right="0"
+ fit-margin-left="0"
+ fit-margin-top="0"
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.35"
+ inkscape:cx="396.85043"
+ inkscape:cy="396.85043"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ inkscape:document-rotation="0"
+ showgrid="false"
+ inkscape:window-width="1366"
+ inkscape:window-height="714"
+ inkscape:window-x="0"
+ inkscape:window-y="28"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata1122">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ transform="translate(-0.83332333,-43.166657)"
+ inkscape:label="Слой 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ class="fil0"
+ d="M 189.50524,43.166657 H 22.161425 c -11.779701,0 -21.32810167,9.548401 -21.32810167,21.328102 V 231.83858 c 0,11.7797 9.54840067,21.3281 21.32810167,21.3281 H 189.50524 c 11.7797,0 21.3281,-9.5484 21.3281,-21.3281 V 64.494759 c 0,-11.779701 -9.5484,-21.328102 -21.3281,-21.328102 z m -62.8272,100.038913 h 11.4327 c 2.4161,0 4.3749,1.9588 4.3749,4.3749 0,2.4161 -1.9588,4.375 -4.3749,4.375 h -11.4327 v 13.0806 c 0,1.0164 0.17869,1.9391 0.53229,2.75951 0.35821,0.83079 0.901,1.59219 1.62421,2.27519 3.71899,3.5119 6.72159,7.7606 8.7677,12.50611 1.9749,4.5799 3.0691,9.6226 3.0691,14.9135 0,10.4132 -4.22131,19.8413 -11.04601,26.6661 -6.82469,6.8246 -16.2528,11.0459 -26.666,11.0459 -10.413296,0 -19.841397,-4.2213 -26.6661,-11.0459 -6.824599,-6.8248 -11.045899,-16.2529 -11.045899,-26.6661 0,-5.2909 1.0941,-10.3336 3.069101,-14.9135 2.0461,-4.74551 5.048599,-8.99421 8.767601,-12.50611 0.723299,-0.683 1.266,-1.4444 1.6242,-2.27519 0.3536,-0.82041 0.5324,-1.74311 0.5324,-2.75951 V 84.720663 c 0,-6.527102 2.667098,-12.457904 6.964,-16.754803 4.296799,-4.296701 10.227501,-6.963901 16.754697,-6.963901 6.5271,0 12.4579,2.6672 16.7547,6.963901 4.2968,4.296899 6.96401,10.227701 6.96401,16.754803 v 0.152299 h 20.9927 c 2.4161,0 4.3749,1.958801 4.3749,4.374999 0,2.416101 -1.9588,4.374902 -4.3749,4.374902 h -20.9927 v 10.694297 h 17.8059 c 2.4161,0 4.3749,1.9588 4.3749,4.375 0,2.4161 -1.9588,4.3749 -4.3749,4.3749 h -17.8059 v 10.69431 h 14.6191 c 2.4161,0 4.3749,1.95879 4.3749,4.3749 0,2.4162 -1.9588,4.375 -4.3749,4.375 h -14.6191 z m -13.30401,39.35391 c 4.7086,3.2902 7.7889,8.7507 7.7889,14.9309 0,10.0535 -8.1501,18.2037 -18.2036,18.2037 -10.053497,0 -18.203698,-8.1502 -18.203698,-18.2036 0,-6.1803 3.080401,-11.6408 7.789003,-14.931 2.475399,-1.7297 3.8296,-4.3274 3.8296,-7.3474 v -72.26402 c 0,-1.992 1.6247,-3.616695 3.6166,-3.616796 l 5.936895,1.01e-4 c 1.992,0 3.6166,1.624795 3.6166,3.616695 v 72.26411 c 0,3.0198 1.354,5.61761 3.8297,7.34731 z m 16.196,3.4695 c -1.5772,-3.658 -3.8773,-6.9195 -6.7169,-9.60091 -1.62099,-1.53079 -2.8489,-3.26419 -3.67499,-5.18039 -0.83041,-1.9265 -1.25001,-4.0036 -1.25001,-6.21161 V 84.720663 c 0,-4.1119 -1.6854,-7.853302 -4.4004,-10.568403 -2.7151,-2.715001 -6.4566,-4.400399 -10.5684,-4.400399 -4.111894,0 -7.853195,1.6853 -10.568297,4.400399 -2.715101,2.715101 -4.400499,6.456503 -4.400499,10.568403 v 80.315407 c 0,2.2079 -0.419701,4.28511 -1.250101,6.21161 -0.826101,1.9162 -2.053899,3.6496 -3.675002,5.18039 -2.839598,2.68141 -5.1396,5.94291 -6.7169,9.60091 -1.512999,3.5089 -2.351299,7.3838 -2.351299,11.4614 0,7.9981 3.241699,15.2389 8.482401,20.4797 5.240801,5.2407 12.4816,8.4824 20.479697,8.4824 7.998,0 15.2389,-3.2417 20.4796,-8.4824 5.24081,-5.2408 8.4825,-12.4816 8.4825,-20.4797 0,-4.0776 -0.83839,-7.9525 -2.3514,-11.4614 z"
+ id="path980"
+ style="clip-rule:evenodd;fill:#000000;fill-rule:evenodd;stroke-width:0.01;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision" />
+ </g>
+</svg>
diff --git a/web/share/svg/led-undervoltage.svg b/web/share/svg/led-undervoltage.svg
new file mode 100644
index 00000000..c85ca6e5
--- /dev/null
+++ b/web/share/svg/led-undervoltage.svg
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210.00002mm"
+ height="210.00003mm"
+ viewBox="0 0 210.00002 210.00003"
+ version="1.1"
+ id="svg1125"
+ inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
+ sodipodi:docname="led-undervoltage.svg">
+ <defs
+ id="defs1119" />
+ <sodipodi:namedview
+ fit-margin-bottom="0"
+ fit-margin-right="0"
+ fit-margin-left="0"
+ fit-margin-top="0"
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.35"
+ inkscape:cx="396.85043"
+ inkscape:cy="396.85043"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ inkscape:document-rotation="0"
+ showgrid="false"
+ inkscape:window-width="1366"
+ inkscape:window-height="714"
+ inkscape:window-x="0"
+ inkscape:window-y="28"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata1122">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ transform="translate(-0.83332333,-43.166657)"
+ inkscape:label="Слой 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ class="fil0"
+ d="M 189.50524,43.166657 H 22.161425 c -11.779701,0 -21.32810167,9.548401 -21.32810167,21.328102 V 231.83858 c 0,11.7797 9.54840067,21.3281 21.32810167,21.3281 H 189.50524 c 11.7797,0 21.3281,-9.5484 21.3281,-21.3281 V 64.494759 c 0,-11.779701 -9.5484,-21.328102 -21.3281,-21.328102 z M 107.06143,171.34288 H 93.483834 l 15.439696,-27.88171 -0.002,-7.9e-4 c 0.3571,-0.64061 0.5569,-1.38041 0.5477,-2.16641 -0.0283,-2.4032 -1.9995,-4.3285 -4.4027,-4.3003 l -27.970085,0.3681 35.023205,-67.467905 h 42.9255 l -36.1879,46.843805 0.003,0.002 c -0.5688,0.7355 -0.9075,1.6581 -0.9075,2.6597 0,2.4032 1.9483,4.3515 4.3515,4.3515 l 27.69881,2e-4 z m 2.2069,28.5437 -49.211999,35.5281 c -1.0414,0.8874 -2.482901,1.2732 -3.909902,0.9107 -2.3373,-0.5937 -3.750799,-2.9699 -3.157101,-5.3073 l 15.073604,-59.16701 0.01209,0.003 c 0.2851,-1.1211 1.013299,-2.1269 2.103999,-2.7335 2.101702,-1.1686 4.752901,-0.4123 5.921401,1.6894 l 3.876101,6.9487 17.700101,-31.9636 -27.499601,0.3619 c -0.768501,0.0536 -1.561002,-0.0959 -2.2958,-0.4746 -2.139402,-1.1026 -2.979801,-3.73081 -1.8772,-5.87021 L 105.46343,63.798659 c 0.6693,-1.554 2.2145,-2.6421 4.0139,-2.6421 h 54.44631 v 0.0133 c 0.9306,-6.88e-4 1.8686,0.2954 2.6622,0.9082 1.9038,1.4701 2.2551,4.205501 0.7849,6.109201 l -36.2011,46.861 28.3356,2e-4 c 1.1372,-0.0781 2.3035,0.2865 3.2177,1.1092 1.7905,1.6117 1.9357,4.3698 0.3242,6.1604 l -62.13701,68.86522 6.3787,0.8534 -2.6e-4,0.002 c 1.1504,0.1503 2.2384,0.7571 2.9696,1.7729 1.4041,1.9508 0.961,4.6709 -0.9898,6.0751 z"
+ id="path978"
+ style="clip-rule:evenodd;fill:#000000;fill-rule:evenodd;stroke-width:0.01;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision" />
+ </g>
+</svg>