diff --git a/ansibleworks/ui/static/css/ansible-ui.css b/ansibleworks/ui/static/css/ansible-ui.css index 36645059b8..232fc4097d 100644 --- a/ansibleworks/ui/static/css/ansible-ui.css +++ b/ansibleworks/ui/static/css/ansible-ui.css @@ -333,3 +333,19 @@ color: #0088cc; font-weight: bold; } + + .inventory-buttons { + margin: 10px 10px 0 0; + } + + .inventory-buttons button { + margin-left: 5px; + } + + #hosts-well { + padding-top: 10px; + } + + #hosts-title { + margin-bottom: 15px; + } \ No newline at end of file diff --git a/ansibleworks/ui/static/js/controllers/Inventories.js b/ansibleworks/ui/static/js/controllers/Inventories.js index a1ba604a19..f33b614651 100644 --- a/ansibleworks/ui/static/js/controllers/Inventories.js +++ b/ansibleworks/ui/static/js/controllers/Inventories.js @@ -360,14 +360,14 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP }, "_disabled": (nodeType == 'all-hosts-group') ? true : false }, - addHost: { + /*addHost: { label: 'Add Host', action: function(obj) { LoadBreadCrumbs({ path: '/groups/' + $(obj).attr('group_id'), title: $(obj).attr('name') }); changePath($location.path() + '/groups/' + $(obj).attr('group_id') + '/hosts'); }, "_disabled": (nodeType == 'all-hosts-group') ? true : false - }, + },*/ edit: { label: 'Edit Group', action: function(obj) { changePath($location.path() + '/groups/' + $(obj).attr('group_id')); }, @@ -411,16 +411,18 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP } scope.$on('NodeSelect', function(e, n) { - var node = $('li[name="' + n.data + '"]'); + var node = $('li[id="' + n.attr.id + '"]'); var type = node.attr('type'); var url; $('#tree-view').jstree('open_node',node); if (type == 'group') { url = node.attr('all'); + scope.groupAddHide = false; + scope.groupEditHide =false; scope.createButtonShow = true; scope.group_id = node.attr('group_id'); scope.groupName = n.data; - scope.groupTitle = 'Hosts: ' + n.data; + scope.groupTitle = n.data; scope.groupTitle += (node.attr('description')) ? ' -' + node.attr('description') : ''; } else if (type == 'all-hosts-group') { @@ -429,8 +431,10 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP scope.groupName = 'All Hosts'; scope.groupTitle = 'All Hosts'; } - else if (type == 'inventory-node') { + else if (type == 'inventory') { url = node.attr('hosts'); + scope.groupAddHide = false; + scope.groupEditHide =true; scope.createButtonShow = false; scope.groupName = 'All Hosts'; scope.groupTitle = 'All Hosts'; diff --git a/ansibleworks/ui/static/js/forms/Inventories.js b/ansibleworks/ui/static/js/forms/Inventories.js index 5d284606b2..27264b51f5 100644 --- a/ansibleworks/ui/static/js/forms/Inventories.js +++ b/ansibleworks/ui/static/js/forms/Inventories.js @@ -76,10 +76,17 @@ angular.module('InventoryFormDefinition', []) add: { ngClick: "add('hosts')", icon: 'icon-plus', - label: 'Add', + label: 'Create Host', awToolTip: 'Create a new host', ngHide: 'createButtonShow == false' }, + select: { + ngClick: "select('hosts')", + icon: 'icon-th-large', + label: 'Select Existing Host', + awToolTip: 'Select an existing host', + ngHide: 'createButtonShow == false' + } }, fields: { diff --git a/ansibleworks/ui/static/js/helpers/inventory.js b/ansibleworks/ui/static/js/helpers/inventory.js index 16c86a42dd..8b20a8ed8d 100644 --- a/ansibleworks/ui/static/js/helpers/inventory.js +++ b/ansibleworks/ui/static/js/helpers/inventory.js @@ -41,7 +41,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi "dots": false, "icons": true }, - "ui": { "initially_select": [ 'all-hosts-group' ]}, + "ui": { "initially_select": [ 'inventory-node' ]}, "json_data": { data: treeData, ajax: { @@ -73,7 +73,6 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi }); idx++; } - //scope.$emit('loadHosts'); return response; } } @@ -87,13 +86,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi $(tree_id).bind("select_node.jstree", function(evt, data){ //selected node object: data.inst.get_json()[0]; //selected node text: data.inst.get_json()[0].data - //console.log( data.inst.get_json()[0].data + ', ' + data.inst.get_json()[0].attr.id ); - if (data.inst.get_json()[0].attr.id != 'inventory-node') { - scope.$emit('NodeSelect',data.inst.get_json()[0]); - } - else { - $('#all-hosts-group a').click(); - } + scope.$emit('NodeSelect',data.inst.get_json()[0]); }); }); @@ -133,12 +126,12 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi }); }); - // Load inventory all hosts + // Setup tree_data Rest.setUrl(hosts + '?order_by=name'); Rest.get() .success ( function(data, status, headers, config) { - treeData = []; - treeData.push({ + treeData = + [{ data: { title: inventory_name }, @@ -153,22 +146,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi }, state: 'open', children:[] - }); - - var all_hosts_node = { - data: { - title: 'All Hosts' - }, - attr: { - type: 'all-hosts-group', - id: 'all-hosts-group', - url: hosts, - name: 'All Hosts' - }, - state: 'closed' - }; - - treeData[0].children.push(all_hosts_node); + }]; scope.$emit('hostsLoaded'); }) .error ( function(data, status, headers, config) { diff --git a/ansibleworks/ui/static/lib/ansible/form-generator.js b/ansibleworks/ui/static/lib/ansible/form-generator.js index 4f440ac6ef..d474d980ea 100644 --- a/ansibleworks/ui/static/lib/ansible/form-generator.js +++ b/ansibleworks/ui/static/lib/ansible/form-generator.js @@ -639,12 +639,18 @@ angular.module('FormGenerator', ['GeneratorHelpers']) for (var itm in form.related) { if (form.related[itm].type == 'tree') { - html += "
\n"; + html += "
"; + html += "
"; + html += ""; + html += ""; + html += "
\n"; + html += "
\n"; + html += "
\n"; } else { html += "
\n"; - html += "
\n"; - html += "
" + form.related[itm].title + "
\n"; + html += "
\n"; + html += "

" + form.related[itm].title + "

\n"; html += SearchWidget({ iterator: form.related[itm].iterator, template: form.related[itm], mini: true }); // Add actions(s)