java/code/src/com/redhat/rhn/frontend/action/systems/duplicate/DuplicateSystemsCompareAction.java
| 51 ++++++----
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
| 2
java/code/src/com/redhat/rhn/manager/system/SystemManager.java
| 7 -
java/code/webapp/WEB-INF/pages/systems/duplicate/duplicatesystemscompare.jsp
| 1
4 files changed, 38 insertions(+), 23 deletions(-)
New commits:
commit 45ad811193b33e995d055a50ae80f82159ea1491
Author: Partha Aji <paji(a)redhat.com>
Date: Thu May 13 12:27:26 2010 -0400
Made the default dups compare page preselect a bunch of items
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/systems/duplicate/DuplicateSystemsCompareAction.java
b/java/code/src/com/redhat/rhn/frontend/action/systems/duplicate/DuplicateSystemsCompareAction.java
index 5380e1c..b84c05c 100644
---
a/java/code/src/com/redhat/rhn/frontend/action/systems/duplicate/DuplicateSystemsCompareAction.java
+++
b/java/code/src/com/redhat/rhn/frontend/action/systems/duplicate/DuplicateSystemsCompareAction.java
@@ -17,6 +17,7 @@ package com.redhat.rhn.frontend.action.systems.duplicate;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.domain.server.Server;
import com.redhat.rhn.frontend.dto.SystemCompareDto;
+import com.redhat.rhn.frontend.dto.SystemOverview;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.frontend.struts.RhnAction;
import com.redhat.rhn.frontend.taglibs.list.helper.ListSessionSetHelper;
@@ -29,10 +30,12 @@ import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -61,6 +64,16 @@ public class DuplicateSystemsCompareAction extends RhnAction implements
Listable
params.put(KEY_TYPE, context.getRequiredParamAsString(KEY_TYPE));
request.setAttribute("maxLimit", MAX_LIMIT);
ListSessionSetHelper helper = new ListSessionSetHelper(this, request, params);
+
+ if (!context.isSubmitted()) {
+ List<SystemOverview> result = getResult(context);
+ Set<String> preSelect = new HashSet<String>();
+ for (int i = 0; i < Math.min(MAX_LIMIT, result.size()); i++) {
+ preSelect.add(result.get(i).getId().toString());
+ }
+ helper.preSelect(preSelect);
+ }
+
helper.execute();
if (context.isSubmitted()) {
boolean resync = false;
@@ -82,26 +95,26 @@ public class DuplicateSystemsCompareAction extends RhnAction
implements Listable
if (resync) {
helper.execute();
}
-
- if (helper.getSet().size() > MAX_LIMIT) {
- LocalizationService ls = LocalizationService.getInstance();
- ActionErrors errors = new ActionErrors();
- getStrutsDelegate().addError(errors,
- "duplicate.compares.max_limit.message",
- String.valueOf(MAX_LIMIT), ls.getMessage("Refresh
Comparison"));
- getStrutsDelegate().saveMessages(request, errors);
- }
- else {
- List<Long> sids = new LinkedList<Long>();
- for (String sid : helper.getSet()) {
- sids.add(Long.valueOf(sid));
- }
- List<Server> systems = SystemManager.
- hydrateServerFromIds(sids, context.getLoggedInUser());
- request.setAttribute("systems",
- new SystemCompareDto(systems, context.getLoggedInUser()));
- }
}
+ if (helper.getSet().size() > MAX_LIMIT) {
+ LocalizationService ls = LocalizationService.getInstance();
+ ActionErrors errors = new ActionErrors();
+ getStrutsDelegate().addError(errors,
+ "duplicate.compares.max_limit.message",
+ String.valueOf(MAX_LIMIT), ls.getMessage("Refresh
Comparison"));
+ getStrutsDelegate().saveMessages(request, errors);
+ }
+ else {
+ List<Long> sids = new LinkedList<Long>();
+ for (String sid : helper.getSet()) {
+ sids.add(Long.valueOf(sid));
+ }
+ List<Server> systems = SystemManager.
+ hydrateServerFromIds(sids, context.getLoggedInUser());
+ request.setAttribute("systems",
+ new SystemCompareDto(systems, context.getLoggedInUser()));
+ }
+
return mapping.findForward("default");
}
diff --git a/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
b/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
index d8420e7..be532f1 100644
--- a/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
+++ b/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
@@ -2734,7 +2734,7 @@ public class SystemManager extends BaseManager {
* @param ip ip address of the system
* @return List of DuplicateSystemGrouping objects
*/
- public static List listDuplicatesByIP(User user, String ip) {
+ public static List<SystemOverview> listDuplicatesByIP(User user, String ip) {
return listDuplicates(user, "duplicate_system_ids_ip_key", ip);
}
@@ -2758,7 +2758,7 @@ public class SystemManager extends BaseManager {
* @param mac the mac address of the system
* @return List of DuplicateSystemGrouping objects
*/
- public static List listDuplicatesByMac(User user, String mac) {
+ public static List<SystemOverview> listDuplicatesByMac(User user, String mac)
{
return listDuplicates(user, "duplicate_system_ids_mac_key", mac);
}
@@ -2780,7 +2780,8 @@ public class SystemManager extends BaseManager {
* @param hostName host name of the system
* @return List of DuplicateSystemGrouping objects
*/
- public static List listDuplicatesByHostname(User user, String hostName) {
+ public static List<SystemOverview> listDuplicatesByHostname(User user,
+ String hostName) {
return listDuplicates(user, "duplicate_system_ids_hostname_key",
hostName);
}
diff --git a/java/code/webapp/WEB-INF/pages/systems/duplicate/duplicatesystemscompare.jsp
b/java/code/webapp/WEB-INF/pages/systems/duplicate/duplicatesystemscompare.jsp
index ad9771a..4cdf7f5 100644
--- a/java/code/webapp/WEB-INF/pages/systems/duplicate/duplicatesystemscompare.jsp
+++ b/java/code/webapp/WEB-INF/pages/systems/duplicate/duplicatesystemscompare.jsp
@@ -39,6 +39,7 @@
<rl:column sortattr="lastCheckinDate"
attr="lastCheckin"
bound="true"
+ styleclass="last-column"
headerkey="systemlist.jsp.last_checked_in"/>
</rl:list>
commit ca5749ce7355c0c9e270575a6a5e9a0903c642c1
Author: Partha Aji <paji(a)redhat.com>
Date: Thu May 13 12:11:02 2010 -0400
Improved a error message on Dups systems page
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 9082bfc..e55d92f 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -5784,7 +5784,7 @@ value for this entitlement, excluding the default organization's
consumption.</s
<source>The systems below are potential duplicates of one another. You may
select a combination of <strong>{0} systems at once</strong>
for detailed comparison</source>
</trans-unit>
<trans-unit id="duplicate.compares.max_limit.message">
- <source>You have crossed the maximum limit for system comparison. Select a
combination of at most <strong>{0} systems</strong> to compare
and select <strong>{1}</strong></source>
+ <source>You have selected more than {0} system profiles for comparison.
Please select a combination of <strong>{0} systems or
less</strong> to compare and select
<strong>{1}</strong></source>
</trans-unit>
<trans-unit id="Delete System Profile">
<source>Delete System Profile</source>