diff --git a/app/assets/javascripts/controllers/reconfigure/reconfigure_form_controller.js b/app/assets/javascripts/controllers/reconfigure/reconfigure_form_controller.js index 62917fd27c7..711c409e999 100644 --- a/app/assets/javascripts/controllers/reconfigure/reconfigure_form_controller.js +++ b/app/assets/javascripts/controllers/reconfigure/reconfigure_form_controller.js @@ -66,16 +66,7 @@ ManageIQ.angular.app.controller('reconfigureFormController', ['$http', '$scope', }; vm.setEnableAddNetworkAdapterButton = function() { - var nrNetworksAfterReconfigure = 0; - angular.forEach(vm.reconfigureModel.vmNetworkAdapters, function(network) { - switch (network.add_remove) { - case "remove": - break; - default: - nrNetworksAfterReconfigure++; - break; - } - }); + var nrNetworksAfterReconfigure = _.reject(vm.reconfigureModel.vmNetworkAdapters, { add_remove: 'remove' }).length; vm.reconfigureModel.enableAddNetworkAdapterButton = (nrNetworksAfterReconfigure < 4); }; @@ -235,9 +226,9 @@ ManageIQ.angular.app.controller('reconfigureFormController', ['$http', '$scope', vm.processAddSelectedNetwork = function() { vm.reconfigureModel.vmNetworkAdapters.push( { - name: 'to be determined', + name: __('to be determined'), vlan: vm.reconfigureModel.vLan_requested, - mac: 'not available yet', + mac: __('not available yet'), add_remove: 'add', }); vm.resetAddNetworkAdapterValues(); @@ -291,8 +282,6 @@ ManageIQ.angular.app.controller('reconfigureFormController', ['$http', '$scope', add_remove: 'add'}); vm.resetAddValues(); vm.updateDisksAddRemove(); - - vm.cb_disks = vm.reconfigureModel.vmAddDisks.length > 0 || vm.reconfigureModel.vmRemoveDisks.length > 0; }; vm.enableDiskAdd = function() { @@ -330,8 +319,6 @@ ManageIQ.angular.app.controller('reconfigureFormController', ['$http', '$scope', } } vm.updateDisksAddRemove(); - - vm.cb_disks = vm.reconfigureModel.vmAddDisks.length > 0 || vm.reconfigureModel.vmRemoveDisks.length > 0; }; vm.cancelAddRemoveDisk = function(vmDisk) { diff --git a/app/controllers/mixins/actions/vm_actions/reconfigure.rb b/app/controllers/mixins/actions/vm_actions/reconfigure.rb index 6b86ed60bff..8dd2f52702d 100644 --- a/app/controllers/mixins/actions/vm_actions/reconfigure.rb +++ b/app/controllers/mixins/actions/vm_actions/reconfigure.rb @@ -192,11 +192,11 @@ def get_vlan_options(host_id) # determine available switches for this host... switch_ids = [] - HostSwitch.where("host_id = ?", host_id).each do |host_switch| + Rbac.filtered(HostSwitch.where("host_id = ?", host_id)).each do |host_switch| switch_ids << host_switch.switch_id end - Lan.where("switch_id IN (?)", switch_ids).each do |lan| + Rbac.filtered(Lan.where("switch_id IN (?)", switch_ids)).each do |lan| vlan_options << lan.name end vlan_options