mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 15:06:02 -03:30
Merge pull request #4125 from jaredevantabor/job-list-labels
adding labels for job type on jobs list
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
export function JobsListController($state, $rootScope, $log, $scope, $compile, $stateParams,
|
export function JobsListController($state, $rootScope, $log, $scope, $compile, $stateParams,
|
||||||
ClearScope, Find, DeleteJob, RelaunchJob, AllJobsList, ScheduledJobsList, GetBasePath, Dataset) {
|
ClearScope, Find, DeleteJob, RelaunchJob, AllJobsList, ScheduledJobsList, GetBasePath, Dataset, GetChoices) {
|
||||||
|
|
||||||
ClearScope();
|
ClearScope();
|
||||||
|
|
||||||
@@ -30,6 +30,34 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $
|
|||||||
$scope.showJobType = true;
|
$scope.showJobType = true;
|
||||||
|
|
||||||
_.forEach($scope[list.name], buildTooltips);
|
_.forEach($scope[list.name], buildTooltips);
|
||||||
|
if ($scope.removeChoicesReady) {
|
||||||
|
$scope.removeChoicesReady();
|
||||||
|
}
|
||||||
|
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
|
||||||
|
$scope[list.name].forEach(function(item, item_idx) {
|
||||||
|
var fld, field,
|
||||||
|
itm = $scope[list.name][item_idx];
|
||||||
|
|
||||||
|
// Set the item type label
|
||||||
|
if (list.fields.type) {
|
||||||
|
$scope.type_choices.every(function(choice) {
|
||||||
|
if (choice.value === item.type) {
|
||||||
|
itm.type_label = choice.label;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
GetChoices({
|
||||||
|
scope: $scope,
|
||||||
|
url: GetBasePath('unified_jobs'),
|
||||||
|
field: 'type',
|
||||||
|
variable: 'type_choices',
|
||||||
|
callback: 'choicesReady'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildTooltips(job) {
|
function buildTooltips(job) {
|
||||||
@@ -101,5 +129,5 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $
|
|||||||
}
|
}
|
||||||
|
|
||||||
JobsListController.$inject = ['$state', '$rootScope', '$log', '$scope', '$compile', '$stateParams',
|
JobsListController.$inject = ['$state', '$rootScope', '$log', '$scope', '$compile', '$stateParams',
|
||||||
'ClearScope', 'Find', 'DeleteJob', 'RelaunchJob', 'AllJobsList', 'ScheduledJobsList', 'GetBasePath', 'Dataset'
|
'ClearScope', 'Find', 'DeleteJob', 'RelaunchJob', 'AllJobsList', 'ScheduledJobsList', 'GetBasePath', 'Dataset', 'GetChoices'
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user