Skip to content

Commit

Permalink
Fixes #33036 - Make via Katello-agent option clickable on content hos…
Browse files Browse the repository at this point in the history
…t errata page
  • Loading branch information
lfu authored and jturel committed Jul 20, 2021
1 parent e919b8f commit b31dcd8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/katello/api/v2/host_errata_controller.rb
Expand Up @@ -115,7 +115,7 @@ def find_errata_ids
fail HttpErrors::NotFound, _("Couldn't find errata ids '%s'") % missing.to_sentence if missing.any?
@errata_ids = params[:errata_ids]
else
@errata_ids = find_bulk_errata_ids([@host], params[:bulk_errata_ids].to_json)
@errata_ids = find_bulk_errata_ids([@host], params[:bulk_errata_ids])
end
end
end
Expand Down
Expand Up @@ -126,7 +126,7 @@ angular.module('Bastion.content-hosts').controller('ContentHostErrataController'

$scope.performViaKatelloAgent = function () {
var errataIds = $scope.selectedErrataIds();
HostErratum.apply({id: $scope.host.id, 'bulk_errata_ids': errataIds},
HostErratum.apply({id: $scope.host.id, 'bulk_errata_ids': angular.toJson(errataIds)},
function (task) {
$scope.table.selectAll(false);
$scope.transitionTo('content-host.tasks.details', {taskId: task.id});
Expand Down
Expand Up @@ -99,12 +99,13 @@ describe('Controller: ContentHostErrataController', function() {
});

it("provide a way to apply errata", function() {
var bulk_errata_ids = angular.toJson({included: { ids: [mockErratum.errata_id], params: {} }});

spyOn(HostErratum, "apply").and.callThrough();
spyOn($scope.table, "selectAll");
spyOn($scope, "transitionTo");
$scope.applySelected();
expect(HostErratum.apply).toHaveBeenCalledWith({id: host.id, bulk_errata_ids: {included: { ids: [mockErratum.errata_id], params: {} }}},
jasmine.any(Function));
expect(HostErratum.apply).toHaveBeenCalledWith({id: host.id, bulk_errata_ids: bulk_errata_ids}, jasmine.any(Function));
expect($scope.transitionTo).toHaveBeenCalledWith('content-host.tasks.details', {taskId: mockTask.id});
expect($scope.table.selectAll).toHaveBeenCalledWith(false);
});
Expand Down

0 comments on commit b31dcd8

Please sign in to comment.