From 7e918bc588ad1a26b4570d7e6d4ff79b22bd5c64 Mon Sep 17 00:00:00 2001
From: Stephen Farry <stephen.farry@gmail.com>
Date: Mon, 27 Apr 2020 14:44:07 +0100
Subject: [PATCH] more implementation of locks and timeouts

---
 raspberry-backend/static/css/style_v3.css    | 25 +++++++++++------
 raspberry-backend/static/js/Chart-display.js | 28 +++++++++++++++-----
 raspberry-backend/templates/base.html        | 21 +++++++++------
 3 files changed, 51 insertions(+), 23 deletions(-)

diff --git a/raspberry-backend/static/css/style_v3.css b/raspberry-backend/static/css/style_v3.css
index a032f925..986cce5a 100644
--- a/raspberry-backend/static/css/style_v3.css
+++ b/raspberry-backend/static/css/style_v3.css
@@ -91,6 +91,12 @@ html {
 	
     }
 }
+@media (min-width: 1400px) {
+    html{
+	font-size: 30px;
+	
+    }
+}
 
 
 
@@ -1843,8 +1849,8 @@ small,
 
 .card-body {
   flex: 1 1 auto;
-  min-height: 1px;
   padding: 1.25rem;
+  align-items:center;
 }
 
 .card-title {
@@ -6076,20 +6082,17 @@ border: 1px solid rgba(0, 0, 0, 0.125);
 .col-cards-main {
     flex: 0 0 41.6666666667%;
     max-width: 41.6666666667%;
-    //display: flex;
-    //flex-wrap: wrap;    
 }
 .card-reading{
     position: relative;
-    //display: flex;
-    //flex-direction: column;
     min-width: 0;
     word-wrap: break-word;
     background-color: #fff;
     background-clip: border-box;
     border: 1px solid rgba(0, 0, 0, 0.125);
     border-radius: 0.25rem;
-    
+    display:flex;
+    flex-direction:column;
     flex: 0 0 31.8%;
     max-width: 31.8%;
     padding-right: 0.15rem !important;
@@ -6113,11 +6116,17 @@ border: 1px solid rgba(0, 0, 0, 0.125);
     width:100%;
     height:calc((100vh - var(--top-height) - 0.5rem - 2.0rem)/3.0); // 2.0rem if for the range-button container
 }
-
+.reading-wrapper{
+    margin-top:auto;
+    margin-bottom:auto;
+}
 @media (min-height: 1200px) {
     .card-reading {
 	flex: 0 49.1%;
 	max-width: 49.1%;
     }
     
-}
\ No newline at end of file
+}
+.nav-link-disabled {
+    pointer-events: none;
+}
diff --git a/raspberry-backend/static/js/Chart-display.js b/raspberry-backend/static/js/Chart-display.js
index 9b7a865d..7b0bee1a 100644
--- a/raspberry-backend/static/js/Chart-display.js
+++ b/raspberry-backend/static/js/Chart-display.js
@@ -179,6 +179,7 @@ $(document).ready(function() {
             title: {
                 display: true,
                 text: 'Pressure [mbar]',
+		fontSize: 0.7*parseFloat(getComputedStyle(document.documentElement).fontSize),
             },            
             scales: {
 		
@@ -187,11 +188,14 @@ $(document).ready(function() {
 		        maxTicksLimit: 13,
 		    maxRotation: 0,
                     min: -60,
-                    max: 0}}],
+                    max: 0,
+	    	    fontSize: 0.6*parseFloat(getComputedStyle(document.documentElement).fontSize),}}],
 		yAxes: [{
                 ticks: {
                     beginAtZero: true,
-                    suggestedMax: 25
+                    suggestedMax: 25,
+	    	    fontSize: 0.6*parseFloat(getComputedStyle(document.documentElement).fontSize),
+		    maxTicksLimit: 8,
                 },
 				scaleLabel: {
 					display: false,
@@ -251,20 +255,24 @@ $(document).ready(function() {
             },
             title: {
               display: true,
-              text: 'Flow [mL/min]',
+		text: 'Flow [mL/min]',
+		fontSize: 0.7*parseFloat(getComputedStyle(document.documentElement).fontSize),
             },
             scales: {
 		
             xAxes: [{
                 ticks: {
 		        maxTicksLimit: 13,
+		    fontSize: 0.6*parseFloat(getComputedStyle(document.documentElement).fontSize),
 		    maxRotation: 0,
                     min: -60,
-                    max: 0}}],
+                    max: 0,
+		fontSize: 0.6*parseFloat(getComputedStyle(document.documentElement).fontSize),}}],
 			yAxes: [{
                 ticks: {
                     beginAtZero: true,
-                    suggestedMax: 25
+                    maxTicksLimit: 8,
+		    fontSize: 0.6*parseFloat(getComputedStyle(document.documentElement).fontSize),
                 },
 				scaleLabel: {
 					display: false,
@@ -324,6 +332,7 @@ $(document).ready(function() {
             title: {
                 display: true,
                 text: 'Volume [mL]',
+		fontSize: 0.7*parseFloat(getComputedStyle(document.documentElement).fontSize),
             },
             scales: {
 		
@@ -332,12 +341,17 @@ $(document).ready(function() {
 		    maxTicksLimit: 13,
 		    maxRotation: 0,
                     min: -60,
-                    max: 0}}],
+                    max: 0,
+		    fontSize: 0.6*parseFloat(getComputedStyle(document.documentElement).fontSize),}}],
 		
 		yAxes: [{
                     ticks: {
                     beginAtZero: true,
-                    suggestedMax: 25
+			suggestedMax: 25,
+			maxTicksLimit: 8,
+		    fontSize: 0.6*parseFloat(getComputedStyle(document.documentElement).fontSize),
+			
+
                 },
 				scaleLabel: {
 					display: false,
diff --git a/raspberry-backend/templates/base.html b/raspberry-backend/templates/base.html
index 42580894..58dded62 100644
--- a/raspberry-backend/templates/base.html
+++ b/raspberry-backend/templates/base.html
@@ -62,23 +62,23 @@
                 <nav class="sb-sidenav accordion sb-sidenav-dark px-1" id="sidenavAccordion">
                   <div class="sb-sidenav-menu">
                     <div class="nav">
-		      <a href="/"> <div id="fan-icon" class = "sb-nav-link-icon border-invisible {{'active' if fan_active }}">
+		      <a href="/" class = "nav-link-href nav-link-disabled"> <div id="fan-icon" class = "sb-nav-link-icon border-invisible {{'active' if fan_active }}">
 			  <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-md" class="fa-user-md fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path class="path-icon"  d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zM104 424c0 13.3 10.7 24 24 24s24-10.7 24-24-10.7-24-24-24-24 10.7-24 24zm216-135.4v49c36.5 7.4 64 39.8 64 78.4v41.7c0 7.6-5.4 14.2-12.9 15.7l-32.2 6.4c-4.3.9-8.5-1.9-9.4-6.3l-3.1-15.7c-.9-4.3 1.9-8.6 6.3-9.4l19.3-3.9V416c0-62.8-96-65.1-96 1.9v26.7l19.3 3.9c4.3.9 7.1 5.1 6.3 9.4l-3.1 15.7c-.9 4.3-5.1 7.1-9.4 6.3l-31.2-4.2c-7.9-1.1-13.8-7.8-13.8-15.9V416c0-38.6 27.5-70.9 64-78.4v-45.2c-2.2.7-4.4 1.1-6.6 1.9-18 6.3-37.3 9.8-57.4 9.8s-39.4-3.5-57.4-9.8c-7.4-2.6-14.9-4.2-22.6-5.2v81.6c23.1 6.9 40 28.1 40 53.4 0 30.9-25.1 56-56 56s-56-25.1-56-56c0-25.3 16.9-46.5 40-53.4v-80.4C48.5 301 0 355.8 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-72-56.8-130.3-128-133.8z"></path></svg>
 			  </div></a>
-			  <a href="prototype"> <div class = "sb-nav-link-icon border-invisible {{'active' if prototype_active}}">
+			  <a href="prototype" class = "nav-link-href nav-link-disabled"> <div class = "sb-nav-link-icon border-invisible {{'active' if prototype_active}}">
 				<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="fan" class="fa-fan fa-w-15" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path class="path-icon" d="M352.57 128c-28.09 0-54.09 4.52-77.06 12.86l12.41-123.11C289 7.31 279.81-1.18 269.33.13 189.63 10.13 128 77.64 128 159.43c0 28.09 4.52 54.09 12.86 77.06L17.75 224.08C7.31 223-1.18 232.19.13 242.67c10 79.7 77.51 141.33 159.3 141.33 28.09 0 54.09-4.52 77.06-12.86l-12.41 123.11c-1.05 10.43 8.11 18.93 18.59 17.62 79.7-10 141.33-77.51 141.33-159.3 0-28.09-4.52-54.09-12.86-77.06l123.11 12.41c10.44 1.05 18.93-8.11 17.62-18.59-10-79.7-77.51-141.33-159.3-141.33zM256 288a32 32 0 1 1 32-32 32 32 0 0 1-32 32z"></path></svg>
 			  </div></a>
-		      <a href="charts"> <div class = "sb-nav-link-icon border-invisible {{'active' if charts_active}}">
+		      <a href="charts" class = "nav-link-href nav-link-disabled"> <div class = "sb-nav-link-icon border-invisible {{'active' if charts_active}}">
 			  <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chart-area" class="fa-chart-area fa-w-15" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path class="path-icon" d="M500 384c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12V76c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v308h436zM372.7 159.5L288 216l-85.3-113.7c-5.1-6.8-15.5-6.3-19.9 1L96 248v104h384l-89.9-187.8c-3.2-6.5-11.4-8.7-17.4-4.7z"></path></svg>
 		      </div></a>
-		      <a href="chartsLoop"> <div class = "sb-nav-link-icon border-invisible {{'active' if chartsLoop_active}}">
+		      <a href="chartsLoop" class = "nav-link-href nav-link-disabled"> <div class = "sb-nav-link-icon border-invisible {{'active' if chartsLoop_active}}">
 			  <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chart-line" class="fa-chart-line fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path class="path-icon" d="M 496,384 H 64 V 80 C 64,71.2 57,64 48,64 H 16 C 7,64 0,71 0,80 v 336 c 0,18 14,32 32,32 h 464 c 9,0 16,-7 16,-16 v -32 c 0,-9 -7,-16 -16,-16 z M 296,79 c -9,-15 -48,-18 -60,-6 L 86,220 c -6,6 -6,16 0,23 L 116,275 c 6,6 16,6 22,0 L 267,143 386,266 H 233 v -22 c -1,-8 -1,-8 -9,-2 l -59,59 56,61 c 8,8 9,9 10,0 v -30 H 440 c 23,0 37,-45 24,-66 z">
 		      </div></a>
 		      
-		      <a href="logs"> <div class = "sb-nav-link-icon border-invisible {{'active' if logs_active}}">
+		      <a href="logs" class = "nav-link-href nav-link-disabled"> <div class = "sb-nav-link-icon border-invisible {{'active' if logs_active}}">
 			  <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="exclamation-circle" class="fa-chart-area fa-w-15" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path class="path-icon" fill="currentColor" d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"></path></svg>
 			  </div></a>
-		      <a href="settings"> <div class = "sb-nav-link-icon border-invisible {{'active' if settings_active}}">
+		      <a href="settings" class = "nav-link-href nav-link-disabled"> <div class = "sb-nav-link-icon border-invisible {{'active' if settings_active}}">
               <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="sliders-h" class="fa-sliders-h fa-w-15" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path class="path-icon" d="M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"></path></svg>
 			  </div></a>
   
@@ -214,6 +214,9 @@
 	  function unlock(){
 	  var x = document.getElementsByClassName("input-editable");
 	  for (i = 0; i < x.length; i++) {x[i].readOnly=false;x[i].disabled = false;}
+	  var l = document.getElementsByClassName("nav-link-href");
+	  for (i = 0; i < l.length; i++) {l[i].classList.remove("nav-link-disabled");}
+
 			  var el = document.getElementById("path-locked-main");
 			  el.classList.add("transparent");
 			  var el2 = document.getElementById("path-unlocked-main");
@@ -228,6 +231,8 @@
 			  clearTimeout(lockTimer);
 			  var x = document.getElementsByClassName("input-editable");
 			  for (i = 0; i < x.length; i++) {x[i].readOnly=true;x[i].disabled = true;}
+					  var l = document.getElementsByClassName("nav-link-href");
+					  for (i = 0; i < l.length; i++) {l[i].classList.add("nav-link-disabled");}
 			  var el = document.getElementById("path-locked-main");
 			  el.classList.remove("transparent");
 			  var el2 = document.getElementById("path-unlocked-main");
@@ -271,7 +276,7 @@
 			  });
 
 			  
-	  var battery = 120;
+	  var battery = 200;
 	  function update_battery() {
 	  // set all transparent
 	  var powered = document.getElementById("powered");
@@ -296,7 +301,7 @@
 												else  if (battery >= 7.5 && battery < 37.5) { one_qtr.classList.remove("transparent"); }
 																      else  { empty.classList.remove("transparent"); }
 																      battery = battery - 1;
-																      if (battery  <= 0 ) battery = 120;
+																      if (battery  <= 0 ) battery = 200;
 																		      }	var batteryInterval = setInterval('update_battery()', 1000);
 																		      var prev_val;
 
-- 
GitLab