Skip to content

Commit

Permalink
Fixes #5102, BZ1084855, limit sync plan add list to enabled products.
Browse files Browse the repository at this point in the history
  • Loading branch information
Walden Raines committed Apr 8, 2014
1 parent fccd6c6 commit 3d6110f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 3 additions & 1 deletion app/controllers/katello/api/v2/sync_plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def destroy
param_group :search, Api::V2::ApiController
param :name, String, :desc => "product name to filter by"
def available_products
filters = [:terms => {:id => Product.all_readable(@sync_plan.organization).pluck(:id) - @sync_plan.product_ids}]
enabled_product_ids = Product.all_readable(@sync_plan.organization).select{|p| p.enabled?}.collect(&:id)

filters = [:terms => {:id => enabled_product_ids - @sync_plan.product_ids}]
filters << {:term => {:name => params[:name].downcase}} if params[:name]

options = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ angular.module('Bastion.sync-plans').controller('SyncPlanAddProductsController',
$scope.errorMessages = [];

params = {
'search': $location.search().search || "",
'sort_by': 'name',
'sort_order': 'ASC',
'paged': true,
'id': $scope.$stateParams.syncPlanId
'search': $location.search().search || "",
'sort_by': 'name',
'sort_order': 'ASC',
'full_result': true,
'id': $scope.$stateParams.syncPlanId
};

productsNutupane = new Nutupane(SyncPlan, params, 'availableProducts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ angular.module('Bastion.sync-plans').controller('SyncPlanProductsController',
$scope.errorMessages = [];

params = {
'id': $scope.$stateParams.syncPlanId,
'search': $location.search().search || "",
'sort_by': 'name',
'sort_order': 'ASC',
'paged': true
'id': $scope.$stateParams.syncPlanId,
'search': $location.search().search || "",
'sort_by': 'name',
'sort_order': 'ASC',
'full_result': true
};

productsNutupane = new Nutupane(SyncPlan, params, 'products');
Expand Down

0 comments on commit 3d6110f

Please sign in to comment.