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 3989160a1c..4b0fc3369f 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 @@ -9,12 +9,12 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'rbacUiControlService', 'ToJSON', 'SourcesService', 'Empty', 'Wait', 'Rest', 'Alert', 'ProcessErrors', 'inventorySourcesOptions', - '$rootScope', + '$rootScope', 'i18n', function($state, $stateParams, $scope, SourcesFormDefinition, ParseTypeChange, GenerateForm, inventoryData, GroupsService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, rbacUiControlService, ToJSON, SourcesService, Empty, Wait, Rest, Alert, ProcessErrors, - inventorySourcesOptions,$rootScope) { + inventorySourcesOptions,$rootScope, i18n) { let form = SourcesFormDefinition; init(); @@ -165,43 +165,40 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', function initGroupBySelect(){ let add_new = false; - if($scope && $scope.source && $scope.source === 'ec2' || $scope && $scope.source && $scope.source.value && $scope.source.value === 'ec2'){ + if( _.get($scope, 'source') === 'ec2' || _.get($scope.source, 'value') === 'ec2') { $scope.group_by_choices = $scope.ec2_group_by; - $scope.groupByPopOver = "

Select which groups to create automatically. " + - $rootScope.BRAND_NAME + " will create group names similar to the following examples based on the options selected:

If blank, all groups above are created except Instance ID.

"; - $scope.instanceFilterPopOver = "

Provide a comma-separated list of filter expressions. " + - "Hosts are imported to " + $rootScope.BRAND_NAME + " when ANY of the filters match.

" + - "Limit to hosts having a tag:
\n" + - "
tag-key=TowerManaged
\n" + - "Limit to hosts using either key pair:
\n" + - "
key-name=staging, key-name=production
\n" + - "Limit to hosts where the Name tag begins with test:
\n" + - "
tag:Name=test*
\n" + - "

View the Describe Instances documentation " + - "for a complete list of supported filters.

"; + $scope.groupByPopOver = "

" + i18n._("Select which groups to create automatically. ") + + $rootScope.BRAND_NAME + i18n._(" will create group names similar to the following examples based on the options selected:") + "

" + i18n._("If blank, all groups above are created except") + "" + i18n._("Instance ID") + ".

"; + + $scope.instanceFilterPopOver = "

" + i18n._("Provide a comma-separated list of filter expressions. ") + + i18n._("Hosts are imported to ") + $rootScope.BRAND_NAME + i18n._(" when ") + "" + i18n._("ANY") + "" + i18n._(" of the filters match.") + "

" + + i18n._("Limit to hosts having a tag:") + "
\n" + + "
tag-key=TowerManaged
\n" + + i18n._("Limit to hosts using either key pair:") + "
\n" + + "
key-name=staging, key-name=production
\n" + + i18n._("Limit to hosts where the Name tag begins with ") + "" + i18n._("test") + ":
\n" + + "
tag:Name=test*
\n" + + "

" + i18n._("View the ") + "" + i18n._("Describe Instances documentation") + " " + + i18n._("for a complete list of supported filters.") + "

"; } - if($scope && $scope.source && $scope.source === 'vmware' || $scope && $scope.source && $scope.source.value && $scope.source.value === 'vmware'){ + if( _.get($scope, 'source') === 'vmware' || _.get($scope.source, 'value') === 'vmware') { add_new = true; $scope.group_by_choices = []; $scope.group_by = $scope.group_by_choices; - $scope.groupByPopOver = `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 = `Provide a comma-separated list of filter expressions. - Hosts are imported when ANY of the filters match. - Refer to Ansible Tower documentation for more detail.`; - } + $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."); + } 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 e9beb3a906..9cf465364c 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 @@ -8,12 +8,12 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', 'rbacUiControlService', 'ToJSON', 'ParseTypeChange', 'GroupsService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'inventorySourceData', 'SourcesService', 'inventoryData', 'inventorySourcesOptions', 'Empty', - 'Wait', 'Rest', 'Alert', '$rootScope', + 'Wait', 'Rest', 'Alert', '$rootScope', 'i18n', function($state, $stateParams, $scope, ParseVariableString, rbacUiControlService, ToJSON,ParseTypeChange, GroupsService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, inventorySourceData, SourcesService, inventoryData, inventorySourcesOptions, Empty, - Wait, Rest, Alert, $rootScope) { + Wait, Rest, Alert, $rootScope, i18n) { function init() { $scope.projectBasePath = GetBasePath('projects') + '?not__status=never updated'; @@ -243,46 +243,45 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', function initGroupBySelect(){ let add_new = false; - if($scope && $scope.source && $scope.source === 'ec2' || $scope && $scope.source && $scope.source.value && $scope.source.value === 'ec2'){ + if( _.get($scope, 'source') === 'ec2' || _.get($scope.source, 'value') === 'ec2') { $scope.group_by_choices = $scope.ec2_group_by; let group_by = inventorySourceData.group_by.split(','); $scope.group_by = _.map(group_by, (item) => _.find($scope.ec2_group_by, { value: item })); - $scope.groupByPopOver = "

Select which groups to create automatically. " + - $rootScope.BRAND_NAME + " will create group names similar to the following examples based on the options selected:

If blank, all groups above are created except Instance ID.

"; - $scope.instanceFilterPopOver = "

Provide a comma-separated list of filter expressions. " + - "Hosts are imported to " + $rootScope.BRAND_NAME + " when ANY of the filters match.

" + - "Limit to hosts having a tag:
\n" + + + $scope.groupByPopOver = "

" + i18n._("Select which groups to create automatically. ") + + $rootScope.BRAND_NAME + i18n._(" will create group names similar to the following examples based on the options selected:") + "

" + i18n._("If blank, all groups above are created except") + "" + i18n._("Instance ID") + ".

"; + + + $scope.instanceFilterPopOver = "

" + i18n._("Provide a comma-separated list of filter expressions. ") + + i18n._("Hosts are imported to ") + $rootScope.BRAND_NAME + i18n._(" when ") + "" + i18n._("ANY") + "" + i18n._(" of the filters match.") + "

" + + i18n._("Limit to hosts having a tag:") + "
\n" + "
tag-key=TowerManaged
\n" + - "Limit to hosts using either key pair:
\n" + + i18n._("Limit to hosts using either key pair:") + "
\n" + "
key-name=staging, key-name=production
\n" + - "Limit to hosts where the Name tag begins with test:
\n" + + i18n._("Limit to hosts where the Name tag begins with ") + "" + i18n._("test") + ":
\n" + "
tag:Name=test*
\n" + - "

View the Describe Instances documentation " + - "for a complete list of supported filters.

"; + "

" + i18n._("View the ") + "" + i18n._("Describe Instances documentation") + " " + + i18n._("for a complete list of supported filters.") + "

"; } - if($scope && $scope.source && $scope.source === 'vmware' || $scope && $scope.source && $scope.source.value && $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})) : []; $scope.group_by = $scope.group_by_choices; - $scope.groupByPopOver = `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 = `Provide a comma-separated list of filter expressions. - Hosts are imported when ANY of the filters match. - Refer to Ansible Tower documentation for more detail.`; + $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.`); } CreateSelect2({ element: '#inventory_source_group_by', 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 a7e4b4acfd..d091289d18 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 @@ -109,7 +109,7 @@ return { inventory_file: { label: i18n._('Inventory File'), type:'select', - defaultText: 'Choose an inventory file', + defaultText: i18n._('Choose an inventory file'), ngOptions: 'file for file in inventory_files track by file', ngShow: "source && source.value === 'scm'", ngDisabled: "!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd) || disableInventoryFileBecausePermissionDenied", @@ -119,7 +119,8 @@ return { init: "true" }, column: 1, - awPopOver: "

" + i18n._("Select the inventory file to be synced by this source. You can select from the dropdown or enter a file within the input.") + "

", + awPopOver: "

" + i18n._("Select the inventory file to be synced by this source. " + + "You can select from the dropdown or enter a file within the input.") + "

", dataTitle: i18n._('Inventory File'), dataPlacement: 'right', dataContainer: "body", @@ -141,10 +142,10 @@ return { subForm: 'sourceSubForm' }, instance_filters: { - label: i18n._('Instance Filters'), + label: i18n._("Instance Filters"), type: 'text', ngShow: "source && (source.value == 'ec2' || source.value == 'vmware')", - dataTitle: 'Instance Filters', + dataTitle: i18n._('Instance Filters'), dataPlacement: 'right', awPopOverWatch: 'instanceFilterPopOver', awPopOver: '{{ instanceFilterPopOver }}', @@ -158,7 +159,7 @@ return { ngShow: "source && (source.value == 'ec2' || source.value == 'vmware')", ngOptions: 'source.label for source in group_by_choices track by source.value', multiSelect: true, - dataTitle: 'Only Group By', + dataTitle: i18n._("Only Group By"), dataPlacement: 'right', awPopOverWatch: 'groupByPopOver', awPopOver: '{{ groupByPopOver }}', @@ -192,14 +193,14 @@ return { parseTypeName: 'envParseType', dataTitle: i18n._("Environment Variables"), dataPlacement: 'right', - awPopOver: "

Provide environment variables to pass to the custom inventory script.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + + awPopOver: "

" + i18n._("Provide environment variables to pass to the custom inventory script.") + "

" + + "

" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "

" + + i18n._("JSON:") + "
\n" + "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + + i18n._("YAML:") + "
\n" + "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', + "

" + i18n._("View JSON examples at ") + 'www.json.org

' + + "

" + i18n._("View YAML examples at ") + 'docs.ansible.com

', dataContainer: 'body', subForm: 'sourceSubForm' }, @@ -214,16 +215,16 @@ return { parseTypeName: 'envParseType', dataTitle: i18n._("Source Variables"), dataPlacement: 'right', - awPopOver: "

Override variables found in ec2.ini and used by the inventory update script. For a detailed description of these variables " + + awPopOver: "

" + i18n._("Override variables found in ec2.ini and used by the inventory update script. For a detailed description of these variables ") + "" + - "view ec2.ini in the Ansible github repo.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + + i18n._("view ec2.ini in the Ansible github repo.") + "

" + + "

" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "

" + + i18n._("JSON:") + "
\n" + "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + + i18n._("YAML:") + "
\n" + "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', + "

" + i18n._("View JSON examples at ") + 'www.json.org

' + + "

" + i18n._("View YAML examples at ") + 'docs.ansible.com

', dataContainer: 'body', subForm: 'sourceSubForm' }, @@ -236,18 +237,18 @@ return { rows: 6, 'default': '---', parseTypeName: 'envParseType', - dataTitle: "Source Variables", + dataTitle: i18n._("Source Variables"), dataPlacement: 'right', - awPopOver: "

Override variables found in vmware.ini and used by the inventory update script. For a detailed description of these variables " + + awPopOver: "

" + i18n._("Override variables found in vmware.ini and used by the inventory update script. For a detailed description of these variables ") + "" + - "view vmware_inventory.ini in the Ansible github repo.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + + i18n._("view vmware_inventory.ini in the Ansible github repo.") + "

" + + "

" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "

" + + i18n._("JSON:") + "
\n" + "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + + i18n._("YAML:") + "
\n" + "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', + "

" + i18n._("View JSON examples at ") + 'www.json.org

' + + "

" + i18n._("View YAML examples at ") + 'docs.ansible.com

', dataContainer: 'body', subForm: 'sourceSubForm' }, @@ -260,18 +261,18 @@ return { rows: 6, 'default': '---', parseTypeName: 'envParseType', - dataTitle: "Source Variables", + dataTitle: i18n._("Source Variables"), dataPlacement: 'right', - awPopOver: "

Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration " + + awPopOver: "

" + i18n._("Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration ") + "" + - "view openstack.yml in the Ansible github repo.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + + i18n._("view openstack.yml in the Ansible github repo.") + "

" + + "

" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "

" + + i18n._("JSON:") + "
\n" + "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + + i18n._("YAML:") + "
\n" + "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', + "

" + i18n._("View JSON examples at ") + 'www.json.org

' + + "

" + i18n._("View YAML examples at ") + 'docs.ansible.com

', dataContainer: 'body', subForm: 'sourceSubForm' }, @@ -284,18 +285,18 @@ return { rows: 6, 'default': '---', parseTypeName: 'envParseType', - dataTitle: "Source Variables", + dataTitle: i18n._("Source Variables"), dataPlacement: 'right', - awPopOver: "

Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration " + + awPopOver: "

" + i18n._("Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration ") + "" + - "view openstack.yml in the Ansible github repo.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + + i18n._("view openstack.yml in the Ansible github repo.") + "

" + + "

" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "

" + + i18n._("JSON:") + "
\n" + "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + + i18n._("YAML:") + "
\n" + "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', + "

" + i18n._("View JSON examples at ") + 'www.json.org

' + + "

" + i18n._("View YAML examples at ") + 'docs.ansible.com

', dataContainer: 'body', subForm: 'sourceSubForm' }, @@ -308,18 +309,18 @@ return { rows: 6, 'default': '---', parseTypeName: 'envParseType', - dataTitle: "Source Variables", + dataTitle: i18n._("Source Variables"), dataPlacement: 'right', - awPopOver: "

Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration " + + awPopOver: "

" + i18n._("Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration ") + "" + - "view openstack.yml in the Ansible github repo.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + + i18n._("view openstack.yml in the Ansible github repo.") + "

" + + "

" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "

" + + i18n._("JSON:") + "
\n" + "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + + i18n._("YAML:") + "
\n" + "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', + "

" + i18n._("View JSON examples at ") + 'www.json.org

' + + "

" + i18n._("View YAML examples at ") + 'docs.ansible.com

', dataContainer: 'body', subForm: 'sourceSubForm' }, @@ -348,9 +349,8 @@ return { label: i18n._('Overwrite'), type: 'checkbox', ngShow: "source.value !== '' && source.value !== null", - awPopOver: '

If checked, all child groups and hosts not found on the external source will be deleted from ' + - 'the local inventory.

When not checked, local child hosts and groups not found on the external source will ' + - 'remain untouched by the inventory update process.

', + awPopOver: "

" + i18n._("If checked, all child groups and hosts not found on the external source will be deleted from the local inventory.") + '

' + + i18n._("When not checked, local child hosts and groups not found on the external source will remain untouched by the inventory update process.") + "

", dataTitle: i18n._('Overwrite'), dataContainer: 'body', dataPlacement: 'right', @@ -361,9 +361,8 @@ return { label: i18n._('Overwrite Variables'), type: 'checkbox', ngShow: "source.value !== '' && source.value !== null", - awPopOver: '

If checked, all variables for child groups and hosts will be removed and replaced by those ' + - 'found on the external source.

When not checked, a merge will be performed, combining local variables with ' + - 'those found on the external source.

', + awPopOver: "

" + i18n._("If checked, all variables for child groups and hosts will be removed and replaced by those found on the external source.") + '

' + + i18n._("When not checked, a merge will be performed, combining local variables with those found on the external source.") + "

", dataTitle: i18n._('Overwrite Variables'), dataContainer: 'body', dataPlacement: 'right', @@ -374,8 +373,8 @@ return { label: i18n._('Update on Launch'), type: 'checkbox', ngShow: "source.value !== '' && source.value !== null", - awPopOver: '

Each time a job runs using this inventory, refresh the inventory from the selected source before ' + - 'executing job tasks.

', + awPopOver: "

" + i18n._("Each time a job runs using this inventory, " + + "refresh the inventory from the selected source before executing job tasks.") + "

", dataTitle: i18n._('Update on Launch'), dataContainer: 'body', dataPlacement: 'right', @@ -386,9 +385,9 @@ return { label: i18n._('Update on Project Change'), type: 'checkbox', ngShow: "source.value === 'scm'", - awPopOver: '

After every project update where the SCM revision changes, refresh the inventory ' + - 'from the selected source before executing job tasks. This is intended for ' + - 'static content, like the Ansible inventory .ini file format.

', + awPopOver: "

" + i18n._("After every project update where the SCM revision changes, " + + "refresh the inventory from the selected source before executing job tasks. " + + "This is intended for static content, like the Ansible inventory .ini file format.") + "

", dataTitle: i18n._('Update on Project Update'), dataContainer: 'body', dataPlacement: 'right', @@ -406,9 +405,9 @@ return { ngShow: "source && source.value !== '' && update_on_launch", spinner: true, "default": 0, - awPopOver: '

Time in seconds to consider an inventory sync to be current. During job runs and callbacks the task system will ' + - 'evaluate the timestamp of the latest sync. If it is older than Cache Timeout, it is not considered current, ' + - 'and a new inventory sync will be performed.

', + awPopOver: "

" + i18n._("Time in seconds to consider an inventory sync to be current. " + + "During job runs and callbacks the task system will evaluate the timestamp of the latest sync. " + + "If it is older than Cache Timeout, it is not considered current, and a new inventory sync will be performed.") + "

", dataTitle: i18n._('Cache Timeout'), dataPlacement: 'right', dataContainer: "body",