mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 17:28:51 -03:30
Inventory hosts now appear in All Hosts folder. User not allowed to add hosts outside of a group (i.e. cannot add to All Hosts group). Fixed job template so that a credential can be removed.
This commit is contained in:
@@ -343,7 +343,8 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
};
|
||||
|
||||
scope.treeController = function($node) {
|
||||
if ($($node).attr('type') == 'host') {
|
||||
var nodeType = $($node).attr('type');
|
||||
if (nodeType == 'host') {
|
||||
return {
|
||||
edit: {
|
||||
label: 'Edit Host',
|
||||
@@ -386,7 +387,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($($node).attr('type') == 'inventory') {
|
||||
else if (nodeType == 'inventory') {
|
||||
return {
|
||||
addGroup: {
|
||||
label: 'Add Group',
|
||||
@@ -411,19 +412,22 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
action: function(obj) {
|
||||
LoadBreadCrumbs({ path: '/groups/' + $(obj).attr('id'), title: $(obj).attr('name') });
|
||||
changePath($location.path() + '/groups/' + $(obj).attr('id') + '/children');
|
||||
}
|
||||
},
|
||||
"_disabled": (nodeType == 'all-hosts-group') ? true : false
|
||||
},
|
||||
addHost: {
|
||||
label: 'Add Host',
|
||||
action: function(obj) {
|
||||
LoadBreadCrumbs({ path: '/groups/' + $(obj).attr('id'), title: $(obj).attr('name') });
|
||||
changePath($location.path() + '/groups/' + $(obj).attr('id') + '/hosts');
|
||||
}
|
||||
},
|
||||
"_disabled": (nodeType == 'all-hosts-group') ? true : false
|
||||
},
|
||||
edit: {
|
||||
label: 'Edit Group',
|
||||
action: function(obj) { changePath($location.path() + '/groups/' + $(obj).attr('id')); },
|
||||
separator_before: true
|
||||
separator_before: true,
|
||||
"_disabled": (nodeType == 'all-hosts-group') ? true : false
|
||||
},
|
||||
delete: {
|
||||
label: 'Delete Group',
|
||||
@@ -454,7 +458,8 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
keyboard: true,
|
||||
show: true
|
||||
});
|
||||
}
|
||||
},
|
||||
"_disabled": (nodeType == 'all-hosts-group') ? true : false
|
||||
},
|
||||
variables: {
|
||||
label: 'Group variables',
|
||||
|
||||
@@ -475,7 +475,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
|
||||
|
||||
// Save changes to the parent
|
||||
scope.formSave = function() {
|
||||
Rest.setUrl(defaultUrl + $routeParams.id);
|
||||
Rest.setUrl(defaultUrl + $routeParams.id + '/');
|
||||
var data = {}
|
||||
for (var fld in form.fields) {
|
||||
if (form.fields[fld].type == 'select' && fld != 'playbook') {
|
||||
|
||||
@@ -28,7 +28,7 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
|
||||
var postAction = params.postAction //action to perform post user selection
|
||||
|
||||
|
||||
// Show pop-up to select user
|
||||
// Show pop-up
|
||||
var name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||
var defaultUrl = (list.name == 'inventories') ? GetBasePath('inventory') : GetBasePath(list.name);
|
||||
var hdr = (params.hdr) ? params.hdr : 'Select ' + name;
|
||||
|
||||
@@ -149,14 +149,14 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
||||
});
|
||||
});
|
||||
|
||||
// Load inventory top-level hosts
|
||||
// Load inventory all hosts
|
||||
Rest.setUrl(hosts + '?order_by=name');
|
||||
Rest.get()
|
||||
.success ( function(data, status, headers, config) {
|
||||
treeData = [];
|
||||
treeData.push({
|
||||
data: {
|
||||
title: inventory_name,
|
||||
title: inventory_name
|
||||
},
|
||||
attr: {
|
||||
type: 'inventory',
|
||||
@@ -168,8 +168,22 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
||||
state: 'open',
|
||||
children:[]
|
||||
});
|
||||
//treeData[0].children.push({
|
||||
var all_hosts_node = {
|
||||
data: {
|
||||
title: 'All Hosts'
|
||||
},
|
||||
attr: {
|
||||
type: 'all-hosts-group',
|
||||
id: 'all-hosts-group',
|
||||
url: hosts + '?order_by=name',
|
||||
name: 'All Hosts'
|
||||
},
|
||||
state: 'closed',
|
||||
children: []
|
||||
};
|
||||
for (var i=0; i < data.results.length; i++ ) {
|
||||
treeData[0].children.push({
|
||||
all_hosts_node.children.push({
|
||||
data: {
|
||||
title: data.results[i].name,
|
||||
icon: '/'
|
||||
@@ -186,6 +200,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
||||
},
|
||||
});
|
||||
}
|
||||
treeData[0].children.push(all_hosts_node);
|
||||
scope.$emit('hostsLoaded');
|
||||
})
|
||||
.error ( function(data, status, headers, config) {
|
||||
|
||||
@@ -24,14 +24,14 @@ angular.module('JobsListDefinition', [])
|
||||
desc: true,
|
||||
searchType: 'int'
|
||||
},
|
||||
created: {
|
||||
label: 'Creation Date',
|
||||
link: true
|
||||
},
|
||||
name: {
|
||||
label: 'Name',
|
||||
link: true,
|
||||
},
|
||||
created: {
|
||||
label: 'Creation Date',
|
||||
link: true
|
||||
},
|
||||
status: {
|
||||
label: 'Status',
|
||||
icon: 'icon-circle',
|
||||
|
||||
@@ -101,25 +101,32 @@ angular.module('AWDirectives', ['RestServices'])
|
||||
require: 'ngModel',
|
||||
link: function(scope, elm, attrs, ctrl) {
|
||||
ctrl.$parsers.unshift( function(viewValue) {
|
||||
url = elm.attr('data-url');
|
||||
url = url.replace(/\:value/,escape(viewValue));
|
||||
scope[elm.attr('data-source')] = null;
|
||||
Rest.setUrl(url);
|
||||
Rest.get().then( function(data) {
|
||||
var results = data.data.results;
|
||||
if (results.length > 0) {
|
||||
scope[elm.attr('data-source')] = results[0].id;
|
||||
scope[elm.attr('name')] = results[0].name;
|
||||
ctrl.$setValidity('required', true);
|
||||
ctrl.$setValidity('awlookup', true);
|
||||
return viewValue;
|
||||
}
|
||||
else {
|
||||
ctrl.$setValidity('required', true);
|
||||
ctrl.$setValidity('awlookup', false);
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
if (viewValue !== '') {
|
||||
url = elm.attr('data-url');
|
||||
url = url.replace(/\:value/,escape(viewValue));
|
||||
scope[elm.attr('data-source')] = null;
|
||||
Rest.setUrl(url);
|
||||
Rest.get().then( function(data) {
|
||||
var results = data.data.results;
|
||||
if (results.length > 0) {
|
||||
scope[elm.attr('data-source')] = results[0].id;
|
||||
scope[elm.attr('name')] = results[0].name;
|
||||
ctrl.$setValidity('required', true);
|
||||
ctrl.$setValidity('awlookup', true);
|
||||
return viewValue;
|
||||
}
|
||||
else {
|
||||
ctrl.$setValidity('required', true);
|
||||
ctrl.$setValidity('awlookup', false);
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
ctrl.$setValidity('awlookup', true);
|
||||
scope[elm.attr('data-source')] = null;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user