Somewhat done control page
[matches/MCTX3420.git] / testing / MCTXWeb / public_html / control.html
index 86a7f82..60817cf 100644 (file)
@@ -9,19 +9,51 @@
     <script type="text/javascript" src="static/jquery-1.10.1.min.js"></script>
     <script type="text/javascript" src="static/jquery.flot.min.js"></script>
     <script type="text/javascript" src="static/mctx.gui.js"></script>
+    <script type="text/javascript" src="static/mctx.control.js"></script>
     
     <link rel="stylesheet" type="text/css" href="static/style.css">
     <link rel="stylesheet" type="text/css" href="static/nav-menu.css">
     <script type="text/javascript">
       runBeforeLoad().done(function () {
         $(document).ready(function () {
-         $("#main_controls").submit(function () {
-           //Validate!
-           return false;
-         });
+          $("form").submit(function () { //Prevent form submit globally
+            return false;
+          })
+          
+          //Set the status updated
+          $("#state-exp").setStatusUpdater();
+          
+          //Set the logic for the start controls
+          $("#start-controls").submit(function () {
+            var start = $("#start-controls input[type='button']");
+            var force = $("#start-controls input[name='start_force']");
+            
+            $(this).startExperiment(start, $("#experiment_name").val(), 
+                      force.is(":checked"), $("#start-result"));
+            force.prop("checked", false);
+          });
+          
+          //Set the logic for the stop button
+          $("#experiment-stop").click(function () {
+            $(this).stopExperiment($("#stop-status"));
+          });
+          
+          //Set the logic for the pressure controls
+          $("#pressure-controls").submit(function () {
+            var pressure = {
+              set : $("#pressure-set").val(),
+              step : $("#pressure-stepsize").val(),
+              wait : $("#pressure-stepwait").val(),
+              count : $("#pressure-stepcount").val()
+            };   
+            $(this).setPressure(pressure, $("#pressure-result"));
+          });
        });       
-      })
-
+      }).fail(function () {
+        $(document).ready(function () {
+         $("#state-exp").text("Connection failure").parent().addClass("fail");
+       });  
+      });
     </script>
   </head>
   
             <table class="horizontal medium">
               <tr id="state-exp-r">
                 <th>Experiment state</th>
-                <td id="state-exp">sdgfsdsses</td>
+                <td id="state-exp"></td>
                 <td style="text-align: right;">
                   <input id="experiment-stop" type="button" value="Stop">
                 </td>
               </tr>
-              <tr id="state-software-r">
-                <th>Software status</th>
-                <td id="state-software"></td>
-                <td></td>
-              </tr>
             </table>
+            <div id="stop-status">
+              &nbsp;
+            </div>
             
             <div class="sub-title">Error and warning messages</div>
             <textarea id="errorlog" wrap="off" rows="4" cols="30" readonly>
             <form id="start-controls" class="nice" action="#">
               <p>
                 <label for="experiment_name">Experiment name</label>
-                <input id="experiment_name" type="text" name="experiment_name">
+                <input id="experiment_name" type="text">
+                
+                <label for="start_force">Overwrite existing</label>
+                <input type="checkbox" name="start_force" id="start_force">
               </p>
               <p id="start-result">
                 &nbsp;
               </p>
               <p class="centre">
-                <input type="button" name="start_strain" value="Strain test">
-                <input type="button" name="start_strain" value="Explode test">
+                <input type="submit" name="start_strain" value="Strain test">
+                <input type="submit" name="start_explode" value="Explode test">                
               </p>
             </form>
           </div>

UCC git Repository :: git.ucc.asn.au