1
0
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:
jaredevantabor 2016-12-14 17:05:15 -08:00
parent c4ce68b4de
commit 9e3b5abc37
3 changed files with 36 additions and 4 deletions

View File

@ -38,10 +38,42 @@ export function ProjectsList($scope, $rootScope, $location, $log, $stateParams,
$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);

View File

@ -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'
},

View File

@ -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();
});