mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 11:11:07 -03:30
fix for type labels for organizations.projects and organizations.job-templates
This commit is contained in:
@@ -38,6 +38,34 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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.type && $scope.options && $scope.options.hasOwnProperty('type')) {
|
||||||
|
$scope.options.type.choices.every(function(choice) {
|
||||||
|
if (choice[0] === item.type) {
|
||||||
|
itm.type_label = choice[1];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$scope.addJobTemplate = function() {
|
$scope.addJobTemplate = function() {
|
||||||
$state.go('jobTemplates.add');
|
$state.go('jobTemplates.add');
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -66,6 +66,39 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// buildTooltips(itm);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Go out and get the organization
|
// Go out and get the organization
|
||||||
Rest.setUrl(orgBase + $stateParams.organization_id);
|
Rest.setUrl(orgBase + $stateParams.organization_id);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
|
|||||||
@@ -298,6 +298,7 @@ export default [{
|
|||||||
list.searchSize = "col-lg-12 col-md-12 col-sm-12 col-xs-12";
|
list.searchSize = "col-lg-12 col-md-12 col-sm-12 col-xs-12";
|
||||||
list.iterator = 'job_template';
|
list.iterator = 'job_template';
|
||||||
list.name = 'job_templates';
|
list.name = 'job_templates';
|
||||||
|
list.fields.type.ngBind = "job_template.type_label";
|
||||||
return list;
|
return list;
|
||||||
}],
|
}],
|
||||||
OrgJobTemplateDataset: ['OrgJobTemplateList', 'QuerySet', '$stateParams', 'GetBasePath',
|
OrgJobTemplateDataset: ['OrgJobTemplateList', 'QuerySet', '$stateParams', 'GetBasePath',
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ export default ['$scope', '$filter',
|
|||||||
var singleJobStatus = true;
|
var singleJobStatus = true;
|
||||||
var firstJobStatus;
|
var firstJobStatus;
|
||||||
var recentJobs = $scope.jobs;
|
var recentJobs = $scope.jobs;
|
||||||
|
if(!recentJobs){
|
||||||
|
return;
|
||||||
|
}
|
||||||
var sparkData =
|
var sparkData =
|
||||||
_.sortBy(recentJobs.map(function(job) {
|
_.sortBy(recentJobs.map(function(job) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user