From 71e132ce0f658f8f214219acd0e2f4143fc0fdd8 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Wed, 25 Oct 2017 16:57:18 -0400 Subject: [PATCH] Show instance filter ui element with tower inventory source --- .../related/sources/add/sources-add.controller.js | 5 ++++- .../related/sources/edit/sources-edit.controller.js | 5 ++++- .../inventories/related/sources/sources.form.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js index 248ecbff60..a08a9e4eb4 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js @@ -198,7 +198,10 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', $scope.group_by = $scope.group_by_choices; $scope.groupByPopOver = i18n._("Specify which groups to create automatically. Group names will be created similar to the options selected. If blank, all groups above are created. Refer to Ansible Tower documentation for more detail."); $scope.instanceFilterPopOver = i18n._("Provide a comma-separated list of filter expressions. Hosts are imported when all of the filters match. Refer to Ansible Tower documentation for more detail."); - } + } + if( _.get($scope, 'source') === 'tower' || _.get($scope.source, 'value') === 'tower') { + $scope.instanceFilterPopOver = i18n._("Provide the name or id of the remote Tower inventory to be imported."); + } CreateSelect2({ element: '#inventory_source_group_by', multiple: true, diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js index 4728e2747a..4b7b9c47aa 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js @@ -275,7 +275,7 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', i18n._("for a complete list of supported filters.") + "

"; } - if( _.get($scope, 'source') === 'vmware' || _.get($scope.source, 'value') === 'vmware') { + if( _.get($scope, 'source') === 'vmware' || _.get($scope.source, 'value') === 'vmware') { add_new = true; $scope.group_by_choices = (inventorySourceData.group_by) ? inventorySourceData.group_by.split(',') .map((i) => ({name: i, label: i, value: i})) : []; @@ -283,6 +283,9 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', $scope.groupByPopOver = i18n._(`Specify which groups to create automatically. Group names will be created similar to the options selected. If blank, all groups above are created. Refer to Ansible Tower documentation for more detail.`); $scope.instanceFilterPopOver = i18n._(`Provide a comma-separated list of filter expressions. Hosts are imported when all of the filters match. Refer to Ansible Tower documentation for more detail.`); } + if( _.get($scope, 'source') === 'tower' || _.get($scope.source, 'value') === 'tower') { + $scope.instanceFilterPopOver = i18n._(`Provide the name or id of the remote Tower inventory to be imported.`); + } CreateSelect2({ element: '#inventory_source_group_by', multiple: true, diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js index 38a786d482..d7d6e31c2b 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js @@ -144,7 +144,7 @@ return { instance_filters: { label: i18n._("Instance Filters"), type: 'text', - ngShow: "source && (source.value == 'ec2' || source.value == 'vmware')", + ngShow: "source && (source.value == 'ec2' || source.value == 'vmware' || source.value == 'tower')", dataTitle: i18n._('Instance Filters'), dataPlacement: 'right', awPopOverWatch: 'instanceFilterPopOver',