diff --git a/awx/ui/client/features/output/details.partial.html b/awx/ui/client/features/output/details.partial.html index b2faddea97..5ad6dde62e 100644 --- a/awx/ui/client/features/output/details.partial.html +++ b/awx/ui/client/features/output/details.partial.html @@ -350,7 +350,7 @@ {{ vm.strings.get('label.YAML')}} @@ -32,7 +32,7 @@ type="radio" value="json" ng-model="parseType" - ng-change="parseTypeChange('parseType', 'variables')" + ng-change="parseTypeChange('parseType', vm.variablesName)" class="ng-pristine ng-untouched ng-valid ng-not-empty"> {{ vm.strings.get('label.JSON')}} diff --git a/awx/ui/client/lib/components/code-mirror/modal/code-mirror-modal.directive.js b/awx/ui/client/lib/components/code-mirror/modal/code-mirror-modal.directive.js index 4eb77d6e0a..02d7d25753 100644 --- a/awx/ui/client/lib/components/code-mirror/modal/code-mirror-modal.directive.js +++ b/awx/ui/client/lib/components/code-mirror/modal/code-mirror-modal.directive.js @@ -13,7 +13,7 @@ function atCodeMirrorModalController ( ParseTypeChange ) { const vm = this; - const variablesName = `${$scope.name}_variables`; + // const variablesName = `${$scope.name}_variables`; function resize () { if ($scope.disabled === 'true') { $scope.disabled = true; @@ -53,8 +53,6 @@ function atCodeMirrorModalController ( minWidth: 600 }); $(`${CodeMirrorModalID} .modal-dialog`).on('resize', resize); - - $scope.foovars = 'testing'; } vm.strings = strings; diff --git a/awx/ui/client/src/inventories-hosts/hosts/host.form.js b/awx/ui/client/src/inventories-hosts/hosts/host.form.js index f66f48b4df..43c065fa25 100644 --- a/awx/ui/client/src/inventories-hosts/hosts/host.form.js +++ b/awx/ui/client/src/inventories-hosts/hosts/host.form.js @@ -65,12 +65,15 @@ function(i18n) { type: 'text' }, variables: { + root: 'host_variables', label: i18n._('Variables'), - type: 'textarea', + type: 'code_mirror', rows: 6, + variables: 'variables', class: 'Form-formGroup--fullWidth', "default": "---", - awPopOver: "

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

" + + awPopOver: i18n._('Enter inventory variables using either JSON or YAML syntax. Use the radio button to toggle between the two.'), + _awPopOver: "

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

" + "JSON:
\n" + "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + "YAML:
\n" + diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js index 52661b4129..c98223bb55 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js @@ -40,11 +40,11 @@ $rootScope.breadcrumb.host_name = host.name; $scope.description = host.description; $scope.host_variables = getVars(host.variables); - ParseTypeChange({ - scope: $scope, - field_id: 'host_host_variables', - variable: 'host_variables', - }); + // ParseTypeChange({ + // scope: $scope, + // field_id: 'host_host_variables', + // variable: 'host_variables', + // }); }; // Adding this function b/c sometimes extra vars are returned to the diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js index f368af8329..2097509e40 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js @@ -66,17 +66,35 @@ function(i18n) { }, host_variables: { label: i18n._('Variables'), - type: 'textarea', + type: 'code_mirror', + root: 'host_variables', rows: 6, class: 'Form-formGroup--fullWidth', "default": "---", - awPopOver: "

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

" + - "JSON:
\n" + - "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + - "
---
somevar: somevalue
password: magic
\n" + - '

' + i18n.sprintf(i18n._('View JSON examples at %s'), 'www.json.org') + '

' + - '

' + i18n.sprintf(i18n._('View YAML examples at %s'), 'docs.ansible.com') + '

', + variables: 'host_variables', + awPopOver: `

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

+ JSON:
+
+ {
 "somevar": "somevalue",
 "password": "magic"
} +
+ YAML:
+
+ ---
+ somevar: somevalue
+ password: magic
+
+

${i18n.sprintf(i18n._( + 'View JSON examples at %s'), + 'www.json.org' + )}

+

${i18n.sprintf(i18n._('View YAML examples at %s'), 'docs.ansible.com')}

`, + // _awPopOver: "

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

" + + // "JSON:
\n" + + // "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + + // "YAML:
\n" + + // "
---
somevar: somevalue
password: magic
\n", // + + // '

' + i18n.sprintf(i18n._('View JSON examples at %s'), 'www.json.org') + '

' + + // '

' + i18n.sprintf(i18n._('View YAML examples at %s'), 'docs.ansible.com') + '

', dataTitle: i18n._('Host Variables'), dataPlacement: 'right', dataContainer: 'body', diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js index b49e6e70d6..48b1d66ddd 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js @@ -66,33 +66,20 @@ function(i18n) { dataContainer: 'body', control: '', }, - // inventory_variables: { - // realName: 'variables', - // label: i18n._('Variables'), - // type: 'textarea', - // class: 'Form-formGroup--fullWidth', - // rows: 6, - // "default": "---", - // awPopOver: i18n._('Enter inventory variables using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax.'), - // dataTitle: i18n._('Variables'), - // dataPlacement: 'right', - // dataContainer: 'body', - // ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)' // TODO: get working - // }, inventory_variables: { - realName: 'variables', + // realName: 'variables', root: 'inventory', label: i18n._('Variables'), type: 'code_mirror', class: 'Form-formGroup--fullWidth', - rows: 6, - "default": "---", + // rows: 6, + // "default": "---", variables: 'inventory_variables', awPopOver: i18n._('Enter inventory variables using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax.'), - dataTitle: i18n._('Variables'), - dataPlacement: 'right', - dataContainer: 'body', - ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)' // TODO: get working + // dataTitle: i18n._('Variables'), + // dataPlacement: 'right', + // dataContainer: 'body', + // ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)' // TODO: get working } }, diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index 1e8440d0ad..4a2a2f163c 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -1370,7 +1370,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat html += `class="${field.class}" `; html += `label="${field.label}" `; html += `tooltip="${field.awPopOver}" `; - html += `name="${field.root}" `; + html += `name="${fld}" `; html += `variables="${field.variables}" `; html += '>
'; }