Procházet zdrojové kódy

add restart button

Chris Mullins před 8 roky
rodič
revize
04aaabf783
1 změnil soubory, kde provedl 34 přidání a 0 odebrání
  1. 34 0
      data/web/index.html

+ 34 - 0
data/web/index.html

@@ -164,6 +164,20 @@
       1000
     );
     
+    var sendCommand = _.throttle(
+      function(params) {
+        $.ajax(
+          '/system',
+          {
+            method: 'POST',
+            data: JSON.stringify(params),
+            contentType: 'application/json'
+          }
+        );
+      },
+      1000
+    )
+    
     var sniffRequest;
     var sniffing = false;
     var getTraffic = function() {
@@ -355,6 +369,10 @@
         updateGroup({command: $(this).data('command')});
       });
       
+      $('.system-btn').click(function() {
+        sendCommand({command: $(this).data('command')});
+      });
+      
       $('#sniff').click(function() {
         if (sniffing) {
           sniffRequest.abort();
@@ -750,6 +768,22 @@
         <pre id="sniffed-traffic"></pre>
       </div>
     </div>
+    
+    <div class="row header-row">
+      <div class="col-sm-12">
+        <h1>Admin</h1>
+      </div>
+    </div>
+    
+    <div>&nbsp;</div>
+    
+    <div class="row">
+      <div class="col-sm-12">
+        <button type="button" class="btn btn-danger system-btn" data-command="restart">
+          Restart
+        </button>
+      </div>
+    </div>
   </div>
 </body>
 </html>