mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 20:50:06 -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:
@@ -30,8 +30,7 @@ export default
|
|||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
label: i18n._('Type'),
|
label: i18n._('Type'),
|
||||||
searchType: 'select',
|
ngBind: 'template.type_label',
|
||||||
searchOptions: [], // will be set by Options call to job templates resource
|
|
||||||
columnClass: 'col-lg-2 col-md-2 col-sm-4 hidden-xs'
|
columnClass: 'col-lg-2 col-md-2 col-sm-4 hidden-xs'
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', 'Alert',
|
export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', 'Alert',
|
||||||
'TemplateList', 'Prompt', 'ClearScope', 'ProcessErrors', 'GetBasePath',
|
'TemplateList', 'Prompt', 'ClearScope', 'ProcessErrors', 'GetBasePath',
|
||||||
'InitiatePlaybookRun', 'Wait', '$state', '$filter', 'Dataset', 'rbacUiControlService', 'TemplatesService',
|
'InitiatePlaybookRun', 'Wait', '$state', '$filter', 'Dataset', 'rbacUiControlService', 'TemplatesService',
|
||||||
'QuerySet',
|
'QuerySet', 'GetChoices',
|
||||||
function(
|
function(
|
||||||
$scope, $rootScope, $location, $stateParams, Rest, Alert,
|
$scope, $rootScope, $location, $stateParams, Rest, Alert,
|
||||||
TemplateList, Prompt, ClearScope, ProcessErrors, GetBasePath,
|
TemplateList, Prompt, ClearScope, ProcessErrors, GetBasePath,
|
||||||
InitiatePlaybookRun, Wait, $state, $filter, Dataset, rbacUiControlService, TemplatesService,
|
InitiatePlaybookRun, Wait, $state, $filter, Dataset, rbacUiControlService, TemplatesService,
|
||||||
qs
|
qs, GetChoices
|
||||||
) {
|
) {
|
||||||
ClearScope();
|
ClearScope();
|
||||||
|
|
||||||
@@ -38,6 +38,34 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', 'Al
|
|||||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||||
|
|
||||||
$rootScope.flashMessage = null;
|
$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 () {
|
$scope.$on(`ws-jobs`, function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user