modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
| 37 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
| 37 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
| 31 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java
| 33 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
| 33 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java
| 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
| 103 ++++++++--
8 files changed, 232 insertions(+), 51 deletions(-)
New commits:
commit 4d60c27b2b60efed1ca0f4d2a4881fa05fd7ceca
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Mar 22 08:57:19 2011 -0400
i)removing D12N column from ResourceAlertsPortlet.
ii)added remaining asynch call to add bundledeployment portlet for groups.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 4ef6e16..ddc343f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -390,4 +390,12 @@ public class AlertDataSource extends RPCDataSource<Alert> {
public AlertGWTServiceAsync getAlertService() {
return alertService;
}
+
+ protected EntityContext getEntityContext() {
+ return entityContext;
+ }
+
+ protected void setEntityContext(EntityContext entityContext) {
+ this.entityContext = entityContext;
+ }
}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
index 2c6621d..5396bc0 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
@@ -75,6 +75,7 @@ public class AlertPortletConfigurationDataSource extends AlertDataSource
{
} else if ((resourceIds != null) && (resourceIds.length > 0)) {
entityContext = EntityContext.forResource(resourceIds[0]);
}
+ setEntityContext(entityContext);
}
/** Override the executeFetch for AlertPortlet to allow specifying smaller than
total
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index 7ff4f7d..dc74fb6 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
@@ -34,11 +35,16 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.criteria.DashboardCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.dashboard.DashboardCategory;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.InitializableView;
@@ -83,8 +89,13 @@ public class ActivityView extends LocatableVLayout implements
DashboardContainer
private Set<Permission> globalPermissions;
private boolean editMode = false;
-
private boolean isInitialized = false;
+ //default portlet positioning parameters
+ private int colLeft = 0;
+ private int colRight = 1;
+ private int rowLeft = 0;
+ private int rowRight = 0;
+ private boolean displayLeft = false;
public ActivityView(String locatorId, ResourceGroupComposite groupComposite) {
super(locatorId);
@@ -177,9 +188,9 @@ public class ActivityView extends LocatableVLayout implements
DashboardContainer
protected Dashboard getDefaultDashboard() {
Subject sessionSubject = UserSessionManager.getSessionSubject();
- ResourceGroup group = groupComposite.getResourceGroup();
+ final ResourceGroup group = groupComposite.getResourceGroup();
- Dashboard dashboard = new Dashboard();
+ final Dashboard dashboard = new Dashboard();
dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_"
+ group.getId());
dashboard.setCategory(DashboardCategory.GROUP);
@@ -196,12 +207,50 @@ public class ActivityView extends LocatableVLayout implements
DashboardContainer
//remove BundleDeployment and add back later if relevant.
groupKeyNameMap.remove(GroupBundleDeploymentsPortlet.KEY);
groupKeyNameMap = DashboardView.processPortletNameMapForGroup(groupKeyNameMap,
groupComposite);
- //TODO: spinder 3/21/11 need asynch call to execute and then update the menu for
bundle
- int colLeft = 0;
- int colRight = 1;
- int rowLeft = 0;
- int rowRight = 0;
+ //initiate asynch call to execute and then update the dashboard with bundle
deployment portlet if necessary
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(group.getId());
+ criteria.fetchExplicitResources(true);
+ criteria.setPageControl(new PageControl(0, 1));
+
GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroup>>() {
+ @Override
+ public void onSuccess(PageList<ResourceGroup> results) {
+ if (!results.isEmpty()) {
+ ResourceGroup grp = results.get(0);
+ Set<Resource> explicitMembers =
grp.getExplicitResources();
+ Resource[] currentResources = new
Resource[explicitMembers.size()];
+ explicitMembers.toArray(currentResources);
+ Map<String, String> portletToAdd = new HashMap<String,
String>();
+ //membership dynamically determined if all platforms then will be
compatible.
+ if (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)) {
+ if
(currentResources[0].getResourceType().getCategory().equals(ResourceCategory.PLATFORM)) {
+ //this portlet allowed to add bundle portlet monitoring
+ portletToAdd.put(GroupBundleDeploymentsPortlet.KEY,
GroupBundleDeploymentsPortlet.NAME);
+ }
+ if (!portletToAdd.isEmpty()) {
+ //update dashboard with that portlet and reload
+ updateDashboardWithPortlets(portletToAdd, dashboard,
100);
+ //request reload of dashboard widget
+ setDashboard(dashboard);
+ markForRedraw();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving information for group [" +
group.getId() + "]:" + caught.getMessage());
+ }
+ });
+
+ //reset positioning parameters
+ colLeft = 0;
+ colRight = 1;
+ rowLeft = 0;
+ rowRight = 0;
//Left Column
if (groupKeyNameMap.containsKey(GroupMetricsPortlet.KEY)) {//measurments top left
if available
DashboardPortlet measurements = new
DashboardPortlet(GroupMetricsPortlet.NAME, GroupMetricsPortlet.KEY, 220);
@@ -222,22 +271,36 @@ public class ActivityView extends LocatableVLayout implements
DashboardContainer
}
//Fill out left column(typically smaller portlets) then alternate cols with
remaining
- boolean displayLeft = false;
- for (String key : groupKeyNameMap.keySet()) {
- DashboardPortlet portlet = new DashboardPortlet(groupKeyNameMap.get(key),
key, 100);
- if (rowLeft < 4) {
- dashboard.addPortlet(portlet, colLeft, rowLeft++);
- } else {//alternate
- if (!displayLeft) {
- dashboard.addPortlet(portlet, colRight, rowRight++);
- } else {
+ displayLeft = false;
+ updateDashboardWithPortlets(groupKeyNameMap, dashboard, 100);
+ return dashboard;
+ }
+
+ /**Iterates list of new portlets and updates the dashboard reference with these new
portlets.
+ * Attempts to fill the spaces around the remaining larger portlets if already
installed, then alternates
+ * adding to left and right columns. Assumes dashboard has only two columns.
+ *
+ * @param keyNameMap portlet key|name map
+ * @param dashboard dasboard instance to update
+ */
+ private void updateDashboardWithPortlets(Map<String, String> keyNameMap,
Dashboard dashboard, int initialHeight) {
+ if ((keyNameMap != null) && (dashboard != null)) {
+ for (String key : keyNameMap.keySet()) {
+ //locate portlet and add to dashboard
+ DashboardPortlet portlet = new DashboardPortlet(keyNameMap.get(key), key,
initialHeight);
+ if (rowLeft < 4) {
dashboard.addPortlet(portlet, colLeft, rowLeft++);
+ } else {//alternate
+ if (!displayLeft) {
+ dashboard.addPortlet(portlet, colRight, rowRight++);
+ } else {
+ dashboard.addPortlet(portlet, colLeft, rowLeft++);
+ }
+ //toggle
+ displayLeft = !displayLeft;
}
- //toggle
- displayLeft = !displayLeft;
}
}
- return dashboard;
}
@Override
commit e46e1bc770a08dc17173994af8fa5abc28e186c4
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Mar 21 18:21:49 2011 -0400
time range refresh fixes.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
index 39f2f52..2c6621d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletConfigurationDataSource.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.alert;
+import java.util.ArrayList;
+
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
@@ -40,6 +42,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.PortletConfigurationEditorComponent;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.PortletConfigurationEditorComponent.Constant;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.RecentAlertsPortlet;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
/** Customize the AlertDataSource to pull fetch criteria information from
* the Configuration object passed in.
@@ -116,15 +119,38 @@ public class AlertPortletConfigurationDataSource extends
AlertDataSource {
pc.setPrimarySortOrder(PageOrdering.ASC);
}
}
+
//result timeframe if enabled
property = portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
if (Boolean.valueOf(property.getBooleanValue())) {//then proceed setting
- property = portletConfig.getSimple(Constant.METRIC_RANGE);
+
+ boolean isAdvanced = false;
+ //detect type of widget[Simple|Advanced]
+ property =
portletConfig.getSimple(Constant.METRIC_RANGE_BEGIN_END_FLAG);
if (property != null) {
- String currentSetting = property.getStringValue();
- String[] range = currentSetting.split(",");
- criteria.addFilterStartTime(Long.valueOf(range[0]));
- criteria.addFilterEndTime(Long.valueOf(range[1]));
+ isAdvanced = property.getBooleanValue();
+ }
+ if (isAdvanced) {
+ //Advanced time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE);
+ if (property != null) {
+ String currentSetting = property.getStringValue();
+ String[] range = currentSetting.split(",");
+ criteria.addFilterStartTime(Long.valueOf(range[0]));
+ criteria.addFilterEndTime(Long.valueOf(range[1]));
+ }
+ } else {
+ //Simple time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_LASTN);
+ if (property != null) {
+ int lastN = property.getIntegerValue();
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_UNIT);
+ int lastUnits = property.getIntegerValue();
+ ArrayList<Long> beginEnd =
MeasurementUtility.calculateTimeFrame(lastN, Integer
+ .valueOf(lastUnits));
+ criteria.addFilterStartTime(Long.valueOf(beginEnd.get(0)));
+ criteria.addFilterEndTime(Long.valueOf(beginEnd.get(1)));
+ }
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
index 35d5886..9978a6a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
@@ -105,7 +105,7 @@ public class GroupEventsPortlet extends LocatableVLayout implements
CustomSettin
protected void onInit() {
super.onInit();
initializeUi();
- loadData();
+ redraw();
}
/**Defines layout for the portlet page.
@@ -178,7 +178,7 @@ public class GroupEventsPortlet extends LocatableVLayout implements
CustomSettin
//persist
storedPortlet.setConfiguration(portletConfig);
configure(portletWindow, storedPortlet);
- loadData();
+ redraw();
customSettings.markForRedraw();
}
});
@@ -198,12 +198,33 @@ public class GroupEventsPortlet extends LocatableVLayout implements
CustomSettin
//result timeframe if enabled
PropertySimple property = portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
if (Boolean.valueOf(property.getBooleanValue())) {//then proceed setting
- property = portletConfig.getSimple(Constant.METRIC_RANGE);
+
+ boolean isAdvanced = false;
+ //detect type of widget[Simple|Advanced]
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_BEGIN_END_FLAG);
if (property != null) {
- String currentSetting = property.getStringValue();
- String[] range = currentSetting.split(",");
- start = Long.valueOf(range[0]);
- end = Long.valueOf(range[1]);
+ isAdvanced = property.getBooleanValue();
+ }
+ if (isAdvanced) {
+ //Advanced time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE);
+ if (property != null) {
+ String currentSetting = property.getStringValue();
+ String[] range = currentSetting.split(",");
+ start = Long.valueOf(range[0]);
+ end = Long.valueOf(range[1]);
+ }
+ } else {
+ //Simple time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_LASTN);
+ if (property != null) {
+ int lastN = property.getIntegerValue();
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_UNIT);
+ int lastUnits = property.getIntegerValue();
+ ArrayList<Long> beginEnd =
MeasurementUtility.calculateTimeFrame(lastN, Integer.valueOf(lastUnits));
+ start = Long.valueOf(beginEnd.get(0));
+ end = Long.valueOf(beginEnd.get(1));
+ }
}
}
@@ -287,7 +308,6 @@ public class GroupEventsPortlet extends LocatableVLayout implements
CustomSettin
refreshTimer = new Timer() {
public void run() {
if (!currentlyLoading) {
- loadData();
redraw();
}
}
@@ -311,5 +331,4 @@ public class GroupEventsPortlet extends LocatableVLayout implements
CustomSettin
super.redraw();
loadData();
}
-
}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
index 80bf045..d0a4f84 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
@@ -219,12 +219,33 @@ public class GroupMetricsPortlet extends LocatableVLayout implements
CustomSetti
//result timeframe if enabled
PropertySimple property = portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
if (Boolean.valueOf(property.getBooleanValue())) {//then proceed setting
- property = portletConfig.getSimple(Constant.METRIC_RANGE);
+
+ boolean isAdvanced = false;
+ //detect type of widget[Simple|Advanced]
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_BEGIN_END_FLAG);
if (property != null) {
- String currentSetting = property.getStringValue();
- String[] range = currentSetting.split(",");
- start = Long.valueOf(range[0]);
- end = Long.valueOf(range[1]);
+ isAdvanced = property.getBooleanValue();
+ }
+ if (isAdvanced) {
+ //Advanced time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE);
+ if (property != null) {
+ String currentSetting = property.getStringValue();
+ String[] range = currentSetting.split(",");
+ start = Long.valueOf(range[0]);
+ end = Long.valueOf(range[1]);
+ }
+ } else {
+ //Simple time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_LASTN);
+ if (property != null) {
+ int lastN = property.getIntegerValue();
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_UNIT);
+ int lastUnits = property.getIntegerValue();
+ ArrayList<Long> beginEnd =
MeasurementUtility.calculateTimeFrame(lastN, Integer.valueOf(lastUnits));
+ start = Long.valueOf(beginEnd.get(0));
+ end = Long.valueOf(beginEnd.get(1));
+ }
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java
index d915351..a2a2bda 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceEventsPortlet.java
@@ -40,6 +40,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import
org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.GwtTuple;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**This portlet allows the end user to customize the Events display
@@ -102,16 +103,36 @@ public class ResourceEventsPortlet extends GroupEventsPortlet {
//result timeframe if enabled
PropertySimple property = portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
if (Boolean.valueOf(property.getBooleanValue())) {//then proceed setting
- property = portletConfig.getSimple(Constant.METRIC_RANGE);
+
+ boolean isAdvanced = false;
+ //detect type of widget[Simple|Advanced]
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_BEGIN_END_FLAG);
if (property != null) {
- String currentSetting = property.getStringValue();
- String[] range = currentSetting.split(",");
- start = Long.valueOf(range[0]);
- end = Long.valueOf(range[1]);
+ isAdvanced = property.getBooleanValue();
+ }
+ if (isAdvanced) {
+ //Advanced time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE);
+ if (property != null) {
+ String currentSetting = property.getStringValue();
+ String[] range = currentSetting.split(",");
+ start = Long.valueOf(range[0]);
+ end = Long.valueOf(range[1]);
+ }
+ } else {
+ //Simple time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_LASTN);
+ if (property != null) {
+ int lastN = property.getIntegerValue();
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_UNIT);
+ int lastUnits = property.getIntegerValue();
+ ArrayList<Long> beginEnd =
MeasurementUtility.calculateTimeFrame(lastN, Integer.valueOf(lastUnits));
+ start = Long.valueOf(beginEnd.get(0));
+ end = Long.valueOf(beginEnd.get(1));
+ }
}
}
- //
GWTServiceLookup.getEventService().getEventCountsBySeverityForGroup(resourceId, start,
end,
GWTServiceLookup.getEventService().getEventCountsBySeverity(resourceId, start,
end,
new AsyncCallback<Map<EventSeverity, Integer>>() {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
index b7ed496..e907ce6 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
@@ -52,6 +53,7 @@ import
org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.Abs
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**This portlet allows the end user to customize the metric display
@@ -121,12 +123,33 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
//result timeframe if enabled
PropertySimple property = portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
if (Boolean.valueOf(property.getBooleanValue())) {//then proceed setting
- property = portletConfig.getSimple(Constant.METRIC_RANGE);
+
+ boolean isAdvanced = false;
+ //detect type of widget[Simple|Advanced]
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_BEGIN_END_FLAG);
if (property != null) {
- String currentSetting = property.getStringValue();
- String[] range = currentSetting.split(",");
- start = Long.valueOf(range[0]);
- end = Long.valueOf(range[1]);
+ isAdvanced = property.getBooleanValue();
+ }
+ if (isAdvanced) {
+ //Advanced time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE);
+ if (property != null) {
+ String currentSetting = property.getStringValue();
+ String[] range = currentSetting.split(",");
+ start = Long.valueOf(range[0]);
+ end = Long.valueOf(range[1]);
+ }
+ } else {
+ //Simple time settings
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_LASTN);
+ if (property != null) {
+ int lastN = property.getIntegerValue();
+ property = portletConfig.getSimple(Constant.METRIC_RANGE_UNIT);
+ int lastUnits = property.getIntegerValue();
+ ArrayList<Long> beginEnd =
MeasurementUtility.calculateTimeFrame(lastN, Integer.valueOf(lastUnits));
+ start = Long.valueOf(beginEnd.get(0));
+ end = Long.valueOf(beginEnd.get(1));
+ }
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java
index 6110d7e..41ce660 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourcePkgHistoryPortlet.java
@@ -110,7 +110,6 @@ public class ResourcePkgHistoryPortlet extends GroupPkgHistoryPortlet
{
}
PageControl pageControl = new PageControl(0, resultCount);
criteria.setPageControl(pageControl);
- // criteria.addFilterResourceGroupIds(resourceId);
criteria.addFilterResourceId(resourceId);
criteria.addSortStatus(PageOrdering.DESC);