mirror of
https://github.com/ansible/awx.git
synced 2026-01-23 07:28:02 -03:30
Merge pull request #5346 from jaredevantabor/rbac-users
Project types on permissions modal
This commit is contained in:
commit
8df1088c99
@ -123,6 +123,34 @@ export default ['addPermissionsTeamsList', 'addPermissionsUsersList', 'TemplateL
|
||||
_.forEach(scope[`${list.name}`], isSelected);
|
||||
});
|
||||
|
||||
scope.$on(`${list.iterator}_options`, function(event, data){
|
||||
scope.options = data.data.actions.GET;
|
||||
optionsRequestDataProcessing();
|
||||
});
|
||||
|
||||
// iterate over the list and add fields like type label, after the
|
||||
// OPTIONS request returns, or the list is sorted/paginated/searched
|
||||
function optionsRequestDataProcessing(){
|
||||
if(scope.list.name === 'projects'){
|
||||
if (scope[list.name] !== undefined) {
|
||||
scope[list.name].forEach(function(item, item_idx) {
|
||||
var itm = scope[list.name][item_idx];
|
||||
|
||||
// Set the item type label
|
||||
if (list.fields.scm_type && scope.options &&
|
||||
scope.options.hasOwnProperty('scm_type')) {
|
||||
scope.options.scm_type.choices.forEach(function(choice) {
|
||||
if (choice[0] === item.scm_type) {
|
||||
itm.type_label = choice[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isSelected(item){
|
||||
if(_.find(scope.allSelected, {id: item.id, type: item.type})){
|
||||
item.isSelected = true;
|
||||
|
||||
@ -56,12 +56,10 @@ export function CredentialsList($scope, $rootScope, $location, $log,
|
||||
// Set the item type label
|
||||
if (list.fields.kind && $scope.options &&
|
||||
$scope.options.hasOwnProperty('kind')) {
|
||||
$scope.options.kind.choices.every(function(choice) {
|
||||
$scope.options.kind.choices.forEach(function(choice) {
|
||||
if (choice[0] === item.kind) {
|
||||
itm.kind_label = choice[1];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -462,7 +460,7 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
||||
form: form,
|
||||
reset: false
|
||||
});
|
||||
|
||||
|
||||
master.kind = $scope.kind;
|
||||
|
||||
CreateSelect2({
|
||||
|
||||
@ -58,12 +58,10 @@ export function ProjectsList($scope, $rootScope, $location, $log, $stateParams,
|
||||
// Set the item type label
|
||||
if (list.fields.scm_type && $scope.options &&
|
||||
$scope.options.hasOwnProperty('scm_type')) {
|
||||
$scope.options.scm_type.choices.every(function(choice) {
|
||||
$scope.options.scm_type.choices.forEach(function(choice) {
|
||||
if (choice[0] === item.scm_type) {
|
||||
itm.type_label = choice[1];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@ -275,7 +273,7 @@ export function ProjectsList($scope, $rootScope, $location, $log, $stateParams,
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
$scope.projects.every(function(project) {
|
||||
$scope.projects.forEach(function(project) {
|
||||
if (project.id === project_id) {
|
||||
if (project.scm_type === "Manual" || Empty(project.scm_type)) {
|
||||
// Do not respond. Button appears greyed out as if it is disabled. Not disabled though, because we need mouse over event
|
||||
@ -286,9 +284,7 @@ export function ProjectsList($scope, $rootScope, $location, $log, $stateParams,
|
||||
} else {
|
||||
ProjectUpdate({ scope: $scope, project_id: project.id });
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -88,21 +88,17 @@ export default
|
||||
|
||||
// Set the item type label
|
||||
if (list.fields.type) {
|
||||
parent_scope.type_choices.every(function(choice) {
|
||||
parent_scope.type_choices.forEach(function(choice) {
|
||||
if (choice.value === item.type) {
|
||||
itm.type_label = choice.label;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
// Set the job status label
|
||||
parent_scope.status_choices.every(function(status) {
|
||||
parent_scope.status_choices.forEach(function(status) {
|
||||
if (status.value === item.status) {
|
||||
itm.status_label = status.label;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (list.name === 'completed_jobs' || list.name === 'running_jobs') {
|
||||
|
||||
@ -58,12 +58,10 @@
|
||||
// Set the item type label
|
||||
if (list.fields.type && $scope.options &&
|
||||
$scope.options.hasOwnProperty('type')) {
|
||||
$scope.options.type.choices.every(function(choice) {
|
||||
$scope.options.type.choices.forEach(function(choice) {
|
||||
if (choice[0] === item.type) {
|
||||
itm.type_label = choice[1];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
buildTooltips(itm);
|
||||
|
||||
@ -50,14 +50,12 @@
|
||||
// Set the item type label
|
||||
if (list.fields.notification_type && $scope.options &&
|
||||
$scope.options.hasOwnProperty('notification_type')) {
|
||||
$scope.options.notification_type.choices.every(function(choice) {
|
||||
$scope.options.notification_type.choices.forEach(function(choice) {
|
||||
if (choice[0] === item.notification_type) {
|
||||
itm.type_label = choice[1];
|
||||
var recent_notifications = itm.summary_fields.recent_notifications;
|
||||
itm.status = recent_notifications && recent_notifications.length > 0 ? recent_notifications[0].status : "none";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
setStatus(itm);
|
||||
|
||||
@ -60,12 +60,10 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
||||
|
||||
// Set the item type label
|
||||
if (list.fields.type && $scope.options && $scope.options.hasOwnProperty('type')) {
|
||||
$scope.options.type.choices.every(function(choice) {
|
||||
$scope.options.type.choices.forEach(function(choice) {
|
||||
if (choice[0] === item.type) {
|
||||
itm.type_label = choice[1];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -85,12 +85,10 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
||||
// Set the item type label
|
||||
if (list.fields.scm_type && $scope.options &&
|
||||
$scope.options.hasOwnProperty('scm_type')) {
|
||||
$scope.options.scm_type.choices.every(function(choice) {
|
||||
$scope.options.scm_type.choices.forEach(function(choice) {
|
||||
if (choice[0] === item.scm_type) {
|
||||
itm.type_label = choice[1];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@ -301,7 +299,7 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
$scope.projects.every(function(project) {
|
||||
$scope.projects.forEach(function(project) {
|
||||
if (project.id === project_id) {
|
||||
if (project.scm_type === "Manual" || Empty(project.scm_type)) {
|
||||
// Do not respond. Button appears greyed out as if it is disabled. Not disabled though, because we need mouse over event
|
||||
@ -312,9 +310,7 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
||||
} else {
|
||||
ProjectUpdate({ scope: $scope, project_id: project.id });
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -59,12 +59,10 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest',
|
||||
|
||||
// Set the item type label
|
||||
if (list.fields.type && $scope.options.hasOwnProperty('type')) {
|
||||
$scope.options.type.choices.every(function(choice) {
|
||||
$scope.options.type.choices.forEach(function(choice) {
|
||||
if (choice[0] === item.type) {
|
||||
itm.type_label = choice[1];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user