From 9c50609776e838175d78a39b5fc10e70ff31fa43 Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 12 Jun 2019 14:40:48 -0400 Subject: [PATCH 1/3] Always show search bar in smart inventory host filter modal --- awx/ui/client/legacy/styles/lists.less | 4 ++++ .../host-filter-modal/host-filter-modal.directive.js | 4 +++- .../src/shared/list-generator/list-generator.factory.js | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/legacy/styles/lists.less b/awx/ui/client/legacy/styles/lists.less index 562b1d79d1..3e004461af 100644 --- a/awx/ui/client/legacy/styles/lists.less +++ b/awx/ui/client/legacy/styles/lists.less @@ -390,6 +390,10 @@ table, tbody { margin-top: 0px; } +.modal-body > .List-emptyHostFilter { + margin-top: 20px; +} + .List-actionButton--selected, .List-editButton--selected { background-color: @list-actn-bg-hov !important; diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js index ef77fcc0fe..0fb6d5b556 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js @@ -55,8 +55,10 @@ export default ['templateUrl', function(templateUrl) { delete hostList.fields.inventory.ngClick; hostList.fields.inventory.columnClass = 'col-sm-6'; hostList.fields.inventory.ngBind = 'host.summary_fields.inventory.name'; - hostList.emptyListText = i18n._('You must have access to at least one host in order to create a smart inventory host filter'); + hostList.emptyListText = i18n._('Perform a search above to define a host filter'); hostList.layoutClass = 'List-defaultLayout'; + hostList.alwaysShowSearch = true; + hostList.emptyListClass = 'List-noItems List-emptyHostFilter' let html = GenerateList.build({ list: hostList, input_type: 'host-filter-modal-body', diff --git a/awx/ui/client/src/shared/list-generator/list-generator.factory.js b/awx/ui/client/src/shared/list-generator/list-generator.factory.js index 51f4eae891..1523895dff 100644 --- a/awx/ui/client/src/shared/list-generator/list-generator.factory.js +++ b/awx/ui/client/src/shared/list-generator/list-generator.factory.js @@ -200,7 +200,7 @@ export default ['$compile', 'Attr', 'Icon', if (options.showSearch === undefined || options.showSearch === true) { let singleSearchParam = list.singleSearchParam && list.singleSearchParam.param ? `single-search-param="${list.singleSearchParam.param}"` : ''; html += ` -
+
`; + const emptyListClass = list.emptyListClass || "List-noItems"; + html += `
`; html += (list.emptyListText) ? list.emptyListText : i18n._("PLEASE ADD ITEMS TO THIS LIST"); html += "
"; } From 0023591bb07f54fb11c74010286e57742646fc09 Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 12 Jun 2019 14:45:51 -0400 Subject: [PATCH 2/3] Removes unnecessary variable --- .../client/src/shared/list-generator/list-generator.factory.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/awx/ui/client/src/shared/list-generator/list-generator.factory.js b/awx/ui/client/src/shared/list-generator/list-generator.factory.js index 1523895dff..a3227121d6 100644 --- a/awx/ui/client/src/shared/list-generator/list-generator.factory.js +++ b/awx/ui/client/src/shared/list-generator/list-generator.factory.js @@ -244,8 +244,7 @@ export default ['$compile', 'Attr', 'Icon', // Show the "no items" box when loading is done and the user isn't actively searching and there are no results if (options.showEmptyPanel === undefined || options.showEmptyPanel === true){ - const emptyListClass = list.emptyListClass || "List-noItems"; - html += `
`; + html += `
`; html += (list.emptyListText) ? list.emptyListText : i18n._("PLEASE ADD ITEMS TO THIS LIST"); html += "
"; } From effe7151eb9bee2229643527e6be87fc1b42f46c Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 12 Jun 2019 16:16:55 -0400 Subject: [PATCH 3/3] Adds missing semi-colon --- .../host-filter-modal/host-filter-modal.directive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js index 0fb6d5b556..aa65ad09be 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js @@ -58,7 +58,7 @@ export default ['templateUrl', function(templateUrl) { hostList.emptyListText = i18n._('Perform a search above to define a host filter'); hostList.layoutClass = 'List-defaultLayout'; hostList.alwaysShowSearch = true; - hostList.emptyListClass = 'List-noItems List-emptyHostFilter' + hostList.emptyListClass = 'List-noItems List-emptyHostFilter'; let html = GenerateList.build({ list: hostList, input_type: 'host-filter-modal-body',