fix(js/set-repo-permissions): chk not null before iterating
This commit is contained in:
parent
65fa59fceb
commit
bdb86fdc10
1 changed files with 12 additions and 6 deletions
|
@ -39,6 +39,9 @@ angular.module('quay').directive('setRepoPermissions', function () {
|
||||||
|
|
||||||
var checkForChanges = function() {
|
var checkForChanges = function() {
|
||||||
var hasChanges = false;
|
var hasChanges = false;
|
||||||
|
if (!$scope.repositories) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.repositories.forEach(function(repo) {
|
$scope.repositories.forEach(function(repo) {
|
||||||
if (repo['permission'] != repo['original_permission']) {
|
if (repo['permission'] != repo['original_permission']) {
|
||||||
|
@ -51,6 +54,9 @@ angular.module('quay').directive('setRepoPermissions', function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleRepoCheckChange = function() {
|
var handleRepoCheckChange = function() {
|
||||||
|
if (!$scope.repositories) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$scope.repositories.forEach(function(repo) {
|
$scope.repositories.forEach(function(repo) {
|
||||||
if ($scope.checkedRepos.isChecked(repo)) {
|
if ($scope.checkedRepos.isChecked(repo)) {
|
||||||
if (repo['permission'] == 'none') {
|
if (repo['permission'] == 'none') {
|
||||||
|
@ -121,6 +127,11 @@ angular.module('quay').directive('setRepoPermissions', function () {
|
||||||
$scope.currentNamespace = $scope.namespace;
|
$scope.currentNamespace = $scope.namespace;
|
||||||
|
|
||||||
var repos = [];
|
var repos = [];
|
||||||
|
if (!resp || !resp['repositories'] || resp['repositories'].length == 0) {
|
||||||
|
$scope.repositoriesLoaded({'repositories': []});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
resp['repositories'].forEach(function(repo) {
|
resp['repositories'].forEach(function(repo) {
|
||||||
var existingPermission = existingPermissionsMap[repo.name] || 'none';
|
var existingPermission = existingPermissionsMap[repo.name] || 'none';
|
||||||
|
|
||||||
|
@ -134,11 +145,6 @@ angular.module('quay').directive('setRepoPermissions', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (repos.length == 0) {
|
|
||||||
$scope.repositoriesLoaded({'repositories': repos});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.repositories = repos;
|
$scope.repositories = repos;
|
||||||
$scope.checkedRepos = UIService.createCheckStateController($scope.repositories, 'name');
|
$scope.checkedRepos = UIService.createCheckStateController($scope.repositories, 'name');
|
||||||
|
|
||||||
|
@ -232,4 +238,4 @@ angular.module('quay').directive('setRepoPermissions', function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return directiveDefinitionObject;
|
return directiveDefinitionObject;
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue