engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.controller.js in katello-3.15.3.1 vs engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.controller.js in katello-3.16.0.rc1
- old
+ new
@@ -16,20 +16,25 @@
* Provides the functionality specific to errata for use with the Nutupane UI pattern.
* Defines the columns to display and the transform function for how to generate each row
* within the table.
*/
angular.module('Bastion.errata').controller('ErrataController',
- ['$scope', '$state', '$location', 'translate', 'Nutupane', 'Erratum', 'IncrementalUpdate', 'Repository', 'CurrentOrganization',
- function ($scope, $state, $location, translate, Nutupane, Erratum, IncrementalUpdate, Repository, CurrentOrganization) {
+ ['$scope', '$state', '$stateParams', '$location', 'translate', 'Nutupane', 'Erratum', 'IncrementalUpdate', 'Repository', 'CurrentOrganization',
+ function ($scope, $state, $stateParams, $location, translate, Nutupane, Erratum, IncrementalUpdate, Repository, CurrentOrganization) {
var nutupane, params = {
'organization_id': CurrentOrganization,
'search': $location.search().search || "",
'sort_by': 'updated',
'sort_order': 'DESC',
'paged': true,
- 'errata_restrict_applicable': true
+ 'errata_restrict_applicable': false,
+ 'disableAutoLoad': true
};
+ var repoId = $stateParams.repositoryId;
+ if (repoId) {
+ params['repository_id'] = repoId;
+ }
nutupane = $scope.nutupane = new Nutupane(Erratum, params);
$scope.controllerName = 'katello_errata';
$scope.table = nutupane.table;
$scope.removeRow = nutupane.removeRow;
@@ -41,19 +46,23 @@
$scope.repository = {name: translate('All Repositories'), id: 'all'};
Repository.queryUnpaged({'organization_id': CurrentOrganization, 'content_type': 'yum', 'with_content': 'erratum'}, function (response) {
$scope.repositories = [$scope.repository];
$scope.repositories = $scope.repositories.concat(response.results);
-
+ if (repoId) {
+ $scope.repository = _.find($scope.repositories, function (repository) {
+ return repository.id === repoId;
+ });
+ }
if ($location.search().repositoryId) {
$scope.repository = _.find($scope.repositories, function (repository) {
return repository.id === parseInt($location.search().repositoryId, 10);
});
}
});
- $scope.showApplicable = true;
+ $scope.showApplicable = false;
$scope.showInstallable = false;
$scope.toggleFilters = function () {
if ($scope.showInstallable === true) {
$scope.showApplicable = true;
@@ -65,10 +74,10 @@
};
$scope.$watch('repository', function (repository) {
var nutupaneParams = nutupane.getParams();
- if (repository.id === 'all') {
+ if (repository && repository.id === 'all') {
nutupaneParams['repository_id'] = null;
nutupane.setParams(nutupaneParams);
} else {
$location.search('repositoryId', repository.id);
nutupaneParams['repository_id'] = repository.id;