2 commits - backend/server spacewalk/setup
by Jan Pazdziora
backend/server/rhnSQL/__init__.py | 18 ++++++++++++++++++
spacewalk/setup/bin/spacewalk-setup | 2 +-
2 files changed, 19 insertions(+), 1 deletion(-)
New commits:
commit 39a78e2b6192e384996310c06c22e2a481a3b663
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Jun 24 13:04:44 2010 +0200
Parse the default_db; the DNS part (the one after @) is DBI-style connect string.
diff --git a/backend/server/rhnSQL/__init__.py b/backend/server/rhnSQL/__init__.py
index de6303a..e7c7df2 100644
--- a/backend/server/rhnSQL/__init__.py
+++ b/backend/server/rhnSQL/__init__.py
@@ -92,6 +92,24 @@ def initDB(dsn=None, backend=ORACLE, host="localhost", port=None, username=None,
(username, temp) = dsn.split("/")
(password, database) = temp.split("@")
+ if backend == POSTGRESQL:
+ host = None
+ port = None
+ dsn = CFG.DEFAULT_DB
+ print "dsn [%s]" % dsn
+ (username, temp) = dsn.split("/")
+ (password, dsn) = temp.split("@")
+ for i in dsn.split(';'):
+ (k, v) = i.split('=')
+ if k == 'dbname':
+ database = v
+ elif k == 'host':
+ host = v
+ elif k == 'port':
+ port = v
+ else:
+ raise rhnException("Unknown piece in default_db string", i)
+
# Hide the password
add_to_seclist(dsn)
try:
commit df17a3ab507cc17d8c336c373b389b67437f5866
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Jun 24 12:06:47 2010 +0200
The default_db has username and password in Oracle case, let's make it the same for PostgreSQL.
For now.
diff --git a/spacewalk/setup/bin/spacewalk-setup b/spacewalk/setup/bin/spacewalk-setup
index ab7752a..4fe82a5 100755
--- a/spacewalk/setup/bin/spacewalk-setup
+++ b/spacewalk/setup/bin/spacewalk-setup
@@ -956,7 +956,7 @@ sub populate_initial_configs {
$hibernate_dialect = "org.hibernate.dialect.PostgreSQLDialect";
$hibernate_driver = "org.postgresql.Driver";
$hibernate_url = "jdbc:postgresql://";
- $default_db = "dbname=$answers->{'db-name'}";
+ $default_db = "$answers->{'db-user'}/$answers->{'db-password'}\@dbname=$answers->{'db-name'}";
if (defined $answers->{"db-host"} and $answers->{"db-host"} ne '') {
$hibernate_url .= $answers->{"db-host"};
$default_db .= ";host=$answers->{'db-host'}";
13 years, 10 months
Branch 'fve' - 2 commits - java/code
by Partha Aji
java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java | 1 +
java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp | 2 +-
java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp | 2 +-
java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp | 2 +-
4 files changed, 4 insertions(+), 3 deletions(-)
New commits:
commit 76f9e3af9dad4896e6d514399513ce0181ac7052
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 20:49:00 2010 -0400
Added page sizes to flex multiorg pages
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
index 7aeebdc..f2b3505 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
@@ -49,7 +49,7 @@
alphabarcolumn="name"
styleclass="list"
emptykey="orgsoftwaresubs.jsp.nochannelfams">
-
+ <rl:decorator name="PageSizeDecorator"/>
<rl:column
filterattr="name"
sortattr = "name"
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
index 367b72c..3443ed8 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
@@ -39,7 +39,7 @@
<rl:list alphabarcolumn="name"
styleclass="list"
emptykey="softwareentitlements.noentitlements">
-
+ <rl:decorator name="PageSizeDecorator"/>
<rl:column
sortattr="name"
filterattr="name"
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp
index 1d7eec0..a19ce7d 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp
@@ -38,7 +38,7 @@
styleId="multiorg-entitlement-listview"
alphabarcolumn="orgName"
emptykey="softwareEntitlementSubs.noOrgsFound">
-
+ <rl:decorator name="PageSizeDecorator"/>
<rl:column
filterattr="orgName"
sortattr="orgName"
commit f92b49ab81bd4a9d1aba569b102221ebc9fc92df
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 20:44:47 2010 -0400
fixed a line typo where I forgot to clear the map create in session
diff --git a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java b/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java
index 206b7d1..55efd7d 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java
@@ -112,6 +112,7 @@ public class SoftwareEntitlementSubscriptionsAction extends RhnAction implements
getStrutsDelegate().saveMessages(request, ae);
}
else {
+ request.getSession().removeAttribute(makeLabel(request));
createSuccessMessage(request,
"softwareEntitlementSubs.successMessage", org.getName());
retval = getStrutsDelegate().forwardParam(
13 years, 10 months
Branch 'fve' - java/code
by Partha Aji
java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 3f38e5c1b39b14dc2d99579e3105e7a194dea0c1
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 20:39:04 2010 -0400
Added sorting to channel family-> orgs page
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp
index 791f922..1d7eec0 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp
@@ -31,7 +31,7 @@
<!-- Reuse the form opened by the list tag -->
<html:hidden property="submitted" value="true"/>
<html:hidden property="cfid" value="${channelFamily.id}"/>
- <html:hidden property="orgClicked" value="0"/>
+ <html:hidden property="orgClicked" value=""/>
<rl:list
styleclass="list"
@@ -41,6 +41,7 @@
<rl:column
filterattr="orgName"
+ sortattr="orgName"
headerkey="softwareEntitlementSubs.column.orgName"
styleclass="first-column">
<a href="/rhn/admin/multiorg/OrgDetails.do?oid=${current.org.id}" tabindex="-1">
13 years, 10 months
Branch 'fve' - 2 commits - java/code web/html
by Partha Aji
java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml | 8
java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java | 2
java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgNameFilter.java | 42 -
java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java | 234 ++++++----
java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java | 28 -
java/code/src/com/redhat/rhn/frontend/dto/OrgSoftwareEntitlementDto.java | 128 +++++
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 19
java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java | 67 +-
java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp | 4
java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp | 2
java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp | 166 +++++--
web/html/javascript/multiorg-entitlements.js | 163 ------
12 files changed, 483 insertions(+), 380 deletions(-)
New commits:
commit 5eb0be32bb6841accafaafcb3f7b27aa4f26708e
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 20:25:05 2010 -0400
Added flex magic to ChannelFamily -> Orgs page
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
index 8e4b073..6d5c259 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
@@ -380,7 +380,9 @@ ORDER by cfo.name DESC
<mode name="channel_entitlement" class="com.redhat.rhn.frontend.dto.ChannelOverview">
<query params="org_id, entitlement_id">
-SELECT CFO.id, CFO.name, CFO.label, CFO.current_members, CFO.max_members, CFO.has_subscription, CFO.url
+SELECT CFO.id, CFO.name, CFO.label, CFO.current_members, CFO.max_members,
+CFO.fve_current_members as current_flex, CFO.fve_max_members as max_flex,
+ CFO.has_subscription, CFO.url
FROM rhnChannelFamilyOverview CFO
WHERE CFO.org_id = :org_id
AND CFO.id = :entitlement_id
@@ -390,7 +392,9 @@ SELECT CFO.id, CFO.name, CFO.label, CFO.current_members, CFO.max_members, CFO.ha
<mode name="channel_entitlement_for_all_orgs" class="com.redhat.rhn.frontend.dto.ChannelOverview">
<query params="entitlement_id">
-SELECT CFO.id, CFO.org_id, CFO.name, CFO.label, CFO.current_members, CFO.max_members, CFO.has_subscription, CFO.url
+SELECT CFO.id, CFO.org_id, CFO.name, CFO.label, CFO.current_members, CFO.max_members,
+ CFO.fve_current_members as current_flex, CFO.fve_max_members as max_flex,
+ CFO.has_subscription, CFO.url
FROM rhnChannelFamilyOverview CFO
WHERE CFO.id = :entitlement_id
AND CFO.org_id in (SELECT ID FROM WEB_CUSTOMER)
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java b/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
index 9a032ac..adfbd69 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
@@ -246,7 +246,7 @@ public class ChannelFamily extends BaseDomainHelper {
*/
private PrivateChannelFamily getAllocation(Org orgIn) {
for (PrivateChannelFamily alloc : getPrivateChannelFamilies()) {
- if (orgIn.equals(alloc.getOrg())) {
+ if (orgIn.getId().equals(alloc.getOrg().getId())) {
return alloc;
}
}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgNameFilter.java b/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgNameFilter.java
deleted file mode 100644
index 79bc10b..0000000
--- a/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgNameFilter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2009--2010 Red Hat, Inc.
- *
- * This software is licensed to you under the GNU General Public License,
- * version 2 (GPLv2). There is NO WARRANTY for this software, express or
- * implied, including the implied warranties of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
- * along with this software; if not, see
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
- *
- * Red Hat trademarks are not licensed under GPLv2. No permission is
- * granted to use or replicate Red Hat trademarks that are incorporated
- * in this software or its documentation.
- */
-package com.redhat.rhn.frontend.action.multiorg;
-
-import com.redhat.rhn.common.localization.LocalizationService;
-import com.redhat.rhn.frontend.taglibs.list.BaseListFilter;
-
-import java.util.Locale;
-import java.util.Map;
-
-
-/**
- * SoftwareEntitlementsFilter
- * @version $Rev$
- */
-public class OrgNameFilter extends BaseListFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void processMap(Map map, Locale userLocale) {
- LocalizationService ls =
- LocalizationService.getInstance();
- String filterBy = ls.getMessage("softwareEntitlementSubs.filterBy",
- userLocale);
- map.put(filterBy, "orgName");
- }
-
-}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java b/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java
index b5841ab..206b7d1 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java
@@ -14,20 +14,6 @@
*/
package com.redhat.rhn.frontend.action.multiorg;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.struts.action.ActionErrors;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-import org.apache.struts.action.DynaActionForm;
-
import com.redhat.rhn.common.validator.ValidatorError;
import com.redhat.rhn.domain.channel.ChannelFamily;
import com.redhat.rhn.domain.channel.ChannelFamilyFactory;
@@ -39,19 +25,45 @@ import com.redhat.rhn.frontend.dto.OrgSoftwareEntitlementDto;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.frontend.struts.RhnAction;
import com.redhat.rhn.frontend.struts.RhnValidationHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
import com.redhat.rhn.manager.channel.ChannelManager;
import com.redhat.rhn.manager.org.OrgManager;
import com.redhat.rhn.manager.org.UpdateOrgSoftwareEntitlementsCommand;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.DynaActionForm;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
/**
* SoftwareEntitlementSubscriptionsAction
* @version $Rev$
*/
-public class SoftwareEntitlementSubscriptionsAction extends RhnAction {
+public class SoftwareEntitlementSubscriptionsAction extends RhnAction implements Listable {
private static Logger log = Logger.getLogger(
SoftwareEntitlementSubscriptionsAction.class);
+ private static final String ORGS = "orgs";
+
+ private static String makeLabel(HttpServletRequest request) {
+ RequestContext ctx = new RequestContext(request);
+ Long cfid = ctx.getParamAsLong("cfid");
+ return "SoftwareEntitlementSubscriptionsAction" + cfid;
+ }
+
/** {@inheritDoc} */
public ActionForward execute(ActionMapping mapping,
@@ -65,26 +77,36 @@ public class SoftwareEntitlementSubscriptionsAction extends RhnAction {
Long cfid = ctx.getParamAsLong("cfid");
ChannelFamily channelFamily = ChannelFamilyFactory.lookupById(cfid);
-
+
// custom channel, redirect to entitlement page
Long max = channelFamily.getMaxMembers(OrgFactory.getSatelliteOrg());
if (max == null) {
return mapping.findForward("unlimited");
}
- ActionForward retval = getStrutsDelegate().forwardParam(mapping.findForward(
- "default"), "cfid", cfid.toString());
+ Map params = new HashMap();
+ params.put("cfid", cfid);
+ ListHelper helper = new ListHelper(this, request, params);
+ helper.execute();
+ ActionForward retval = mapping.findForward("default");
if (isSubmitted(dynaForm)) {
+
+ Map <String, String> subsMap = (Map <String, String>)
+ request.getSession().getAttribute(makeLabel(request));
+ for (String id : subsMap.keySet()) {
+ if (request.getParameter(id) != null) {
+ subsMap.put(id, request.getParameter(id));
+ }
+ }
+
String orgClickedStr = request.getParameter("orgClicked");
- String newCountStr = request.getParameter("newCount_" + orgClickedStr);
-
- if (newCountStr != null && !StringUtils.isEmpty(newCountStr)) {
+ if (!StringUtils.isBlank(orgClickedStr)) {
Long orgId = Long.parseLong(orgClickedStr);
Org org = OrgFactory.lookupById(orgId);
ActionErrors ae = updateSubscriptions(org, dynaForm, request,
- channelFamily, newCountStr);
+ channelFamily, subsMap);
if (ae != null && ae.size() > 0) {
getStrutsDelegate().saveMessages(request, ae);
@@ -101,7 +123,21 @@ public class SoftwareEntitlementSubscriptionsAction extends RhnAction {
log.debug("Ignoring form submit (likely a page change)");
}
}
-
+ else {
+ Map<String, String> subsMap = new HashMap<String, String>();
+ List <OrgSoftwareEntitlementDto> subs = helper.getDataSet();
+ for (OrgSoftwareEntitlementDto sub : subs) {
+ if (sub.getMaxPossibleAllocation() > 0) {
+ subsMap.put(sub.getKey(), sub.getMaxMembers().toString());
+ }
+ if (sub.getMaxPossibleFlexAllocation() > 0) {
+ subsMap.put(sub.getFlexKey(), sub.getMaxFlex().toString());
+ }
+ }
+ request.getSession().setAttribute(makeLabel(request), subsMap);
+ }
+ request.setAttribute(ORGS,
+ request.getSession().getAttribute(makeLabel(request)));
setupFormValues(request, user, cfid, channelFamily);
return retval;
@@ -110,10 +146,8 @@ public class SoftwareEntitlementSubscriptionsAction extends RhnAction {
private void setupFormValues(HttpServletRequest request, User user,
Long cfid, ChannelFamily channelFamily) {
Org satelliteOrg = OrgFactory.getSatelliteOrg();
-
setupOrgEntitlementUsageList(request, user, satelliteOrg, channelFamily);
setupEntitlementUsageTotals(request, cfid, satelliteOrg, user);
-
request.setAttribute("channelFamily", channelFamily);
}
@@ -122,28 +156,13 @@ public class SoftwareEntitlementSubscriptionsAction extends RhnAction {
*/
private void setupOrgEntitlementUsageList(HttpServletRequest request,
User user, Org satelliteOrg, ChannelFamily cf) {
-
- List<OrgSoftwareEntitlementDto> entitlementUsage =
- ChannelManager.listEntitlementsForAllOrgsWithEmptyOrgs(cf, user);
-
- for (Iterator <OrgSoftwareEntitlementDto> itr =
- entitlementUsage.iterator(); itr.hasNext();) {
- OrgSoftwareEntitlementDto dto = itr.next();
- if (satelliteOrg.equals(dto.getOrg())) {
- itr.remove();
- }
- }
-
ChannelOverview satelliteOrgOverview = ChannelManager.getEntitlement(
satelliteOrg.getId(), cf.getId());
if (satelliteOrgOverview == null) {
log.error("Default org does not appear to have been allocated entitlement:" +
cf.getId());
}
- request.setAttribute("pageList", entitlementUsage);
- request.setAttribute("parentUrl", request.getRequestURI());
request.setAttribute("satelliteOrgOverview", satelliteOrgOverview);
-
}
private void setupEntitlementUsageTotals(HttpServletRequest request,
@@ -151,79 +170,131 @@ public class SoftwareEntitlementSubscriptionsAction extends RhnAction {
List<ChannelOverview> channelOverviews =
ChannelManager.getEntitlementForAllOrgs(cfid);
- Long entitlementsMaxMembers = new Long(0);
- Long entitlementsCurrentMembers = new Long(0);
+ Long maxMembers = new Long(0);
+ Long currMembers = new Long(0);
Long entitlementRatio = new Long(0);
Long orgRatio = new Long(0);
Long entitledOrgs = new Long(0);
+ boolean regularAvailable = false;
+
+
+ long currFlex = 0;
+ long maxFlex = 0;
+ long flexEntRatio = 0;
+ long flexOrgRatio = 0;
+ long flexEntitledOrgs = 0;
+ boolean flexAvailable = false;
+
// don't include default org
Long orgCount = OrgManager.getTotalOrgCount(user) - 1;
-
for (ChannelOverview co : channelOverviews) {
if (co.getOrgId().equals(satelliteOrg.getId())) {
+ flexAvailable = co.getFreeFlex() > 0;
+ regularAvailable = co.getFreeMembers() > 0;
continue;
}
- entitlementsCurrentMembers += co.getCurrentMembers();
-
- entitlementsMaxMembers += co.getMaxMembers();
+
+ currMembers += co.getCurrentMembers();
+ maxMembers += co.getMaxMembers();
+ currFlex += co.getCurrentFlex();
+ maxFlex += co.getMaxFlex();
+
if (co.getMaxMembers() > 0) {
// manually count rather then use list size since max mem can be 0
entitledOrgs++;
+ regularAvailable = true;
}
+
+ if (co.getMaxFlex() > 0) {
+ flexAvailable = true;
+ flexEntitledOrgs++;
+ }
}
try {
- entitlementRatio = entitlementsCurrentMembers * 100 / entitlementsMaxMembers;
+ if (maxMembers > 0) {
+ entitlementRatio = currMembers * 100 / maxMembers;
+ }
+ if (maxFlex > 0) {
+ flexEntRatio = currFlex * 100 / maxFlex;
+ }
+ if (orgCount > 0) {
+ orgRatio = entitledOrgs * 100 / orgCount;
+ flexOrgRatio = flexEntitledOrgs * 100 / orgCount;
+ }
+
}
catch (Exception e) {
//default to 0
}
- try {
- orgRatio = entitledOrgs * 100 / orgCount;
- }
- catch (Exception e) {
- //default to 0
- }
request.setAttribute("orgCount", orgCount);
request.setAttribute("entitledOrgs", entitledOrgs);
- request.setAttribute("maxMem", entitlementsMaxMembers);
- request.setAttribute("curMem", entitlementsCurrentMembers);
+ request.setAttribute("maxMem", maxMembers);
+ request.setAttribute("curMem", currMembers);
request.setAttribute("entRatio", entitlementRatio);
request.setAttribute("orgRatio", orgRatio);
+ if (regularAvailable) {
+ request.setAttribute("regularAvailable", Boolean.TRUE);
+ }
+
+
+ request.setAttribute("flexEntitledOrgs", flexEntitledOrgs);
+ request.setAttribute("maxFlex", maxFlex);
+ request.setAttribute("curFlex", currFlex);
+ request.setAttribute("flexEntRatio", flexEntRatio);
+ request.setAttribute("flexOrgRatio", flexOrgRatio);
+ if (flexAvailable) {
+ request.setAttribute("flexAvailable", Boolean.TRUE);
+ }
}
private ActionErrors updateSubscriptions(Org org, DynaActionForm dynaForm,
- HttpServletRequest request, ChannelFamily channelFamily, String newCountStr) {
+ HttpServletRequest request, ChannelFamily channelFamily,
+ Map<String, String> subsMap) {
ActionErrors ae = new ActionErrors();
- Long newCount = null;
- try {
- newCount = Long.parseLong(newCountStr.trim());
+ long regCount = 0;
+ long flexCount = 0;
+
+ if (subsMap.containsKey(OrgSoftwareEntitlementDto.makeFlexKey(org.getId()))) {
+ try {
+ String flexValue = subsMap.get(
+ OrgSoftwareEntitlementDto.makeFlexKey(org.getId()));
+ flexCount = Long.parseLong(flexValue.trim());
+ }
+ catch (NumberFormatException e) {
+ ValidatorError error = new ValidatorError(
+ "softwareEntitlementSubs.invalidInput");
+ ae.add(RhnValidationHelper.validatorErrorToActionErrors(error));
+ }
}
- catch (NumberFormatException e) {
- ValidatorError error = new ValidatorError(
- "softwareEntitlementSubs.invalidInput");
- ae.add(RhnValidationHelper.validatorErrorToActionErrors(error));
- return ae;
+
+ if (subsMap.containsKey(OrgSoftwareEntitlementDto.makeKey(org.getId()))) {
+ try {
+ String value = subsMap.get(
+ OrgSoftwareEntitlementDto.makeKey(org.getId()));
+ regCount = Long.parseLong(value.trim());
+ }
+ catch (NumberFormatException e) {
+ ValidatorError error = new ValidatorError(
+ "softwareEntitlementSubs.invalidInput");
+ ae.add(RhnValidationHelper.validatorErrorToActionErrors(error));
+ }
}
- if (newCount < 0) {
- ValidatorError error = new ValidatorError(
- "softwareEntitlementSubs.invalidInput");
- ae.add(RhnValidationHelper.validatorErrorToActionErrors(error));
+ if (ae.size() > 0) {
return ae;
}
-
if (org.getId().equals(OrgFactory.getSatelliteOrg().getId())) {
createErrorMessage(request, "org.entitlements.system.defaultorg", null);
return null;
}
-
+
UpdateOrgSoftwareEntitlementsCommand updateCmd = null;
try {
updateCmd = new UpdateOrgSoftwareEntitlementsCommand(channelFamily.getLabel(),
- org, newCount, 0L);
+ org, regCount, flexCount);
}
catch (IllegalArgumentException e) {
ValidatorError error = new ValidatorError(
@@ -242,4 +313,25 @@ public class SoftwareEntitlementSubscriptionsAction extends RhnAction {
}
+ /**
+ * {@inheritDoc}
+ */
+ public List getResult(RequestContext contextIn) {
+ ChannelFamily cf = ChannelFamilyFactory.
+ lookupById(contextIn.getParamAsLong("cfid"));
+ List<OrgSoftwareEntitlementDto> entitlementUsage =
+ ChannelManager.listEntitlementsForAllOrgsWithEmptyOrgs(cf,
+ contextIn.getLoggedInUser());
+ Org satelliteOrg = OrgFactory.getSatelliteOrg();
+
+ for (Iterator <OrgSoftwareEntitlementDto> itr =
+ entitlementUsage.iterator(); itr.hasNext();) {
+ OrgSoftwareEntitlementDto dto = itr.next();
+ if (satelliteOrg.equals(dto.getOrg())) {
+ itr.remove();
+ }
+ }
+ return entitlementUsage;
+ }
+
}
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java b/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java
index 53d8d36..1ffd4aa 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java
@@ -33,6 +33,11 @@ public class ChannelOverview extends BaseDto implements Comparable {
private Long currentFlex;
private Long maxFlex;
private Long subscribeCount;
+ private Long hasSubscription;
+ private String url;
+ private Long relevantPackages;
+ private Long originalId;
+ private List<PackageDto> packages = new ArrayList<PackageDto>();
/**
@@ -88,14 +93,17 @@ public class ChannelOverview extends BaseDto implements Comparable {
this.maxFlex = maxFlexIn;
}
-
-
- private Long hasSubscription;
- private String url;
- private Long relevantPackages;
- private Long originalId;
- private List<PackageDto> packages = new ArrayList<PackageDto>();
-
+ /**
+ * @return Returns the free flex members.
+ */
+ public Long getFreeFlex() {
+ // Looks like the schema sadly allows this to be null:
+ Long max = maxFlex;
+ if (max == null || max == 0) {
+ return 0L;
+ }
+ return max - currentFlex;
+ }
/**
* @return Returns the originalId.
@@ -146,8 +154,8 @@ public class ChannelOverview extends BaseDto implements Comparable {
public Long getFreeMembers() {
// Looks like the schema sadly allows this to be null:
Long max = maxMembers;
- if (max == null) {
- max = new Long(0);
+ if (max == null || max == 0) {
+ return 0L;
}
return max - currentMembers;
}
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/OrgSoftwareEntitlementDto.java b/java/code/src/com/redhat/rhn/frontend/dto/OrgSoftwareEntitlementDto.java
index 114e066..768993f 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/OrgSoftwareEntitlementDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/OrgSoftwareEntitlementDto.java
@@ -28,23 +28,42 @@ public class OrgSoftwareEntitlementDto {
private Long currentMembers;
private Long maxMembers;
private Long maxPossibleAllocation;
+ private Long currentFlex;
+ private Long maxFlex;
+ private Long maxPossibleFlexAllocation;
/**
- * Constructor
- * @param orgIn Org
- * @param currentMembersIn Current member count
- * @param maxMembersIn Current max member count
- * @param maxPossibleAllocationIn Maximum possible allocation
+ * @param orgIn The org to set.
*/
- public OrgSoftwareEntitlementDto(Org orgIn, Long currentMembersIn, Long maxMembersIn,
- Long maxPossibleAllocationIn) {
- this.org = orgIn;
- this.currentMembers = currentMembersIn;
- this.maxMembers = maxMembersIn;
- this.maxPossibleAllocation = maxPossibleAllocationIn;
+ public void setOrg(Org orgIn) {
+ org = orgIn;
}
+
/**
+ * @param currentMembersIn The currentMembers to set.
+ */
+ public void setCurrentMembers(Long currentMembersIn) {
+ currentMembers = currentMembersIn;
+ }
+
+
+ /**
+ * @param maxMembersIn The maxMembers to set.
+ */
+ public void setMaxMembers(Long maxMembersIn) {
+ maxMembers = maxMembersIn;
+ }
+
+
+ /**
+ * @param maxPossibleAllocationIn The maxPossibleAllocation to set.
+ */
+ public void setMaxPossibleAllocation(Long maxPossibleAllocationIn) {
+ maxPossibleAllocation = maxPossibleAllocationIn;
+ }
+
+ /**
* @return The org in question.
*/
public Org getOrg() {
@@ -93,6 +112,93 @@ public class OrgSoftwareEntitlementDto {
* @return Max possible allocation.
*/
public Long getMaxPossibleAllocation() {
+ if (maxPossibleAllocation == null) {
+ return 0L;
+ }
return maxPossibleAllocation;
}
+
+
+ /**
+ * @return Returns the currentFlex.
+ */
+ public Long getCurrentFlex() {
+ return currentFlex;
+ }
+
+
+ /**
+ * @param currentFlexIn The currentFlex to set.
+ */
+ public void setCurrentFlex(Long currentFlexIn) {
+ currentFlex = currentFlexIn;
+ }
+
+
+ /**
+ * @return Returns the maxFlex.
+ */
+ public Long getMaxFlex() {
+ return maxFlex;
+ }
+
+
+ /**
+ * @param maxFlexIn The maxFlex to set.
+ */
+ public void setMaxFlex(Long maxFlexIn) {
+ maxFlex = maxFlexIn;
+ }
+
+
+ /**
+ * @return Returns the maxPossibleFlexAllocation.
+ */
+ public Long getMaxPossibleFlexAllocation() {
+ if (maxPossibleFlexAllocation == null) {
+ return 0L;
+ }
+ return maxPossibleFlexAllocation;
+ }
+
+
+ /**
+ * @param maxPossibleFlexAllocationIn The maxPossibleFlexAllocation to set.
+ */
+ public void setMaxPossibleFlexAllocation(Long maxPossibleFlexAllocationIn) {
+ maxPossibleFlexAllocation = maxPossibleFlexAllocationIn;
+ }
+
+
+ /**
+ * @return the key
+ */
+ public String getKey() {
+ return makeKey(getOrg().getId());
+ }
+
+ /**
+ * @return the key
+ */
+ public String getFlexKey() {
+ return makeFlexKey(getOrg().getId());
+ }
+
+
+ /**
+ * @param id the id of the channel family
+ * @return the key
+ */
+ public static String makeKey(Long id) {
+ return String.valueOf(id);
+ }
+
+
+ /**
+ * @param id the id of the channel family
+ * @return the key
+ */
+ public static String makeFlexKey(Long id) {
+ return id + "-flex";
+ }
}
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 8c59f44..559206f 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
@@ -4701,12 +4701,18 @@ deducted from the default organization.</source>
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
</context-group>
</trans-unit>
- <trans-unit id="softwareEntitlementSubs.systemWideCounts.header">
-<source>System-Wide Entitlement Counts</source>
+ <trans-unit id="softwareEntitlementSubs.systemWideCounts.header.regular">
+<source>System-Wide Regular Entitlement Counts</source>
<context-group name="ctx">
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
</context-group>
</trans-unit>
+ <trans-unit id="softwareEntitlementSubs.systemWideCounts.header.flex">
+<source>System-Wide Flex Entitlement Counts</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
+ </context-group>
+ </trans-unit>
<trans-unit id="softwareEntitlementSubs.submit">
<source>Update</source>
<context-group name="ctx">
@@ -4725,14 +4731,15 @@ deducted from the default organization.</source>
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
</context-group>
</trans-unit>
- <trans-unit id="softwareEntitlementSubs.totaltip">
-<source><strong>Tip:</strong> 'Total' refers to the total available entitlements to the organizations (excluding the default @@PRODUCT_NAME@@ organization) on this @@PRODUCT_NAME@@. It is not equal to the total available in the @@PRODUCT_NAME@@ certificate.</source>
+
+ <trans-unit id="softwareEntitlementSubs.Used/Alloted">
+<source>'Alloted' refers to the total available entitlements to the organizations (excluding the default @@PRODUCT_NAME@@ organization) on this @@PRODUCT_NAME@@. It is not equal to the total available in the @@PRODUCT_NAME@@ certificate.</source>
<context-group name="ctx">
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
</context-group>
</trans-unit>
<trans-unit id="softwareEntitlementSubs.systemWideCounts.totaltip">
-<source><strong>Tip:</strong> This total corresponds to your @@PRODUCT_NAME@@ certificate's
+<source> This total corresponds to your @@PRODUCT_NAME@@ certificate's
value for this entitlement, excluding the default organization's consumption.</source>
<context-group name="ctx">
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
@@ -4744,12 +4751,14 @@ value for this entitlement, excluding the default organization's consumption.</s
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
</context-group>
</trans-unit>
+
<trans-unit id="softwareEntitlementSubs.systemWideCounts.orgUsage">
<source>Organization Usage</source>
<context-group name="ctx">
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
</context-group>
</trans-unit>
+
<trans-unit id="softwareEntitlementSubs.systemWideCounts.entUsageData">
<source>{0} of {1} ({2}%)</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
index c773824..1e30559 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
@@ -325,8 +325,8 @@ public class ChannelManager extends BaseManager {
// Create a mapping of org ID's to the channel overview returned, we'll need this
// when iterating the list of all orgs shortly:
- Map<Long, ChannelOverview> orgEntitlementUsage =
- new HashMap<Long, ChannelOverview>();
+ Map<Long, ChannelOverview> orgEntitlementUsage = new
+ HashMap<Long, ChannelOverview>();
for (ChannelOverview o : entitlementUsage) {
orgEntitlementUsage.put(o.getOrgId(), o);
}
@@ -344,24 +344,42 @@ public class ChannelManager extends BaseManager {
for (Org org : allOrgs) {
if (orgEntitlementUsage.containsKey(org.getId())) {
ChannelOverview co = orgEntitlementUsage.get(org.getId());
- if (co.getMaxMembers() == 0) {
+ if (co.getMaxMembers() == 0 && co.getMaxFlex() == 0) {
continue;
}
- Long maxPossibleAllocation = null;
- if (co.getMaxMembers() != null &&
- satelliteOrgOverview.getFreeMembers() != null) {
- maxPossibleAllocation = co.getMaxMembers() +
- satelliteOrgOverview.getFreeMembers();
- }
- OrgSoftwareEntitlementDto seDto = new OrgSoftwareEntitlementDto(org,
- co.getCurrentMembers(), co.getMaxMembers(), maxPossibleAllocation);
- ret.add(seDto);
+ ret.add(makeOrgSoftwareEntitlement(co, org, satelliteOrgOverview));
}
}
return ret;
}
+
+ private static OrgSoftwareEntitlementDto makeOrgSoftwareEntitlement(
+ ChannelOverview co,
+ Org org,
+ ChannelOverview satelliteOrgOverview) {
+ OrgSoftwareEntitlementDto seDto = new OrgSoftwareEntitlementDto();
+ seDto.setOrg(org);
+ seDto.setCurrentMembers(co.getCurrentMembers());
+ seDto.setMaxMembers(co.getMaxMembers());
+ if (co.getMaxMembers() != null &&
+ satelliteOrgOverview.getFreeMembers() != null) {
+ seDto.setMaxPossibleAllocation(co.getMaxMembers() +
+ satelliteOrgOverview.getFreeMembers());
+ }
+
+ seDto.setCurrentFlex(co.getCurrentFlex());
+ seDto.setMaxFlex(co.getMaxFlex());
+
+ if (co.getMaxFlex() != null &&
+ satelliteOrgOverview.getFreeFlex() != null) {
+ seDto.setMaxPossibleFlexAllocation(co.getMaxFlex() +
+ satelliteOrgOverview.getFreeFlex());
+ }
+ return seDto;
+ }
+
/**
* Given a channel family, this method returns entitlement information on a per org
* basis. This call will return all organizations, even if it does not have any
@@ -399,28 +417,23 @@ public class ChannelManager extends BaseManager {
List<Org> allOrgs = OrgManager.allOrgs(user);
for (Org org : allOrgs) {
- Long maxPossibleAllocation = null;
-
if (orgEntitlementUsage.containsKey(org.getId())) {
ChannelOverview co = orgEntitlementUsage.get(org.getId());
-
- if (co.getMaxMembers() != null &&
- satelliteOrgOverview.getFreeMembers() != null) {
- maxPossibleAllocation = co.getMaxMembers() +
- satelliteOrgOverview.getFreeMembers();
- }
- OrgSoftwareEntitlementDto seDto = new OrgSoftwareEntitlementDto(org,
- co.getCurrentMembers(), co.getMaxMembers(), maxPossibleAllocation);
- ret.add(seDto);
+ ret.add(makeOrgSoftwareEntitlement(co, org, satelliteOrgOverview));
}
else {
- maxPossibleAllocation = satelliteOrgOverview.getFreeMembers();
- OrgSoftwareEntitlementDto seDto =
- new OrgSoftwareEntitlementDto(org, 0L, 0L, maxPossibleAllocation);
+ OrgSoftwareEntitlementDto seDto = new OrgSoftwareEntitlementDto();
+ seDto.setOrg(org);
+ seDto.setCurrentMembers(0L);
+ seDto.setMaxMembers(0L);
+ seDto.setMaxPossibleAllocation(satelliteOrgOverview.getFreeMembers());
+ seDto.setCurrentFlex(0L);
+ seDto.setMaxFlex(0L);
+ seDto.setMaxPossibleFlexAllocation(satelliteOrgOverview.getFreeFlex());
ret.add(seDto);
}
+
}
-
return ret;
}
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp
index c24736a..791f922 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlementsubs.jsp
@@ -7,10 +7,9 @@
<html:html xhtml="true">
<head>
-<script src="/javascript/multiorg-entitlements.js" type="text/javascript"> </script>
</head>
-<body onload="onLoadStuff(4);">
+<body>
<rhn:toolbar base="h1" img="/img/rhn-icon-channels.gif"
miscUrl="${url}"
miscAcl="user_role(org_admin)"
@@ -34,68 +33,111 @@
<html:hidden property="cfid" value="${channelFamily.id}"/>
<html:hidden property="orgClicked" value="0"/>
- <rl:list dataset="pageList"
- width="100%"
- name="pageList"
- filter="com.redhat.rhn.frontend.action.multiorg.OrgNameFilter"
+ <rl:list
styleclass="list"
styleId="multiorg-entitlement-listview"
alphabarcolumn="orgName"
emptykey="softwareEntitlementSubs.noOrgsFound">
- <rl:column bound="false"
- sortable="false"
+ <rl:column
+ filterattr="orgName"
headerkey="softwareEntitlementSubs.column.orgName"
styleclass="first-column">
- <a href="/rhn/admin/multiorg/OrgDetails.do?oid=${current.org.id}">
+ <a href="/rhn/admin/multiorg/OrgDetails.do?oid=${current.org.id}" tabindex="-1">
${current.orgName}
</a>
</rl:column>
-
- <rl:column bound="true"
- sortable="false"
- headerkey="softwareEntitlementSubs.column.total"
- attr="maxMembersDisplay"/>
-
- <rl:column bound="true"
- sortable="false"
- headerkey="softwareEntitlementSubs.column.currentMembers"
- attr="currentMembers"/>
-
- <rl:column bound="false"
- sortable="false"
- headerkey="softwareEntitlementSubs.column.proposedTotal"
- styleclass="last-column"
- attr="maxMembers">
-
- <c:choose>
- <c:when test="${current.maxMembers != null}">
- <div id="id${current.org.id}">
- <html:text property="newCount_${current.org.id}" size="5" value="${current.maxMembers}"
+ <c:if test="${not empty requestScope.regularAvailable}">
+ <rl:column
+ headertext="${rhn:localize('Regular Usage')} <br/> (${rhn:localize('Used/Alloted')})*"
+ >
+ <c:choose>
+ <c:when test="${empty current.maxMembers or current.maxMembers == 0}">
+ <bean:message key="None Allocated"/>
+ </c:when>
+ <c:otherwise>
+ ${current.currentMembers}/${current.maxMembers}
+ </c:otherwise>
+ </c:choose>
+ </rl:column>
+
+ <rl:column
+ headerkey="Regular Proposed Total">
+ <c:choose>
+ <c:when test = "${current.maxPossibleAllocation == 0}">
+ <bean:message key="No Entitlements Available"/>
+ </c:when>
+ <c:otherwise>
+ <div id="id${current.key}">
+ <html:text property="${current.key}" size="10" value="${requestScope.orgs[current.key]}"
onkeydown="return blockEnter(event)"
- onclick="rowHash['id${current.org.id}'].toggleVisibility();"/>
- <html:submit onclick="this.form.orgClicked.value = '${current.org.id}';">
- <bean:message key="softwareEntitlementSubs.submit"/>
- </html:submit>
+ />
<br/>
- <div class="small-text" id="id${current.org.id}-tooltip">
+ <div class="small-text" id="id${current.key}-tooltip">
<bean:message key="softwareEntitlementSubs.possibleValues"
arg0="0"
arg1="${current.maxMembers + satelliteOrgOverview.freeMembers}"/>
</div>
</div>
- </c:when>
- </c:choose>
-
+ </c:otherwise>
+ </c:choose>
+ </rl:column>
+ </c:if>
+ <c:if test="${not empty requestScope.flexAvailable}">
+ <rl:column
+ headertext="${rhn:localize('Flex Usage')} <br/> (${rhn:localize('Used/Alloted')})*"
+ >
+ <c:choose>
+ <c:when test="${empty current.maxFlex or current.maxFlex == 0}">
+ <bean:message key="None Allocated"/>
+ </c:when>
+ <c:otherwise>
+ ${current.currentFlex}/${current.maxFlex}
+ </c:otherwise>
+ </c:choose>
+ </rl:column>
+
+ <rl:column
+ headerkey="Flex Proposed Total">
+ <c:choose>
+ <c:when test = "${current.maxPossibleFlexAllocation == 0}">
+ <bean:message key="No Entitlements Available"/>
+ </c:when>
+ <c:otherwise>
+ <div id="id${current.flexKey}">
+ <html:text property="${current.flexKey}" size="10" value="${requestScope.orgs[current.flexKey]}"
+ onkeydown="return blockEnter(event)"
+ />
+ <br/>
+ <div class="small-text" id="id${current.flexKey}-tooltip">
+ <bean:message key="softwareEntitlementSubs.possibleValues"
+ arg0="0"
+ arg1="${current.maxFlex + satelliteOrgOverview.freeFlex}"/>
+ </div>
+ </div>
+ </c:otherwise>
+ </c:choose>
+ </rl:column>
+ </c:if>
+
+ <rl:column
+ headerkey="emptyspace.jsp"
+ styleclass="last-column"
+ >
+ <c:if test = "${current.maxPossibleAllocation > 0 || current.maxPossibleFlexAllocation > 0}">
+ <html:submit onclick="this.form.orgClicked.value = '${current.org.id}';">
+ <bean:message key="softwareEntitlementSubs.submit"/>
+ </html:submit>
+ </c:if>
+
</rl:column>
</rl:list>
</rl:listset>
</p>
- <span class="small-text">
- <bean:message key="softwareEntitlementSubs.totaltip"/>
- </span>
-<h2><bean:message key="softwareEntitlementSubs.systemWideCounts.header"/></h2>
+<rhn:tooltip key="softwareEntitlementSubs.Used/Alloted"/>
+<c:if test="${not empty requestScope.regularAvailable}">
+<h2><bean:message key="softwareEntitlementSubs.systemWideCounts.header.regular"/></h2>
<table class="details">
<tr>
@@ -105,8 +147,7 @@
<td>
${maxMem}
<p/>
- <span class="small-text">
- <bean:message key="softwareEntitlementSubs.systemWideCounts.totaltip"/></em>
+ <rhn:tooltip key="softwareEntitlementSubs.systemWideCounts.totaltip"/>
</span>
</td>
</tr>
@@ -127,9 +168,44 @@
<bean:message key="softwareEntitlementSubs.systemWideCounts.orgUsageData"
arg0="${entitledOrgs}" arg1="${orgCount}" arg2="${orgRatio}" />
</td>
- </tr>
+ </tr>
</table>
+</c:if>
+<c:if test="${not empty requestScope.flexAvailable}">
+<h2><bean:message key="softwareEntitlementSubs.systemWideCounts.header.flex"/></h2>
+<table class="details">
+ <tr>
+ <th>
+ <strong><bean:message key="softwareEntitlementSubs.systemWideCounts.total"/>:</strong>
+ </th>
+ <td>
+ ${maxFlex}
+ <p/>
+ <rhn:tooltip key="softwareEntitlementSubs.systemWideCounts.totaltip"/>
+ </td>
+ </tr>
+
+ <tr>
+ <th>
+ <strong><bean:message key="softwareEntitlementSubs.systemWideCounts.entUsage"/>:</strong>
+ </th>
+ <td>
+ <bean:message key="softwareEntitlementSubs.systemWideCounts.entUsageData"
+ arg0="${curFlex}" arg1="${maxFlex}" arg2="${flexEntRatio}" />
+ </td>
+ </tr>
+ <tr>
+ <th>
+ <strong><bean:message key="softwareEntitlementSubs.systemWideCounts.orgUsage"/>:</strong>
+ </th>
+ <td>
+ <bean:message key="softwareEntitlementSubs.systemWideCounts.orgUsageData"
+ arg0="${flexEntitledOrgs}" arg1="${orgCount}" arg2="${flexOrgRatio}" />
+ </td>
+ </tr>
+</table>
+</c:if>
</body>
</html:html>
diff --git a/web/html/javascript/multiorg-entitlements.js b/web/html/javascript/multiorg-entitlements.js
deleted file mode 100644
index a54ee17..0000000
--- a/web/html/javascript/multiorg-entitlements.js
+++ /dev/null
@@ -1,163 +0,0 @@
-var rowHash = new Array();
-var browserType;
-var columnsPerRow;
-
-// tip of the Red Hat to Mar Orlygsson for this little IE detection script
-var is_ie/*@cc_on = {
- quirksmode : (document.compatMode=="BackCompat"),
- version : parseFloat(navigator.appVersion.match(/MSIE (.+?);/)[1])
-}@*/;
-browserType = is_ie;
-
-function onLoadStuff(columns) {
- var channelTable = document.getElementById('multiorg-entitlement-listview');
- createParentRows(channelTable, rowHash);
- reuniteChildrenWithParents(channelTable, rowHash);
- hideAllRows();
-}
-
-function createParentRows(channelTable, rowHash) {
- for (var i = 0; i < channelTable.rows.length; i++) {
- tableRowNode = channelTable.rows[i];
-
- var rowParentDiv = getRowParentDiv(tableRowNode);
- if (rowParentDiv) {
- tableRowNode = rowParentDiv;
- if (!tableRowNode.id) { continue; }
- id = tableRowNode.id;
- var toolTip = findRowToolTip(id);
- if (!toolTip) { continue; }
- rowHash[id] = new Row(rowParentDiv, toolTip);
- }
- }
- return;
-}
-
-function Row(parentDiv, toolTip) {
- this.parentDiv = parentDiv;
- this.children = parentDiv.children;
- this.toolTip = toolTip;
- this.isHidden = 1; // 1 = hidden; 0 = visible. all rows are hidden by default
-
- // Row object methods below!
- this.toggleVisibility = function() {
- hideAllRows();
- this.show();
- return;
- }
-
- this.hide = function hide() {
- this.toolTip.style.visibility = 'hidden';
- this.isHidden = 1;
- return;
- }
-
- this.show = function show() {
- this.toolTip.style.visibility = 'visible';
- this.isHidden = 0;
- return;
- }
-}
-
-/* return 0 if not a parent, if a parent of a parent, return the node for the parent div */
-function getRowParentDiv(node) {
- /* make sure it's a tr */
- var trNodeInLowercase = getNodeTagName(node);
- var tdNode = null;
- var divNode = null;
-
- if (trNodeInLowercase != 'tr') { return 0; }
-
- /* now, iterate through the tds */
- for (var j = 0; j < node.childNodes.length; j++) {
- tdNode = node.childNodes[j];
- if (getNodeTagName(tdNode) != 'td') { continue; }
- if (tdNode.childNodes.length >= 3) {
- for (var k = 0; tdNode.childNodes[k]; k++) {
- divNode = tdNode.childNodes[k];
- if (getNodeTagName(divNode) != 'div') { continue; }
- if (divNode.id.indexOf('id')) { return 0; }
- return divNode;
- }
- }
- }
-}
-
-function findRowToolTip(id) {
- var toolTipId = id + '-tooltip';
- return document.getElementById(toolTipId);
-}
-
-function hideAllRows() {
- var row;
- for (var i in rowHash) {
- row = rowHash[i];
- if (!row) { continue; }
- if (!rowHash[i].toolTip) { continue; }
- row.hide();
- }
- return;
-}
-
-function showAllRows() {
- var row;
- for (var i in rowHash) {
- row = rowHash[i];
- if (!row) { continue; }
- if (!rowHash[i].toolTip) { continue; }
- row.show();
- }
- return;
-}
-
-
-
-
-// called from clicking the show/hide button on individual rows in the page
-function toggleRowVisibility(id) {
- if (!rowHash[id]) { return; }
- if (!rowHash[id].hasChildren) { return; }
- rowHash[id].toggleVisibility();
- return;
-}
-
-function reuniteChildrenWithParents(channelTable, rowHash) {
- var parentNode;
- var childId;
- var tableChildRowNode;
- for (var i = 0; i < channelTable.rows.length; i++) {
- tableChildRowNode = channelTable.rows[i];
- // when we find a parent, set it as parent for the children after it
- if (getRowParentDiv(tableChildRowNode) && tableChildRowNode.id) {
- parentNode = tableChildRowNode;
- continue;
- }
- if (!parentNode) { continue; }
-
- // it its not a child node we bail here
- if (!isChildRowNode(tableChildRowNode)) { continue; }
- // FIXME: chceck child id against parent id
- if (!rowHash[parentNode.id]) { continue; }
- for (var j = 0; j < tableChildRowNode.cells.length; j++) {
- rowHash[parentNode.id].cells.push(tableChildRowNode.cells[j]);
- rowHash[parentNode.id].hasChildren = 1;
- }
- }
- return;
-}
-
-function getNodeTagName(node) {
- var tagName;
- var nodeId;
- tagName = new String(node.tagName);
- return tagName.toLowerCase();
-}
-
-function isChildRowNode(node) {
- var nodeInLowercase = getNodeTagName(node);
- var nodeId;
- if (nodeInLowercase != 'tr') { return 0; }
- nodeId = node.id;
- if (nodeId.indexOf('child')) { return 0; }
- return 1;
-}
commit 8b6d0d2f82e0b4040fc960b993b82a81d2d8f2f8
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 14:16:54 2010 -0400
Added alphabar columns for the mutli org pages
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
index 29fb8f4..7aeebdc 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
@@ -45,8 +45,8 @@
<rhn:submitted/>
<input type="hidden" name="oid" value="${param.oid}"/>
- <rl:list
- width="100%"
+ <rl:list
+ alphabarcolumn="name"
styleclass="list"
emptykey="orgsoftwaresubs.jsp.nochannelfams">
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
index a11c4e1..367b72c 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
@@ -36,7 +36,7 @@
<rl:listset name="entitlementSet">
- <rl:list
+ <rl:list alphabarcolumn="name"
styleclass="list"
emptykey="softwareentitlements.noentitlements">
13 years, 10 months
Branch 'yum-repo-sync' - java/code
by Shannon Hughes
java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java | 37 ++++------
1 file changed, 18 insertions(+), 19 deletions(-)
New commits:
commit 2b4b60ae40f599052ebf639895a83a5102ead763
Author: Shannon Hughes <shughes(a)redhat.com>
Date: Wed Jun 23 17:04:21 2010 -0400
checkstyle fix, extra java import
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
index 04bffb1..26efd0b 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
@@ -14,13 +14,30 @@
*/
package com.redhat.rhn.frontend.action.channel.manage;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.apache.struts.action.DynaActionForm;
+
import com.redhat.rhn.common.db.datasource.DataResult;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.security.PermissionException;
import com.redhat.rhn.domain.channel.Channel;
import com.redhat.rhn.domain.channel.ChannelArch;
import com.redhat.rhn.domain.channel.ChannelFactory;
-import com.redhat.rhn.domain.channel.ContentSource;
import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.role.RoleFactory;
import com.redhat.rhn.domain.server.Server;
@@ -43,24 +60,6 @@ import com.redhat.rhn.manager.download.DownloadManager;
import com.redhat.rhn.manager.system.SystemManager;
import com.redhat.rhn.manager.user.UserManager;
-import org.apache.struts.action.ActionErrors;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-import org.apache.struts.action.ActionMessage;
-import org.apache.struts.action.ActionMessages;
-import org.apache.struts.action.DynaActionForm;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* EditChannelAction
13 years, 10 months
Branch 'yum-repo-sync' - java/code
by Shannon Hughes
java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncRepositoriesAction.java | 29 ++++------
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 2
java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java | 2
java/code/webapp/WEB-INF/pages/channel/manage/syncrepos.jsp | 4 -
4 files changed, 16 insertions(+), 21 deletions(-)
New commits:
commit 08f471eb64a6ce78302e4e216acefe7c4b00a31f
Author: Shannon Hughes <shughes(a)redhat.com>
Date: Wed Jun 23 16:59:24 2010 -0400
hook to call create repo sync task in taskomatic
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncRepositoriesAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncRepositoriesAction.java
index 752919e..e1246a3 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncRepositoriesAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncRepositoriesAction.java
@@ -17,7 +17,6 @@ package com.redhat.rhn.frontend.action.channel.manage;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -29,12 +28,14 @@ import org.apache.struts.action.ActionMapping;
import com.redhat.rhn.domain.channel.Channel;
import com.redhat.rhn.domain.channel.ChannelFactory;
import com.redhat.rhn.domain.channel.ContentSource;
+import com.redhat.rhn.domain.task.TaskFactory;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.frontend.struts.RhnAction;
import com.redhat.rhn.frontend.struts.StrutsDelegate;
-import com.redhat.rhn.frontend.taglibs.list.helper.ListSessionSetHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper;
import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
+import com.redhat.rhn.taskomatic.task.RepoSyncTask;
/**
*
@@ -61,21 +62,19 @@ public class SyncRepositoriesAction extends RhnAction implements Listable {
Map params = new HashMap();
params.put(RequestContext.CID, chan.getId().toString());
- ListSessionSetHelper helper = new ListSessionSetHelper(this, request, params);
-
- helper.execute();
-
- if (helper.isDispatched()) {
- Set <String> set = helper.getSet();
- for (String id : set) {
- Long sgid = Long.valueOf(id);
- ContentSource tmp = ChannelFactory.lookupContentSource(sgid);
- System.out.println("SYNCING:" + tmp.getSourceUrl());
- }
+
+ ListHelper helper = new ListHelper(this, request, params);
+
+ helper.execute();
+
+ if (context.isSubmitted()) {
+
+ TaskFactory.createTask(user.getOrg(),
+ RepoSyncTask.DISPLAY_NAME, chan.getId());
StrutsDelegate strutsDelegate = getStrutsDelegate();
- strutsDelegate.saveMessage("channel.edit.repo.updated",
- new String[] {chan.getName()}, request);
+ createSuccessMessage(request, "message.syncscheduled",
+ chan.getName());
return strutsDelegate.forwardParams
(mapping.findForward("success"), params);
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index e7e55bc..5bf9041 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -8417,7 +8417,7 @@ Follow this url to see the full list of inactive systems:
<source>Channel <strong>{0}</strong> updated.</source>
</trans-unit>
<trans-unit id="message.syncscheduled">
- <source>Repository Sync Scheduled.</source>
+ <source>Repository sync scheduled for {0}.</source>
</trans-unit>
<trans-unit id="message.channelsubscribers">
<source>Per-User subscription restrictions may be applied in the Subscribers tab</source>
diff --git a/java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java b/java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java
index abd6936..499eb7e 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java
@@ -17,12 +17,10 @@ package com.redhat.rhn.manager.channel;
import com.redhat.rhn.domain.channel.Channel;
import com.redhat.rhn.domain.channel.ChannelFactory;
-import com.redhat.rhn.domain.task.TaskFactory;
import com.redhat.rhn.domain.common.ChecksumType;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelLabelException;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelNameException;
import com.redhat.rhn.frontend.xmlrpc.InvalidParentChannelException;
-import com.redhat.rhn.taskomatic.task.RepoSyncTask;
/**
* UpdateChannelCommand - command to create a new channel.
diff --git a/java/code/webapp/WEB-INF/pages/channel/manage/syncrepos.jsp b/java/code/webapp/WEB-INF/pages/channel/manage/syncrepos.jsp
index a96bb4e..4836de1 100644
--- a/java/code/webapp/WEB-INF/pages/channel/manage/syncrepos.jsp
+++ b/java/code/webapp/WEB-INF/pages/channel/manage/syncrepos.jsp
@@ -21,21 +21,19 @@
<input type="hidden" name="cid" value="${cid}" />
<rl:list
- decorator="SelectableDecorator"
emptykey="repos.jsp.norepos"
alphabarcolumn="label"
>
<rl:decorator name="PageSizeDecorator"/>
- <rl:selectablecolumn value="${current.id}"
- styleclass="first-column"/>
<rl:column sortable="true"
bound="false"
headerkey="repos.jsp.channel.header"
sortattr="label"
defaultsort="asc"
+ styleclass="first-column last-column"
>
<a href="/rhn/channels/manage/repos/RepoEdit.do?id=${current.id}">${current.label}</a>
13 years, 10 months
Branch 'yum-repo-sync' - 12 commits - java/code java/spacewalk-java.spec rel-eng/build-missing-builds-in-koji.sh rel-eng/koji-missing-builds.py rel-eng/packages rel-eng/tito.props schema/spacewalk spacewalk/admin spacewalk/setup
by Shannon Hughes
java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java | 6 -
java/spacewalk-java.spec | 5
rel-eng/build-missing-builds-in-koji.sh | 4
rel-eng/koji-missing-builds.py | 2
rel-eng/packages/spacewalk-java | 2
rel-eng/tito.props | 6 -
schema/spacewalk/Makefile | 1
spacewalk/admin/rhn-populate-database.pl | 2
spacewalk/setup/bin/spacewalk-setup | 27 +++--
spacewalk/setup/lib/Spacewalk/Setup.pm | 54 ++++++----
10 files changed, 72 insertions(+), 37 deletions(-)
New commits:
commit 444d01eac021a3c64bae62c26861e95b915285a6
Merge: 51d2ffe... c14d55f...
Author: Shannon Hughes <shughes(a)redhat.com>
Date: Wed Jun 23 14:55:03 2010 -0400
fix merge conflict
Merge branch 'master' into repo
Conflicts:
java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
commit c14d55fb1e6f0c2d66e257744128be3647378af2
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Jun 23 16:11:57 2010 +0200
start building for Fedora 13
diff --git a/rel-eng/tito.props b/rel-eng/tito.props
index bf14015..9236bdd 100644
--- a/rel-eng/tito.props
+++ b/rel-eng/tito.props
@@ -3,7 +3,7 @@ default_builder = spacewalk.releng.builder.Builder
default_tagger = spacewalk.releng.tagger.VersionTagger
[koji]
-autobuild_tags = dist-f11-sw-1.1-candidate dist-5E-sw-1.1-candidate dist-f12-sw-1.1-candidate
+autobuild_tags = dist-f11-sw-1.1-candidate dist-5E-sw-1.1-candidate dist-f12-sw-1.1-candidate dist-f13-sw-1.1-candidate
[dist-f11-sw-1.1-candidate]
disttag = .fc11
@@ -15,3 +15,7 @@ disttag = .el5
[dist-f12-sw-1.1-candidate]
disttag = .fc12
blacklist=jabberd-selinux
+
+[dist-f13-sw-1.1-candidate]
+disttag = .fc13
+blacklist=jabberd-selinux
commit b9d38ff4da55f3bcb370b40e2c1434da438a33cc
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Jun 23 15:47:44 2010 +0200
start building for Fedora 13
diff --git a/rel-eng/build-missing-builds-in-koji.sh b/rel-eng/build-missing-builds-in-koji.sh
index 88bb144..443020a 100755
--- a/rel-eng/build-missing-builds-in-koji.sh
+++ b/rel-eng/build-missing-builds-in-koji.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-TAGS=([0]="dist-5E-sw-1.1-candidate" [1]="dist-f11-sw-1.1-candidate" [2]="dist-f12-sw-1.1-candidate")
+TAGS=([0]="dist-5E-sw-1.1-candidate" [1]="dist-f11-sw-1.1-candidate" [2]="dist-f12-sw-1.1-candidate" [3]="dist-f13-sw-1.1-candidate")
pushd `pwd`
@@ -9,7 +9,7 @@ cd `dirname $0`/..
# say python to be nice to pipe
export PYTHONUNBUFFERED=1
-for tag in 0 1 2; do
+for tag in 0 1 2 3; do
rel-eng/koji-missing-builds.py --no-extra ${TAGS[$tag]} | \
awk '!(/buildsys-macros/ || /oracle-server-admin/ || /oracle-server-scripts/ || /heirloom-pkgtools/) {
if (x==1) { print gensub(" *([a-zA-Z_-]+)-.*", "\\1", "g")}
commit 98e0c0cb1247b0c39771c33626d157905f331b33
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 14:53:15 2010 +0200
Automatic commit of package [spacewalk-java] release [1.1.15-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index beaa193..ecbbf3a 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -19,7 +19,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.1.14
+Version: 1.1.15
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -321,6 +321,9 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Wed Jun 23 2010 Jan Pazdziora 1.1.15-1
+- Fixed a couple of checkstyle errors (paji(a)redhat.com)
+
* Mon Jun 21 2010 Jan Pazdziora 1.1.14-1
- updating rhnPackageRepodata table to not use a reserved word.
(jsherril(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 4588215..ab8d625 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.1.14-1 java/
+1.1.15-1 java/
commit 593420c807048f59b00330880164cc70388dd7b1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 14:07:18 2010 +0200
Some values (db-sid) can be undef, do not pass them to rhn-config-satellite.pl.
diff --git a/spacewalk/setup/bin/spacewalk-setup b/spacewalk/setup/bin/spacewalk-setup
index b923ddb..ab7752a 100755
--- a/spacewalk/setup/bin/spacewalk-setup
+++ b/spacewalk/setup/bin/spacewalk-setup
@@ -1116,7 +1116,7 @@ sub write_config {
my $options = shift;
my $target = shift || Spacewalk::Setup::DEFAULT_RHN_CONF_LOCATION;
- my @opt_strings = map { "--option=${_}=" . $options->{$_} } keys %{$options};
+ my @opt_strings = map { "--option=${_}=" . $options->{$_} } grep { defined $options->{$_} } keys %{$options};
Spacewalk::Setup::system_or_exit([ "/usr/bin/rhn-config-satellite.pl",
"--target=$target",
commit ef76f21dae3aab9b1dd1841b25636c924765e90d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 14:06:44 2010 +0200
Some values (db-sid) can be undef, leading to warnings, there does not need to be a host a port, and the default_db is different for PostgreSQL.
diff --git a/spacewalk/setup/bin/spacewalk-setup b/spacewalk/setup/bin/spacewalk-setup
index d851cfa..b923ddb 100755
--- a/spacewalk/setup/bin/spacewalk-setup
+++ b/spacewalk/setup/bin/spacewalk-setup
@@ -946,13 +946,26 @@ sub populate_initial_configs {
}
# Define some db specific settings:
- my $hibernate_dialect = "org.hibernate.dialect.Oracle9iDialect";
- my $hibernate_driver = "oracle.jdbc.driver.OracleDriver";
- my $hibernate_url = "jdbc:oracle:thin:@" . $answers->{"db-host"} . ":" . $answers->{"db-port"} . ":" . $answers->{"db-sid"};
- if ($answers->{'db-backend'} eq 'postgresql') {
+ my ($hibernate_dialect, $hibernate_driver, $hibernate_url, $default_db);
+ if ($answers->{'db-backend'} eq 'oracle') {
+ $hibernate_dialect = "org.hibernate.dialect.Oracle9iDialect";
+ $hibernate_driver = "oracle.jdbc.driver.OracleDriver";
+ $hibernate_url = "jdbc:oracle:thin:@" . $answers->{"db-host"} . ":" . $answers->{"db-port"} . ":" . $answers->{"db-sid"};
+ $default_db = sprintf('%s/%s@%s', @{$answers}{qw/db-user db-password db-sid/}),
+ } elsif ($answers->{'db-backend'} eq 'postgresql') {
$hibernate_dialect = "org.hibernate.dialect.PostgreSQLDialect";
$hibernate_driver = "org.postgresql.Driver";
- $hibernate_url = "jdbc:postgresql://" . $answers->{"db-host"} . ":" . $answers->{"db-port"} . "/" . $answers->{"db-sid"};
+ $hibernate_url = "jdbc:postgresql://";
+ $default_db = "dbname=$answers->{'db-name'}";
+ if (defined $answers->{"db-host"} and $answers->{"db-host"} ne '') {
+ $hibernate_url .= $answers->{"db-host"};
+ $default_db .= ";host=$answers->{'db-host'}";
+ if (defined $answers->{"db-port"} and $answers->{"db-port"} ne '') {
+ $hibernate_url .= ':' . $answers->{"db-port"};
+ $default_db .= ";port=$answers->{'db-port'}";
+ }
+ }
+ $hibernate_url .= "/" . $answers->{"db-name"};
}
my %config_opts =
@@ -967,7 +980,7 @@ sub populate_initial_configs {
webDOTenable_solaris_support => 0,
osadispatcherDOTosa_ssl_cert => '/var/www/html/pub/RHN-ORG-TRUSTED-SSL-CERT',
encrypted_passwords => 1,
- default_db => sprintf('%s/%s@%s', @{$answers}{qw/db-user db-password db-sid/}),
+ default_db => $default_db,
db_backend => $answers->{'db-backend'},
db_user => $answers->{'db-user'},
db_password => $answers->{'db-password'},
commit 1e9a2e4ac4ab2a3e44bb53dad94170a05bbf3ddb
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 14:03:07 2010 +0200
Let's do a slightly better formatting of our terminal output.
diff --git a/spacewalk/setup/lib/Spacewalk/Setup.pm b/spacewalk/setup/lib/Spacewalk/Setup.pm
index 0cd5856..0a49712 100644
--- a/spacewalk/setup/lib/Spacewalk/Setup.pm
+++ b/spacewalk/setup/lib/Spacewalk/Setup.pm
@@ -809,7 +809,7 @@ sub postgresql_populate_db {
print Spacewalk::Setup::loc("** Database: Re-populating database.\n");
}
else {
- print Spacewalk::Setup::loc("**Database: The database already has schema. Skipping database population.");
+ print Spacewalk::Setup::loc("** Database: The database already has schema. Skipping database population.\n");
return 1;
}
}
@@ -1288,7 +1288,7 @@ sub oracle_populate_db {
print loc("** Database: Re-populating database.\n");
}
else {
- print loc("**Database: The database already has schema. Skipping database population.");
+ print loc("** Database: The database already has schema. Skipping database population.\n");
return 1;
}
commit e2487b374fa5156f5e03736ebf4a5c496f505b0a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 13:55:57 2010 +0200
To allow database population to create at least some database schema, do not stop on error for now.
diff --git a/spacewalk/admin/rhn-populate-database.pl b/spacewalk/admin/rhn-populate-database.pl
index 7e98d11..1841ab4 100755
--- a/spacewalk/admin/rhn-populate-database.pl
+++ b/spacewalk/admin/rhn-populate-database.pl
@@ -113,7 +113,7 @@ my @command;
if ($postgresql) {
print "*** Installing PostgreSQL schema from [$schema_deploy_file].\n";
chdir("/usr/share/spacewalk/schema/postgresql/");
- @command = ( 'psql', '-U', $user, '-d', $database, '-v', 'ON_ERROR_STOP=', '-f', $schema_deploy_file );
+ @command = ( 'psql', '-U', $user, '-d', $database, '-v', 'ON_ERROR_ROLLBACK=ON', '-f', $schema_deploy_file );
if (defined $host) {
push @command, '-h', $host;
if (defined $port) {
commit d44bef006b38b42031d5865ce9098467b2402c6e
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jun 22 16:28:30 2010 +0200
TOP declaration seems to be needed, for Makefile to be useful at all.
diff --git a/schema/spacewalk/Makefile b/schema/spacewalk/Makefile
index f38bdd1..514b8bb 100644
--- a/schema/spacewalk/Makefile
+++ b/schema/spacewalk/Makefile
@@ -1,5 +1,6 @@
include ../../rel-eng/Makefile
+TOP := .
SPECFILE := $(firstword $(wildcard *.spec))
NAME := $(shell rpm -q --qf '%{name}\n' --specfile $(SPECFILE))
VERSION := $(shell rpm -q --qf '%{version}\n' --specfile $(SPECFILE))
commit 7138db043d2d370abd75b3db8043620cb6e2f44e
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 11:00:32 2010 +0200
Fix postgresql_clear_db to clear the content of the PostgreSQL database.
diff --git a/spacewalk/setup/lib/Spacewalk/Setup.pm b/spacewalk/setup/lib/Spacewalk/Setup.pm
index b0019ed..0cd5856 100644
--- a/spacewalk/setup/lib/Spacewalk/Setup.pm
+++ b/spacewalk/setup/lib/Spacewalk/Setup.pm
@@ -854,27 +854,41 @@ sub postgresql_test_db_schema {
}
# Clear the PostgreSQL schema by deleting the 'public' schema with cascade,
-# then re-creating it.
+# then re-creating it. Also delete all the other known schemas that
+# Spacewalk might have created.
+
+my $POSTGRESQL_CLEAR_SCHEMA = <<EOS;
+ drop schema rpm cascade ;
+ drop schema rhn_exception cascade ;
+ drop schema rhn_quota cascade ;
+ drop schema rhn_config cascade ;
+ drop schema rhn_server cascade ;
+ drop schema rhn_entitlements cascade ;
+ drop schema rhn_bel cascade ;
+ drop schema rhn_cache cascade ;
+ drop schema rhn_channel cascade ;
+ drop schema rhn_config_channel cascade ;
+ drop schema rhn_org cascade ;
+ drop schema rhn_package cascade ;
+ drop schema rhn_user cascade ;
+ drop schema public cascade ;
+ create schema public authorization postgres ;
+EOS
sub postgresql_clear_db {
- my $answers = shift;
-
+ my $answers = shift;
+
+ my $dbh = get_dbh($answers);
+ local $dbh->{RaiseError} = 0;
+ local $dbh->{PrintError} = 1;
+ local $dbh->{AutoCommit} = 1;
+ for my $c (split /\n/, $POSTGRESQL_CLEAR_SCHEMA) {
+ $dbh->do($c);
+ }
+ $dbh->disconnect;
+ return 1;
+}
- # Only way to clear a PostgreSQL db we've found so far is to wipe it out
- # completely:
- my $password = @{$answers}{'db-password'};
- my $user = @{$answers}{'db-user'};
- my $host = @{$answers}{'db-host'};
- my $port = @{$answers}{'db-port'};
- my $database = @{$answers}{'db-sid'};
- my $clear_db_cmd = "PGPASSWORD=$password dropdb -U $user -h $host -p $port $database";
- system($clear_db_cmd);
- $clear_db_cmd = "PGPASSWORD=$password createdb -U $user -h $host $database";
- system($clear_db_cmd);
- $clear_db_cmd = "PGPASSWORD=$password createlang -U $user -h $host plpgsql $database";
- system($clear_db_cmd);
- return 1;
-}
commit 8386844d4d3fdf0822291f3b5037de87bf62725a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jun 22 20:19:51 2010 +0200
Search for missing builds on koji.spacewalkproject.org.
diff --git a/rel-eng/koji-missing-builds.py b/rel-eng/koji-missing-builds.py
index e311e77..f2e582d 100755
--- a/rel-eng/koji-missing-builds.py
+++ b/rel-eng/koji-missing-builds.py
@@ -51,7 +51,7 @@ if opts.brew:
mysession = koji.ClientSession("http://brewhub.devel.redhat.com/brewhub")
distsuffix = 'sat'
else:
- mysession = koji.ClientSession("http://koji.rhndev.redhat.com/kojihub")
+ mysession = koji.ClientSession("http://koji.spacewalkproject.org/kojihub")
rpmlist = mysession.getLatestRPMS(tag)
nvrs = []
commit 0042ae7f1487a88c72b88b4e335777b732f0cfd2
Author: Partha Aji <paji(a)redhat.com>
Date: Tue Jun 22 12:30:22 2010 -0400
Fixed a couple of checkstyle errors
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
index 58557cc..8449e9f 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
@@ -529,9 +529,11 @@ public class SystemHandler extends BaseHandler {
Channel baseChannel = server.getBaseChannel();
List returnList = new ArrayList();
- List<EssentialChannelDto> list = ChannelManager.listBaseChannelsForSystem(loggedInUser, server);
+ List<EssentialChannelDto> list = ChannelManager.
+ listBaseChannelsForSystem(loggedInUser, server);
for (EssentialChannelDto ch : list) {
- Boolean currentBase = (baseChannel != null) && baseChannel.getId().equals(ch.getId());
+ Boolean currentBase = (baseChannel != null) &&
+ baseChannel.getId().equals(ch.getId());
returnList.add(createChannelMap(ch, currentBase));
}
13 years, 10 months
Branch 'fve' - java/code
by Partha Aji
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 19 ++++++++--
java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp | 19 ++++------
2 files changed, 24 insertions(+), 14 deletions(-)
New commits:
commit cd02ea279659dcead74d793d1c9b677e5b91744a
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 14:12:13 2010 -0400
More verbiage on software entitlements 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 402af22..8c59f44 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
@@ -4465,6 +4465,12 @@ button below, and <b>will be unable to log back in</b>.</source>
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
</context-group>
</trans-unit>
+ <trans-unit id="Used/Alloted">
+<source>Used/Alloted</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
+ </context-group>
+ </trans-unit>
<trans-unit id="None Allocated">
<source>None Alloted</source>
<context-group name="ctx">
@@ -4503,13 +4509,20 @@ button below, and <b>will be unable to log back in</b>.</source>
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
</context-group>
</trans-unit>
- <trans-unit id="softwareentitlements.tip">
-<source><strong>*Tip:</strong> 'Total' refers to the total available to the @@PRODUCT_NAME@@
-as reflected in this @@PRODUCT_NAME@@'s certificate.</source>
+ <trans-unit id="Available/Total.tip">
+<source>'Total' refers to the total available entitlements to the @@PRODUCT_NAME@@ as reflected in this @@PRODUCT_NAME@@'s certificate. 'Available' refers to the number entitlements that are available to be allocated to various organizations.</source>
<context-group name="ctx">
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
</context-group>
</trans-unit>
+
+ <trans-unit id="Used/Alloted.tip">
+<source>'Alloted' refers to the total number of entitlements allocated to any organization from initial pool as reflected in this @@PRODUCT_NAME@@'s certificate. 'Used' refers to entitlements that have been consumed by systems in various organizations.</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlementSubscriptions</context>
+ </context-group>
+ </trans-unit>
+
<trans-unit id="satusers.tip">
<source><strong>*Tip:</strong> Organization administrator privileges can
not be modified on this page. Instead, please visit the "Users" top-level
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
index 6675676..a11c4e1 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
@@ -52,7 +52,7 @@
</rl:column>
<rl:column
- headertext="${rhn:localize('Regular Counts')} <br/> (${rhn:localize('Available/Total')}*)">
+ headertext="${rhn:localize('Regular Counts')} <br/> (${rhn:localize('Available/Total')})*">
<c:choose>
<c:when test="${empty current.total or current.total == 0}">
<bean:message key="softwareentitlements.noentitlements"/>
@@ -64,7 +64,8 @@
</rl:column>
<c:if test="${orgCount > 1}">
- <rl:column headerkey="Regular Usage">
+ <rl:column
+ headertext="${rhn:localize('Regular Usage')} <br/> (${rhn:localize('Used/Alloted')})**">
<c:choose>
<c:when test="${empty current.allocated or current.allocated == 0}">
<bean:message key="None Allocated"/>
@@ -78,7 +79,7 @@
<rl:column
styleclass="${countstyle}"
- headertext="${rhn:localize('Flex Counts')} <br/> (${rhn:localize('Available/Total')}*)">
+ headertext="${rhn:localize('Flex Counts')} <br/> (${rhn:localize('Available/Total')})*">
<c:choose>
<c:when test="${empty current.totalFlex or current.totalFlex == 0}">
<bean:message key="softwareentitlements.noentitlements"/>
@@ -91,7 +92,7 @@
<c:if test="${orgCount > 1}">
<rl:column bound="false"
- headerkey="Flex Usage"
+ headertext="${rhn:localize('Flex Usage')} <br/> (${rhn:localize('Used/Alloted')})**"
styleclass="${usagestyle}">
<c:choose>
@@ -102,17 +103,13 @@
<bean:message key="softwareentitlements.usagedata" arg0="${current.usedFlex}" arg1="${current.allocatedFlex}" arg2="${current.flexRatio}"/>
</c:otherwise>
</c:choose>
-
-
- </rl:column>
+ </rl:column>
</c:if>
</rl:list>
</rl:listset>
-<span class="small-text">
- <bean:message key="softwareentitlements.tip"/>
-</span>
-
+<rhn:tooltip typeKey="Tip">*-<bean:message key = "Available/Total.tip"/></rhn:tooltip>
+<rhn:tooltip typeKey="Tip">**-<bean:message key = "Used/Alloted.tip"/></rhn:tooltip>
</body>
</html:html>
13 years, 10 months
Branch 'fve' - java/code
by Partha Aji
java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml | 16 +
java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementsAction.java | 24 +-
java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementsFilter.java | 42 ----
java/code/src/com/redhat/rhn/frontend/dto/MultiOrgEntitlementsDto.java | 75 ++++++++
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 32 ++-
java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp | 89 +++++++---
6 files changed, 193 insertions(+), 85 deletions(-)
New commits:
commit a0e93438c91b5ed14527efb83ee94995ad088125
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 13:14:09 2010 -0400
Updated the software entitlements page to deal with FVE
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
index f43463e..8e4b073 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
@@ -362,14 +362,18 @@ SELECT MAX(cfo.id) as id,
SUM(cfo.max_members) as total,
SUM(cfo.current_members) as used,
(SELECT (cfo2.max_members) - (cfo2.current_members)
- FROM rhnChannelFamilyOverview cfo2
- WHERE 1=1
- AND cfo2.name = cfo.name
- AND cfo2.org_id = 1) as available
+ FROM rhnChannelFamilyOverview cfo2
+ WHERE cfo2.label = cfo.label
+ AND cfo2.org_id = 1) as available,
+ SUM(cfo.fve_max_members) as total_flex,
+ SUM(cfo.fve_current_members) as used_flex,
+ (SELECT (cfo2.fve_max_members) - (cfo2.fve_current_members)
+ FROM rhnChannelFamilyOverview cfo2
+ WHERE cfo2.label = cfo.label AND cfo2.org_id = 1) as available_flex
FROM rhnChannelFamilyOverview cfo
-WHERE cfo.max_members is not null
+WHERE cfo.max_members is not null
GROUP BY cfo.label, cfo.name
-HAVING SUM(cfo.max_members) is not null
+HAVING (SUM(cfo.max_members) is not null)
ORDER by cfo.name DESC
</query>
</mode>
diff --git a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementsAction.java b/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementsAction.java
index 61deb7a..f5ebb98 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementsAction.java
@@ -14,11 +14,11 @@
*/
package com.redhat.rhn.frontend.action.multiorg;
-import com.redhat.rhn.common.db.datasource.DataList;
import com.redhat.rhn.domain.user.User;
-import com.redhat.rhn.frontend.dto.MultiOrgEntitlementsDto;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
import com.redhat.rhn.manager.channel.ChannelManager;
import com.redhat.rhn.manager.org.OrgManager;
@@ -26,6 +26,8 @@ import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
+import java.util.List;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -34,7 +36,7 @@ import javax.servlet.http.HttpServletResponse;
* SoftwareEntitlementsAction
* @version $Rev$
*/
-public class SoftwareEntitlementsAction extends RhnAction {
+public class SoftwareEntitlementsAction extends RhnAction implements Listable {
/**
* ${@inheritDoc}
@@ -44,17 +46,19 @@ public class SoftwareEntitlementsAction extends RhnAction {
RequestContext requestContext = new RequestContext(request);
User u = requestContext.getLoggedInUser();
-
- DataList<MultiOrgEntitlementsDto> result =
- ChannelManager.entitlementsForAllMOrgs();
-
+ ListHelper helper = new ListHelper(this, request);
+ helper.execute();
Long orgCount = OrgManager.getTotalOrgCount(u);
-
request.setAttribute("orgCount", orgCount);
- request.setAttribute("pageList", result);
- request.setAttribute("parentUrl", request.getRequestURI());
return mapping.findForward("default");
}
+ /**
+ * {@inheritDoc}
+ */
+ public List getResult(RequestContext contextIn) {
+ return ChannelManager.entitlementsForAllMOrgs();
+ }
+
}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementsFilter.java b/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementsFilter.java
deleted file mode 100644
index 5b0d420..0000000
--- a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementsFilter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2009--2010 Red Hat, Inc.
- *
- * This software is licensed to you under the GNU General Public License,
- * version 2 (GPLv2). There is NO WARRANTY for this software, express or
- * implied, including the implied warranties of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
- * along with this software; if not, see
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
- *
- * Red Hat trademarks are not licensed under GPLv2. No permission is
- * granted to use or replicate Red Hat trademarks that are incorporated
- * in this software or its documentation.
- */
-package com.redhat.rhn.frontend.action.multiorg;
-
-import com.redhat.rhn.common.localization.LocalizationService;
-import com.redhat.rhn.frontend.taglibs.list.BaseListFilter;
-
-import java.util.Locale;
-import java.util.Map;
-
-
-/**
- * SoftwareEntitlementsFilter
- * @version $Rev$
- */
-public class SoftwareEntitlementsFilter extends BaseListFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void processMap(Map map, Locale userLocale) {
- LocalizationService ls =
- LocalizationService.getInstance();
- String filterBy = ls.getMessage("softwareentitlements.header.entitlement.name",
- userLocale);
- map.put(filterBy, "name");
- }
-
-}
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/MultiOrgEntitlementsDto.java b/java/code/src/com/redhat/rhn/frontend/dto/MultiOrgEntitlementsDto.java
index c4012cd..8f26351 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/MultiOrgEntitlementsDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/MultiOrgEntitlementsDto.java
@@ -24,6 +24,7 @@ import java.math.BigDecimal;
public class MultiOrgEntitlementsDto extends BaseDto {
private Long id;
private Long total, used, available;
+ private Long totalFlex, usedFlex, availableFlex;
private String label;
private String name;
@@ -108,6 +109,9 @@ public class MultiOrgEntitlementsDto extends BaseDto {
* @return the number of used slots.
*/
public Long getAllocated() {
+ if (getTotal() == null || getAvailable() == null) {
+ return 0L;
+ }
return getTotal() - getAvailable();
}
@@ -143,5 +147,76 @@ public class MultiOrgEntitlementsDto extends BaseDto {
*/
public void setName(String nameIn) {
this.name = nameIn;
+ }
+
+
+ /**
+ * @return Returns the totalFlex.
+ */
+ public Long getTotalFlex() {
+ return totalFlex;
+ }
+
+
+ /**
+ * @param totalFlexIn The totalFlex to set.
+ */
+ public void setTotalFlex(Long totalFlexIn) {
+ totalFlex = totalFlexIn;
+ }
+
+
+ /**
+ * @return Returns the usedFlex.
+ */
+ public Long getUsedFlex() {
+ return usedFlex;
+ }
+
+
+ /**
+ * @param usedFlexIn The usedFlex to set.
+ */
+ public void setUsedFlex(Long usedFlexIn) {
+ usedFlex = usedFlexIn;
+ }
+
+
+ /**
+ * @return Returns the availableFlex.
+ */
+ public Long getAvailableFlex() {
+ return availableFlex;
+ }
+
+
+ /**
+ * @param availableFlexIn The availableFlex to set.
+ */
+ public void setAvailableFlex(Long availableFlexIn) {
+ availableFlex = availableFlexIn;
+ }
+
+ /**
+ * @return the number of used slots.
+ */
+ public Long getAllocatedFlex() {
+ if (getTotal() == null || getAvailable() == null) {
+ return 0L;
+ }
+ return getTotalFlex() - getAvailableFlex();
+ }
+
+ /**
+ * @return the ratio of current: allocated
+ */
+ public BigDecimal getFlexRatio() {
+ BigDecimal allocated = BigDecimal.valueOf(getAllocatedFlex());
+ if (!allocated.equals(BigDecimal.ZERO)) {
+ BigDecimal hundred = BigDecimal.TEN.multiply(BigDecimal.TEN);
+ BigDecimal dividend = BigDecimal.valueOf(getUsedFlex()).multiply(hundred);
+ return dividend.divide(allocated, BigDecimal.ROUND_UP);
+ }
+ return BigDecimal.ZERO;
}
}
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 98cc570..402af22 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
@@ -4459,24 +4459,44 @@ button below, and <b>will be unable to log back in</b>.</source>
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
</context-group>
</trans-unit>
- <trans-unit id="softwareentitlements.header.available">
-<source>Available</source>
+ <trans-unit id="Available/Total">
+<source>Available/Total</source>
<context-group name="ctx">
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
</context-group>
</trans-unit>
- <trans-unit id="softwareentitlements.header.total">
-<source>Total*</source>
+ <trans-unit id="None Allocated">
+<source>None Alloted</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="Regular Counts">
+<source>Regular Entitlement Counts</source>
<context-group name="ctx">
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
</context-group>
</trans-unit>
- <trans-unit id="softwareentitlements.header.usage">
-<source>Usage</source>
+ <trans-unit id="Regular Usage">
+<source>Regular Usage</source>
<context-group name="ctx">
<context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
</context-group>
</trans-unit>
+ <trans-unit id="Flex Counts">
+<source>Flex Entitlement Counts</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="Flex Usage">
+<source>Flex Usage</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/SoftwareEntitlements</context>
+ </context-group>
+ </trans-unit>
+
<trans-unit id="softwareentitlements.usagedata">
<source>{0} of {1} ({2}%)</source>
<context-group name="ctx">
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
index c4b6a9e..6675676 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/softwareentitlements.jsp
@@ -22,15 +22,27 @@
<p/>
+<c:choose>
+ <c:when test = "${orgCount > 1}">
+ <c:set var = "countstyle" value= ""/>
+ <c:set var = "usagestyle" value = "last-column"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var = "countstyle" value= "last-column"/>
+ <c:set var = "usagestyle" value = ""/>
+ </c:otherwise>
+</c:choose>
+
+
+
<rl:listset name="entitlementSet">
- <rl:list dataset="pageList"
- width="100%"
- name="pageList"
- filter="com.redhat.rhn.frontend.action.multiorg.SoftwareEntitlementsFilter"
+ <rl:list
styleclass="list"
- emptykey="softwareentitlements.noentitlements">
- <rl:column bound="false"
- sortable="false"
+ emptykey="softwareentitlements.noentitlements">
+
+ <rl:column
+ sortattr="name"
+ filterattr="name"
headerkey="softwareentitlements.header.entitlement.name"
styleclass="first-column"
>
@@ -39,26 +51,61 @@
</a>
</rl:column>
- <rl:column bound="false"
- sortable="false"
- headerkey="softwareentitlements.header.total">
- ${current.total}
+ <rl:column
+ headertext="${rhn:localize('Regular Counts')} <br/> (${rhn:localize('Available/Total')}*)">
+ <c:choose>
+ <c:when test="${empty current.total or current.total == 0}">
+ <bean:message key="softwareentitlements.noentitlements"/>
+ </c:when>
+ <c:otherwise>
+ ${current.available} / ${current.total}
+ </c:otherwise>
+ </c:choose>
</rl:column>
+
+ <c:if test="${orgCount > 1}">
+ <rl:column headerkey="Regular Usage">
+ <c:choose>
+ <c:when test="${empty current.allocated or current.allocated == 0}">
+ <bean:message key="None Allocated"/>
+ </c:when>
+ <c:otherwise>
+ <bean:message key="softwareentitlements.usagedata" arg0="${current.used}" arg1="${current.allocated}" arg2="${current.ratio}"/>
+ </c:otherwise>
+ </c:choose>
+ </rl:column>
+ </c:if>
- <rl:column bound="false"
- sortable="false"
- headerkey="softwareentitlements.header.available">
- ${current.available}
- </rl:column>
+ <rl:column
+ styleclass="${countstyle}"
+ headertext="${rhn:localize('Flex Counts')} <br/> (${rhn:localize('Available/Total')}*)">
+ <c:choose>
+ <c:when test="${empty current.totalFlex or current.totalFlex == 0}">
+ <bean:message key="softwareentitlements.noentitlements"/>
+ </c:when>
+ <c:otherwise>
+ ${current.availableFlex} / ${current.totalFlex}
+ </c:otherwise>
+ </c:choose>
+ </rl:column>
<c:if test="${orgCount > 1}">
<rl:column bound="false"
- sortable="false"
- headerkey="softwareentitlements.header.usage"
- styleclass="last-column">
- <bean:message key="softwareentitlements.usagedata" arg0="${current.used}" arg1="${current.allocated}" arg2="${current.ratio}"/>
+ headerkey="Flex Usage"
+ styleclass="${usagestyle}">
+ <c:choose>
+
+ <c:when test="${empty current.allocatedFlex or current.allocatedFlex == 0}">
+ <bean:message key="None Allocated"/>
+ </c:when>
+ <c:otherwise>
+ <bean:message key="softwareentitlements.usagedata" arg0="${current.usedFlex}" arg1="${current.allocatedFlex}" arg2="${current.flexRatio}"/>
+ </c:otherwise>
+ </c:choose>
+
+
</rl:column>
- </c:if>
+ </c:if>
</rl:list>
</rl:listset>
13 years, 10 months
Branch 'fve' - java/code
by Partha Aji
java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 51e92e091784f9aa9b345e0c42d8adc8af062f38
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 11:10:19 2010 -0400
Added a couple of enhancements on the Org software subs pager
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
index d2f2314..29fb8f4 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
@@ -52,8 +52,9 @@
<rl:column
filterattr="name"
+ sortattr = "name"
headerkey="entitlements.jsp.channel" styleclass="first-column">
- <a href="/rhn/admin/multiorg/SoftwareEntitlementDetails.do?cfid=${current.id}"><c:out value="${current.name}" /></a>
+ <a href="/rhn/admin/multiorg/SoftwareEntitlementDetails.do?cfid=${current.id}" tabindex="-1"><c:out value="${current.name}" /></a>
</rl:column>
<rl:column styleclass="center"
headertext="${rhn:localize('Regular Usage')} <br/>(${rhn:localize('Entitlement Usage Type')})">
13 years, 10 months