scan on demand

pull/30/head
Ondřej Hruška 8 years ago
parent f6621252f6
commit 812feebf54
  1. 10
      html_orig/css/app.css
  2. 1
      html_orig/lang/en.php
  3. 20
      html_orig/pages/cfg_wifi.php
  4. 2
      html_orig/pages/cfg_wifi_conn.php
  5. 10
      html_orig/sass/pages/_wifi.scss

@ -845,7 +845,7 @@ form span.required {
#ap-list { #ap-list {
column-count: 1; } } column-count: 1; } }
#ap-loader, #ap-noscan { #ap-loader, #ap-noscan, #ap-scan {
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
border-radius: 5px; border-radius: 5px;
padding: 0.38198rem; padding: 0.38198rem;
@ -917,9 +917,11 @@ form span.required {
word-wrap: normal; } word-wrap: normal; }
.AP-preview-nil { .AP-preview-nil {
padding: 0.38198rem 0.61805rem; padding: 8px;
border-radius: 3px; border-radius: 5px;
border: 2px dashed black; } border: 1px dashed #ddd;
width: 250px;
height: 94px; }
.AP-preview .wrap { .AP-preview .wrap {
flex-direction: row; flex-direction: row;

@ -30,6 +30,7 @@ return [
'wifi.submit' => 'Apply!', 'wifi.submit' => 'Apply!',
'wifi.scanning' => 'Scanning', 'wifi.scanning' => 'Scanning',
'wifi.scan_now' => 'Start scanning!',
'wifi.cant_scan_no_sta' => 'Can\'t scan with Client mode disabled.', 'wifi.cant_scan_no_sta' => 'Can\'t scan with Client mode disabled.',
'wifi.select_ssid' => 'Available networks:', 'wifi.select_ssid' => 'Available networks:',

@ -85,7 +85,8 @@
<div id="ap-box"> <div id="ap-box">
<label><?= tr('wifi.select_ssid') ?></label> <label><?= tr('wifi.select_ssid') ?></label>
<div id="ap-loader"><?= tr('wifi.scanning') ?><span class="anim-dots">.</span></div> <div id="ap-scan"><a onclick="startScanning(); return false"><?= tr('wifi.scan_now') ?></a></div>
<div id="ap-loader" class="hidden"><?= tr('wifi.scanning') ?><span class="anim-dots">.</span></div>
<div id="ap-noscan" class="hidden"><?= tr('wifi.cant_scan_no_sta') ?></div> <div id="ap-noscan" class="hidden"><?= tr('wifi.cant_scan_no_sta') ?></div>
<div id="ap-list" class="hidden"></div> <div id="ap-list" class="hidden"></div>
</div> </div>
@ -238,6 +239,13 @@
}); });
} }
function startScanning() {
$('#ap-loader').removeClass('hidden');
$('#ap-scan').addClass('hidden');
$('#ap-loader .anim-dots').html('.');
scanAPs();
}
/** Ask the CGI what APs are visible (async) */ /** Ask the CGI what APs are visible (async) */
function scanAPs() { function scanAPs() {
$.get('http://'+_root+'<?= url('wifi_scan', true) ?>', onScan); $.get('http://'+_root+'<?= url('wifi_scan', true) ?>', onScan);
@ -263,12 +271,12 @@
obj.mode = +obj.mode; obj.mode = +obj.mode;
$('#ap-noscan').toggleClass('hidden', obj.mode != 2); $('#ap-noscan').toggleClass('hidden', obj.mode != 2);
$('#ap-loader').toggleClass('hidden', obj.mode == 2); $('#ap-scan').toggleClass('hidden', obj.mode == 2);
// scan if not AP // // scan if not AP
if (obj.mode != 2) { // if (obj.mode != 2) {
scanAPs(); // scanAPs();
} // }
} }
wifiInit({mode: '%opmode%'}); wifiInit({mode: '%opmode%'});

@ -6,7 +6,6 @@
</div> </div>
<script> <script>
(function() {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
var abortTmeo; var abortTmeo;
@ -49,5 +48,4 @@
} }
getStatus(); getStatus();
})();
</script> </script>

@ -13,7 +13,7 @@
margin: 0 (- dist(-3)); margin: 0 (- dist(-3));
} }
#ap-loader, #ap-noscan { #ap-loader, #ap-noscan, #ap-scan {
background: rgba(white, .1); background: rgba(white, .1);
border-radius: 5px; border-radius: 5px;
padding: dist(-2); padding: dist(-2);
@ -118,9 +118,11 @@
} }
.AP-preview-nil { .AP-preview-nil {
padding: dist(-2) dist(-1); padding: 8px;
border-radius: 3px; border-radius: 5px;
border: 2px dashed black; border: 1px dashed #ddd;
width: 250px;
height: 94px;
} }
.AP-preview { .AP-preview {

Loading…
Cancel
Save