mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-28 01:47:19 +01:00
Added dynamic wifi signal indicator
This commit is contained in:
parent
2cf8bde6b9
commit
9be73d94c4
6 changed files with 48 additions and 5 deletions
|
|
@ -8,8 +8,9 @@ angular.module("luci")
|
|||
"status_led": { dvalue: true, type: Boolean },
|
||||
"power_led": { dvalue: true, type: Boolean },
|
||||
"power_led_br": { dvalue: 100, type: Number },
|
||||
"wifibutton": { dvalue: true, type: Boolean },
|
||||
"wpsbutton": { dvalue: true, type: Boolean }
|
||||
"wifibutton": { dvalue: true, type: Boolean },
|
||||
"wpsbutton": { dvalue: true, type: Boolean },
|
||||
"wpsdevicepin": { dvalue: true, type: Boolean }
|
||||
},
|
||||
"firewall-defaults": {
|
||||
"syn_flood": { dvalue: true, type: Boolean },
|
||||
|
|
@ -53,7 +54,7 @@ angular.module("luci")
|
|||
"ping_wan": { dvalue: false, type: Boolean }
|
||||
},
|
||||
"wifi-status": {
|
||||
"wlan": { dvalue: true, type: Boolean },
|
||||
"wlan": { dvalue: true, type: Boolean },
|
||||
"wps": { dvalue: true, type: Boolean },
|
||||
"schedule": { dvalue: false, type: Boolean },
|
||||
"sched_status": { dvalue: false, type: Boolean }
|
||||
|
|
|
|||
|
|
@ -42,7 +42,10 @@
|
|||
<td>
|
||||
<div class="col-md-2"><i class="fa fa-desktop fa-2x"></i></div>
|
||||
<div class="col-md-8">{{client.hostname}}<br/>{{client.ipaddr}}</div>
|
||||
<div ng-show="client.connected" class="col-md-2" style="color: #a9b400"><i class="fa fa-signal fa-2x"></i></div>
|
||||
<div ng-show="client.connected" class="col-md-2" style="color: #a9b400">
|
||||
<wifi-signal-indicator ng-model="client.snr"></wifi-signal-indicator>
|
||||
<!--<i class="fa fa-signal fa-2x"></i>-->
|
||||
</div>
|
||||
<div ng-show="!client.connected" class="col-md-2" style="color: #eee"><i class="fa fa-signal fa-2x"></i></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -48,5 +48,5 @@ $juci.module("core")
|
|||
});
|
||||
});
|
||||
} refresh();
|
||||
setInterval(refresh, 5000);
|
||||
//setInterval(refresh, 5000);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
"widgets/luci.nav",
|
||||
"widgets/luci.navbar",
|
||||
"widgets/luci.top_bar",
|
||||
"widgets/wifi.signal.indicator",
|
||||
"widgets/uci.firewall.nat.rule.edit",
|
||||
"widgets/core.modal",
|
||||
"widgets/luci.input.port"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
<div style="width: 40px; position: relative; ">
|
||||
<div ng-repeat="bar in bars track by $index" ng-style="barStyle($index, bar)"></div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
$juci.module("core")
|
||||
.directive("wifiSignalIndicator", function($compile, $parse){
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
return {
|
||||
templateUrl: plugin_root+"/widgets/wifi.signal.indicator.html",
|
||||
scope: {
|
||||
value: "=ngModel"
|
||||
},
|
||||
controller: "wifiSignalIndicator",
|
||||
replace: true,
|
||||
require: "^ngModel"
|
||||
};
|
||||
}).controller("wifiSignalIndicator", function($scope, $uci, $rpc){
|
||||
var step = 100 / 4;
|
||||
$scope.bars = [false, false, false, false];
|
||||
$scope.$watch("value", function(value){
|
||||
$scope.bars[0] = true;
|
||||
$scope.bars[1] = $scope.bars[2] = $scope.bars[3] = false;
|
||||
if(value > step) $scope.bars[1] = true;
|
||||
if(value > (step * 2)) $scope.bars[2] = true;
|
||||
if(value > (step * 3)) $scope.bars[3] = true;
|
||||
});
|
||||
$scope.barStyle = function(idx, active){
|
||||
var height = 5 + ((idx) * 5);
|
||||
var top = 20 - height;
|
||||
return {
|
||||
"position": "absolute",
|
||||
"width": "6px",
|
||||
"height": ""+height+"px",
|
||||
"background-color": (active)?"#aab400":"#d5d5d5",
|
||||
"top": ""+top+"px",
|
||||
"left": ""+(idx * 8)+"px"
|
||||
};
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue