Always show search bar in smart inventory host filter modal

This commit is contained in:
mabashian 2019-06-12 14:40:48 -04:00 committed by Jake McDermott
parent 28cc08f215
commit 9c50609776
3 changed files with 10 additions and 3 deletions

View File

@ -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;

View File

@ -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',

View File

@ -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 += `
<div ng-hide="${list.name}.length === 0 && (searchTags | isEmpty)">
<div ng-hide="!${list.alwaysShowSearch} && ${list.name}.length === 0 && (searchTags | isEmpty)">
<smart-search
django-model="${list.name}"
${singleSearchParam}
@ -244,7 +244,8 @@ 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){
html += `<div class="List-noItems" ng-show="${list.name}.length === 0 && (searchTags | isEmpty)">`;
const emptyListClass = list.emptyListClass || "List-noItems";
html += `<div class="${emptyListClass}" ng-show="${list.name}.length === 0 && (searchTags | isEmpty)">`;
html += (list.emptyListText) ? list.emptyListText : i18n._("PLEASE ADD ITEMS TO THIS LIST");
html += "</div>";
}