浏览代码

add update AP button

Christian Herzog 5 年之前
父节点
当前提交
fc1c0a4bd2
共有 3 个文件被更改,包括 17 次插入5 次删除
  1. 9 4
      components/wifi-manager/code.js
  2. 3 1
      components/wifi-manager/index.html
  3. 5 0
      components/wifi-manager/style.css

+ 9 - 4
components/wifi-manager/code.js

@@ -54,7 +54,7 @@ function startCheckStatusInterval(){
 
 function startRefreshAPInterval(){
     RefreshAPIIntervalActive = true;
-    refreshAPInterval = setTimeout(refreshAP, 2800);
+    refreshAPInterval = setTimeout(refreshAP(false), 2800);
 }
 
 function RepeatCheckStatusInterval(){
@@ -430,8 +430,13 @@ $(document).ready(function(){
         enableStatusTimer = true;
     });
 
+    $('#updateAP').on("click", function(){
+        refreshAP(true);
+        console.log("refresh AP");
+    });
+
     //first time the page loads: attempt to get the connection status and start the wifi scan
-    refreshAP();
+    refreshAP(false);
     getConfig();
 
     //start timers
@@ -518,8 +523,8 @@ function rssiToIcon(rssi){
     }
 }
 
-function refreshAP(){
-    if (!enableAPTimer) return;
+function refreshAP(force){
+    if (!enableAPTimer && !force) return;
     $.getJSON( "/ap.json", function( data ) {
         if(data.length > 0){
             //sort by signal strength

+ 3 - 1
components/wifi-manager/index.html

@@ -60,7 +60,9 @@
                         <section id="manual_add">
                             <div class="ape">ADD (HIDDEN) SSID</div>
                         </section>
-                        <h2>or choose a network...</h2>
+                        <h2>or choose a network...
+                        <button type="button" id="updateAP" class="btn btn-info btn-sm">Update</button>
+                        </h2>
                         <section id="wifi-list">
                         </section>
                     </div>

+ 5 - 0
components/wifi-manager/style.css

@@ -362,3 +362,8 @@ tr.hide {
     float: right;
     display: none;
 }
+
+button#updateAP {
+    float: right;
+    display: inline;
+}