mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
fixing post-processing for projects list
This commit is contained in:
parent
c4ce68b4de
commit
9e3b5abc37
@ -37,11 +37,43 @@ export function ProjectsList($scope, $rootScope, $location, $log, $stateParams,
|
||||
_.forEach($scope[list.name], buildTooltips);
|
||||
$rootScope.flashMessage = null;
|
||||
}
|
||||
|
||||
$scope.$watch(`${list.name}`, function() {
|
||||
_.forEach($scope[list.name], buildTooltips);
|
||||
|
||||
$scope.$on(`${list.iterator}_options`, function(event, data){
|
||||
$scope.options = data.data.actions.GET;
|
||||
optionsRequestDataProcessing();
|
||||
});
|
||||
|
||||
$scope.$watchCollection(`${$scope.list.name}`, function() {
|
||||
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(){
|
||||
$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.every(function(choice) {
|
||||
if (choice[0] === item.scm_type) {
|
||||
itm.type_label = choice[1];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
_.forEach($scope[list.name], buildTooltips);
|
||||
|
||||
});
|
||||
}
|
||||
// $scope.$watch(`${list.name}`, function() {
|
||||
// _.forEach($scope[list.name], buildTooltips);
|
||||
// });
|
||||
|
||||
function buildTooltips(project) {
|
||||
project.statusIcon = GetProjectIcon(project.status);
|
||||
project.statusTip = GetProjectToolTip(project.status);
|
||||
|
@ -46,6 +46,7 @@ export default
|
||||
},
|
||||
scm_type: {
|
||||
label: i18n._('Type'),
|
||||
ngBind: 'project.type_label',
|
||||
excludeModal: true,
|
||||
columnClass: 'col-lg-3 col-md-2 col-sm-3 hidden-xs'
|
||||
},
|
||||
|
@ -43,7 +43,6 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest',
|
||||
}
|
||||
|
||||
$scope.$on(`${list.iterator}_options`, function(event, data){
|
||||
debugger;
|
||||
$scope.options = data.data.actions.GET;
|
||||
optionsRequestDataProcessing();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user