java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml | 30
+++++++++-
java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigActionHelper.java | 12
++--
java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java | 5
+
java/code/src/com/redhat/rhn/frontend/dto/ConfigChannelDto.java | 12
+++-
java/code/webapp/WEB-INF/pages/configuration/overview/globalconfiglist.jsp | 7
--
java/code/webapp/WEB-INF/pages/configuration/sdc/channellist.jsp | 11
---
6 files changed, 52 insertions(+), 25 deletions(-)
New commits:
commit c37b7e2804b9aceeea217d6a589dfcb3d7968fac
Author: Partha Aji <paji(a)redhat.com>
Date: Tue Jul 20 17:50:36 2010 -0400
Initial set of changes to show the 'files' include info on dirs and symlinks
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
index 83dba69..8ad97e8 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
@@ -1811,9 +1811,33 @@ ORDER BY SCC.position ASC
</query>
<elaborator params="sid">
SELECT CC.id, CC.label,
- ( SELECT count(CF.id)
- FROM rhnConfigFile CF
- WHERE CF.config_channel_id = CC.id ) AS file_count,
+ NVL( (
+ SELECT COUNT(CF.id)
+ FROM rhnConfigFile CF
+ INNER JOIN rhnConfigRevision CR ON CR.id = CF.latest_config_revision_id
+ INNER JOIN rhnConfigFileType CFT ON CFT.ID = CR.CONFIG_FILE_TYPE_ID
+ WHERE CF.config_channel_id = CC.id
+ AND CF.latest_config_revision_id IS NOT NULL
+ AND CFT.LABEL = 'file'
+ ), 0) AS files_only_count,
+ NVL( (
+ SELECT COUNT(CF.id)
+ FROM rhnConfigFile CF
+ INNER JOIN rhnConfigRevision CR ON CR.id = CF.latest_config_revision_id
+ INNER JOIN rhnConfigFileType CFT ON CFT.ID = CR.CONFIG_FILE_TYPE_ID
+ WHERE CF.config_channel_id = CC.id
+ AND CF.latest_config_revision_id IS NOT NULL
+ AND CFT.LABEL = 'symlink'
+ ), 0) AS symlinks_only_count,
+ NVL( (
+ SELECT COUNT(CF.id)
+ FROM rhnConfigFile CF
+ INNER JOIN rhnConfigRevision CR ON CR.id = CF.latest_config_revision_id
+ INNER JOIN rhnConfigFileType CFT ON CFT.ID = CR.CONFIG_FILE_TYPE_ID
+ WHERE CF.config_channel_id = CC.id
+ AND CF.latest_config_revision_id IS NOT NULL
+ AND CFT.LABEL = 'directory'
+ ), 0) AS dirs_only_count,
( SELECT count(CF.id)
FROM rhnConfigFile CF, rhnConfigFileName CFN
WHERE CF.config_channel_id = CC.id
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigActionHelper.java
b/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigActionHelper.java
index 6407866..df007e1 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigActionHelper.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigActionHelper.java
@@ -259,11 +259,13 @@ public abstract class ConfigActionHelper {
* @param count the ConfigFileCount object,
* that stores info on the number of files and directories
* @param url the url to wrap the messages if so desired
+ * @param includeAddUrlForEmpty include "Add" section for empty
* @return the properly formatted File & Directories helper messages ..
*/
public static String makeFileCountsMessage(ConfigFileCount count,
- String url) {
- return makeFileCountsMessage(count, url, false);
+ String url,
+ boolean includeAddUrlForEmpty) {
+ return makeFileCountsMessage(count, url, false, includeAddUrlForEmpty);
}
/**
@@ -284,11 +286,13 @@ public abstract class ConfigActionHelper {
* return "0 files and 1 directory and 0
symlinks"
* else
* return "1 directory"
+ * @param includeAddUrlForEmpty include "Add" section for empty
* @return the properly formatted File & Directories helper messages ..
*/
public static String makeFileCountsMessage(ConfigFileCount count,
String url,
- boolean includeEmptyFilesAndDirs) {
+ boolean includeEmptyFilesAndDirs,
+ boolean includeAddUrlForEmpty) {
long fileCount = count.getFiles(), dirCount = count.getDirectories(),
symlinkCount = count.getSymlinks();
int fileSuffix = getSuffix(fileCount);
@@ -300,7 +304,7 @@ public abstract class ConfigActionHelper {
"_symlinks_" + symlinkSuffix;
if (fileSuffix == NONE && dirSuffix == NONE && symlinkSuffix ==
NONE) {
- if (url != null) {
+ if (includeAddUrlForEmpty && url != null) {
key += "_url";
return service.getMessage(key, new Object[] {url});
}
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
b/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
index a64288c..d4cb3d5 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
@@ -97,6 +97,7 @@ public class OverviewAction extends RhnAction {
/**
* {@inheritDoc}
*/
+ @Override
public ActionForward execute(ActionMapping mapping,
ActionForm formIn,
HttpServletRequest request,
@@ -155,7 +156,7 @@ public class OverviewAction extends RhnAction {
url = ADD_FILES_URL + "?sid=" + server.getId();
}
context.getRequest().setAttribute(key,
- ConfigActionHelper.makeFileCountsMessage(info, url));
+ ConfigActionHelper.makeFileCountsMessage(info, url, true));
}
@@ -241,7 +242,7 @@ public class OverviewAction extends RhnAction {
Object [] params = new Object[2];
params[0] = ConfigActionHelper.makeFileCountsMessage(total,
- null, true);
+ null, true, true);
params[1] = ACTION_DETAILS_URL +
"?hid=" + ca.getId() + "&sid=" +
server.getId();
String messageKey;
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/ConfigChannelDto.java
b/java/code/src/com/redhat/rhn/frontend/dto/ConfigChannelDto.java
index 26d1df0..b01f87d 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/ConfigChannelDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/ConfigChannelDto.java
@@ -167,6 +167,15 @@ public class ConfigChannelDto extends BaseDto {
return fileCount;
}
+
+ /**
+ * Makes a nice looking file counts message
+ * @return the file description
+ */
+ public String getFileCountsMessage() {
+ return getFilesAndDirsDisplayString();
+ }
+
/**
* @param fileCountIn The fileCount to set.
*/
@@ -177,6 +186,7 @@ public class ConfigChannelDto extends BaseDto {
/**
* @return Returns the id.
*/
+ @Override
public Long getId() {
return id;
}
@@ -413,7 +423,7 @@ public class ConfigChannelDto extends BaseDto {
symlinks = symlinksOnlyCount.intValue();
}
ConfigFileCount count = ConfigFileCount.create(files, dirs, symlinks);
- return ConfigActionHelper.makeFileCountsMessage(count, null);
+ return ConfigActionHelper.makeFileCountsMessage(count, null, false, false);
}
/**
diff --git a/java/code/webapp/WEB-INF/pages/configuration/overview/globalconfiglist.jsp
b/java/code/webapp/WEB-INF/pages/configuration/overview/globalconfiglist.jsp
index f3a70a3..09f2f76 100644
--- a/java/code/webapp/WEB-INF/pages/configuration/overview/globalconfiglist.jsp
+++ b/java/code/webapp/WEB-INF/pages/configuration/overview/globalconfiglist.jsp
@@ -41,12 +41,7 @@
<rhn:column header="globalconfiglist.jsp.files"
url="/rhn/configuration/ChannelFiles.do?ccid=${current.id}"
renderUrl="${current.fileCount > 0}">
- <c:if test="${current.fileCount == 1}">
- <bean:message key="config.common.onefile" />
- </c:if>
- <c:if test="${current.fileCount != 1}">
- <bean:message key="config.common.numfiles"
arg0="${current.fileCount}"/>
- </c:if>
+ <c:out value="${current.fileCountsMessage}"/>
</rhn:column>
<rhn:column header="globalconfiglist.jsp.systems"
diff --git a/java/code/webapp/WEB-INF/pages/configuration/sdc/channellist.jsp
b/java/code/webapp/WEB-INF/pages/configuration/sdc/channellist.jsp
index 2418961..1955a11 100644
--- a/java/code/webapp/WEB-INF/pages/configuration/sdc/channellist.jsp
+++ b/java/code/webapp/WEB-INF/pages/configuration/sdc/channellist.jsp
@@ -37,15 +37,8 @@
${current.label}
</rhn:column>
- <rhn:column header="sdc.configlist.jsp.files"
- url="/rhn/configuration/ChannelFiles.do?ccid=${current.id}"
- renderUrl="${current.fileCount > 0}">
- <c:if test="${current.fileCount == 1}">
- <bean:message key="config.common.onefile" />
- </c:if>
- <c:if test="${current.fileCount != 1}">
- <bean:message key="config.common.numfiles"
arg0="${current.fileCount}"/>
- </c:if>
+ <rhn:column header="sdc.configlist.jsp.files">
+ ${current.fileCountsMessage}
</rhn:column>
<rhn:column header="sdc.configlist.jsp.deployablefiles">