Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/bz1069606-r…
Browse files Browse the repository at this point in the history
…ebase-eap-63
  • Loading branch information
jmazzitelli committed Mar 28, 2014
2 parents f2b7ea3 + e2eac63 commit c838682
Show file tree
Hide file tree
Showing 25 changed files with 773 additions and 463 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class EventCriteria extends Criteria {
private Long filterStartTime; // requires overrides
private Long filterEndTime; // requires overrides
private Integer filterResourceId; // requires overrides
private String filterResourceName; // requires overrides
private Integer filterResourceGroupId; // requires overrides
private Integer filterAutoGroupResourceTypeId; // requires overrides
private Integer filterAutoGroupParentResourceId; // requires overrides
Expand All @@ -65,6 +66,7 @@ public EventCriteria() {
filterOverrides.put("startTime", "timestamp >= ?");
filterOverrides.put("endTime", "timestamp <= ?");
filterOverrides.put("resourceId", "source.resourceId = ?");
filterOverrides.put("resourceName", "source.resource.name like ?");
filterOverrides.put("resourceGroupId", "source.resourceId IN " //
+ "( SELECT res.id " //
+ " FROM Resource res " //
Expand Down Expand Up @@ -128,6 +130,10 @@ public void addFilterEntityContext(EntityContext filterEntityContext) {
public void addFilterResourceId(Integer filterResourceId) {
this.filterResourceId = filterResourceId;
}

public void addFilterResourceName(String filterResourceName) {
this.filterResourceName = filterResourceName;
}

public void addFilterResourceGroupId(Integer filterResourceGroupId) {
this.filterResourceGroupId = filterResourceGroupId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@
</chmod>

<!-- copy over the agent-configuration and log4j xml files, but rename them so they do not take effect -->
<echo>Copy agent configuration file - use the new copy and backup the old copy</echo>
<echo>Copy agent configuration file - use the old copy and backup the new copy</echo>
<copy-with-backup olddir="${rhq.agent.update.update-agent-dir}/conf"
newdir="${_update.tmp.dir}/rhq-agent/conf"
filename="agent-configuration.xml" keep="new" backupextension=".custom" failonerror="false" />
<echo>Copy log4j configuration file - use the new copy and backup the old copy</echo>
filename="agent-configuration.xml" keep="old" backupextension=".new" failonerror="false" />
<echo>Copy log4j configuration file - use the old copy and backup the new copy</echo>
<copy-with-backup olddir="${rhq.agent.update.update-agent-dir}/conf"
newdir="${_update.tmp.dir}/rhq-agent/conf"
filename="log4j.xml" keep="new" backupextension=".custom" failonerror="false" />
filename="log4j.xml" keep="old" backupextension=".new" failonerror="false" />

<echo>
Everything is done; _update.tmp.dir/rhq-agent has our new agent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,14 @@ public static String getSubsystemGroupOperationScheduleLink(int groupId, int opS

public static String getAlertDetailLink(EntityContext entityContext, int alertId) {
String link;
if (GWT) {
String baseLink = getEntityTabLink(entityContext, "Alerts", "History");
link = baseLink + "/" + alertId;
} else {
link = null; // TODO
}
String baseLink = getEntityTabLink(entityContext, "Alerts", "History");
link = baseLink + "/" + alertId;

return link;
}

public static String getEventDetailLink(int resourceId, int eventId) {
String link = "#Resource/" + resourceId + "/Events/History/" + eventId;
return link;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.rhq.coregui.client.dashboard.portlets.inventory.resource.graph.ResourceD3GraphPortlet;
import org.rhq.coregui.client.dashboard.portlets.platform.PlatformSummaryPortlet;
import org.rhq.coregui.client.dashboard.portlets.recent.alerts.RecentAlertsPortlet;
import org.rhq.coregui.client.dashboard.portlets.recent.events.RecentEventsPortlet;
import org.rhq.coregui.client.dashboard.portlets.recent.imported.RecentlyAddedResourcesPortlet;
import org.rhq.coregui.client.dashboard.portlets.recent.operations.OperationHistoryPortlet;
import org.rhq.coregui.client.dashboard.portlets.recent.operations.OperationSchedulePortlet;
Expand Down Expand Up @@ -99,6 +100,7 @@ public class PortletFactory {
globalPortletFactoryMap.put(PlatformSummaryPortlet.KEY, PlatformSummaryPortlet.Factory.INSTANCE);
globalPortletFactoryMap.put(AutodiscoveryPortlet.KEY, AutodiscoveryPortlet.Factory.INSTANCE);
globalPortletFactoryMap.put(RecentAlertsPortlet.KEY, RecentAlertsPortlet.Factory.INSTANCE);
globalPortletFactoryMap.put(RecentEventsPortlet.KEY, RecentEventsPortlet.Factory.INSTANCE);
globalPortletFactoryMap.put(ResourceD3GraphPortlet.KEY, ResourceD3GraphPortlet.Factory.INSTANCE);
globalPortletFactoryMap.put(ResourceGroupD3GraphPortlet.KEY, ResourceGroupD3GraphPortlet.Factory.INSTANCE);
//conditionally add tags. Defaults to true, not available in JON builds.
Expand All @@ -121,6 +123,7 @@ public class PortletFactory {
globalPortletNameMap.put(PlatformSummaryPortlet.NAME, PlatformSummaryPortlet.KEY);
globalPortletNameMap.put(AutodiscoveryPortlet.NAME, AutodiscoveryPortlet.KEY);
globalPortletNameMap.put(RecentAlertsPortlet.NAME, RecentAlertsPortlet.KEY);
globalPortletNameMap.put(RecentEventsPortlet.NAME, RecentEventsPortlet.KEY);
globalPortletNameMap.put(ResourceD3GraphPortlet.NAME, ResourceD3GraphPortlet.KEY);
globalPortletNameMap.put(ResourceGroupD3GraphPortlet.NAME, ResourceGroupD3GraphPortlet.KEY);
//conditionally add tags. Defaults to true, not available in JON builds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
*/
package org.rhq.coregui.client.dashboard.portlets;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import com.smartgwt.client.types.MultipleAppearance;
Expand All @@ -29,6 +31,7 @@
import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.event.EventSeverity;
import org.rhq.core.domain.operation.OperationRequestStatus;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.coregui.client.CoreGUI;
Expand All @@ -50,6 +53,10 @@ public interface Constant {
String ALERT_PRIORITY = "ALERT_PRIORITY";
String ALERT_PRIORITY_DEFAULT = ""; // no filtering
String ALERT_NAME = "ALERT_NAME";
String EVENT_SEVERITY = "EVENT_SEVERITY";
String EVENT_SEVERITY_DEFAULT = ""; // no filtering
String EVENT_SOURCE = "EVENT_SOURCE";
String EVENT_RESOURCE = "EVENT_RESOURCE";
String METRIC_RANGE_ENABLE = "METRIC_RANGE_ENABLE";
String METRIC_RANGE_ENABLE_DEFAULT = String.valueOf(false); //disabled
String METRIC_RANGE_BEGIN_END_FLAG = "METRIC_RANGE_BEGIN_END_FLAG";
Expand Down Expand Up @@ -77,6 +84,12 @@ public interface Constant {
static {// Key, Default value
CONFIG_PROPERTY_INITIALIZATION.put(Constant.ALERT_PRIORITY, Constant.ALERT_PRIORITY_DEFAULT);
CONFIG_PROPERTY_INITIALIZATION.put(Constant.ALERT_NAME, "");

CONFIG_PROPERTY_INITIALIZATION.put(Constant.EVENT_SEVERITY, Constant.EVENT_SEVERITY_DEFAULT);
CONFIG_PROPERTY_INITIALIZATION.put(Constant.EVENT_SOURCE, "");

CONFIG_PROPERTY_INITIALIZATION.put(Constant.EVENT_RESOURCE, "");

//result sort order, if empty initialize to "DESC"
CONFIG_PROPERTY_INITIALIZATION.put(Constant.RESULT_SORT_ORDER, Constant.RESULT_SORT_ORDER_DEFAULT);
//result count, if empty initialize to 5
Expand Down Expand Up @@ -141,6 +154,26 @@ public static TextItem getAlertNameEditor(Configuration portletConfig) {
return alertNameEditor;
}

public static TextItem getEventSourceEditor(Configuration portletConfig) {
final TextItem eventSourceEditor = new TextItem(Constant.EVENT_SOURCE);
eventSourceEditor.setTitle(MSG.view_alert_common_tab_conditions_type_event_matching());
eventSourceEditor.setWrapTitle(false);
eventSourceEditor.setWidth(100);
String currentValue = portletConfig.getSimpleValue(Constant.EVENT_SOURCE, "");
eventSourceEditor.setValue(currentValue);
return eventSourceEditor;
}

public static TextItem getEventResourceEditor(Configuration portletConfig) {
final TextItem eventResourceEditor = new TextItem(Constant.EVENT_RESOURCE);
eventResourceEditor.setTitle(MSG.common_title_resource());
eventResourceEditor.setWrapTitle(false);
eventResourceEditor.setWidth(100);
String currentValue = portletConfig.getSimpleValue(Constant.EVENT_RESOURCE, "");
eventResourceEditor.setValue(currentValue);
return eventResourceEditor;
}

/* Multiple select combobox for alert priorities to display on dashboard
*
* @return Populated selectItem instance.
Expand Down Expand Up @@ -186,7 +219,61 @@ public static SelectItem getAlertPriorityEditor(Configuration portletConfig) {

return priorityFilter;
}

/* Multiple select combobox for event severities to display on dashboard
*
* @return Populated selectItem instance.
*/
public static SelectItem getEventSeverityEditor(Configuration portletConfig) {
SelectItem severityFilter = new SelectItem(Constant.EVENT_SEVERITY, MSG.view_inventory_eventHistory_severityFilter());
severityFilter.setWrapTitle(false);
severityFilter.setWidth(200);
severityFilter.setMultiple(true);
severityFilter.setMultipleAppearance(MultipleAppearance.PICKLIST);

LinkedHashMap<String, String> severities = new LinkedHashMap<String, String>(5);
severities.put(EventSeverity.DEBUG.name(), MSG.common_severity_debug());
severities.put(EventSeverity.INFO.name(), MSG.common_severity_info());
severities.put(EventSeverity.WARN.name(), MSG.common_severity_warn());
severities.put(EventSeverity.ERROR.name(), MSG.common_severity_error());
severities.put(EventSeverity.FATAL.name(), MSG.common_severity_fatal());
LinkedHashMap<String, String> severityIcons = new LinkedHashMap<String, String>(5);
severityIcons.put(EventSeverity.DEBUG.name(), ImageManager.getEventSeverityIcon(EventSeverity.DEBUG));
severityIcons.put(EventSeverity.INFO.name(), ImageManager.getEventSeverityIcon(EventSeverity.INFO));
severityIcons.put(EventSeverity.WARN.name(), ImageManager.getEventSeverityIcon(EventSeverity.WARN));
severityIcons.put(EventSeverity.ERROR.name(), ImageManager.getEventSeverityIcon(EventSeverity.ERROR));
severityIcons.put(EventSeverity.FATAL.name(), ImageManager.getEventSeverityIcon(EventSeverity.FATAL));
severityFilter.setValueMap(severities);
severityFilter.setValueIcons(severityIcons);
//reload current settings if they exist, otherwise enable all.
String currentValue = portletConfig.getSimpleValue(Constant.EVENT_SEVERITY, Constant.EVENT_SEVERITY_DEFAULT);
if (currentValue.trim().isEmpty() || currentValue.split(",").length == EventSeverity.values().length) {
severityFilter.setValues(EventSeverity.DEBUG.name(), EventSeverity.INFO.name(), EventSeverity.WARN.name(),
EventSeverity.ERROR.name(), EventSeverity.FATAL.name());

} else {
List<String> values = new ArrayList<String>(5);
if (currentValue.toUpperCase().contains(EventSeverity.FATAL.name())) {
values.add(EventSeverity.FATAL.name());
}
if (currentValue.toUpperCase().contains(EventSeverity.ERROR.name())) {
values.add(EventSeverity.ERROR.name());
}
if (currentValue.toUpperCase().contains(EventSeverity.WARN.name())) {
values.add(EventSeverity.WARN.name());
}
if (currentValue.toUpperCase().contains(EventSeverity.INFO.name())) {
values.add(EventSeverity.INFO.name());
}
if (currentValue.toUpperCase().contains(EventSeverity.DEBUG.name())) {
values.add(EventSeverity.DEBUG.name());
}
severityFilter.setValues(values.toArray(new String[values.size()]));
}

return severityFilter;
}

/* Single select combobox for sort order of items to display on dashboard
*
* @return Populated selectItem instance.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
* Copyright (C) 2005-2010 Red Hat, Inc.
* Copyright (C) 2005-2014 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
Expand All @@ -19,7 +19,6 @@
package org.rhq.coregui.client.dashboard.portlets.groups;

import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.coregui.client.dashboard.Portlet;
import org.rhq.coregui.client.dashboard.PortletViewFactory;
import org.rhq.coregui.client.dashboard.portlets.recent.alerts.AbstractRecentAlertsPortlet;
Expand Down Expand Up @@ -52,7 +51,8 @@ public int getResourceId() {

@Override
protected String getBasePath() {
return (isAutogroup ? ResourceGroupDetailView.AUTO_GROUP_VIEW + '/' : "ResourceGroup/") + groupId + "/Alerts/History";
return (isAutogroup ? ResourceGroupDetailView.AUTO_GROUP_VIEW + '/' : "ResourceGroup/") + groupId
+ "/Alerts/History";

}

Expand All @@ -65,7 +65,7 @@ public final Portlet getInstance(EntityContext context) {
throw new IllegalArgumentException("Context [" + context + "] not supported by portlet");
}

return new GroupAlertsPortlet(context);
return new GroupEventsPortlet(context);
}
}

Expand Down
Loading

0 comments on commit c838682

Please sign in to comment.