From 15d88b81ffa835cc90071174e10ff7de4cd830ff Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Sun, 19 Aug 2018 22:00:29 +0100 Subject: [PATCH] Don't show cpu temperature if it can't be detected --- src/freedombone-installer | 7 ++++++- src/freedombone-utils-webadmin | 7 ++++++- webadmin/EN/system_monitor_template.html | 13 +++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/freedombone-installer b/src/freedombone-installer index 54e8f5266..83a2ed5c2 100755 --- a/src/freedombone-installer +++ b/src/freedombone-installer @@ -1542,7 +1542,12 @@ function update_system_monitor { sed -i "s|<div name=\"memory\" class=\"w3-container.*|<div name=\"memory\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${used_memory_percent}%\">${used_memory_percent}%</div>|g" "$webadmin_install_dir/system_monitor.html" - sed -i "s|<div name=\"cputemp\" class=\"w3-container.*|<div name=\"cputemp\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${cpu_temperature}%\">${cpu_temperature}C</div>|g" "$webadmin_install_dir/system_monitor.html" + if [ $cpu_temperature -gt 0 ]; then + sed -i "s|<div name=\"cputemp\" class=\"w3-container.*|<div name=\"cputemp\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${cpu_temperature}%\">${cpu_temperature}C</div>|g" "$webadmin_install_dir/system_monitor.html" + else + sed -i "/\"cputemp\"/d" "$webadmin_install_dir/system_monitor.html" + sed -i '/titletextcputemp/d' "$webadmin_install_dir/system_monitor.html" + fi sed -i "s|<div name=\"diskio\" class=\"w3-container.*|<div name=\"diskio\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${disk_io_speed_percent}%\">${disk_io_speed} MB/s</div>|g" "$webadmin_install_dir/system_monitor.html" diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin index d2c3bc242..0e68d80f9 100755 --- a/src/freedombone-utils-webadmin +++ b/src/freedombone-utils-webadmin @@ -791,7 +791,12 @@ function webadmin_update_system_monitor { sed -i "s|<div name=\"memory\" class=\"w3-container.*|<div name=\"memory\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${used_memory_percent}%\">${used_memory_percent}%</div>|g" "$webadmin_install_dir/system_monitor.html" - sed -i "s|<div name=\"cputemp\" class=\"w3-container.*|<div name=\"cputemp\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${cpu_temperature}%\">${cpu_temperature}C</div>|g" "$webadmin_install_dir/system_monitor.html" + if [ $cpu_temperature -gt 0 ]; then + sed -i "s|<div name=\"cputemp\" class=\"w3-container.*|<div name=\"cputemp\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${cpu_temperature}%\">${cpu_temperature}C</div>|g" "$webadmin_install_dir/system_monitor.html" + else + sed -i "/\"cputemp\"/d" "$webadmin_install_dir/system_monitor.html" + sed -i '/titletextcputemp/d' "$webadmin_install_dir/system_monitor.html" + fi sed -i "s|<div name=\"diskio\" class=\"w3-container.*|<div name=\"diskio\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${disk_io_speed_percent}%\">${disk_io_speed} MB/s</div>|g" "$webadmin_install_dir/system_monitor.html" diff --git a/webadmin/EN/system_monitor_template.html b/webadmin/EN/system_monitor_template.html index 59c34249a..5e84a13af 100644 --- a/webadmin/EN/system_monitor_template.html +++ b/webadmin/EN/system_monitor_template.html @@ -41,6 +41,11 @@ font-size: 100%; } + .titletextcputemp { + color: black; + font-size: 100%; + } + .appdesc { color: black; font-size: 65%; @@ -91,14 +96,14 @@ <div name="memory" class="w3-container w3-blue w3-round-xlarge" style="width:80%">80%</div> </div> - <p class="titletext">CPU temperature</p> + <p class="titletext">Disk I/O Speed</p> <div class="w3-light-grey w3-round-xlarge"> - <div name="cputemp" class="w3-container w3-blue w3-round-xlarge" style="width:40%">40°C</div> + <div name="diskio" class="w3-container w3-blue w3-round-xlarge" style="width:10%">20 MB/s</div> </div> - <p class="titletext">Disk I/O Speed</p> + <p class="titletextcputemp">CPU temperature</p> <div class="w3-light-grey w3-round-xlarge"> - <div name="diskio" class="w3-container w3-blue w3-round-xlarge" style="width:10%">20 MB/s</div> + <div name="cputemp" class="w3-container w3-blue w3-round-xlarge" style="width:40%">40°C</div> </div> <br><br> -- GitLab