Merge pull request #4125 from jaredevantabor/job-list-labels

adding labels for job type on jobs list
This commit is contained in:
Jared Tabor 2016-11-28 11:35:58 -08:00 committed by GitHub
commit 4aea3ebc5b

View File

@ -13,7 +13,7 @@
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();
@ -30,6 +30,34 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $
$scope.showJobType = true;
_.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) {
@ -101,5 +129,5 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $
}
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'
];