Skip to content

Commit

Permalink
MGR-130
Browse files Browse the repository at this point in the history
  • Loading branch information
madness-inc committed Dec 17, 2021
1 parent b7f70b0 commit 2567b93
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Expand Up @@ -134,8 +134,9 @@ public DataContainer getData(Site site, Application application, Environment env
try {
String name = options.getString(SITE, "siteName");
String domain = options.getString(SITE, "siteDomain");
String active = StringUtils.trimToEmpty(options.getString(SITE, "siteActive"));
data = service.searchSites(environment, fp, siteId, name, domain, active);
String active = StringUtils.trimToNull(options.getString(SITE, "siteActive"));
data = service.searchSites(environment, fp, siteId, name, domain,
StringUtils.defaultString(active, "all"));
} catch (BusinessException e) {
String message = request.getMessage(e.getMessageKey(), e.getMessageArgs());
log.error(message, e);
Expand Down
Expand Up @@ -979,7 +979,7 @@ public DataContainer searchSites(Environment environment, FieldProcessor fp, Int
if (StringUtils.isNotBlank(domain)) {
siteQuery.contains("domain", domain);
}
if (StringUtils.isNotBlank(active)) {
if (!"all".equals(active)) {
siteQuery.equals("active", Boolean.valueOf(active));
}
Page<SiteImpl> sites = siteRepository.search(siteQuery, fp.getPageable());
Expand All @@ -996,7 +996,7 @@ public DataContainer searchSites(Environment environment, FieldProcessor fp, Int
.select(domain).build();

Map<String, String> activeValues = new HashMap<>();
activeValues.put("", "all");
activeValues.put("all", "all");
activeValues.put("true", "yes");
activeValues.put("false", "no");
Selection activeFilter = selectionFactory.fromObjects(FILTER_SITE_ACTIVE, MessageConstants.ACTIVE,
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/xml/SitesTest-testShowSites.xml
Expand Up @@ -118,7 +118,7 @@
</selection>
<selection id="f_sa" type="radio">
<title id="active">Active</title>
<option value="" name="all" selected="true" />
<option value="all" name="all" selected="true" />
<option value="true" name="yes" selected="false" />
<option value="false" name="no" selected="false" />
</selection>
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/xml/SitesTest-testShowSitesFiltered.xml
Expand Up @@ -118,7 +118,7 @@
</selection>
<selection id="f_sa" type="radio">
<title id="active">Active</title>
<option value="" name="all" selected="false"/>
<option value="all" name="all" selected="false"/>
<option value="true" name="yes" selected="true"/>
<option value="false" name="no" selected="false"/>
</selection>
Expand Down

0 comments on commit 2567b93

Please sign in to comment.