瀏覽代碼

add restart button

Chris Mullins 8 年之前
父節點
當前提交
04aaabf783
共有 1 個文件被更改,包括 34 次插入0 次删除
  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>