mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
Merge pull request #4129 from mabashian/3959-template-type-column-v2
Fix the type column on the templates list
This commit is contained in:
commit
29cc5d0f2e
@ -30,8 +30,7 @@ export default
|
||||
},
|
||||
type: {
|
||||
label: i18n._('Type'),
|
||||
searchType: 'select',
|
||||
searchOptions: [], // will be set by Options call to job templates resource
|
||||
ngBind: 'template.type_label',
|
||||
columnClass: 'col-lg-2 col-md-2 col-sm-4 hidden-xs'
|
||||
},
|
||||
description: {
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', 'Alert',
|
||||
'TemplateList', 'Prompt', 'ClearScope', 'ProcessErrors', 'GetBasePath',
|
||||
'InitiatePlaybookRun', 'Wait', '$state', '$filter', 'Dataset', 'rbacUiControlService', 'TemplatesService',
|
||||
'QuerySet',
|
||||
'QuerySet', 'GetChoices',
|
||||
function(
|
||||
$scope, $rootScope, $location, $stateParams, Rest, Alert,
|
||||
TemplateList, Prompt, ClearScope, ProcessErrors, GetBasePath,
|
||||
InitiatePlaybookRun, Wait, $state, $filter, Dataset, rbacUiControlService, TemplatesService,
|
||||
qs
|
||||
qs, GetChoices
|
||||
) {
|
||||
ClearScope();
|
||||
|
||||
@ -38,6 +38,34 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', 'Al
|
||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||
|
||||
$rootScope.flashMessage = null;
|
||||
|
||||
if ($scope.removeChoicesReady) {
|
||||
$scope.removeChoicesReady();
|
||||
}
|
||||
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
|
||||
$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.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_job_templates'),
|
||||
field: 'type',
|
||||
variable: 'type_choices',
|
||||
callback: 'choicesReady'
|
||||
});
|
||||
}
|
||||
|
||||
$scope.$on(`ws-jobs`, function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user