-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #4821, content views allow inclusion/exclusion of repos via fil…
…ter UI.
- Loading branch information
Walden Raines
committed
Mar 28, 2014
1 parent
1d29f92
commit 6d5c514
Showing
21 changed files
with
718 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...ssets/javascripts/bastion/content-views/details/filters/filter-repositories.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* Copyright 2014 Red Hat, Inc. | ||
* | ||
* This software is licensed to you under the GNU General Public | ||
* License as published by the Free Software Foundation; either version | ||
* 2 of the License (GPLv2) or (at your option) any later version. | ||
* There is NO WARRANTY for this software, express or implied, | ||
* including the implied warranties of MERCHANTABILITY, | ||
* NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should | ||
* have received a copy of GPLv2 along with this software; if not, see | ||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. | ||
*/ | ||
|
||
/** | ||
* @ngdoc object | ||
* @name Bastion.content-views.controller:FilterRepositoriesController | ||
* | ||
* @requires $scope | ||
* @requires gettext | ||
* @requires Filter | ||
* @requires ContentViewRepositoriesUtl | ||
* | ||
* @description | ||
* Provides a way for users to select which repositories the filter applies to. | ||
*/ | ||
angular.module('Bastion.content-views').controller('FilterRepositoriesController', | ||
['$scope', 'gettext', 'Filter', 'ContentViewRepositoriesUtil', | ||
function ($scope, gettext, Filter, ContentViewRepositoriesUtil) { | ||
var refreshTable, success, error; | ||
|
||
ContentViewRepositoriesUtil($scope); | ||
|
||
refreshTable = function (filter) { | ||
$scope.$parent.filter = filter; | ||
|
||
var displayedRepositories = filter['content_view'].repositories, | ||
filterRepositories = filter.repositories; | ||
|
||
if (filterRepositories.length === 0) { | ||
displayedRepositories = _.map(displayedRepositories, function (repository) { | ||
repository.selected = true; | ||
return repository; | ||
}); | ||
} else { | ||
displayedRepositories = _.map(displayedRepositories, function (repository) { | ||
repository.selected = _.pluck(filterRepositories, 'id').indexOf(repository.id) >= 0; | ||
return repository; | ||
}); | ||
} | ||
|
||
$scope.repositoriesTable.rows = displayedRepositories; | ||
$scope.showRepos = filterRepositories.length !== 0; | ||
}; | ||
|
||
success = function (filter) { | ||
refreshTable(filter); | ||
$scope.successMessages = [gettext('Affected repositories have been updated.')]; | ||
}; | ||
|
||
error = function (response) { | ||
$scope.errorMessages = response.data.errors; | ||
}; | ||
|
||
$scope.successMessages = []; | ||
$scope.errorMessages = []; | ||
$scope.showRepos = false; | ||
$scope.repositoriesTable = {}; | ||
|
||
$scope.filter.$promise.then(refreshTable); | ||
|
||
$scope.updateRepositories = function () { | ||
var repositoryIds = _.pluck($scope.repositoriesTable.getSelected(), 'id'); | ||
|
||
if (repositoryIds.length === 0) { | ||
$scope.errorMessages = [gettext('You must select at least one repository.')]; | ||
} else { | ||
Filter.update({id: $scope.filter.id, 'repository_ids': repositoryIds}, success, error); | ||
} | ||
}; | ||
|
||
$scope.selectAllRepositories = function () { | ||
Filter.update({id: $scope.filter.id, 'repository_ids': []}, success, error); | ||
}; | ||
}] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
...ls/filters/views/errata-filter-table.html → .../filters/views/errata-filter-details.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ion/app/assets/javascripts/bastion/content-views/details/filters/views/errata-filter.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 35 additions & 5 deletions
40
...on/app/assets/javascripts/bastion/content-views/details/filters/views/filter-details.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.