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