Added static dhcp

This commit is contained in:
Martin Schröder 2015-05-28 15:03:29 +02:00 committed by Martin Schröder
parent 49e1147eee
commit 98e0c2abd3
2 changed files with 15 additions and 7 deletions

View file

@ -40,6 +40,7 @@
</luci-config-lines>
<div ng-show="dhcp.ignore.value">
<hr/>
<h3 translate>Static DHCP</h3>
<table class="table">
<thead>
<th translate>Device Name</th>
@ -57,20 +58,21 @@
<td>
<input type="text" class="form-control" ng-model="host.ip.value"/>
</td>
<td>
<button class="btn btn-default" ng-click="onAddExistingHost()"><i class="fa fa-plus"></i></button>
<td style="white-space: nowrap">
<!--<button class="btn btn-default" style="display: inline-block; float: none;" ng-click="onAddExistingHost()"><i class="fa fa-plus"></i></button>-->
<button class="btn btn-default" style="display: inline-block; float: none;" ng-click="onRemoveStaticDHCP(host)"><i class="fa fa-trash-o"></i></button>
</td>
</tr>
<tr>
<td colspan="3"></td>
<td >
<td colspan="2"></td>
<td style="text-align: right;">
<luci-select ng-model="existingHost" ng-items="hosts" on-change="onAddExistingHost()" placeholder="{{'Add existing host'|translate}}"/>
</td>
<td style="text-align: right;">
<button class="btn btn-default" ng-click="onAddStaticDHCP()"><i class="fa fa-plus"></i></button>
</td>
</tr>
</table>
<div class="pull-right">
<luci-select ng-model="existingHost" ng-items="hosts" on-change="onAddExistingHost()" placeholder="{{'Add existing host'|translate}}"/>
</div>
</div>
</div>
</div>

View file

@ -45,6 +45,12 @@ JUCI.app
$scope.$apply();
});
}
$scope.onRemoveStaticDHCP = function(host){
if(!host) return;
host.$delete().done(function(){
$scope.$apply();
});
}
$scope.onAddExistingHost = function(){
var item = $scope.existingHost;
$uci.dhcp.create({