java/code/src/com/redhat/rhn/common/db/datasource/xml/Crash_queries.xml | 22 + java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml | 1 java/code/src/com/redhat/rhn/domain/server/CrashFactory.java | 22 + java/code/src/com/redhat/rhn/frontend/action/systems/SoftwareCrashesOverviewAction.java | 62 +++++ java/code/src/com/redhat/rhn/frontend/dto/IdenticalCrashesDto.java | 111 ++++++++++ java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 27 ++ java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml | 18 + java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml | 1 java/code/webapp/WEB-INF/pages/systems/softwarecrashesoverview.jsp | 61 +++++ java/code/webapp/WEB-INF/struts-config.xml | 10 java/spacewalk-java.spec | 5 rel-eng/packages/spacewalk-java | 2 12 files changed, 339 insertions(+), 3 deletions(-)
New commits: commit f18c4729b2e56ae2b020e78a92980e4c2e4c844c Author: Milan Zazrivec mzazrivec@redhat.com Date: Thu Mar 21 17:47:04 2013 +0100
Automatic commit of package [spacewalk-java] release [1.10.23-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec index a3f61f3..f3e47ff 100644 --- a/java/spacewalk-java.spec +++ b/java/spacewalk-java.spec @@ -28,7 +28,7 @@ Name: spacewalk-java Summary: Spacewalk Java site packages Group: Applications/Internet License: GPLv2 -Version: 1.10.22 +Version: 1.10.23 Release: 1%{?dist} URL: https://fedorahosted.org/spacewalk Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... @@ -677,6 +677,9 @@ fi %{jardir}/postgresql-jdbc.jar
%changelog +* Thu Mar 21 2013 Milan Zazrivec mzazrivec@redhat.com 1.10.23-1 +- abrt: software crash overview, grouped by uuid + * Thu Mar 21 2013 Jan Pazdziora 1.10.22-1 - if token does not exist in DB better use it instead of new one
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java index 79259c7..cd93036 100644 --- a/rel-eng/packages/spacewalk-java +++ b/rel-eng/packages/spacewalk-java @@ -1 +1 @@ -1.10.22-1 java/ +1.10.23-1 java/
commit 7baf42b7288e8b32d77d3b1d9f3dbc8674c76dc9 Author: Milan Zazrivec mzazrivec@redhat.com Date: Thu Mar 21 17:46:35 2013 +0100
abrt: software crash overview, grouped by uuid
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Crash_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Crash_queries.xml new file mode 100644 index 0000000..e813acd --- /dev/null +++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Crash_queries.xml @@ -0,0 +1,22 @@ +<datasource_modes> + +<mode name="list_identical_crashes_for_org" class="com.redhat.rhn.frontend.dto.IdenticalCrashesDto"> + <query params="org_id, user_id"> +select sc.uuid as uuid, + count(distinct sc.server_id) as system_count, + sum(sc.count) as total_crash_count, + max(sc.modified) as last_report + from rhnServerCrash sc, + rhnServer s, + rhnUserServerPerms usp + where sc.uuid is not null + and s.id = sc.server_id + and usp.server_id = s.id + and s.org_id = :org_id + and usp.user_id = :user_id + group by uuid + order by total_crash_count desc + </query> +</mode> + +</datasource_modes> diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml index 651c615..db97a85 100644 --- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml +++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml @@ -24,6 +24,7 @@ <template name="ErrataCache_queries" filename="xml/ErrataCache_queries.xml" /> <template name="CustomInfo_queries" filename="xml/CustomInfo_queries.xml" /> <template name="scap_queries" filename="xml/scap_queries.xml" /> + <template name="Crash_queries" filename="xml/Crash_queries.xml" />
<!-- queries used to test the datasource system --> <template name="test_queries" filename="xml/test_queries.xml" /> diff --git a/java/code/src/com/redhat/rhn/domain/server/CrashFactory.java b/java/code/src/com/redhat/rhn/domain/server/CrashFactory.java index c14456a..e6ab30b 100644 --- a/java/code/src/com/redhat/rhn/domain/server/CrashFactory.java +++ b/java/code/src/com/redhat/rhn/domain/server/CrashFactory.java @@ -16,6 +16,12 @@ package com.redhat.rhn.domain.server;
import com.redhat.rhn.common.hibernate.HibernateFactory; +import com.redhat.rhn.common.db.datasource.ModeFactory; +import com.redhat.rhn.common.db.datasource.SelectMode; +import com.redhat.rhn.domain.user.User; +import com.redhat.rhn.domain.org.Org; +import com.redhat.rhn.frontend.dto.IdenticalCrashesDto; + import org.apache.log4j.Logger;
import java.util.HashMap; @@ -125,4 +131,20 @@ public class CrashFactory extends HibernateFactory { public static void delete(CrashNote crashNoteIn) { singleton.removeObject(crashNoteIn); } + + /** + * List Software crashes for a given user and org grouped by crash uuid + * @param userIn The org to return the list for + * @param orgIn The org to return the list for + * @return software crash list for a user and org group by crash uuid + */ + public static List<IdenticalCrashesDto> listIdenticalCrashesForOrg(User userIn, + Org orgIn) { + SelectMode m = ModeFactory.getMode("Crash_queries", + "list_identical_crashes_for_org"); + Map params = new HashMap(); + params.put("user_id", userIn.getId()); + params.put("org_id", orgIn.getId()); + return m.execute(params); + } } diff --git a/java/code/src/com/redhat/rhn/frontend/action/systems/SoftwareCrashesOverviewAction.java b/java/code/src/com/redhat/rhn/frontend/action/systems/SoftwareCrashesOverviewAction.java new file mode 100644 index 0000000..b39d94d --- /dev/null +++ b/java/code/src/com/redhat/rhn/frontend/action/systems/SoftwareCrashesOverviewAction.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2013 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.systems; + +import com.redhat.rhn.domain.user.User; +import com.redhat.rhn.domain.server.CrashFactory; +import com.redhat.rhn.frontend.dto.IdenticalCrashesDto; +import com.redhat.rhn.frontend.struts.RequestContext; +import com.redhat.rhn.frontend.struts.RhnAction; +import com.redhat.rhn.frontend.struts.RhnHelper; +import com.redhat.rhn.frontend.taglibs.list.helper.Listable; +import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.util.List; + +/** + * SoftwareCrashesOverviewAction + * @version $Rev$ + */ +public class SoftwareCrashesOverviewAction extends RhnAction implements Listable { + + /** + * {@inheritDoc} + */ + public ActionForward execute(ActionMapping mapping, + ActionForm formIn, + HttpServletRequest request, + HttpServletResponse response) { + ListHelper helper = new ListHelper(this, request); + helper.execute(); + + return mapping.findForward(RhnHelper.DEFAULT_FORWARD); + } + + /** + * {@inheritDoc} + */ + public List<IdenticalCrashesDto> getResult(RequestContext contextIn) { + User user = contextIn.getCurrentUser(); + return CrashFactory.listIdenticalCrashesForOrg(user, user.getOrg()); + } +} diff --git a/java/code/src/com/redhat/rhn/frontend/dto/IdenticalCrashesDto.java b/java/code/src/com/redhat/rhn/frontend/dto/IdenticalCrashesDto.java new file mode 100644 index 0000000..c31f969 --- /dev/null +++ b/java/code/src/com/redhat/rhn/frontend/dto/IdenticalCrashesDto.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) 2013 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.dto; + +import java.util.Date; + +/** + * IdenticalCrashesDto + * @version $Rev$ + */ +public class IdenticalCrashesDto extends BaseDto { + + private Long id; + private String uuid; + private long totalCrashCount; + private long systemCount; + private Date lastReport; + + /** + * Returns id + * @return Returns id + */ + public Long getId() { + return id; + } + + /** + * Set the id + * @param idIn The id to set + */ + public void setId(Long idIn) { + id = idIn; + } + + /** + * Returns the database uuid. + * @return Returns the uuid. + */ + public String getUuid() { + return uuid; + } + + /** + * Sets the uuid. + * @param uuidIn The id to set. + */ + public void setUuid(String uuidIn) { + uuid = uuidIn; + } + + /** + * Returns total number of crashes. + * @return total number of crashes. + */ + public long getTotalCrashCount() { + return totalCrashCount; + } + + /** + * Sets total number of crashes. + * @param countIn Total number crashes. + */ + public void setTotalCrashCount(long countIn) { + totalCrashCount = countIn; + } + + /** + * Returns number of systems. + * @return number of systems. + */ + public long getSystemCount() { + return systemCount; + } + + /** + * Sets the number of systems + * @param countIn The number of systems + */ + public void setSystemCount(long countIn) { + systemCount = countIn; + } + + /** + * Returns the date last of last crash report. + * @return the date last of last crash report. + */ + public Date getLastReport() { + return lastReport; + } + + /** + * Sets the date of last crash report. + * @param lastReportIn the date of last crash report. + */ + public void setLastReport(Date lastReportIn) { + lastReport = lastReportIn; + } +} 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 1d5c3a1..9750937 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 @@ -98,6 +98,12 @@ <context context-type="sourcefile">/rhn/YourRhn</context> </context-group> </trans-unit> + <trans-unit id="nocrashes.message"> + <source>No software crashes.</source> + <context-group name="ctx"> + <context context-type="sourcefile">/rhn/systems/SoftwareCrashesOverview</context> + </context-group> + </trans-unit> <trans-unit id="none.message"> <source>(none)</source> <context-group name="ctx"> @@ -16357,6 +16363,24 @@ The Tree Path, Kickstart RPM, Base Channel, and Installer Generation should alwa <context context-type="sourcefile">/systems/details/Overview.do</context> </context-group> </trans-unit> + <trans-unit id="crashes.jsp.totalcrashcount"> + <source>Total Crash Count</source> + <context-group name="ctx"> + <context context-type="sourcefile">/systems/SoftwareCrashesOverview.do</context> + </context-group> + </trans-unit> + <trans-unit id="crashes.jsp.affectedsystemscount"> + <source>Affected Systems Count</source> + <context-group name="ctx"> + <context context-type="sourcefile">/systems/SoftwareCrashesOverview.do</context> + </context-group> + </trans-unit> + <trans-unit id="crashes.jsp.lastoccurence"> + <source>Last Crash Occurence</source> + <context-group name="ctx"> + <context context-type="sourcefile">/systems/SoftwareCrashesOverview.do</context> + </context-group> + </trans-unit> <trans-unit id="crashes.jsp.crashcount"> <source>Crash Count</source> <context-group name="ctx"> @@ -16442,9 +16466,10 @@ The Tree Path, Kickstart RPM, Base Channel, and Installer Generation should alwa </context-group> </trans-unit> <trans-unit id="crashes.jsp.uuid"> - <source>UUID</source> + <source>Crash UUID</source> <context-group name="ctx"> <context context-type="sourcefile">/rhn/systems/details/SoftwareCrashDetail.do</context> + <context context-type="sourcefile">/rhn/systems/SoftwareCrashesOverview.do</context> </context-group> </trans-unit> <trans-unit id="crashes.jsp.analyzer"> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml index 9c0a6b1..f5bbc8b 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml @@ -135,6 +135,24 @@ <context context-type="sourcefile">Systems Navigation Menu</context> </context-group> </trans-unit> + <trans-unit id="software.crashes"> + <source>Software Crashes</source> + <context-group name="ctx"> + <context context-type="sourcefile">Systems Navigation Menu</context> + </context-group> + </trans-unit> + <trans-unit id="software.crashes.overview"> + <source>Software Crashes Overview</source> + <context-group name="ctx"> + <context context-type="sourcefile">Systems Navigation Menu</context> + </context-group> + </trans-unit> + <trans-unit id="software.crashes.overview.summary"> + <source>The table below lists software crashes, that occured on your systems. Each type of crash is identified by its UUID.</source> + <context-group name="ctx"> + <context context-type="sourcefile">Systems Navigation Menu</context> + </context-group> + </trans-unit> <trans-unit id="ssm.nav.config"> <source>Configuration</source> <context-group name="ctx"> diff --git a/java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml b/java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml index ee7f365..4c7f658 100644 --- a/java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml +++ b/java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml @@ -115,6 +115,7 @@ <rhn-tab-url>/rhn/kickstart/cobbler/DefaultSnippetView.do</rhn-tab-url> </rhn-tab> </rhn-tab> + <rhn-tab name="software.crashes" url="/rhn/systems/SoftwareCrashesOverview.do"/> </rhn-tab> <rhn-tab name="Errata" url="/rhn/errata/RelevantErrata.do" active-image="tab-errata-selected.gif" inactive-image="tab-errata.gif" on-click="Sniglets::Lists->navi_empty_set" node-id="target_systems_list"> <rhn-tab name="Errata" url="/rhn/errata/RelevantErrata.do" on-click="Sniglets::Lists->navi_empty_set" node-id="target_systems_list"> diff --git a/java/code/webapp/WEB-INF/pages/systems/softwarecrashesoverview.jsp b/java/code/webapp/WEB-INF/pages/systems/softwarecrashesoverview.jsp new file mode 100644 index 0000000..145b186 --- /dev/null +++ b/java/code/webapp/WEB-INF/pages/systems/softwarecrashesoverview.jsp @@ -0,0 +1,61 @@ +<%@ taglib uri="http://rhn.redhat.com/rhn" prefix="rhn" %> +<%@ taglib uri="http://rhn.redhat.com/tags/list" prefix="rl" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> +<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> +<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %> + +<html> +<head> + <meta name="page-decorator" content="none" /> +</head> +<body> + <rhn:toolbar base="h1" img="/img/rhn-icon-bug-ex.gif"> + <bean:message key="software.crashes.overview"/> + </rhn:toolbar> + + <div class="page-summary"> + <p><bean:message key="software.crashes.overview.summary"/></p> + </div> + + <rl:listset name="identicalCrashes"> + <rhn:csrf /> + <rhn:submitted /> + + <div class="full-width-wrapper" style="clear: both;"> + <rl:list emptykey="nocrashes.message" + alphabarcolumn="uuid"> + <rl:decorator name="PageSizeDecorator"/> + <rl:column headerkey="crashes.jsp.uuid" + bound="false" + sortattr="uuid" + sortable="true"> + ${current.uuid} + </rl:column> + <rl:column headerkey="crashes.jsp.totalcrashcount" + bound="false" + sortattr="totalCrashCount" + sortable="true"> + ${current.totalCrashCount} + </rl:column> + <rl:column headerkey="crashes.jsp.affectedsystemscount" + bound="false" + sortattr="systemCount" + sortable="true"> + ${current.systemCount} + </rl:column> + <rl:column headerkey="crashes.jsp.lastoccurence" + bound="false" + sortattr="lastReport" + sortable="true"> + ${current.lastReport} + </rl:column> + </rl:list> + </div> + <rl:csv name="identicalCrashes" + exportColumns="uuid,totalCrashCount,systemCount,lastReport" /> + </rl:listset> +</body> +</html> diff --git a/java/code/webapp/WEB-INF/struts-config.xml b/java/code/webapp/WEB-INF/struts-config.xml index 9ae55cd..1e9761f 100644 --- a/java/code/webapp/WEB-INF/struts-config.xml +++ b/java/code/webapp/WEB-INF/struts-config.xml @@ -2861,6 +2861,16 @@ path="/WEB-INF/pages/systems/systemcurrency.jsp"/> </action>
+ <action path="/systems/SoftwareCrashesOverview" + scope="request" + input="/WEB-INF/pages/systems/softwarecrashesoverview.jsp" + type="com.redhat.rhn.frontend.action.systems.SoftwareCrashesOverviewAction" + className="com.redhat.rhn.frontend.struts.RhnActionMapping"> + <set-property property="postRequiredIfSubmitted" value="true" /> + <forward name="default" + path="/WEB-INF/pages/systems/softwarecrashesoverview.jsp"/> + </action> + <action path="/systems/ProxyList" scope="request" input="/WEB-INF/pages/systems/proxylist.jsp"
spacewalk-commits@lists.fedorahosted.org