From 7e0f72de4590d8b18a8662c1118692a29712bf75 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Wed, 17 Jul 2013 17:53:18 -0400 Subject: [PATCH] AC-209 on inventory page, when user selects inventory node the add group buttons displays the 'create new group' dialog rather than the select dialog. --- awx/ui/static/css/ansible-ui.css | 5 +++++ awx/ui/static/js/controllers/Inventories.js | 13 +++++++++---- awx/ui/static/js/forms/Inventories.js | 3 ++- awx/ui/static/lib/ansible/form-generator.js | 4 ++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/awx/ui/static/css/ansible-ui.css b/awx/ui/static/css/ansible-ui.css index 261503cf52..e24910095d 100644 --- a/awx/ui/static/css/ansible-ui.css +++ b/awx/ui/static/css/ansible-ui.css @@ -43,6 +43,11 @@ padding-bottom: 1px; } + .btn-inventory-edit { + padding-top: 2px; + padding-bottom: 1px; + } + .modal-footer .btn-success, .modal-footer .btn-danger, .modal-footer .btn-info, diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index e2fdc8b115..40337ef410 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -263,7 +263,7 @@ InventoriesAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$lo function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit, Prompt, - OrganizationList, TreeInit, GetBasePath, GroupsList, GroupsEdit, LoadInventory, + OrganizationList, TreeInit, GetBasePath, GroupsList, GroupsAdd, GroupsEdit, LoadInventory, GroupsDelete, HostsList, HostsAdd, HostsEdit, HostsDelete, RefreshTree, ParseTypeChange) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior @@ -436,7 +436,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP return { addGroup: { label: 'Add Group', - action: function(obj) { GroupsList({ "inventory_id": id, group_id: null }); } + action: function(obj) { GroupsAdd({ "inventory_id": id, group_id: null }); } } } } @@ -499,7 +499,12 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP }); scope.addGroup = function() { - GroupsList({ "inventory_id": id, group_id: scope.group_id }); + if (scope.group_id == null) { + GroupsAdd({ "inventory_id": id, group_id: null }); + } + else { + GroupsList({ "inventory_id": id, group_id: scope.group_id }); + } } scope.editGroup = function() { @@ -545,7 +550,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP InventoriesEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'LookUpInit', 'Prompt', - 'OrganizationList', 'TreeInit', 'GetBasePath', 'GroupsList', 'GroupsEdit', 'LoadInventory', + 'OrganizationList', 'TreeInit', 'GetBasePath', 'GroupsList', 'GroupsAdd', 'GroupsEdit', 'LoadInventory', 'GroupsDelete', 'HostsList', 'HostsAdd', 'HostsEdit', 'HostsDelete', 'RefreshTree', 'ParseTypeChange' ]; diff --git a/awx/ui/static/js/forms/Inventories.js b/awx/ui/static/js/forms/Inventories.js index 1512ac4ef3..066278ff11 100644 --- a/awx/ui/static/js/forms/Inventories.js +++ b/awx/ui/static/js/forms/Inventories.js @@ -152,7 +152,8 @@ angular.module('InventoryFormDefinition', []) ngClick: "editHost(\{\{ host.id \}\}, '\{\{ host.name \}\}')", icon: 'icon-edit', label: 'Edit', - awToolTip: 'Edit host' + awToolTip: 'Edit host', + 'class': 'btn-inventory-edit' }, "delete": { ngClick: "deleteHost(\{\{ host.id \}\}, '\{\{ host.name \}\}')", diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index d93a405c25..e5550e7237 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -808,8 +808,8 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) html += "
"; html += "
"; html += ""; + "class=\"btn btn-mini btn-success\" aw-tool-tip=\"Add a new group\" " + + "data-placement=\"bottom\"> Add Group"; html += "";