From: <ma...@rh...> - 2009-04-10 19:05:42
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [3681] add "group search" functionality in the drop down menu to go along with the ability to search for individual resources</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>3681</dd> <dt>Author</dt> <dd>mazz</dd> <dt>Date</dt> <dd>2009-04-10 14:05:38 -0500 (Fri, 10 Apr 2009)</dd> </dl> <h3>Log Message</h3> <pre>add "group search" functionality in the drop down menu to go along with the ability to search for individual resources</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainresourcegroupcompositeResourceGroupCompositejava">rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainwebappWEBINFjsfmanagedbeansnavigationbeansxml">rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/navigation-beans.xml</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainwebapprhqcommonmenumenuxhtml">rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml</a></li> </ul> <h3>Added Paths</h3> <ul> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguinavigationgroupResourceGroupSelectUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupSelectUIBean.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainresourcegroupcompositeResourceGroupCompositejava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java (3680 => 3681)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java 2009-04-10 18:46:05 UTC (rev 3680) +++ rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java 2009-04-10 19:05:38 UTC (rev 3681) </span><span class="lines">@@ -68,6 +68,8 @@ </span><span class="cx"> implicitAvail = implicitAvailability; } </span><span class="add">+ this.resourceGroup = resourceGroup; + </span><span class="cx"> if (this.resourceGroup.getGroupCategory() == GroupCategory.COMPATIBLE) { this.category = GroupCategory.COMPATIBLE; } else if (this.resourceGroup.getGroupCategory() == GroupCategory.MIXED) { </span><span class="lines">@@ -76,8 +78,6 @@ </span><span class="cx"> throw new IllegalArgumentException("Unknown category " + this.resourceGroup.getGroupCategory() + " for ResourceGroup " + this.resourceGroup.getName()); } </span><span class="rem">- - this.resourceGroup = resourceGroup; </span><span class="cx"> } public Double getImplicitAvail() { </span><span class="lines">@@ -120,6 +120,16 @@ </span><span class="cx"> return getAlignedAvailabilityResults(getImplicitUp(), getImplicitDown()); } </span><span class="add">+ /** + * Returns a query string snippet that can be passed to group URLs that reference this specific group. + * Note that the returned string does not include the "?" itself. + * + * @return query string snippet that can appear after the "?" in group URLs. + */ + public String getGroupQueryString() { + return "category=" + getCategory().getName() + "&amp;groupId=" + getResourceGroup().getId(); + } + </span><span class="cx"> private String getAlignedAvailabilityResults(long up, long down) { StringBuilder results = new StringBuilder(); results.append("<table width=\"120px\"><tr>"); </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguinavigationgroupResourceGroupSelectUIBeanjava"></a> <div class="addfile"><h4>Added: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupSelectUIBean.java (0 => 3681)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupSelectUIBean.java (rev 0) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupSelectUIBean.java 2009-04-10 19:05:38 UTC (rev 3681) </span><span class="lines">@@ -0,0 +1,72 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.enterprise.gui.navigation.group; + +import java.util.ArrayList; +import java.util.List; + +import org.rhq.core.domain.resource.group.ResourceGroup; +import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite; +import org.rhq.core.domain.util.PageControl; +import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility; +import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal; +import org.rhq.enterprise.server.util.LookupUtil; + +/** + * Used to support searching for groups. + * + * @author John Mazzitelli + */ +public class ResourceGroupSelectUIBean { + + private ResourceGroup resourceGroup; + + private ResourceGroupManagerLocal resourceGroupManager = LookupUtil.getResourceGroupManager(); + + private String searchString; + + public ResourceGroup getResourceGroup() { + return resourceGroup; + } + + public void setResourceGroup(ResourceGroup resourceGroup) { + this.resourceGroup = resourceGroup; + } + + public String getSearchString() { + return searchString; + } + + public void setSearchString(String searchString) { + this.searchString = searchString; + } + + public List<ResourceGroupComposite> autocomplete(Object suggest) { + String pref = (String) suggest; + ArrayList<ResourceGroupComposite> result; + + PageControl pc = new PageControl(); + pc.setPageSize(50); + + result = resourceGroupManager.getResourceGroupsFiltered(EnterpriseFacesContextUtility.getSubject(), null, null, + null, pref, null, null, pc); + + return result; + } +} </span><span class="cx">Property changes on: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupSelectUIBean.java ___________________________________________________________________ </span></pre></div> <a id="svnmimetype"></a> <div class="addfile"><h4>Added: svn:mime-type ( => )</h4> <pre class="diff"> <span class="info">Added: svn:keywords + Date Author Id Revision HeadURL </span></pre></div> <a id="svneolstyle"></a> <div class="addfile"><h4>Added: svn:eol-style ( => )</h4> <pre class="diff"> <span class="info"> Modified: rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/navigation-beans.xml </span><span class="cx">=================================================================== </span><span class="rem">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/navigation-beans.xml 2009-04-10 18:46:05 UTC (rev 3680) </span><span class="add">+++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/navigation-beans.xml 2009-04-10 19:05:38 UTC (rev 3681) </span><span class="lines">@@ -29,5 +29,10 @@ </span><span class="cx"> <managed-bean-class>org.rhq.enterprise.gui.navigation.resource.ResourceSelectUIBean</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> </span><span class="add">+ <managed-bean> + <managed-bean-name>ResourceGroupSelectUIBean</managed-bean-name> + <managed-bean-class>org.rhq.enterprise.gui.navigation.group.ResourceGroupSelectUIBean</managed-bean-class> + <managed-bean-scope>request</managed-bean-scope> + </managed-bean> </span><span class="cx"> </faces-config> </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainwebapprhqcommonmenumenuxhtml"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml (3680 => 3681)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml 2009-04-10 18:46:05 UTC (rev 3680) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml 2009-04-10 19:05:38 UTC (rev 3681) </span><span class="lines">@@ -175,19 +175,19 @@ </span><span class="cx"> </rich:menuItem> <ui:remove>***** Groups > GROUP DEFINITIONS *****</ui:remove> </span><span class="rem">- <rich:menuItem submitMode="none" icon="/images/GroupDefinition_16.png" </span><span class="add">+ <rich:menuItem submitMode="none" icon="/images/GroupDefinition_16.png" </span><span class="cx"> onclick="window.location = '/rhq/definition/group/list.xhtml'"> <h:outputText value="#{msg['resource.hub.filter.groupDefinitions']}"/> </rich:menuItem> <rich:menuSeparator rendered="#{GlobalPermissionsUIBean.inventory}"/> </span><span class="rem">- </span><span class="add">+ </span><span class="cx"> <ui:remove>***** Groups > NEW RESOURCE GROUP *****</ui:remove> <rich:menuItem submitMode="none" onclick="window.location = '/resource/group/Inventory.do?mode=new'" rendered="#{GlobalPermissionsUIBean.inventory}"> <h:outputText value="#{msg['resource.hub.NewGroupLink']}"/> </rich:menuItem> </span><span class="rem">- </span><span class="add">+ </span><span class="cx"> <ui:remove>***** Groups > NEW GROUP DEFINITIONS *****</ui:remove> <rich:menuItem submitMode="none" onclick="window.location = '/rhq/definition/group/new.xhtml'" rendered="#{GlobalPermissionsUIBean.inventory}"> </span><span class="lines">@@ -219,6 +219,43 @@ </span><span class="cx"> </c:if> </c:forEach> </rich:menuGroup> </span><span class="add">+ + <rich:menuSeparator/> + + <ui:remove>***** Groups > SEARCH *****</ui:remove> + <rich:menuItem submitMode="none" disabled="true" iconDisabled="/images/icons/Search_16.png"> + <h:outputText value="Search: " style="color: black;"/> + <h:panelGroup> + <h:inputText id="selectedGroup" style="width: 250px;" immediate="true" + onkeypress="return ignoreEnterKey(event);" /> + <rich:suggestionbox id="groupSelectBox" for="selectedGroup" tokens=",[]" + ajaxSingle="true" immediate="true" + suggestionAction="#{ResourceGroupSelectUIBean.autocomplete}" + var="result" data="foo" fetchValue="#{result.groupQueryString}" + nothingLabel="No matching groups found" + style="background-color: #cccccc;" + onselect="document.location.href='/rhq/group/inventory/view.xhtml?' + #{rich:element('selectedGroup')}.value" + usingSuggestObjects="false" width="700" height="400"> + <h:column> + <f:facet name="header">Avail</f:facet> + <h:graphicImage value="/images/icons/availability_green_16.png" rendered="#{result.implicitUp > 0 and result.implicitDown == 0}"/> + <h:graphicImage value="/images/icons/availability_red_16.png" rendered="#{result.implicitUp == 0 and result.implicitDown > 0}"/> + <h:graphicImage value="/images/icons/availability_yellow_16.png" rendered="#{result.implicitUp > 0 and result.implicitDown > 0}"/> + <h:graphicImage value="/images/icons/availability_grey_16.png" rendered="#{result.implicitUp == 0 and result.implicitDown == 0}"/> + </h:column> + <h:column> + <f:facet name="header">Group</f:facet> + <h:outputText value="#{result.resourceGroup.name}"/> + </h:column> + <h:column> + <f:facet name="header">Category</f:facet> + <h:outputText value="#{result.category.name}" rendered="#{result.category.name == 'MIXED'}"/> + <h:outputText value="#{result.resourceGroup.resourceType.name}" rendered="#{result.category.name == 'COMPATIBLE'}"/> + </h:column> + </rich:suggestionbox> + </h:panelGroup> + </rich:menuItem> + </span><span class="cx"> </rich:dropDownMenu> <ui:remove>===== ADMINISTRATION =====</ui:remove> </span> </pre> </div> </div> </body> </html> |