mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-13 04:28:41 +01:00
Working on wifi general settings
This commit is contained in:
parent
2b53e77a36
commit
4215177ebc
3 changed files with 66 additions and 13 deletions
|
|
@ -1,5 +1,5 @@
|
|||
$juci.module("router")
|
||||
.controller("InternetExHostPageCtrl", function($scope, $rpc, $config, $uci){
|
||||
.controller("InternetExHostPageCtrl", function($scope, $rpc, $config, $uci, $tr){
|
||||
$scope.exposedHostEnabled = 0;
|
||||
$scope.wan = {};
|
||||
$scope.lan = {};
|
||||
|
|
@ -27,10 +27,10 @@ $juci.module("router")
|
|||
};
|
||||
$scope.onSave = function(){
|
||||
$uci.set("firewall.dmz", $scope.dmz).done(function(){
|
||||
$scope.info_message = "Settings saved!";
|
||||
$scope.info_message = $tr("STR_SETTINGSSAVED");
|
||||
$scope.$apply();
|
||||
}).fail(function(){
|
||||
$scope.error_message = "Saving failed!";
|
||||
$scope.error_message = $tr("STR_SETTINGSSAVEFAILED");
|
||||
});
|
||||
setTimeout(function(){
|
||||
$scope.error_message = null;
|
||||
|
|
|
|||
|
|
@ -2,21 +2,27 @@
|
|||
<div ng-controller="WifiGeneralPageCtrl">
|
||||
<h2>General WiFi Settings</h2>
|
||||
<p>Your EasyBox supports the industry-wide WiFi standards, enabling easy wireless connection of your devices.</p>
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="col-md-11"><strong style="font-size: 1.2em">Wifi Network</strong></div>
|
||||
<div class="col-md-1"> <switch id="enabled" name="enabled" ng-model="wifiEnabled" class="green"></switch></div>
|
||||
<div class="col-md-1">
|
||||
<switch ng-show="!info" id="enabled" name="enabled" ng-model="wifiEnabled" ng-change="onWifiEnable" class="green"></switch>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="col-md-11"><strong style="font-size: 1.2em">Enable WiFi On/Off button on EasyBox</strong></div>
|
||||
<div class="col-md-1"> <switch id="enabled" name="enabled" ng-model="wifiButtonEnabled" class="green"></switch></div>
|
||||
<div class="col-md-1"><switch id="enabled" name="enabled" ng-model="wifiButtonEnabled" class="green"></switch></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="row" ng-show="wifiEnabled">
|
||||
<div class="alert alert-info" ng-show="info">
|
||||
<p translate><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> {{info}}</p>
|
||||
</div>
|
||||
<div class="row" ng-show="wifiCheckEnabled()">
|
||||
<h2>Setup</h2>
|
||||
<div class="col-md-6">
|
||||
<table class="table">
|
||||
|
|
@ -31,7 +37,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<div class="col-md-6"><strong style="font-size: 1.2em">Wifi Name (SSID)</strong></div>
|
||||
<div class="col-md-6"><input type="text" class="form-control" placeholder="Wifi Name"/></div>
|
||||
<div class="col-md-6"><input type="text" class="form-control" placeholder="Wifi Name" ng-model="main_wifi.interface.ssid"/></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -61,7 +67,7 @@
|
|||
<td>
|
||||
<div class="col-md-6"><strong style="font-size: 1.2em">Protection Mode</strong></div>
|
||||
<div class="col-md-6">
|
||||
<ui-select ng-model="selectedProtection"
|
||||
<ui-select ng-model="main_wifi.enc_mode"
|
||||
theme="bootstrap"
|
||||
search-enabled="false"
|
||||
>
|
||||
|
|
@ -77,7 +83,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<div class="col-md-6"><strong style="font-size: 1.2em">Wifi Password</strong></div>
|
||||
<div class="col-md-6"><input type="text" class="form-control" placeholder="Wifi Password" ng-mode="wifiPassword"/></div>
|
||||
<div class="col-md-6"><input type="text" class="form-control" placeholder="Wifi Password" ng-model="main_wifi.interface.key"/></div>
|
||||
<br style="clear: both"/>
|
||||
<div style="float: right;margin-top: 10px; margin-bottom: 10px;"><strong style="font-size: 1.2em;">Display Characters: <input type="checkbox"/></strong></div>
|
||||
<br style="clear: both"/>
|
||||
|
|
@ -99,13 +105,13 @@
|
|||
<tr>
|
||||
<td>
|
||||
<div class="col-md-6"><strong style="font-size: 1.2em">Wifi Name (SSID)</strong></div>
|
||||
<div class="col-md-6"><input type="text" class="form-control" placeholder="Wifi Name"/></div>
|
||||
<div class="col-md-6"><input type="text" class="form-control" placeholder="Wifi Name" ng-model="guest_wifi.interface.ssid"/></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="col-md-9"><strong style="font-size: 1.2em">Broadcast SSID</strong></div>
|
||||
<div class="col-md-3"> <switch id="enabled" name="enabled" ng-model="wifiBcastSSID" class="green"></switch></div>
|
||||
<div class="col-md-3"> <switch id="enabled" name="enabled" ng-model="guest_wifi.interface.broadcast_ssid" class="green"></switch></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -145,7 +151,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<div class="col-md-6"><strong style="font-size: 1.2em">Wifi Password</strong></div>
|
||||
<div class="col-md-6"><input type="text" class="form-control" placeholder="Wifi Password" ng-mode="wifiPassword"/></div>
|
||||
<div class="col-md-6"><input type="text" class="form-control" placeholder="Wifi Password" ng-model="guest_wifi.interface.key"/></div>
|
||||
<br style="clear: both"/>
|
||||
<div style="float: right;margin-top: 10px; margin-bottom: 10px;"><strong style="font-size: 1.2em;">Display Characters: <input type="checkbox"/></strong></div>
|
||||
<br style="clear: both"/>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
$juci.module("wifi")
|
||||
.controller("WifiGeneralPageCtrl", function($scope){
|
||||
.controller("WifiGeneralPageCtrl", function($scope, $uci, $tr){
|
||||
$scope.wifiEnabled = 1;
|
||||
$scope.mainWifiEnabled = 1;
|
||||
$scope.wifiButtonEnabled = 1;
|
||||
|
|
@ -23,4 +23,51 @@ $juci.module("wifi")
|
|||
label: "WEP"
|
||||
}];
|
||||
$scope.wifiPassword = "123123";
|
||||
|
||||
$scope.wifiCheckEnabled = function(){
|
||||
if(!$scope.radios) return 0;
|
||||
$scope.wifiEnabled = $scope.radios
|
||||
.filter(function(x) { return x.radio == "on"; })
|
||||
.length > 0;
|
||||
return $scope.wifiEnabled;
|
||||
}
|
||||
|
||||
$scope.onWifiEnable = function(){
|
||||
if(!$scope.radios) {
|
||||
$scope.wifiEnabled = !$scope.wifiEnabled;
|
||||
return;
|
||||
}
|
||||
var enabled = $scope.wifiEnabled;
|
||||
if(enabled) $scope.info = $tr("STR_ENABLINGWIFIRADIOS");
|
||||
else $scope.info = $tr("STR_DISABLINGWIFIRADIOS");
|
||||
async.eachSeries($scope.radios, function(radio, next) {
|
||||
radio.radio = ((enabled)?"on":"off");
|
||||
$uci.set("wireless."+radio[".name"], radio).always(function(){
|
||||
console.log("Disabling "+radio[".name"]+" "+radio.radio);
|
||||
next();
|
||||
});
|
||||
}, function(){
|
||||
$scope.info = null;
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
$scope.onGuestEnable = function(){
|
||||
|
||||
}
|
||||
$uci.show("wireless").done(function(interfaces){
|
||||
var list = Object.keys(interfaces)
|
||||
.map(function(x){ return interfaces[x]; });
|
||||
$scope.radios = list.filter(function(x) { return x[".name"].indexOf("wl") == 0; });
|
||||
$scope.virtual_radios = list.filter(function(x) { return x.device && x[".name"].indexOf("wl") != 0; });
|
||||
if($scope.virtual_radios.length > 0) { // TODO: get main/guest from config
|
||||
var radio = $scope.virtual_radios[0];
|
||||
$scope.main_wifi = { interface: radio, device: interfaces[radio.device] };
|
||||
}
|
||||
if($scope.virtual_radios.length > 1) { // TODO: get main/guest from config
|
||||
var radio = $scope.virtual_radios[1];
|
||||
$scope.guest_wifi = { interface: radio, device: interfaces[radio.device] };
|
||||
}
|
||||
$scope.guestWifiEnabled = $scope.guest_wifi.interface.up == '1';
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue