From 64f4cb03e732034f1973b7f0814145a21b4885dd Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Wed, 27 Jan 2016 10:14:18 -0500 Subject: [PATCH] Added the ability to pass ngShow to the SearchWidget generator helper. By specifying this parameter we can control when the search bar gets shown. In this case we want to hide the search bar when a list is empty to start with. --- awx/ui/client/src/shared/form-generator.js | 3 ++- awx/ui/client/src/shared/generator-helpers.js | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index 6f824a93fc..9dcfc06d10 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -1658,7 +1658,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat html += SearchWidget({ iterator: collection.iterator, template: collection, - mini: true + mini: true, + ngShow: collection.iterator + "Loading == true || " + collection.iterator + "_active_search == true || (" + collection.iterator + "Loading == false && " + collection.iterator + "_active_search == false && " + collection.iterator + "_total_rows > 0)" }); html += "
\n"; diff --git a/awx/ui/client/src/shared/generator-helpers.js b/awx/ui/client/src/shared/generator-helpers.js index 1cf426b801..5e3fcfe148 100644 --- a/awx/ui/client/src/shared/generator-helpers.js +++ b/awx/ui/client/src/shared/generator-helpers.js @@ -632,6 +632,7 @@ angular.module('GeneratorHelpers', [systemStatus.name]) form = params.template, size = params.size, includeSize = (params.includeSize === undefined) ? true : params.includeSize, + ngShow = (params.ngShow) ? params.ngShow : false, i, html = '', modifier, searchWidgets = (params.searchWidgets) ? params.searchWidgets : 1, @@ -667,6 +668,10 @@ angular.module('GeneratorHelpers', [systemStatus.name]) html += "\" id=\"search-widget-container" + modifier + "\">\n"; } + if(ngShow) { + html += "
"; + } + html += "
\n"; + if(ngShow) { + html += "
"; + } + if (includeSize) { html += "\n"; }