~ubuntudotcom1/maas/bug-1438977-rename-zone-no-delete

« back to all changes in this revision

Viewing changes to src/maasserver/static/js/angular/controllers/add_device.js

  • Committer: ubuntudotcom1
  • Date: 2015-04-23 20:02:16 UTC
  • mfrom: (3828.2.10 maas)
  • Revision ID: ubuntudotcom1-20150423200216-3j5jn2c82itloyn4
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
            if(!ValidationService.validateIP($scope.device.ipAddress)) {
140
140
                return true;
141
141
            }
142
 
            var i, inRange, managedInterfaces = $scope.getManagedInterfaces();
 
142
            var i, inNetwork, managedInterfaces = $scope.getManagedInterfaces();
143
143
            if(angular.isObject($scope.device.ipAssignment)){
144
144
                if($scope.device.ipAssignment.name === "external") {
145
145
                    // External IP address cannot be within a managed interface
146
146
                    // on one of the clusters.
147
147
                    for(i = 0; i < managedInterfaces.length; i++) {
148
 
                        inRange = ValidationService.validateIPInRange(
 
148
                        inNetwork = ValidationService.validateIPInNetwork(
149
149
                            $scope.device.ipAddress,
150
150
                            managedInterfaces[i].network);
151
 
                        if(inRange) {
 
151
                        if(inNetwork) {
152
152
                            return true;
153
153
                        }
154
154
                    }
158
158
                    // of the selected clusterInterface.
159
159
                    var clusterInterface = getInterfaceById(
160
160
                        $scope.device.clusterInterfaceId);
161
 
                    inRange = ValidationService.validateIPInRange(
 
161
                    inNetwork = ValidationService.validateIPInNetwork(
162
162
                        $scope.device.ipAddress, clusterInterface.network);
163
 
                    if(!inRange) {
 
163
                    var inDynamicRange = ValidationService.validateIPInRange(
 
164
                        $scope.device.ipAddress, clusterInterface.network,
 
165
                        clusterInterface.dynamic_range.low,
 
166
                        clusterInterface.dynamic_range.high);
 
167
                    if(!inNetwork || inDynamicRange) {
164
168
                        return true;
165
169
                    }
166
170
                }