summaryrefslogtreecommitdiffstats
path: root/awx/ui/static/js/helpers/Hosts.js
diff options
context:
space:
mode:
authorChris Houseknecht <chouse@ansibleworks.com>2013-11-04 16:02:06 +0100
committerChris Church <chris@ninemoreminutes.com>2013-11-04 16:16:57 +0100
commit778fe0717907ab9bedc8fabd355a2676efac0bb0 (patch)
tree8b6504ebe425d8571e68a22df9476e6d7fada936 /awx/ui/static/js/helpers/Hosts.js
parentFixed home page to work with new Utilities.GetChoices, which is used to get s... (diff)
downloadawx-778fe0717907ab9bedc8fabd355a2676efac0bb0.tar.xz
awx-778fe0717907ab9bedc8fabd355a2676efac0bb0.zip
AC-403 changed Host add/update to stringify variable data and include it directly in the Post or Put operation, bypassing use of host/N/variables. Now host names can include a :port.
Diffstat (limited to '')
-rw-r--r--awx/ui/static/js/helpers/Hosts.js47
1 files changed, 18 insertions, 29 deletions
diff --git a/awx/ui/static/js/helpers/Hosts.js b/awx/ui/static/js/helpers/Hosts.js
index 332ea82b84..c79e5edb6c 100644
--- a/awx/ui/static/js/helpers/Hosts.js
+++ b/awx/ui/static/js/helpers/Hosts.js
@@ -145,25 +145,20 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
data[fld] = scope[fld];
}
}
+
data['inventory'] = inventory_id;
+ if ($.isEmptyObject(json_data)) {
+ data['variables'] = "";
+ }
+ else {
+ data['variables'] = JSON.stringify(json_data, undefined, '\t');
+ }
+
Rest.setUrl(defaultUrl);
Rest.post(data)
.success( function(data, status, headers, config) {
- if (scope.variables) {
- Rest.setUrl(data.related.variable_data);
- Rest.put(json_data)
- .success( function(data, status, headers, config) {
- finished();
- })
- .error( function(data, status, headers, config) {
- ProcessErrors(scope, data, status, form,
- { hdr: 'Error!', msg: 'Failed to add host varaibles. PUT returned status: ' + status });
- });
- }
- else {
- finished();
- }
+ finished();
})
.error( function(data, status, headers, config) {
scope.formModalActionDisabled = false;
@@ -306,24 +301,18 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
data[fld] = scope[fld];
}
data['inventory'] = inventory_id;
+
+ if ($.isEmptyObject(json_data)) {
+ data['variables'] = "";
+ }
+ else {
+ data['variables'] = JSON.stringify(json_data, undefined, '\t');
+ }
+
Rest.setUrl(defaultUrl);
Rest.put(data)
.success( function(data, status, headers, config) {
- if (scope.variables) {
- //update host variables
- Rest.setUrl(GetBasePath('hosts') + data.id + '/variable_data/');
- Rest.put(json_data)
- .success( function(data, status, headers, config) {
- finished();
- })
- .error( function(data, status, headers, config) {
- ProcessErrors(scope, data, status, form,
- { hdr: 'Error!', msg: 'Failed to update host varaibles. PUT returned status: ' + status });
- });
- }
- else {
- finished();
- }
+ finished();
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,