Merge pull request #1887 from jaredevantabor/related-search

Fixing related tab empty list styling
This commit is contained in:
Jared Tabor
2016-05-10 16:29:07 -04:00
3 changed files with 47 additions and 41 deletions

View File

@@ -167,6 +167,13 @@ export default
scope[iterator + 'ShowStartBtn'] = false; scope[iterator + 'ShowStartBtn'] = false;
} }
if(scope[iterator + 'SearchValue'] && scope[iterator + 'SearchValue'] !== '') {
scope[iterator + '_active_search'] = true;
}
else {
scope[iterator + '_active_search'] = false;
}
if (iterator === 'host') { if (iterator === 'host') {
if (scope.hostSearchField === 'has_active_failures') { if (scope.hostSearchField === 'has_active_failures') {
if (scope.hostSearchSelectValue && scope.hostSearchSelectValue.value === 1) { if (scope.hostSearchSelectValue && scope.hostSearchSelectValue.value === 1) {
@@ -230,7 +237,6 @@ export default
url += (url.match(/\/$/)) ? '?' : '&'; url += (url.match(/\/$/)) ? '?' : '&';
url += scope[iterator + 'SearchParams']; url += scope[iterator + 'SearchParams'];
url += (scope[iterator + '_page_size']) ? '&page_size=' + scope[iterator + '_page_size'] : ""; url += (scope[iterator + '_page_size']) ? '&page_size=' + scope[iterator + '_page_size'] : "";
scope[iterator + '_active_search'] = true;
RefreshRelated({ scope: scope, set: set, iterator: iterator, url: url }); RefreshRelated({ scope: scope, set: set, iterator: iterator, url: url });
}; };

View File

@@ -119,7 +119,7 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$l
// Go back to most recent navigation path // Go back to most recent navigation path
$location.path(lastPath()); $location.path(lastPath());
} else { } else {
$location.url('/home?login=true'); $location.url('/home');
} }
}) })
.error(function () { .error(function () {

View File

@@ -1780,61 +1780,61 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
actionButtons += ActionButton(collection actionButtons += ActionButton(collection
.actions[act]); .actions[act]);
}); });
var hideOnSuperuser = (hideOnSuperuser === true) ? true : false;
html += ` html += `
<div class=\"row\" <div class=\"row\"
ng-show=\"${collection.hideSearchAndActions ? false : true}\"> ng-show=\"${collection.hideSearchAndActions ? false : true}\">
<div class=\"col-lg-8 col-md-8 col-sm-8 col-xs-12\" <div class=\"col-lg-8 col-md-8 col-sm-8 col-xs-12\"
ng-show=\"${collection.iterator}Loading == true || ng-show=\"${collection.iterator}Loading == true ||
${collection.iterator}_active_search == true || ( ${collection.iterator}_active_search == true || (
${collection.iterator}Loading == false && ${collection.iterator}Loading == false &&
${collection.iterator}_active_search == false && ${collection.iterator}_active_search == false &&
${collection.iterator}_total_rows > 0)\" ${collection.iterator}_total_rows > 0) &&
ng-hide=\"is_superuser && ${collection.hideOnSuperuser}\" !(is_superuser && ${hideOnSuperuser})\">
> ${tagSearch}
${tagSearch} </div>
</div> <div class=\"col-lg-4 col-md-4 col-sm-4 col-xs-12\">
<div class=\"col-lg-4 col-md-4 col-sm-4 col-xs-12\"> <div class=\"list-actions\">
<div class=\"list-actions\"> ${actionButtons}
${actionButtons} </div>
</div> </div>
</div> </div>
</div>
`; `;
// Message for when a search returns no results. This should only get shown after a search is executed with no results. // Message for when a search returns no results. This should only get shown after a search is executed with no results.
var hideOnSuperuser = (hideOnSuperuser === true) ? true : false;
html += ` html += `
<div <div
class=\"row\" class=\"row\"
ng-show=\" ${collection.iterator}Loading == false && ng-show=\" ${collection.iterator}Loading == false &&
${collection.iterator}_active_search == true && ${collection.iterator}_active_search == true &&
${itm}.length == 0 && ${itm}.length == 0 &&
!(is_superuser && ${collection.hideOnSuperuser})\"> !(is_superuser && ${collection.hideOnSuperuser})\">
<div class=\"col-lg-12 List-searchNoResults\"> <div class=\"col-lg-12 List-searchNoResults\">
No records matched your search. No records matched your search.
</div> </div>
</div> </div>
`; `;
// Show the "no items" box when loading is done and the user isn't actively searching and there are no results // Show the "no items" box when loading is done and the user isn't actively searching and there are no results
html += "<div class=\"List-noItems\" ng-show=\"" + collection.iterator + "Loading == false && " + collection.iterator + "_active_search == false && " + collection.iterator + "_total_rows < 1\">PLEASE ADD ITEMS TO THIS LIST</div>"; html += "<div class=\"List-noItems\" ng-show=\"" + collection.iterator + "Loading == false && " + collection.iterator + "_active_search == false && " + collection.iterator + "_total_rows < 1\">PLEASE ADD ITEMS TO THIS LIST</div>";
html += ` html += `
<div class=\"List-noItems\" ng-show=\"is_superuser\"> <div class=\"List-noItems\" ng-show=\"is_superuser\">
System Administrators have access to all ${collection.iterator}s System Administrators have access to all ${collection.iterator}s
</div> </div>
`; `;
// Start the list // Start the list
html += ` html += `
<div class=\"list-wrapper\" <div class=\"list-wrapper\"
ng-show=\"(${collection.iterator}Loading == true || ng-show=\"(${collection.iterator}Loading == true ||
(${collection.iterator}Loading == false && ${itm}.length > 0)) && (${collection.iterator}Loading == false && ${itm}.length > 0)) &&
!(is_superuser && ${collection.hideOnSuperuser})\"> !(is_superuser && ${collection.hideOnSuperuser})\">
<table id=\"${itm}_table\" class=\"${collection.iterator} List-table\"> <table id=\"${itm}_table\" class=\"${collection.iterator} List-table\">
<thead> <thead>
<tr class=\"List-tableHeaderRow\"> <tr class=\"List-tableHeaderRow\">
`; `;
html += (collection.index === undefined || collection.index !== false) ? "<th class=\"col-xs-1\">#</th>\n" : ""; html += (collection.index === undefined || collection.index !== false) ? "<th class=\"col-xs-1\">#</th>\n" : "";
for (fld in collection.fields) { for (fld in collection.fields) {