modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
| 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
| 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
| 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
| 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
| 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
| 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
| 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
| 61 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
| 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AuthorizedTableAction.java
| 95 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EscapedHtmlCellFormatter.java
| 19
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/IconField.java
| 73 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/RecordExtractor.java
| 38
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/ResourceAuthorizedTableAction.java
| 101 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
| 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java
| 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
| 111 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/PortletConfigurationEditorComponent.java
| 93 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
| 554 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
| 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
| 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
| 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
| 330 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java
| 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AuthorizationGWTService.java
| 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
| 45
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
| 22
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
| 17
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
| 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
| 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
| 108 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
| 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
| 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
| 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationDataSource.java
| 97 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
| 100 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
| 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
| 58 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
| 44
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
| 339 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
| 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceErrorsDataSource.java
| 106 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceErrorsView.java
| 189 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
| 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
| 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
| 333 ------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsDataSource.java
| 106 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsView.java
| 189 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
| 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/StringUtility.java
| 65 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
| 11
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
| 28
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
| 49
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/measurement/graphs/EventsTimelineUIBean.java
| 3
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
| 2
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventConfigJSON.jsp
| 2
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventContentJSON.jsp
| 4
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp
| 4
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventEventsJSON.jsp
| 4
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventOperationsJSON.jsp
| 2
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventPluginConfigJSON.jsp
| 2
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/events/data-plain.xhtml
| 4
modules/enterprise/remoting/cli/pom.xml
| 1
modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
| 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
| 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementProblemManagerBean.java
| 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
| 3
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
| 2
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerOperationsDelegate.java
| 78 -
modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
| 13
modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
| 28
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
| 2
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerOperationsDelegate.java
| 27
modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
| 13
105 files changed, 3010 insertions(+), 1120 deletions(-)
New commits:
commit 1054ae44f1831fc3c7787bd118d4d5e7c1ad725b
Merge: 7bda199 7b91cb2
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Apr 6 21:52:03 2011 +0200
Merge branch 'master' into as7plugin
commit 7b91cb2e587aac2017094f313f89047cc89f275f
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Apr 6 12:21:38 2011 -0400
class i missed in a commit yesterday
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
index eaca3b6..d92e7ba 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
@@ -38,6 +38,7 @@ public abstract class SubjectPreferencesBase {
/** delimiter for preferences that are multi-valued and stringified */
protected static final String PREF_LIST_DELIM = ",";
protected static final String PREF_ITEM_DELIM = "|";
+ protected static final String PREF_ITEM_DELIM_REGEX = "\\|";
private int subjectId;
private Set<String> changed;
@@ -50,7 +51,6 @@ public abstract class SubjectPreferencesBase {
/**
* Get the value of a preference as a boolean.
* @param key the preference to get
- * @param ifNull if the pref is undefined, return this value instead
* @return the boolean value of 'key', or if key is null, returns the
* 'ifNull' value.
*/
@@ -204,11 +204,11 @@ public abstract class SubjectPreferencesBase {
protected List<Integer> getPreferenceAsIntegerList(String key, String
delimiter) {
try {
- List<String> value = getPreferenceAsList(key, delimiter);
+ List<String> values = getPreferenceAsList(key, delimiter);
- List<Integer> result = new ArrayList<Integer>(value.size());
- for (int i = 0; i < value.size(); i++) {
- String trimmed = value.get(i).trim();
+ List<Integer> result = new ArrayList<Integer>(values.size());
+ for (String value : values) {
+ String trimmed = value.trim();
if (trimmed.length() > 0) {
result.add(Integer.valueOf(trimmed));
}
@@ -230,7 +230,7 @@ public abstract class SubjectPreferencesBase {
}
public void setPreference(String key, Object value) throws IllegalArgumentException
{
- String val = null;
+ String val;
if (value == null) {
val = "";
} else if (value instanceof String) {
commit 4228e9661ede4596981453f225117ab403e8be66
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Apr 5 17:06:19 2011 -0400
fix exception caused by different format for recentResources user pref between
portal-war and coregui (
https://bugzilla.redhat.com/show_bug.cgi?id=693411)
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
index 3e34ceb..9006bec 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
@@ -308,6 +308,8 @@ public class UserPreferences {
}
return result;
} catch (Exception e) {
+ // value was probably in be the old comma-delimited format used by portal-war
-
+ // throw it away and return an empty list
return new ArrayList<Integer>();
}
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
index e2414a7..5d317b0 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
@@ -1,5 +1,6 @@
package org.rhq.enterprise.gui.legacy;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -769,7 +770,7 @@ public class WebUserPreferences extends SubjectPreferencesBase {
return; // nothing is stored in session for the special NONE view
}
- List pageControlProperties = new ArrayList();
+ List<Serializable> pageControlProperties = new
ArrayList<Serializable>();
pageControlProperties.add(pageControl.getPageSize());
pageControlProperties.add(pageControl.getPageNumber());
@@ -797,16 +798,37 @@ public class WebUserPreferences extends SubjectPreferencesBase {
visits.remove(10);
}
- setPreference(PREF_RECENT_RESOURCES, visits, ",");
+ setPreference(PREF_RECENT_RESOURCES, visits, PREF_LIST_DELIM);
}
public List<ResourceVisit> getRecentResourceVisits() {
- List<String> stringList = getPreferenceAsList(PREF_RECENT_RESOURCES,
",");
List<ResourceVisit> visits = new ArrayList<ResourceVisit>();
- for (String string : stringList) {
- String[] data = string.split("\\|");
- if (data.length == 3)
- visits.add(new ResourceVisit(Integer.parseInt(data[0]), data[2],
ResourceVisit.Kind.valueOf(data[1])));
+ try {
+ // first try the new coregui format
+ List<Integer> resourceIds =
getPreferenceAsIntegerList(PREF_RECENT_RESOURCES, "|");
+ for (Integer resourceId : resourceIds) {
+ ResourceVisit visit = new ResourceVisit(resourceId, "",
ResourceVisit.Kind.resource);
+ visits.add(visit);
+ }
+ } catch (RuntimeException e) {
+ // if an exception occurs, try the legacy portal-war format
+ List<String> stringList = getPreferenceAsList(PREF_RECENT_RESOURCES,
PREF_LIST_DELIM);
+ for (String string : stringList) {
+ String[] data = string.split(PREF_ITEM_DELIM_REGEX);
+ if (data.length != 3) {
+ throw new RuntimeException("Failed to parse resource visit item:
" + string);
+ }
+ ResourceVisit.Kind kind = ResourceVisit.Kind.valueOf(data[1]);
+ // throw away recent groups, since the new coregui format only supports
resources
+ if (kind == ResourceVisit.Kind.resource || kind ==
ResourceVisit.Kind.PLATFORM
+ || kind == ResourceVisit.Kind.SERVER || kind ==
ResourceVisit.Kind.SERVICE) {
+ int resourceId = Integer.parseInt(data[0]);
+ ResourceVisit visit = new ResourceVisit(resourceId, "",
ResourceVisit.Kind.resource);
+ visits.add(visit);
+ }
+ }
+ // overwrite the pref value with the new coregui format
+ setPreference(PREF_RECENT_RESOURCES, visits, "|");
}
return visits;
}
@@ -814,9 +836,14 @@ public class WebUserPreferences extends SubjectPreferencesBase {
public static class ResourceVisit {
public enum Kind {
@Deprecated
- resource("Resource"), @Deprecated
- group("Group"), PLATFORM("Platform"),
SERVER("Server"), SERVICE("Service"),
COMPATIBLE_GROUP("Cluster"), MIXED_GROUP(
- "Group");
+ resource("Resource"),
+ @Deprecated
+ group("Group"),
+ PLATFORM("Platform"),
+ SERVER("Server"),
+ SERVICE("Service"),
+ COMPATIBLE_GROUP("Cluster"),
+ MIXED_GROUP("Group");
private String displayName;
@@ -881,7 +908,7 @@ public class WebUserPreferences extends SubjectPreferencesBase {
@Override
public String toString() {
- return id + "|" + kind.name() + "|" + name;
+ return String.valueOf(id);
}
}
commit 3447a66c09dfdec0ea2bdcc45798bd1caf6f41ac
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Apr 5 15:06:43 2011 -0400
escape HTML in names and descriptions on groupdef list and details views
(
https://bugzilla.redhat.com/show_bug.cgi?id=691547)
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
index 9106e60..f5f7ba0 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -36,6 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
@@ -56,8 +57,8 @@ public class GroupDefinitionListView extends
TableSection<GroupDefinitionDataSou
super(locatorId, TITLE);
setHeaderIcon(headerIcon);
-
setDataSource(GroupDefinitionDataSource.getInstance());
+ setEscapeHtmlInDetailsLinkColumn(true);
}
@Override
@@ -67,7 +68,9 @@ public class GroupDefinitionListView extends
TableSection<GroupDefinitionDataSou
idField.setWidth(50);
ListGridField nameField = new ListGridField("name",
MSG.common_title_name(), 150);
+ nameField.setCellFormatter(new EscapedHtmlCellFormatter());
ListGridField descriptionField = new ListGridField("description",
MSG.common_title_description());
+ descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());
ListGridField expressionField = new ListGridField("expression",
MSG.view_dynagroup_expressionSet(), 250);
expressionField.setCellFormatter(new CellFormatter() {
public String format(Object value, ListGridRecord record, int rowNum, int
colNum) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
index a302455..10daf03 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -73,10 +73,12 @@ import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions.GroupDefinitionExpressionBuilder.AddExpressionHandler;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
@@ -139,11 +141,8 @@ public class SingleGroupDefinitionView extends LocatableVLayout
implements Bookm
form.setDataSource(GroupDefinitionDataSource.getInstance());
form.setHiliteRequiredFields(true);
form.setRequiredTitleSuffix(" <span style=\"color: red;\">*
</span>:");
- if (groupDefinition.getId() == 0) {
- form.setSaveOperationType(DSOperationType.ADD);
- } else {
- form.setSaveOperationType(DSOperationType.UPDATE);
- }
+ DSOperationType saveOperationType = (groupDefinition.getId() == 0) ?
DSOperationType.ADD : DSOperationType.UPDATE;
+ form.setSaveOperationType(saveOperationType);
final DynaGroupChildrenView dynaGroupChildrenView = new
DynaGroupChildrenView(extendLocatorId("DynaGroups"),
groupDefinitionId);
@@ -201,7 +200,7 @@ public class SingleGroupDefinitionView extends LocatableVLayout
implements Bookm
} else {
Record newRecord = results[0];
GroupDefinition newGroupDefinition =
GroupDefinitionDataSource.getInstance().copyValues(
- (ListGridRecord) newRecord);
+ newRecord);
if (recalc) {
recalculate(dynaGroupChildrenView,
newGroupDefinition.getId());
}
@@ -257,12 +256,13 @@ public class SingleGroupDefinitionView extends LocatableVLayout
implements Bookm
public String format(Object value, ListGridRecord record, int rowNum, int
colNum) {
String linkName = record.getAttributeAsString(NAME.propertyName());
String linkUrl =
LinkManager.getResourceGroupLink(record.getAttributeAsInt("id"));
- return "<a href=\"" + linkUrl +
"\">" + linkName + "</a>";
+ return "<a href=\"" + linkUrl +
"\">" + StringUtility.escapeHtml(linkName) + "</a>";
}
});
ListGridField descriptionField = new
ListGridField(DESCRIPTION.propertyName(), DESCRIPTION.title());
descriptionField.setWidth("300");
+ descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());
ListGridField typeNameField = new ListGridField(TYPE.propertyName(),
TYPE.title());
typeNameField.setWidth("100");
@@ -350,12 +350,12 @@ public class SingleGroupDefinitionView extends LocatableVLayout
implements Bookm
templateSelectorTitleSpacer.setColSpan(1);
templateSelectorTitleSpacer.setEndRow(false);
- templateSelector = new SelectItem("templateSelector");
+ // TODO: i18n title
+ templateSelector = new SelectItem("templateSelector", "Saved
Expression");
templateStrings = getTemplates();
templateSelector.setValueMap(templateStrings.keySet().toArray(new
String[templateStrings.size()]));
templateSelector.setAllowEmptyValue(true);
templateSelector.setWidth(300);
- templateSelector.setShowTitle(false);
templateSelector.setColSpan(1);
templateSelector.setEndRow(true);
templateSelector.setStartRow(false);
commit 1a711ed042d252270dcf81ebfbb0001f4bf45225
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Apr 5 13:00:37 2011 -0400
add hibernate-annotations.jar to the CLI's lib dir, so users can compile custom
RHQ remote clients using CLI/lib/*.jar as the compile classpath
(
https://bugzilla.redhat.com/show_bug.cgi?id=683136)
diff --git a/modules/enterprise/remoting/cli/pom.xml
b/modules/enterprise/remoting/cli/pom.xml
index 1c5207c..370f509 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -126,6 +126,7 @@
<property name="opencsv.version"
value="${opencsv.version}" />
<property name="concurrent.version"
value="${concurrent.version}" />
<property name="getopt.version"
value="${getopt.version}" />
+ <property name="hibernate-annotations.version"
value="${hibernate-annotations.version}" />
<property name="i18nlog.version"
value="${i18nlog.version}" />
<property name="jboss-common.version"
value="${jboss-common.version}" />
<property name="jboss.version"
value="${jboss.version}" />
diff --git a/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
b/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
index f54a691..baf99e5 100644
--- a/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
+++ b/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
@@ -65,6 +65,7 @@
<copy
file="${settings.localRepository}/net/sf/opencsv/opencsv/${opencsv.version}/opencsv-${opencsv.version}.jar"
tofile="${lib.home}/opencsv-${opencsv.version}.jar" verbose="true"
/>
<copy
file="${settings.localRepository}/org/testng/testng/${testng.version}/testng-${testng.version}.jar"
tofile="${lib.home}/testng-${testng.version}.jar" verbose="true"
/>
<copy
file="${settings.localRepository}/org/rhq/rhq-script-bindings/${project.version}/rhq-script-bindings-${project.version}.jar"
tofile="${lib.home}/rhq-script-bindings-${project.version}.jar"
verbose="true" />
+ <copy
file="${settings.localRepository}/hibernate-annotations/hibernate-annotations/${hibernate-annotations.version}/hibernate-annotations-${hibernate-annotations.version}.jar"
todir="${lib.home}" verbose="true" />
</target>
</project>
commit 08da74a83a3122f2df503fe87532dcf660515e9f
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Apr 4 17:24:38 2011 -0400
update default message for resource ops portlet.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java
index a0ef80ffba..9ca8f5c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceOperationsPortlet.java
@@ -253,6 +253,12 @@ class ResourceOperationsCriteriaHistoryListView extends
protected String getBasePath() {
return "Resource/" + resourceComposite.getResource().getId() +
"/Operations/History";
}
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
+ }
}
/** Provide implementation of ResourceOperationHistoryDataSource that dynamically
commit 9c5652e29fda9c0bbf5ed880616ecd3620b9ed26
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Apr 4 16:36:06 2011 -0400
i)several refresh issues
ii)BZ:636733: platform util portlet always scrolling.
iii)BZ:636723: Platform util not refreshing.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
index 7c0f8d3..256f9c1 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
@@ -404,7 +404,6 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout
implement
public GroupConfigurationHistoryCriteriaTable(String locatorId,
ResourceGroupComposite groupComposite) {
super(locatorId, groupComposite);
- getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
}
@Override
@@ -416,6 +415,13 @@ public class GroupConfigurationUpdatesPortlet extends
LocatableVLayout implement
MSG.view_table_matchingRows(String.valueOf(getListGrid().getTotalRows()),
String.valueOf(count)));
}
}
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
+ }
+
}
class GroupConfigurationUdpatesCriteriaDataSource extends
GroupResourceConfigurationDataSource {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
index a0171c2..6f38d63 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
@@ -25,6 +25,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Autofit;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
@@ -79,7 +80,6 @@ public class PlatformSummaryPortlet extends LocatableListGrid implements
Portlet
public PlatformSummaryPortlet(String locatorId) {
super(locatorId);
-
setWidth100();
setHeight100();
@@ -89,7 +89,8 @@ public class PlatformSummaryPortlet extends LocatableListGrid implements
Portlet
setShowRecordComponentsByCell(true);
setUseAllDataSourceFields(true);
- setAutoFitData(Autofit.HORIZONTAL);
+ setAutoFitData(Autofit.VERTICAL);
+ setOverflow(Overflow.AUTO);
setDataSource(new PlatformMetricDataSource(this));
setInitialCriteria(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
ResourceCategory.PLATFORM
@@ -387,4 +388,13 @@ public class PlatformSummaryPortlet extends LocatableListGrid
implements Portlet
return new PlatformSummaryPortlet(locatorId);
}
}
+
+ /** Custom refresh operation as we are not directly extending Table
+ */
+ @Override
+ public void redraw() {
+ super.redraw();
+ invalidateCache();
+ markForRedraw();
+ }
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
index 1ffacf6..4519b95 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
@@ -68,9 +68,6 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
setOverflow(Overflow.VISIBLE);
setShowFooterRefresh(false); //disable footer refresh button as redundant for
portlets
setShowHeader(false);//disable header for portlets
- if (getListGrid() != null) {
- getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
- }
}
public Timer getRefreshTimer() {
@@ -396,4 +393,10 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
return criteria;
}
}
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
+ }
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
index 7eac876..e739098 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
@@ -353,6 +353,11 @@ public class ProblemResourcesPortlet extends
Table<ProblemResourcesDataSource> i
return false;
}
+ @Override
+ public void redraw() {
+ super.refresh();
+ markForRedraw();
+ }
}
/**Construct table widget Label to display timerange settings used with latest datasource
query.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
index a4a6e67..bd5c4ac 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
@@ -195,6 +195,12 @@ public class ResourceConfigurationUpdatesPortlet extends
GroupConfigurationUpdat
protected String getBasePath() {
return "Resource/" + resourceComposite.getResource().getId() +
"/Configuration/History";
}
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
+ }
}
class ConfigurationUdpatesCriteriaDataSource extends ConfigurationHistoryDataSource
{
commit 3f6374cf07943d7403752d4a5367d7b0ce0e59ac
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Apr 4 15:03:35 2011 -0400
adding npe check.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
index af95e7a..1ffacf6 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
@@ -68,7 +68,9 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
setOverflow(Overflow.VISIBLE);
setShowFooterRefresh(false); //disable footer refresh button as redundant for
portlets
setShowHeader(false);//disable header for portlets
- getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
+ if (getListGrid() != null) {
+ getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
+ }
}
public Timer getRefreshTimer() {
commit 2009d4df168098b31cc6e833392a5ed8cd40c133
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Apr 4 12:53:44 2011 -0400
i)modify table empty/populated messages for portlets to indicate matching results.
ii)enable auto-refresh for Alert* portlets.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
index f002795..7c0f8d3 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
@@ -112,7 +112,7 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout
implement
protected boolean portletConfigInitialized = false;
protected boolean currentlyLoading = false;
protected String baseViewPath = "";
- private HistoryGroupResourceConfigurationTable groupHistoryTable;
+ private GroupConfigurationHistoryCriteriaTable groupHistoryTable;
protected static HashMap<String, String> updatedMapping = new
HashMap<String, String>();
static {
@@ -300,16 +300,6 @@ public class GroupConfigurationUpdatesPortlet extends
LocatableVLayout implement
loadData();
}
- // @Override
- // protected void refreshTableInfo() {
- // super.refreshTableInfo();
- // if (getTableInfo() != null) {
- // int count = getListGrid().getSelection().length;
- // getTableInfo().setContents(
- //
MSG.view_table_matchingRows(String.valueOf(getListGrid().getTotalRows()),
String.valueOf(count)));
- // }
- // }
-
@Override
public boolean isRefreshing() {
return this.currentlyLoading;
@@ -370,29 +360,18 @@ public class GroupConfigurationUpdatesPortlet extends
LocatableVLayout implement
filterResourceGroupIds.add(groupId);
criteria.addFilterResourceGroupIds(filterResourceGroupIds);
- groupHistoryTable = new
HistoryGroupResourceConfigurationTable(extendLocatorId("Table"),
+ groupHistoryTable = new
GroupConfigurationHistoryCriteriaTable(extendLocatorId("Table"),
groupComposite);
- // groupHistoryTable.setDataSource(new
GroupConfigurationUdpatesCriteriaDataSource(portletConfig,
- // groupId));
- //
groupHistoryTable.setShowHeader(false);
- //
groupHistoryTable.setShowFooterRefresh(false);
} else {
- //TODO: spinder fix for empties
- // Criteria criteria = new Criteria();
ResourceGroup emptyGroup = new ResourceGroup("");
emptyGroup.setId(-1);
Long zero = new Long(0);
groupComposite = new ResourceGroupComposite(zero, zero, zero,
zero, emptyGroup);
- // groupOperations = new
GroupOperationsCriteriaHistoryListView(locatorId,
- // new
GroupOperationsCriteriaDataSource(portletConfig), null, criteria, groupComposite);
- groupHistoryTable = new
HistoryGroupResourceConfigurationTable(extendLocatorId("Table"),
+ groupHistoryTable = new
GroupConfigurationHistoryCriteriaTable(extendLocatorId("Table"),
groupComposite);
- // groupHistoryTable.setDataSource(new
GroupConfigurationUdpatesCriteriaDataSource(portletConfig,
- // groupId));
- //
groupHistoryTable.setShowHeader(false);
- //
groupHistoryTable.setShowFooterRefresh(false);
}
+ //update table for portlet display.
groupHistoryTable.setDataSource(new
GroupConfigurationUdpatesCriteriaDataSource(portletConfig,
groupId));
groupHistoryTable.setShowHeader(false);
@@ -421,6 +400,24 @@ public class GroupConfigurationUpdatesPortlet extends
LocatableVLayout implement
return baseViewPath;
}
+ class GroupConfigurationHistoryCriteriaTable extends
HistoryGroupResourceConfigurationTable {
+
+ public GroupConfigurationHistoryCriteriaTable(String locatorId,
ResourceGroupComposite groupComposite) {
+ super(locatorId, groupComposite);
+ getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
+ }
+
+ @Override
+ protected void refreshTableInfo() {
+ super.refreshTableInfo();
+ if (getTableInfo() != null) {
+ int count = getListGrid().getSelection().length;
+ getTableInfo().setContents(
+
MSG.view_table_matchingRows(String.valueOf(getListGrid().getTotalRows()),
String.valueOf(count)));
+ }
+ }
+ }
+
class GroupConfigurationUdpatesCriteriaDataSource extends
GroupResourceConfigurationDataSource {
public GroupConfigurationUdpatesCriteriaDataSource(Configuration portletConfig,
int groupId) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
index 008c34b..b06c9a4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
@@ -240,6 +240,7 @@ public class GroupOobsPortlet extends LocatableVLayout implements
CustomSettings
recentOobContent.addChild(column);
recentOobContent.markForRedraw();
currentlyLoading = false;
+ markForRedraw();
}
});
}
@@ -247,6 +248,7 @@ public class GroupOobsPortlet extends LocatableVLayout implements
CustomSettings
public void startRefreshCycle() {
refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this,
refreshTimer);
recentOobContent.markForRedraw();
+ markForRedraw();
}
@Override
@@ -263,6 +265,7 @@ public class GroupOobsPortlet extends LocatableVLayout implements
CustomSettings
@Override
public void redraw() {
super.redraw();
+ //spinder 4/3/11: although screen does not flash autorefresh is being called on
time. Too fast for user to notice.
loadData();
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
index 188b2a1..af95e7a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
@@ -68,6 +68,7 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
setOverflow(Overflow.VISIBLE);
setShowFooterRefresh(false); //disable footer refresh button as redundant for
portlets
setShowHeader(false);//disable header for portlets
+ getListGrid().setEmptyMessage(MSG.view_portlet_results_empty());
}
public Timer getRefreshTimer() {
@@ -273,6 +274,12 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
super.onDestroy();
}
+ @Override
+ public void redraw() {
+ super.refresh();
+ markForRedraw();
+ }
+
static public class AlertsPortletDataSource extends AlertDataSource {
private Configuration configuration;
commit 877170b93dacaa5e71b83709fdea29e10f70fe57
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Apr 4 16:51:02 2011 -0400
Work on issues revolving around direct navigation to either a resource/group
subtab list view, or detail for that view.
- rake sure to always invoke a bookmarkable view's renderView method in
order to get basePath set correctly, which is required for list entry link
creation.
- remove restriction that the subTabLayout be drawn prior to adding a
member canvas. It may not be fully drawn in the direct navigation use case.
- make it more clear when we should handle tab selection events and when we
ignore them.
Maybe *this* time I finally got it right...
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 1d684ff..1dbc33d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -210,7 +210,7 @@ public class SubTabLayout extends LocatableVLayout {
}
if (foundTab) {
- refresh();
+ setCurrentlySelected();
}
return foundTab;
@@ -248,7 +248,7 @@ public class SubTabLayout extends LocatableVLayout {
return false;
}
this.currentlySelected = subTab.getLocatorId();
- refresh();
+ setCurrentlySelected();
return true;
}
}
@@ -293,8 +293,8 @@ public class SubTabLayout extends LocatableVLayout {
}
}
- private void refresh() {
- if (isDrawn() && null != this.currentlySelected) {
+ private void setCurrentlySelected() {
+ if (null != this.currentlySelected) {
Button button = this.subTabs.get(this.currentlySelected).getButton();
button.select();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index cac30b2..c6867ac 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -228,7 +228,8 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends
Layout> extends Lo
TwoLevelTab tab = (tabName != null) ? this.tabSet.getTabByName(tabName) :
null;
SubTab subtab = null;
- // if the requested tab is not available for the tabset then select the
defaults (firing a new event)
+ // if the requested tab is not available for the tabset then select the
default tab/subtab. Fire
+ // an event in order to navigate to the new path
if (tab == null || tab.getDisabled()) {
this.tabSet.setIgnoreSelectEvents(false);
subtab = selectDefaultTabAndSubTab();
@@ -239,39 +240,36 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends
Layout> extends Lo
subtab = (subtabName != null) ? tab.getSubTabByName(subtabName) :
tab.getDefaultSubTab();
// due to our attempt to perform sticky tabbing we may request an invalid
subtab when
- // switching resources. If the requested subtab is not available the select
the default subtab for the tab
+ // switching resources. If the requested subtab is not available the select
the default subtab
+ // for the tab. Fire an event in order to navigate to the new path.
if (subtab == null || tab.getLayout().isSubTabDisabled(subtab)) {
- subtab = tab.getLayout().getDefaultSubTab();
+ this.tabSet.setIgnoreSelectEvents(false);
+ subtab = selectDefaultSubTab(tab);
+ return;
}
- // select the subTab (this does not fire an event, just sets the subtab)
- tab.getLayout().selectSubTab(subtab);
-
- // the target tab/subtab is now determined. if the currently selected tab is
not the target tab then
- // select it now.
- if (!tab.equals(this.tabSet.getSelectedTab())) {
-
- // Fire a tab selection event only if we're at the end of the path.
If not then it is assumed that
- // the subtab view is a BookmarkableView and the navigation will continue
in that way, below.
- if (viewPath.isEnd()) {
- this.tabSet.setIgnoreSelectEvents(false);
- this.tabSet.selectTab(tab);
- return;
- }
+ // the requested tab/subtab are valid, continue with this path
- this.tabSet.selectTab(tab);
- }
+ // select the tab and subTab (no event fired, we're already dealing with
the correct path)
+ this.tabSet.selectTab(tab);
+ // this call adds the subtab canvas as a member of the subtablayout
+ tab.getLayout().selectSubTab(subtab);
- // if the desired tab/subtab are already selected, now we can render the
subtab canvas
+ // get the target canvas
Canvas subView = subtab.getCanvas();
+ // if this is a bookmarkable view then further rendering is deferred to its
renderView method. This
+ // will set the basePath as well as handle any remaining view items (e.g. id
of a selected item in
+ // a subtab that contains a Master-Details view). Otherwise, make sure we
perform any required
+ // refresh.
if (subView instanceof BookmarkableView) {
- // Handle any remaining view items (e.g. id of a selected item in a
subtab that contains a Master-Details view).
((BookmarkableView) subView).renderView(viewPath);
+
} else if (subView instanceof RefreshableView && subView.isDrawn())
{
// Refresh the data on the subtab, so it's not stale.
Log.debug("Refreshing data for [" +
subView.getClass().getName() + "]...");
((RefreshableView) subView).refresh();
+
}
// ensure the tabset is enabled (disabled in onTabSelected), and redraw
@@ -291,6 +289,11 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends
Layout> extends Lo
throw new IllegalStateException("No default tab is defined.");
}
+ return selectDefaultSubTab(tab);
+ }
+
+ private SubTab selectDefaultSubTab(TwoLevelTab tab) {
+
SubTab subTab = tab.getDefaultSubTab();
if (subTab == null || tab.getLayout().isSubTabDisabled(subTab)) {
CoreGUI.getErrorHandler().handleError(MSG.view_tabs_invalidSubTab(subTab.getName()));
commit 6773ca8922f29b95bf5b286f2f8a8330493d169e
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Apr 4 14:48:13 2011 -0400
fix bug in checkboxes for implied-read resource perms in permissions editor
(
https://bugzilla.redhat.com/show_bug.cgi?id=683852)
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
index 447659b..506850a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
@@ -20,7 +20,6 @@ package org.rhq.enterprise.gui.coregui.client.admin.roles;
import java.util.ArrayList;
import java.util.EnumSet;
-import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
@@ -73,7 +72,8 @@ public class PermissionsEditor extends LocatableVStack {
this.roleEditView = roleEditView;
this.isReadOnly = isReadOnly;
- this.selectedPermissions = new HashSet<Permission>();
+ // Default permission set
+ this.selectedPermissions = EnumSet.of(Permission.VIEW_RESOURCE);
setWidth("95%");
setHeight100();
@@ -337,7 +337,6 @@ public class PermissionsEditor extends LocatableVStack {
Permission permission = Permission.valueOf(permissionName);
if (permission == Permission.VIEW_RESOURCE) {
event.getItem().setValue(true);
- event.getItem().disable();
String permissionDisplayName =
record.getAttribute("displayName");
Message message = new Message(
MSG.view_adminRoles_permissions_readAccessImplied(permissionDisplayName),
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
index 3af67b6..fd2a086 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
@@ -251,6 +251,8 @@ public class RolesDataSource extends RPCDataSource<Role,
RoleCriteria> {
public static Set<Permission> toPermissionSet(Record[] permissionRecords) {
Set<Permission> permissions = new HashSet<Permission>();
+ // VIEW_RESOURCE is implied, so make sure it's always in the returned Set.
+ permissions.add(Permission.VIEW_RESOURCE);
for (Record permissionRecord : permissionRecords) {
String permissionName = permissionRecord.getAttribute("name");
Permission permission = Permission.valueOf(permissionName);
commit 25cfc0c27b8a0224dd628acde62722e92915e707
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Apr 4 12:17:46 2011 -0400
on new op schedule page, select mode=calendar and run=now by default and change title
of Save button to "Schedule"; fix bug where read-only prop values were displayed
as " "
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 69a3c52..b7f1adf 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -120,6 +120,7 @@ import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
@@ -1261,10 +1262,7 @@ public class ConfigurationEditor extends LocatableVLayout {
// TODO (ips, 03/25/11): We eventually want to use StaticTextItems for read-only
PASSWORD props too, but we have
// to wait until we implement masking/unmasking of PASSWORD
props at the SLSB layer first.
if (propertyIsReadOnly && propertyDefinitionSimple.getType() !=
PropertySimpleType.PASSWORD) {
- StaticTextItem staticItem = new StaticTextItem();
- // Property values are user-editable, so escape HTML to prevent an XSS
attack.
- staticItem.setOutputAsHTML(true);
- valueItem = staticItem;
+ valueItem = new StaticTextItem();
} else {
List<PropertyDefinitionEnumeration> enumeratedValues =
propertyDefinitionSimple.getEnumeratedValues();
if (enumeratedValues != null && !enumeratedValues.isEmpty()) {
@@ -1336,13 +1334,20 @@ public class ConfigurationEditor extends LocatableVLayout {
}
}
- // for more robust and repeatable item locators (not positional) assign a name
and title
+ // For more robust and repeatable item locators (not positional), assign a name
and a title.
valueItem.setName(propertySimple.getName());
valueItem.setTitle("none");
valueItem.setShowTitle(false);
+
+ String value = propertySimple.getStringValue();
+ if (valueItem instanceof StaticTextItem) {
+ // Property values are user-editable, so escape HTML when displayed as static
text, to prevent XSS attacks.
+ value = StringUtility.escapeHtml(value);
+ }
// TODO (ips): I don't think we want to use setDefaultValue(), as it will
cause the input to be reset to the
// value if the user clears it.
- valueItem.setDefaultValue(propertySimple.getStringValue());
+ valueItem.setDefaultValue(value);
+
valueItem.setRequired(propertyDefinitionSimple.isRequired());
valueItem.setWidth(220);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java
index 13ebe7d..47f9014 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java
@@ -190,12 +190,12 @@ public class JobTriggerEditor extends LocatableVLayout {
modeItem.setValueMap(modeValueMap);
modeItem.setVertical(false);
modeItem.setShowTitle(true);
+ modeItem.setValue("calendar");
this.modeForm.setFields(modeItem);
addMember(this.modeForm);
this.calendarModeLayout = new
LocatableVLayout(extendLocatorId("CalendarModeLayout"));
- this.calendarModeLayout.setVisible(false);
this.calendarTypeForm = new
EnhancedDynamicForm(extendLocatorId("CalendarTypeForm"), this.isReadOnly);
@@ -209,6 +209,7 @@ public class JobTriggerEditor extends LocatableVLayout {
calendarTypeValueMap.put("laterAndRepeat",
MSG.widget_jobTriggerEditor_value_laterAndRepeat());
calendarTypeItem.setValueMap(calendarTypeValueMap);
calendarTypeItem.setVertical(false);
+ calendarTypeItem.setValue("now");
this.calendarTypeForm.setFields(calendarTypeItem);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
index 387c4d5..118cec2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
@@ -218,6 +218,13 @@ public abstract class AbstractOperationScheduleDetailsView extends
AbstractRecor
}
@Override
+ protected ButtonBar buildButtonBar() {
+ ButtonBar buttonBar = super.buildButtonBar();
+ buttonBar.getSaveButton().setTitle(MSG.common_button_schedule());
+ return buttonBar;
+ }
+
+ @Override
protected String getTitleFieldName() {
return ResourceOperationScheduleDataSource.Field.OPERATION_DISPLAY_NAME;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 0e5dadc..4a9cfa4 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -13,7 +13,7 @@ common_buildInfo_gwtVersion = ${gwt.version}
# Button Labels
#--------------
-common_button_ack = Acknowlege
+common_button_ack = Acknowledge
common_button_ack_all = Acknowledge All
common_button_add = Add
common_button_advanced = Advanced...
@@ -37,6 +37,7 @@ common_button_purgeAll = Purge All
common_button_refresh = Refresh
common_button_reset = Reset
common_button_save = Save
+common_button_schedule = Schedule
common_button_search = Search
common_button_set = Set
common_button_showDetails = Show Details...
commit a89e5f870173e6c9df210a97cb39ed12d2fa64f6
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Apr 4 08:17:06 2011 -0400
remove config-updates portlet unless compatible grp.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index 650c9a3..f087202 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -527,6 +527,7 @@ public class DashboardView extends LocatableVLayout {
groupKeyNameMap.remove(GroupMetricsPortlet.KEY);
groupKeyNameMap.remove(GroupOobsPortlet.KEY);
groupKeyNameMap.remove(GroupPkgHistoryPortlet.KEY);
+ groupKeyNameMap.remove(GroupConfigurationUpdatesPortlet.KEY);
} else {
//for compatible may still need to do some pruning.
if (!facets.isEmpty()) {
commit 687c8c170ac700896242e59e2e5d7acc5d301335
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Sun Apr 3 15:03:34 2011 -0400
remove old activityView2 tabs.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 86a7c1c..8e8eca7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -64,7 +64,6 @@ import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.operation.history.GroupOperationHistoryListView;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.operation.schedule.GroupOperationScheduleListView;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.ActivityView;
-import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.ActivityView3;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
/**
@@ -91,7 +90,6 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
// subtabs
private SubTab summaryActivity;
- private SubTab summaryActivity2;
private SubTab summaryTimeline;
private SubTab monitorGraphs;
private SubTab monitorTables;
@@ -155,13 +153,9 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
.view_tabs_common_summary()),
ImageManager.getResourceIcon(ResourceCategory.SERVICE, Boolean.TRUE));
summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"),
new ViewName("Activity", MSG
.view_tabs_common_activity()), null);
- summaryActivity2 = new SubTab(summaryTab.extendLocatorId("Activity2"),
new ViewName("Activity2", MSG
- .view_tabs_common_activity()
- + "2"), null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"),
new ViewName("Timeline", MSG
.view_tabs_common_timeline()), null);
- // summaryTab.registerSubTabs(summaryActivity, summaryTimeline);
- summaryTab.registerSubTabs(summaryActivity, summaryActivity2, summaryTimeline);
+ summaryTab.registerSubTabs(summaryActivity, summaryTimeline);
tabs.add(summaryTab);
inventoryTab = new
TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new
ViewName("Inventory", MSG
@@ -260,12 +254,6 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
return new
ActivityView(summaryActivity.extendLocatorId("View"), groupComposite);
}
});
- updateSubTab(this.summaryTab, this.summaryActivity2, true, true, new
ViewFactory() {
- @Override
- public Canvas createView() {
- return new
ActivityView3(summaryActivity2.extendLocatorId("View2"), groupComposite);
- }
- });
// TODO (ips): Add Timeline subtab?
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 91f617d..8ddb631 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -68,7 +68,6 @@ import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitorin
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.history.ResourceOperationHistoryListView;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.schedule.ResourceOperationScheduleListView;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ActivityView;
-import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ActivityView3;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -113,7 +112,6 @@ public class ResourceDetailView extends
AbstractTwoLevelTabSetView<ResourceCompo
private TwoLevelTab contentTab;
private SubTab summaryActivity;
- private SubTab summaryActivity2;
private SubTab summaryTimeline;
private SubTab monitorGraphs;
private SubTab monitorTables;
@@ -153,12 +151,9 @@ public class ResourceDetailView extends
AbstractTwoLevelTabSetView<ResourceCompo
.view_tabs_common_summary()),
ImageManager.getResourceIcon(ResourceCategory.SERVICE, Boolean.TRUE));
summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"),
new ViewName("Activity", MSG
.view_tabs_common_activity()), null);
- summaryActivity2 = new SubTab(summaryTab.extendLocatorId("Activity2"),
new ViewName("Activity2", MSG
- .view_tabs_common_activity()
- + "2"), null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"),
new ViewName("Timeline", MSG
.view_tabs_common_timeline()), null);
- summaryTab.registerSubTabs(summaryActivity, summaryActivity2, summaryTimeline);
+ summaryTab.registerSubTabs(summaryActivity, summaryTimeline);
tabs.add(summaryTab);
inventoryTab = new
TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new
ViewName("Inventory", MSG
@@ -285,13 +280,6 @@ public class ResourceDetailView extends
AbstractTwoLevelTabSetView<ResourceCompo
}
});
- updateSubTab(this.summaryTab, this.summaryActivity2, true, true, new
ViewFactory() {
- @Override
- public Canvas createView() {
- return new
ActivityView3(summaryActivity2.extendLocatorId("View"), resourceComposite);
- }
- });
-
updateSubTab(this.summaryTab, this.summaryTimeline, true, true, new ViewFactory()
{
@Override
public Canvas createView() {
commit 076c5fd6ad952765cab9e92b815c2fddfd723e9b
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Sun Apr 3 14:59:22 2011 -0400
update portlet table view message to better reflect criteria filtering.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
index 93fd686..188b2a1 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
@@ -247,6 +247,16 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
super.setupTableInteractions(hasWriteAccess);
}
+ @Override
+ protected void refreshTableInfo() {
+ super.refreshTableInfo();
+ if (getTableInfo() != null) {
+ int count = getListGrid().getSelection().length;
+ getTableInfo().setContents(
+ MSG.view_table_matchingRows(String.valueOf(getListGrid().getTotalRows()),
String.valueOf(count)));
+ }
+ }
+
public void startRefreshCycle() {
refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this,
refreshTimer);
}
commit 39f958f9bb1723096d99f54a9834fbe3c103ecc1
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Sun Apr 3 13:42:45 2011 -0400
modify default portlet arangements to include config updates where necessary.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index ba91415..650c9a3 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -67,11 +67,13 @@ import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.form.ColorButtonItem;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupBundleDeploymentsPortlet;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupConfigurationUpdatesPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupMetricsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupOobsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupOperationsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupPkgHistoryPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceBundleDeploymentsPortlet;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceConfigurationUpdatesPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceEventsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceMetricsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceOperationsPortlet;
@@ -495,6 +497,10 @@ public class DashboardView extends LocatableVLayout {
if (!facets.contains(ResourceTypeFacet.EVENT)) {
resourceKeyNameMap.remove(ResourceEventsPortlet.KEY);
}
+ //Configuration related portlets
+ if (!facets.contains(ResourceTypeFacet.CONFIGURATION)) {
+ resourceKeyNameMap.remove(ResourceConfigurationUpdatesPortlet.KEY);
+ }
}
//Bundle related portlet
if
(!resource.getResourceType().getCategory().equals(ResourceCategory.PLATFORM)) {
@@ -537,6 +543,10 @@ public class DashboardView extends LocatableVLayout {
if (!facets.contains(ResourceTypeFacet.CONTENT)) {
groupKeyNameMap.remove(GroupPkgHistoryPortlet.KEY);
}
+ //CONFIGURATION related portlets(CONFIGURATION)
+ if (!facets.contains(ResourceTypeFacet.CONFIGURATION)) {
+ groupKeyNameMap.remove(GroupConfigurationUpdatesPortlet.KEY);
+ }
}
}
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 dc74fb6..c6b36b0 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
@@ -56,6 +56,7 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletFactory;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupAlertsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupBundleDeploymentsPortlet;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupConfigurationUpdatesPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupMetricsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupOperationsPortlet;
import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
@@ -269,6 +270,12 @@ public class ActivityView extends LocatableVLayout implements
DashboardContainer
dashboard.addPortlet(ops, colRight, rowRight++);
groupKeyNameMap.remove(GroupOperationsPortlet.KEY);
}
+ if (groupKeyNameMap.containsKey(GroupConfigurationUpdatesPortlet.KEY))
{//operations if available
+ DashboardPortlet ops = new
DashboardPortlet(GroupConfigurationUpdatesPortlet.NAME,
+ GroupConfigurationUpdatesPortlet.KEY, 220);
+ dashboard.addPortlet(ops, colRight, rowRight++);
+ groupKeyNameMap.remove(GroupConfigurationUpdatesPortlet.KEY);
+ }
//Fill out left column(typically smaller portlets) then alternate cols with
remaining
displayLeft = false;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 4cec210..ca227e2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -30,6 +30,7 @@ import
org.rhq.enterprise.gui.coregui.client.dashboard.DashboardContainer;
import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletFactory;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceAlertsPortlet;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceConfigurationUpdatesPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceMetricsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceOperationsPortlet;
import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
@@ -199,6 +200,12 @@ public class ActivityView extends LocatableVLayout implements
DashboardContainer
dashboard.addPortlet(ops, colRight, rowRight++);
resKeyNameMap.remove(ResourceOperationsPortlet.KEY);
}
+ if (resKeyNameMap.containsKey(ResourceConfigurationUpdatesPortlet.KEY))
{//configuration if available
+ DashboardPortlet ops = new
DashboardPortlet(ResourceConfigurationUpdatesPortlet.NAME,
+ ResourceConfigurationUpdatesPortlet.KEY, 220);
+ dashboard.addPortlet(ops, colRight, rowRight++);
+ resKeyNameMap.remove(ResourceConfigurationUpdatesPortlet.KEY);
+ }
//Fill out left column(typically smaller portlets) then alternate cols with
remaining
boolean displayLeft = false;
commit ede97db6398b087d3624b4736e24e531a685e85f
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Sun Apr 3 13:21:38 2011 -0400
add resource configuration updates portlet.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
index 1bd51de..2ccb582 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
@@ -49,6 +49,7 @@ import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.operation
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.problems.ProblemResourcesPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceAlertsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceBundleDeploymentsPortlet;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceConfigurationUpdatesPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceEventsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceMetricsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource.ResourceOobsPortlet;
@@ -151,6 +152,8 @@ public class PortletFactory {
ResourcePkgHistoryPortlet.Factory.INSTANCE);
registeredResourcePortletFactoryMap.put(ResourceBundleDeploymentsPortlet.KEY,
ResourceBundleDeploymentsPortlet.Factory.INSTANCE);
+ registeredResourcePortletFactoryMap.put(ResourceConfigurationUpdatesPortlet.KEY,
+ ResourceConfigurationUpdatesPortlet.Factory.INSTANCE);
//register resource portlet names
registeredResourcePortletNameMap = new HashMap<String,
String>(registeredResourcePortletFactoryMap.size());
@@ -162,6 +165,8 @@ public class PortletFactory {
registeredResourcePortletNameMap.put(ResourceAlertsPortlet.KEY,
ResourceAlertsPortlet.NAME);
registeredResourcePortletNameMap.put(ResourceBundleDeploymentsPortlet.KEY,
ResourceBundleDeploymentsPortlet.NAME);
+ registeredResourcePortletNameMap.put(ResourceConfigurationUpdatesPortlet.KEY,
+ ResourceConfigurationUpdatesPortlet.NAME);
//############## Portlet icon mappings
############################################
//register portlet names
@@ -181,6 +186,7 @@ public class PortletFactory {
registeredPortletIconMap.put(GroupBundleDeploymentsPortlet.KEY,
ImageManager.getBundleIcon());
registeredPortletIconMap.put(ResourceBundleDeploymentsPortlet.KEY,
ImageManager.getBundleIcon());
registeredPortletIconMap.put(GroupConfigurationUpdatesPortlet.KEY,
ImageManager.getConfigureIcon());
+ registeredPortletIconMap.put(ResourceConfigurationUpdatesPortlet.KEY,
ImageManager.getConfigureIcon());
}
public static Portlet buildPortlet(String locatorId, PortletWindow portletWindow,
DashboardPortlet storedPortlet) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
index 083c43b..f002795 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
@@ -124,11 +124,14 @@ public class GroupConfigurationUpdatesPortlet extends
LocatableVLayout implement
//figure out which page we're loading
String currentPage = History.getToken();
String[] elements = currentPage.split("/");
- int currentGroupId = AbstractActivityView.groupIdLookup(currentPage);
- this.groupId = currentGroupId;
+ this.groupId = groupId;
baseViewPath = elements[0];
}
+ public GroupConfigurationUpdatesPortlet(String locatorId) {
+ super(locatorId);
+ }
+
/**Defines layout for the portlet page.
*/
protected void initializeUi() {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
new file mode 100644
index 0000000..a4a6e67
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceConfigurationUpdatesPortlet.java
@@ -0,0 +1,324 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.resource;
+
+import java.util.ArrayList;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.PortletConfigurationEditorComponent.Constant;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupConfigurationUpdatesPortlet;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryDataSource;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
+
+/**This portlet allows the end user to customize the Package History display
+ *
+ * @author Simeon Pinder
+ */
+public class ResourceConfigurationUpdatesPortlet extends GroupConfigurationUpdatesPortlet
{
+
+ // A non-displayed, persisted identifier for the portlet
+ public static final String KEY = "ResourceConfigurationUpdates";
+ // A default displayed, persisted name for the portlet
+ public static final String NAME =
MSG.view_portlet_defaultName_resource_config_updates();
+
+ private int resourceId = -1;
+ private ResourceComposite resourceComposite;
+
+ private ResourceConfigurationHistoryCriteriaView resourceHistoryTable;
+
+ public ResourceConfigurationUpdatesPortlet(String locatorId, int resourceId) {
+ super(locatorId);
+ this.resourceId = resourceId;
+ //figure out which page we're loading
+ String currentPage = History.getToken();
+ String[] elements = currentPage.split("/");
+ baseViewPath = elements[0];
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ initializeUi();
+ loadData();
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ /* (non-Javadoc)
+ * TODO: This factory ASSUMES the user is currently navigated to a group detail
view, and generates a portlet
+ * for that group. It will fail in other scenarios. This mechanism
should be improved such that the
+ * factory method can take an EntityContext explicitly indicating, in this
case, the group.
+ * @see
org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory#getInstance(java.lang.String)
+ */
+ public final Portlet getInstance(String locatorId) {
+ //figure out which page we're loading
+ String currentPage = History.getToken();
+ String[] elements = currentPage.split("/");
+ int currentResourceIdentifier = Integer.valueOf(elements[1]);
+ int resourceId = currentResourceIdentifier;
+
+ return new ResourceConfigurationUpdatesPortlet(locatorId, resourceId);
+ }
+ }
+
+ @Override
+ public void redraw() {
+ super.redraw();
+ loadData();
+ }
+
+ private void loadData() {
+ //populate composite data
+ //locate resourceRef
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(this.resourceId);
+ criteria.fetchResourceConfigurationUpdates(false);
+ criteria.fetchOperationHistories(false);
+
+ //locate the resource
+ GWTServiceLookup.getResourceService().findResourceCompositesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceComposite>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving resource composite for resource
[" + resourceId + "]:"
+ + caught.getMessage());
+ currentlyLoading = false;
+ }
+
+ @Override
+ public void onSuccess(PageList<ResourceComposite> results) {
+ if (!results.isEmpty()) {
+ resourceComposite = results.get(0);
+ //instantiate view
+
+ PageControl lastFive = new PageControl(0, 5);
+ ResourceConfigurationUpdateCriteria criteria = new
ResourceConfigurationUpdateCriteria();
+ criteria.setPageControl(lastFive);
+ //TODO: spinder: move this up into the pageControl.
+ criteria.addSortStatus(PageOrdering.DESC);
+ criteria.addFilterResourceIds(resourceId);
+
+ resourceHistoryTable = new
ResourceConfigurationHistoryCriteriaView(extendLocatorId("Table"),
+ resourceComposite.getResourcePermission().isConfigureWrite(),
resourceId);
+ } else {
+ resourceHistoryTable = new
ResourceConfigurationHistoryCriteriaView(extendLocatorId("Table"),
+ resourceComposite.getResourcePermission().isConfigureWrite(),
-1);
+ }
+ resourceHistoryTable.setDataSource(new
ConfigurationUdpatesCriteriaDataSource(portletConfig));
+ resourceHistoryTable.setShowHeader(false);
+ resourceHistoryTable.setShowFooterRefresh(false);
+
+ //cleanup
+ for (Canvas child : recentConfigurationContent.getChildren()) {
+ child.destroy();
+ }
+ recentConfigurationContent.addChild(resourceHistoryTable);
+ recentConfigurationContent.markForRedraw();
+ currentlyLoading = false;
+ }
+ });
+ }
+
+ class ResourceConfigurationHistoryCriteriaView extends ConfigurationHistoryView {
+
+ public ResourceConfigurationHistoryCriteriaView(String locatorId, boolean
hasWritePerm, int resourceId) {
+ super(locatorId, hasWritePerm, resourceId);
+ }
+
+ @Override
+ protected void refreshTableInfo() {
+ super.refreshTableInfo();
+ if (getTableInfo() != null) {
+ int count = getListGrid().getSelection().length;
+ getTableInfo().setContents(
+
MSG.view_table_matchingRows(String.valueOf(getListGrid().getTotalRows()),
String.valueOf(count)));
+ }
+ }
+
+ /**
+ * Override if you don't want the detailsLinkColumn to have the default link
wrapper.
+ * @return the desired CellFormatter.
+ */
+ protected CellFormatter getDetailsLinkColumnCellFormatter() {
+ return new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int i, int i1)
{
+ Integer recordId = getId(record);
+ String detailsUrl = "#" + getBasePath() + "/" +
recordId;
+ return SeleniumUtility.getLocatableHref(detailsUrl, value.toString(),
null);
+ }
+ };
+ }
+
+ @Override
+ protected String getBasePath() {
+ return "Resource/" + resourceComposite.getResource().getId() +
"/Configuration/History";
+ }
+ }
+
+ class ConfigurationUdpatesCriteriaDataSource extends ConfigurationHistoryDataSource
{
+
+ public ConfigurationUdpatesCriteriaDataSource(Configuration portletConfig) {
+ super();
+ this.portletConfig = portletConfig;
+ }
+
+ private Configuration portletConfig;
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response,
+ final ResourceConfigurationUpdateCriteria criteria) {
+ ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService();
+
+ configurationService.findResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
+
+ @Override
+ public void onSuccess(PageList<ResourceConfigurationUpdate>
result) {
+ response.setData(buildRecords(result));
+ //adjust for portlets that restrict result size
+ response.setTotalRows(result.size());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.view_group_resConfig_table_failFetch(),
caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ @Override
+ protected ResourceConfigurationUpdateCriteria getFetchCriteria(final DSRequest
request) {
+ //initialize criteria
+ ResourceConfigurationUpdateCriteria criteria = new
ResourceConfigurationUpdateCriteria();
+ criteria.addFilterResourceIds(resourceId);
+
+ //initialize to only five for quick queries.
+ PageControl pageControl = new PageControl(0, 5);//default to displaying five
+ //customize query with latest configuration selections
+
+ //retrieve previous settings from portlet config
+ if (portletConfig != null) {
+ // //result sort order
+ // PropertySimple property =
portletConfig.getSimple(Constant.RESULT_SORT_ORDER);
+ // if (property != null) {
+ // String currentSetting = property.getStringValue();
+ // if (currentSetting.trim().isEmpty() ||
currentSetting.equalsIgnoreCase(PageOrdering.DESC.name())) {
+ // criteria.addSortStatus(PageOrdering.DESC);
+ // } else {
+ // criteria.addSortStatus(PageOrdering.ASC);
+ // }
+ // }
+ //result timeframe if enabled
+ PropertySimple property =
portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
+ if (Boolean.valueOf(property.getBooleanValue())) {//then proceed setting
+
+ boolean isAdvanced = false;
+ //detect type of widget[Simple|Advanced]
+ property =
portletConfig.getSimple(Constant.METRIC_RANGE_BEGIN_END_FLAG);
+ if (property != null) {
+ 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)));
+ }
+ }
+ }
+
+ //result count
+ property = portletConfig.getSimple(Constant.RESULT_COUNT);
+ if (property != null) {
+ String currentSetting = property.getStringValue();
+ if (currentSetting.trim().isEmpty() ||
currentSetting.equalsIgnoreCase("5")) {
+ pageControl.setPageSize(5);
+ } else {
+ pageControl = new PageControl(0,
Integer.valueOf(currentSetting));
+ }
+ }
+ criteria.setPageControl(pageControl);
+
+ //detect operation status filter
+ property = portletConfig.getSimple(Constant.CONFIG_UPDATE_STATUS);
+ if (property != null) {
+ String currentSetting = property.getStringValue();
+ String[] parsedValues = currentSetting.trim().split(",");
+ if (currentSetting.trim().isEmpty()
+ || parsedValues.length ==
ConfigurationUpdateStatus.values().length) {
+ //all operation stati assumed
+ } else {
+ ConfigurationUpdateStatus[] updateStatus = new
ConfigurationUpdateStatus[parsedValues.length];
+ int indx = 0;
+ for (String priority : parsedValues) {
+ ConfigurationUpdateStatus s =
ConfigurationUpdateStatus.valueOf(priority);
+ updateStatus[indx++] = s;
+ }
+ criteria.addFilterStatuses(updateStatus);
+ }
+ }
+ }
+ return criteria;
+ }
+ }
+}
\ No newline at end of file
commit 815e140add7fc76d04157ee5349e560360ee3f68
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Apr 1 11:50:12 2011 -0400
fix invalid ConfigUpdate criteria values when querying on created/ctime.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
index d01b28a..14ebac6 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
@@ -38,7 +38,8 @@ import org.rhq.core.domain.util.PageOrdering;
public abstract class AbstractConfigurationUpdateCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- public static final String SORT_FIELD_CTIME = "ctime";
+ public static final String SORT_FIELD_CTIME = "createdTime";
+
public static final String SORT_FIELD_STATUS = "status";
private Integer filterId;
@@ -54,8 +55,8 @@ public abstract class AbstractConfigurationUpdateCriteria extends
Criteria {
public AbstractConfigurationUpdateCriteria() {
- filterOverrides.put("startTime", "ctime >= ?");
- filterOverrides.put("endTime", "ctime <= ?");
+ filterOverrides.put("startTime", "createdTime >= ?");
+ filterOverrides.put("endTime", "createdTime <= ?");
filterOverrides.put("statuses", "status IN ( ? )");
sortOverrides.put(SORT_FIELD_STATUS, "status");
commit b986579932d81b59f805c23e20c9038a0075da93
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Apr 1 09:06:38 2011 -0400
Adding missing ConfigUpdates portlet:
i)updating ConfigUpdateCriteria to support ConfigUpdateStatus[] as well
ii)ImageManager changes
iii)missing i18n messages
iv)ConfigUpdateStatus widget for shared portlets.
v)moved HistoryGroupResourceConfigurationTable.Datasource to top level class for
better sharing.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
index bd454d5..d01b28a 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
@@ -22,11 +22,14 @@
*/
package org.rhq.core.domain.criteria;
+import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.util.CriteriaUtils;
import org.rhq.core.domain.util.PageOrdering;
@XmlRootElement
@@ -42,6 +45,7 @@ public abstract class AbstractConfigurationUpdateCriteria extends
Criteria {
private Long filterStartTime; // requires overrides
private Long filterEndTime; // requires overrides
private ConfigurationUpdateStatus filterStatus;
+ private List<ConfigurationUpdateStatus> filterStatuses; // requires overrides
private boolean fetchConfiguration;
@@ -52,6 +56,7 @@ public abstract class AbstractConfigurationUpdateCriteria extends
Criteria {
filterOverrides.put("startTime", "ctime >= ?");
filterOverrides.put("endTime", "ctime <= ?");
+ filterOverrides.put("statuses", "status IN ( ? )");
sortOverrides.put(SORT_FIELD_STATUS, "status");
}
@@ -72,6 +77,10 @@ public abstract class AbstractConfigurationUpdateCriteria extends
Criteria {
this.filterStatus = status;
}
+ public void addFilterStatuses(ConfigurationUpdateStatus... configUpdateStatus) {
+ this.filterStatuses = CriteriaUtils.getListIgnoringNulls(configUpdateStatus);
+ }
+
public void fetchConfiguration(boolean configuration) {
this.fetchConfiguration = configuration;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
index 58346f0..8be3976 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
@@ -485,4 +485,12 @@ public class ImageManager {
public static String getBundleIcon() {
return "subsystems/content/Content_16.png";
}
+
+ public static String getConfigureLargeIcon() {
+ return "subsystems/configure/Configure_24.png";
+ }
+
+ public static String getConfigureIcon() {
+ return "subsystems/configure/Configure_16.png";
+ }
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
index 520a948..1bd51de 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
@@ -32,6 +32,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupAlertsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupBundleDeploymentsPortlet;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupConfigurationUpdatesPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupEventsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupMetricsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupOobsPortlet;
@@ -123,6 +124,8 @@ public class PortletFactory {
registeredGroupPortletFactoryMap.put(GroupPkgHistoryPortlet.KEY,
GroupPkgHistoryPortlet.Factory.INSTANCE);
registeredGroupPortletFactoryMap.put(GroupBundleDeploymentsPortlet.KEY,
GroupBundleDeploymentsPortlet.Factory.INSTANCE);
+ registeredGroupPortletFactoryMap.put(GroupConfigurationUpdatesPortlet.KEY,
+ GroupConfigurationUpdatesPortlet.Factory.INSTANCE);
//register group portlet names
registeredGroupPortletNameMap = new HashMap<String,
String>(registeredGroupPortletFactoryMap.size());
@@ -133,6 +136,7 @@ public class PortletFactory {
registeredGroupPortletNameMap.put(GroupOperationsPortlet.KEY,
GroupOperationsPortlet.NAME);
registeredGroupPortletNameMap.put(GroupPkgHistoryPortlet.KEY,
GroupPkgHistoryPortlet.NAME);
registeredGroupPortletNameMap.put(GroupBundleDeploymentsPortlet.KEY,
GroupBundleDeploymentsPortlet.NAME);
+ registeredGroupPortletNameMap.put(GroupConfigurationUpdatesPortlet.KEY,
GroupConfigurationUpdatesPortlet.NAME);
//############## Resource Activity Dashboard
############################################
//defines mapping for Group Activity Dashboard
@@ -176,6 +180,7 @@ public class PortletFactory {
registeredPortletIconMap.put(ResourcePkgHistoryPortlet.KEY,
ImageManager.getActivityPackageIcon());
registeredPortletIconMap.put(GroupBundleDeploymentsPortlet.KEY,
ImageManager.getBundleIcon());
registeredPortletIconMap.put(ResourceBundleDeploymentsPortlet.KEY,
ImageManager.getBundleIcon());
+ registeredPortletIconMap.put(GroupConfigurationUpdatesPortlet.KEY,
ImageManager.getConfigureIcon());
}
public static Portlet buildPortlet(String locatorId, PortletWindow portletWindow,
DashboardPortlet storedPortlet) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/PortletConfigurationEditorComponent.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/PortletConfigurationEditorComponent.java
index cea94a9..b7488da 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/PortletConfigurationEditorComponent.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/PortletConfigurationEditorComponent.java
@@ -27,6 +27,7 @@ import com.smartgwt.client.widgets.form.fields.SelectItem;
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.operation.OperationRequestStatus;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -68,6 +69,8 @@ public class PortletConfigurationEditorComponent {
String CUSTOM_REFRESH = "CUSTOM_REFRESH";
String OPERATION_STATUS = "OPERATION_STATUS";
String OPERATION_STATUS_DEFAULT = "";//empty
+ String CONFIG_UPDATE_STATUS = "CONFIG_UPDATE_STATUS";
+ String CONFIG_UPDATE_STATUS_DEFAULT = "";
}
//configuration map initialization
@@ -90,6 +93,8 @@ public class PortletConfigurationEditorComponent {
CONFIG_PROPERTY_INITIALIZATION.put(Constant.METRIC_RANGE_UNIT,
Constant.METRIC_RANGE_UNIT_DEFAULT);
//operation status, if empty initialize to "" i.e. all stati
CONFIG_PROPERTY_INITIALIZATION.put(Constant.OPERATION_STATUS,
Constant.OPERATION_STATUS_DEFAULT);
+ //config update status, if empty initialize to "" i.e. all stati
+ CONFIG_PROPERTY_INITIALIZATION.put(Constant.CONFIG_UPDATE_STATUS,
Constant.CONFIG_UPDATE_STATUS_DEFAULT);
}
/* Single select combobox for number of items to display on the dashboard
@@ -99,9 +104,9 @@ public class PortletConfigurationEditorComponent {
public static SelectItem getResultCountEditor(Configuration portletConfig) {
final SelectItem maximumResultsComboBox = new SelectItem(Constant.RESULT_COUNT);
- maximumResultsComboBox.setTitle("Results Count");
+ maximumResultsComboBox.setTitle(MSG.common_title_results_count());
maximumResultsComboBox.setWrapTitle(false);
- maximumResultsComboBox.setTooltip("<nobr><b> " +
"Displays N results with alerts" + "</b></nobr>");
+ maximumResultsComboBox.setTooltip("<nobr><b> " +
MSG.common_title_results_count_tooltip() + "</b></nobr>");
//spinder 9/3/10: the following is required workaround to disable editability of
combobox.
maximumResultsComboBox.setType("selection");
//set width of dropdown display region
@@ -176,9 +181,9 @@ public class PortletConfigurationEditorComponent {
* @return Populated selectItem instance.
*/
public static SelectItem getResulSortOrderEditor(Configuration portletConfig) {
- SelectItem sortPrioritySelection = new SelectItem(Constant.RESULT_SORT_PRIORITY,
"Sort Order");
+ SelectItem sortPrioritySelection = new SelectItem(Constant.RESULT_SORT_PRIORITY,
MSG.common_title_sort_order());
sortPrioritySelection.setWrapTitle(false);
- sortPrioritySelection.setTooltip("Sets sort order for results.");
+ sortPrioritySelection.setTooltip(MSG.common_title_sort_order_tooltip());
LinkedHashMap<String, String> priorities = new LinkedHashMap<String,
String>(2);
priorities.put(PageOrdering.ASC.name(), "Ascending");
priorities.put(PageOrdering.DESC.name(), "Descending");
@@ -213,7 +218,7 @@ public class PortletConfigurationEditorComponent {
}
public static SelectItem getOperationStatusEditor(Configuration portletConfig) {
- SelectItem priorityFilter = new SelectItem(Constant.OPERATION_STATUS,
"Operation Status");
+ SelectItem priorityFilter = new SelectItem(Constant.OPERATION_STATUS,
MSG.common_title_operation_status());
priorityFilter.setWrapTitle(false);
priorityFilter.setWidth(325);
priorityFilter.setMultiple(true);
@@ -286,4 +291,82 @@ public class PortletConfigurationEditorComponent {
return priorityFilter;
}
+ public static SelectItem getConfigurationUpdateStatusEditor(Configuration
portletConfig) {
+ SelectItem priorityFilter = new SelectItem(Constant.CONFIG_UPDATE_STATUS, MSG
+ .common_title_config_update_status());
+ priorityFilter.setWrapTitle(false);
+ priorityFilter.setWidth(335);
+ priorityFilter.setMultiple(true);
+ priorityFilter.setMultipleAppearance(MultipleAppearance.PICKLIST);
+
+ LinkedHashMap<String, String> stati = new LinkedHashMap<String,
String>(4);
+ stati.put(ConfigurationUpdateStatus.SUCCESS.name(),
MSG.common_status_success());
+ stati.put(ConfigurationUpdateStatus.INPROGRESS.name(),
MSG.common_status_inprogress());
+ stati.put(ConfigurationUpdateStatus.NOCHANGE.name(),
MSG.common_status_nochange());
+ stati.put(ConfigurationUpdateStatus.FAILURE.name(), MSG.common_status_failed());
+
+ LinkedHashMap<String, String> statusIcons = new LinkedHashMap<String,
String>(3);
+ statusIcons.put(ConfigurationUpdateStatus.SUCCESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.SUCCESS));
+ statusIcons.put(ConfigurationUpdateStatus.INPROGRESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.INPROGRESS));
+ statusIcons.put(ConfigurationUpdateStatus.NOCHANGE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.NOCHANGE));
+ statusIcons.put(ConfigurationUpdateStatus.FAILURE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.FAILURE));
+ priorityFilter.setValueMap(stati);
+ priorityFilter.setValueIcons(statusIcons);
+ //reload current settings if they exist, otherwise enable all.
+ String currentValue =
portletConfig.getSimple(Constant.CONFIG_UPDATE_STATUS).getStringValue();
+ if (currentValue.isEmpty() || currentValue.split(",").length ==
ConfigurationUpdateStatus.values().length) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.SUCCESS.name(),
ConfigurationUpdateStatus.INPROGRESS
+ .name(), ConfigurationUpdateStatus.NOCHANGE.name(),
ConfigurationUpdateStatus.FAILURE.name());
+ } else {
+ //spinder:3/4/11 doing this nonsense due to some weird smartgwt issue with
SelectItem in VLayout.
+ if (currentValue.equalsIgnoreCase(ConfigurationUpdateStatus.SUCCESS.name()))
{
+ priorityFilter.setValues(ConfigurationUpdateStatus.SUCCESS.name());
+ } else if
(currentValue.equalsIgnoreCase("SUCCESS,INPROGRESS,NOCHANGE,FAILURE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.SUCCESS.name(),
ConfigurationUpdateStatus.INPROGRESS
+ .name(), ConfigurationUpdateStatus.NOCHANGE.name(),
ConfigurationUpdateStatus.FAILURE.name());
+ } else if
(currentValue.equalsIgnoreCase("SUCCESS,INPROGRESS,NOCHANGE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.SUCCESS.name(),
ConfigurationUpdateStatus.INPROGRESS
+ .name(), ConfigurationUpdateStatus.NOCHANGE.name());
+ } else if
(currentValue.equalsIgnoreCase("SUCCESS,INPROGRESS,FAILURE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.SUCCESS.name(),
ConfigurationUpdateStatus.INPROGRESS
+ .name(), ConfigurationUpdateStatus.FAILURE.name());
+ } else if (currentValue.equalsIgnoreCase("SUCCESS,INPROGRESS")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.SUCCESS.name(),
ConfigurationUpdateStatus.INPROGRESS
+ .name());
+ } else if
(currentValue.equalsIgnoreCase("SUCCESS,NOCHANGE,FAILURE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.SUCCESS.name(),
ConfigurationUpdateStatus.NOCHANGE
+ .name(), ConfigurationUpdateStatus.FAILURE.name());
+ } else if (currentValue.equalsIgnoreCase("SUCCESS,NOCHANGE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.SUCCESS.name(),
ConfigurationUpdateStatus.NOCHANGE
+ .name());
+ } else if (currentValue.equalsIgnoreCase("SUCCESS,FAILURE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.SUCCESS.name(),
ConfigurationUpdateStatus.FAILURE
+ .name());
+ } else if (currentValue.equalsIgnoreCase("INPROGRESS")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.INPROGRESS.name());
+ } else if
(currentValue.equalsIgnoreCase("INPROGRESS,NOCHANGE,FAILURE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.INPROGRESS.name(),
+ ConfigurationUpdateStatus.NOCHANGE.name(),
ConfigurationUpdateStatus.FAILURE.name());
+ } else if (currentValue.equalsIgnoreCase("INPROGRESS,NOCHANGE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.INPROGRESS.name(),
+ ConfigurationUpdateStatus.NOCHANGE.name());
+ } else if (currentValue.equalsIgnoreCase("INPROGRESS,FAILURE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.INPROGRESS.name(),
ConfigurationUpdateStatus.FAILURE
+ .name());
+ } else if (currentValue.equalsIgnoreCase("NOCHANGE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.NOCHANGE.name());
+ } else if (currentValue.equalsIgnoreCase("NOCHANGE,FAILURE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.NOCHANGE.name(),
ConfigurationUpdateStatus.FAILURE
+ .name());
+ } else if (currentValue.equalsIgnoreCase("FAILURE")) {
+ priorityFilter.setValues(ConfigurationUpdateStatus.FAILURE.name());
+ }
+ }
+ return priorityFilter;
+ }
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
new file mode 100644
index 0000000..083c43b
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
@@ -0,0 +1,548 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
+import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
+import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+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.core.domain.util.PageOrdering;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
+import
org.rhq.enterprise.gui.coregui.client.components.measurement.CustomConfigMeasurementRangeEditor;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+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.gwt.ConfigurationGWTServiceAsync;
+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.inventory.groups.detail.ResourceGroupDetailView;
+import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.GroupResourceConfigurationDataSource;
+import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.HistoryGroupResourceConfigurationTable;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * @author Simeon Pinder
+ */
+public class GroupConfigurationUpdatesPortlet extends LocatableVLayout implements
CustomSettingsPortlet,
+ AutoRefreshPortlet {
+
+ // A non-displayed, persisted identifier for the portlet
+ public static final String KEY = "GroupConfigurationUpdates";
+ // A default displayed, persisted name for the portlet
+ public static final String NAME =
MSG.view_portlet_defaultName_group_config_updates();
+
+ private int groupId = -1;
+ protected LocatableCanvas recentConfigurationContent = new LocatableCanvas(
+ extendLocatorId("RecentConfigurationUpdates"));
+
+ public static final String ID = "id";
+
+ //defines the list of configuration elements to load/persist for this portlet
+ protected static List<String> CONFIG_INCLUDE = new ArrayList<String>();
+ static {
+ CONFIG_INCLUDE.add(Constant.METRIC_RANGE);
+ CONFIG_INCLUDE.add(Constant.METRIC_RANGE_BEGIN_END_FLAG);
+ CONFIG_INCLUDE.add(Constant.METRIC_RANGE_ENABLE);
+ CONFIG_INCLUDE.add(Constant.METRIC_RANGE_LASTN);
+ CONFIG_INCLUDE.add(Constant.METRIC_RANGE_UNIT);
+ CONFIG_INCLUDE.add(Constant.RESULT_COUNT);
+ CONFIG_INCLUDE.add(Constant.CONFIG_UPDATE_STATUS);
+ // CONFIG_INCLUDE.add(Constant.RESULT_SORT_ORDER);
+ }
+
+ // set on initial configuration, the window for this portlet view.
+ protected PortletWindow portletWindow;
+
+ //instance ui widgets
+ protected Canvas containerCanvas;
+
+ protected Timer refreshTimer;
+ protected DashboardPortlet storedPortlet;
+ protected Configuration portletConfig;
+ private ResourceGroupComposite groupComposite;
+ protected boolean portletConfigInitialized = false;
+ protected boolean currentlyLoading = false;
+ protected String baseViewPath = "";
+ private HistoryGroupResourceConfigurationTable groupHistoryTable;
+
+ protected static HashMap<String, String> updatedMapping = new
HashMap<String, String>();
+ static {
+
updatedMapping.putAll(PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION);
+ }
+
+ public GroupConfigurationUpdatesPortlet(String locatorId, int groupId) {
+ super(locatorId);
+ //figure out which page we're loading
+ String currentPage = History.getToken();
+ String[] elements = currentPage.split("/");
+ int currentGroupId = AbstractActivityView.groupIdLookup(currentPage);
+ this.groupId = currentGroupId;
+ baseViewPath = elements[0];
+ }
+
+ /**Defines layout for the portlet page.
+ */
+ protected void initializeUi() {
+ setHeight("*");
+ setWidth100();
+
+ //tell canvas to fill it's component
+ recentConfigurationContent.setHeight100();
+ addMember(recentConfigurationContent);
+ markForRedraw();
+ }
+
+ /** Responsible for initialization and lazy configuration of the portlet values
+ */
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ //populate portlet configuration details
+ if (null == this.portletWindow && null != portletWindow) {
+ this.portletWindow = portletWindow;
+ }
+
+ if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
+ return;
+ }
+ this.storedPortlet = storedPortlet;
+ portletConfig = storedPortlet.getConfiguration();
+
+ //lazy init any elements not yet configured.
+ for (String key :
PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION.keySet()) {
+ if ((portletConfig.getSimple(key) == null) &&
CONFIG_INCLUDE.contains(key)) {
+ portletConfig.put(new PropertySimple(key,
+
PortletConfigurationEditorComponent.CONFIG_PROPERTY_INITIALIZATION.get(key)));
+ }
+ }
+ }
+
+ public Canvas getHelpCanvas() {
+ return new HTMLFlow(MSG.view_portlet_help_config_updates());
+ }
+
+ @Override
+ public DynamicForm getCustomSettingsForm() {
+ LocatableDynamicForm customSettings = new
LocatableDynamicForm(extendLocatorId("customSettings"));
+ LocatableVLayout page = new
LocatableVLayout(customSettings.extendLocatorId("page"));
+ //build editor form container
+ final LocatableDynamicForm form = new
LocatableDynamicForm(page.extendLocatorId("alert-filter"));
+ form.setMargin(5);
+
+ //add sort priority selector
+ // final SelectItem resultSortSelector =
PortletConfigurationEditorComponent
+ // .getResulSortOrderEditor(portletConfig);
+ //add result status selector
+ final SelectItem resultStatusSelector = PortletConfigurationEditorComponent
+ .getConfigurationUpdateStatusEditor(portletConfig);
+
+ //add result count selector
+ final SelectItem resultCountSelector =
PortletConfigurationEditorComponent.getResultCountEditor(portletConfig);
+
+ //add range selector
+ final CustomConfigMeasurementRangeEditor measurementRangeEditor =
PortletConfigurationEditorComponent
+ .getMeasurementRangeEditor(portletConfig);
+
+ // form.setItems(alertPrioritySelector, resultCountSelector);
+ form.setItems(resultStatusSelector, resultCountSelector);
+
+ //submit handler
+ customSettings.addSubmitValuesHandler(new SubmitValuesHandler() {
+
+ @Override
+ public void onSubmitValues(SubmitValuesEvent event) {
+ String selectedValue;
+
+ // //result sort order
+ // selectedValue =
resultSortSelector.getValue().toString();
+ // if ((selectedValue.trim().isEmpty()) ||
(selectedValue.equalsIgnoreCase(PageOrdering.DESC.name()))) {//then desc
+ // portletConfig.put(new
PropertySimple(Constant.RESULT_SORT_ORDER, PageOrdering.DESC));
+ // } else {
+ // portletConfig.put(new
PropertySimple(Constant.RESULT_SORT_ORDER, PageOrdering.ASC));
+ // }
+ //config status
+ portletConfig =
AbstractActivityView.saveConfigUpdateStatusSelectorSettings(resultStatusSelector,
+ portletConfig);
+
+ //result count
+ portletConfig =
AbstractActivityView.saveResultCounterSettings(resultCountSelector, portletConfig);
+
+ //time range settings
+ portletConfig =
AbstractActivityView.saveMeasurementRangeEditorSettings(measurementRangeEditor,
+ portletConfig);
+
+ //persist and reload portlet
+ storedPortlet.setConfiguration(portletConfig);
+ configure(portletWindow, storedPortlet);
+ // refresh();
+ redraw();
+ }
+ });
+ form.markForRedraw();
+ page.addMember(measurementRangeEditor);
+ page.addMember(form);
+ customSettings.addChild(page);
+ return customSettings;
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ /* (non-Javadoc)
+ * TODO: This factory ASSUMES the user is currently navigated to a group detail
view, and generates a portlet
+ * for that group. It will fail in other scenarios. This mechanism
should be improved such that the
+ * factory method can take an EntityContext explicitly indicating, in this
case, the group.
+ * @see
org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory#getInstance(java.lang.String)
+ */
+ public final Portlet getInstance(String locatorId) {
+
+ String currentPage = History.getToken();
+ int groupId = -1;
+ String[] elements = currentPage.split("/");
+ // process for groups and auto groups Ex. ResourceGroup/10111 or
ResourceGroup/AutoCluster/10321
+ try {
+ groupId = Integer.valueOf(elements[1]);
+ } catch (NumberFormatException nfe) {
+ groupId = Integer.valueOf(elements[2]);
+ }
+
+ return new GroupConfigurationUpdatesPortlet(locatorId, groupId);
+ }
+ }
+
+ @Override
+ public void startRefreshCycle() {
+ //current setting
+ final int refreshInterval =
UserSessionManager.getUserPreferences().getPageRefreshInterval();
+
+ //cancel any existing timer
+ if (refreshTimer != null) {
+ refreshTimer.cancel();
+ }
+
+ if (refreshInterval >= MeasurementUtility.MINUTES) {
+
+ refreshTimer = new Timer() {
+ public void run() {
+ redraw();
+ }
+ };
+
+ refreshTimer.scheduleRepeating(refreshInterval);
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ if (refreshTimer != null) {
+ refreshTimer.cancel();
+ }
+
+ super.onDestroy();
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ //disable the refresh timer for this run
+ currentlyLoading = true;
+ initializeUi();
+ loadData();
+ }
+
+ // @Override
+ // protected void refreshTableInfo() {
+ // super.refreshTableInfo();
+ // if (getTableInfo() != null) {
+ // int count = getListGrid().getSelection().length;
+ // getTableInfo().setContents(
+ //
MSG.view_table_matchingRows(String.valueOf(getListGrid().getTotalRows()),
String.valueOf(count)));
+ // }
+ // }
+
+ @Override
+ public boolean isRefreshing() {
+ return this.currentlyLoading;
+ }
+
+ protected void setRefreshing(boolean currentlyRefreshing) {
+ this.currentlyLoading = currentlyRefreshing;
+ }
+
+ @Override
+ public void redraw() {
+ super.redraw();
+ loadData();
+ }
+
+ private void loadData() {
+ //populate composite data
+ //locate resourceGroupRef
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(this.groupId);
+ criteria.fetchConfigurationUpdates(false);
+ criteria.fetchExplicitResources(false);
+ criteria.fetchGroupDefinition(false);
+ criteria.fetchOperationHistories(false);
+
+ // for autoclusters and autogroups we need to add more criteria
+ final boolean isAutoCluster = isAutoCluster();
+ final boolean isAutoGroup = isAutoGroup();
+ if (isAutoCluster) {
+ criteria.addFilterVisible(false);
+ } else if (isAutoGroup) {
+ criteria.addFilterVisible(false);
+ criteria.addFilterPrivate(true);
+ }
+
+ //locate the resource group
+
GWTServiceLookup.getResourceGroupService().findResourceGroupCompositesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroupComposite>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving resource group composite for group
[" + groupId + "]:"
+ + caught.getMessage());
+ currentlyLoading = false;
+ }
+
+ @Override
+ public void onSuccess(PageList<ResourceGroupComposite> results) {
+ if (!results.isEmpty()) {
+ groupComposite = results.get(0);
+ //instantiate view
+
+ PageControl lastFive = new PageControl(0, 5);
+ GroupResourceConfigurationUpdateCriteria criteria = new
GroupResourceConfigurationUpdateCriteria();
+ criteria.setPageControl(lastFive);
+ //TODO: spinder: move this up into the pageControl.
+ criteria.addSortStatus(PageOrdering.DESC);
+ List<Integer> filterResourceGroupIds = new
ArrayList<Integer>();
+ filterResourceGroupIds.add(groupId);
+ criteria.addFilterResourceGroupIds(filterResourceGroupIds);
+
+ groupHistoryTable = new
HistoryGroupResourceConfigurationTable(extendLocatorId("Table"),
+ groupComposite);
+ // groupHistoryTable.setDataSource(new
GroupConfigurationUdpatesCriteriaDataSource(portletConfig,
+ // groupId));
+ //
groupHistoryTable.setShowHeader(false);
+ //
groupHistoryTable.setShowFooterRefresh(false);
+ } else {
+ //TODO: spinder fix for empties
+ // Criteria criteria = new Criteria();
+ ResourceGroup emptyGroup = new ResourceGroup("");
+ emptyGroup.setId(-1);
+ Long zero = new Long(0);
+ groupComposite = new ResourceGroupComposite(zero, zero, zero,
zero, emptyGroup);
+ // groupOperations = new
GroupOperationsCriteriaHistoryListView(locatorId,
+ // new
GroupOperationsCriteriaDataSource(portletConfig), null, criteria, groupComposite);
+ groupHistoryTable = new
HistoryGroupResourceConfigurationTable(extendLocatorId("Table"),
+ groupComposite);
+ // groupHistoryTable.setDataSource(new
GroupConfigurationUdpatesCriteriaDataSource(portletConfig,
+ // groupId));
+ //
groupHistoryTable.setShowHeader(false);
+ //
groupHistoryTable.setShowFooterRefresh(false);
+ }
+
+ groupHistoryTable.setDataSource(new
GroupConfigurationUdpatesCriteriaDataSource(portletConfig,
+ groupId));
+ groupHistoryTable.setShowHeader(false);
+ groupHistoryTable.setShowFooterRefresh(false);
+
+ //cleanup
+ for (Canvas child : recentConfigurationContent.getChildren()) {
+ child.destroy();
+ }
+ recentConfigurationContent.addChild(groupHistoryTable);
+ recentConfigurationContent.markForRedraw();
+ currentlyLoading = false;
+ }
+ });
+ }
+
+ private boolean isAutoGroup() {
+ return ResourceGroupDetailView.AUTO_GROUP_VIEW_PATH.equals(getBaseViewPath());
+ }
+
+ private boolean isAutoCluster() {
+ return ResourceGroupDetailView.AUTO_CLUSTER_VIEW_PATH.equals(getBaseViewPath());
+ }
+
+ public String getBaseViewPath() {
+ return baseViewPath;
+ }
+
+ class GroupConfigurationUdpatesCriteriaDataSource extends
GroupResourceConfigurationDataSource {
+
+ public GroupConfigurationUdpatesCriteriaDataSource(Configuration portletConfig,
int groupId) {
+ super(groupId);
+ this.portletConfig = portletConfig;
+ this.groupId = groupId;
+ }
+
+ private int groupId;
+ private Configuration portletConfig;
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response,
+ final GroupResourceConfigurationUpdateCriteria criteria) {
+ ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService();
+
+
configurationService.findGroupResourceConfigurationUpdatesByCriteria(criteria,
+ new
AsyncCallback<PageList<GroupResourceConfigurationUpdate>>() {
+
+ @Override
+ public void
onSuccess(PageList<GroupResourceConfigurationUpdate> result) {
+ response.setData(buildRecords(result));
+ //adjust for portlets that restrict result size
+ response.setTotalRows(result.size());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.view_group_resConfig_table_failFetch(),
caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ @Override
+ protected GroupResourceConfigurationUpdateCriteria getFetchCriteria(final
DSRequest request) {
+ //initialize criteria
+ GroupResourceConfigurationUpdateCriteria criteria = new
GroupResourceConfigurationUpdateCriteria();
+
+ criteria.addFilterResourceGroupIds(Arrays.asList(groupId));
+
+ //initialize to only five for quick queries.
+ PageControl pageControl = new PageControl(0, 5);//default to displaying five
+ //customize query with latest configuration selections
+
+ //retrieve previous settings from portlet config
+ if (portletConfig != null) {
+ // //result sort order
+ // PropertySimple property =
portletConfig.getSimple(Constant.RESULT_SORT_ORDER);
+ // if (property != null) {
+ // String currentSetting = property.getStringValue();
+ // if (currentSetting.trim().isEmpty() ||
currentSetting.equalsIgnoreCase(PageOrdering.DESC.name())) {
+ // criteria.addSortStatus(PageOrdering.DESC);
+ // } else {
+ // criteria.addSortStatus(PageOrdering.ASC);
+ // }
+ // }
+ //result timeframe if enabled
+ PropertySimple property =
portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
+ if (Boolean.valueOf(property.getBooleanValue())) {//then proceed setting
+
+ boolean isAdvanced = false;
+ //detect type of widget[Simple|Advanced]
+ property =
portletConfig.getSimple(Constant.METRIC_RANGE_BEGIN_END_FLAG);
+ if (property != null) {
+ 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)));
+ }
+ }
+ }
+
+ //result count
+ property = portletConfig.getSimple(Constant.RESULT_COUNT);
+ if (property != null) {
+ String currentSetting = property.getStringValue();
+ if (currentSetting.trim().isEmpty() ||
currentSetting.equalsIgnoreCase("5")) {
+ pageControl.setPageSize(5);
+ } else {
+ pageControl = new PageControl(0,
Integer.valueOf(currentSetting));
+ }
+ }
+ criteria.setPageControl(pageControl);
+
+ //detect operation status filter
+ property = portletConfig.getSimple(Constant.CONFIG_UPDATE_STATUS);
+ if (property != null) {
+ String currentSetting = property.getStringValue();
+ String[] parsedValues = currentSetting.trim().split(",");
+ if (currentSetting.trim().isEmpty()
+ || parsedValues.length ==
ConfigurationUpdateStatus.values().length) {
+ //all operation stati assumed
+ } else {
+ ConfigurationUpdateStatus[] updateStatus = new
ConfigurationUpdateStatus[parsedValues.length];
+ int indx = 0;
+ for (String priority : parsedValues) {
+ ConfigurationUpdateStatus s =
ConfigurationUpdateStatus.valueOf(priority);
+ updateStatus[indx++] = s;
+ }
+ criteria.addFilterStatuses(updateStatus);
+ }
+ }
+ }
+ return criteria;
+ }
+ }
+}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
index 5fec813..0ee3647 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
@@ -41,6 +41,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
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.configuration.PropertySimple;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -507,6 +508,25 @@ public abstract class AbstractActivityView extends LocatableVLayout
implements R
/** Takes the current value of the widget and persists it into the configuration
object passed in.
*
+ * @param configUpdateStatusSelector
+ * @param portletConfig
+ * returns populated configuration object.
+ */
+ public static Configuration saveConfigUpdateStatusSelectorSettings(final SelectItem
configStatusSelector,
+ final Configuration portletConfig) {
+ String selectedValue;
+ selectedValue = configStatusSelector.getValue().toString();
+ if ((selectedValue.trim().isEmpty())
+ || (selectedValue.split(",").length ==
ConfigurationUpdateStatus.values().length)) {//then no operation status specified
+ portletConfig.put(new PropertySimple(Constant.CONFIG_UPDATE_STATUS,
Constant.CONFIG_UPDATE_STATUS_DEFAULT));
+ } else {//some subset of available configUpdate statuses will be used
+ portletConfig.put(new PropertySimple(Constant.CONFIG_UPDATE_STATUS,
selectedValue));
+ }
+ return portletConfig;
+ }
+
+ /** Takes the current value of the widget and persists it into the configuration
object passed in.
+ *
* @param measurementRangeEditor
* @param portletConfig
* returns populated configuration object.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationDataSource.java
new file mode 100644
index 0000000..770753a
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationDataSource.java
@@ -0,0 +1,97 @@
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
+import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * DataSource implementation for HistoryGroupResourceConfigurationTable.
+ *
+ * @author John Mazzitelli
+ * @author Simeon Pinder
+ */
+public class GroupResourceConfigurationDataSource extends
+ RPCDataSource<GroupResourceConfigurationUpdate,
GroupResourceConfigurationUpdateCriteria> {
+
+ private int groupId;
+
+ public class Field {
+ public static final String ID = "id";
+ public static final String DATECREATED = "dateCreated";
+ public static final String LASTUPDATED = "lastUpdated";
+ public static final String STATUS = "status";
+ public static final String USER = "user";
+ public static final String OBJECT = "object";
+ }
+
+ public GroupResourceConfigurationDataSource(int groupId) {
+ super();
+ this.groupId = groupId;
+ }
+
+ @Override
+ public GroupResourceConfigurationUpdate copyValues(Record from) {
+ return (GroupResourceConfigurationUpdate)
from.getAttributeAsObject(Field.OBJECT);
+ }
+
+ @Override
+ public ListGridRecord copyValues(GroupResourceConfigurationUpdate from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+ record.setAttribute(Field.USER, from.getSubjectName());
+
+ record.setAttribute(Field.OBJECT, from);
+
+ return record;
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response,
+ final GroupResourceConfigurationUpdateCriteria criteria) {
+ ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService();
+
+ configurationService.findGroupResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<GroupResourceConfigurationUpdate>>()
{
+
+ @Override
+ public void onSuccess(PageList<GroupResourceConfigurationUpdate>
result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.view_group_resConfig_table_failFetch(),
caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ @Override
+ protected GroupResourceConfigurationUpdateCriteria getFetchCriteria(final DSRequest
request) {
+ GroupResourceConfigurationUpdateCriteria criteria = new
GroupResourceConfigurationUpdateCriteria();
+ ArrayList<Integer> groupList = new ArrayList<Integer>(1);
+ groupList.add(this.groupId);
+ criteria.addFilterResourceGroupIds(groupList);
+ return criteria;
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
index 35be43c..ae52f4d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
@@ -18,14 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
-import java.util.ArrayList;
-import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
@@ -37,12 +33,9 @@ import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
-import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
-import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
@@ -53,7 +46,6 @@ import
org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablem
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
@@ -61,7 +53,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
*
* @author John Mazzitelli
*/
-public class HistoryGroupResourceConfigurationTable extends
Table<HistoryGroupResourceConfigurationTable.DataSource> {
+public class HistoryGroupResourceConfigurationTable extends
Table<GroupResourceConfigurationDataSource> {
private final ResourceGroup group;
private final ResourcePermission groupPerms;
@@ -70,16 +62,21 @@ public class HistoryGroupResourceConfigurationTable extends
Table<HistoryGroupRe
this.group = groupComposite.getResourceGroup();
this.groupPerms = groupComposite.getResourcePermission();
- setDataSource(new DataSource());
+ setDataSource(new GroupResourceConfigurationDataSource(this.group.getId()));
}
@Override
protected void configureTable() {
- ListGridField fieldId = new ListGridField(DataSource.Field.ID,
MSG.common_title_version());
- ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED,
MSG.common_title_dateCreated());
- ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED,
MSG.common_title_lastUpdated());
- ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS,
MSG.common_title_status());
- ListGridField fieldUser = new ListGridField(DataSource.Field.USER,
MSG.common_title_user());
+ ListGridField fieldId = new
ListGridField(GroupResourceConfigurationDataSource.Field.ID, MSG
+ .common_title_version());
+ ListGridField fieldDateCreated = new
ListGridField(GroupResourceConfigurationDataSource.Field.DATECREATED, MSG
+ .common_title_dateCreated());
+ ListGridField fieldLastUpdated = new
ListGridField(GroupResourceConfigurationDataSource.Field.LASTUPDATED, MSG
+ .common_title_lastUpdated());
+ ListGridField fieldStatus = new
ListGridField(GroupResourceConfigurationDataSource.Field.STATUS, MSG
+ .common_title_status());
+ ListGridField fieldUser = new
ListGridField(GroupResourceConfigurationDataSource.Field.USER, MSG
+ .common_title_user());
TimestampCellFormatter.prepareDateField(fieldDateCreated);
TimestampCellFormatter.prepareDateField(fieldLastUpdated);
@@ -135,7 +132,7 @@ public class HistoryGroupResourceConfigurationTable extends
Table<HistoryGroupRe
Integer[] updateIds = new Integer[selection.length];
int i = 0;
for (ListGridRecord record : selection) {
- updateIds[i++] = record.getAttributeAsInt(DataSource.Field.ID);
+ updateIds[i++] =
record.getAttributeAsInt(GroupResourceConfigurationDataSource.Field.ID);
}
service.deleteGroupResourceConfigurationUpdate(groupId, updateIds,
new AsyncCallback<Void>() {
@@ -163,7 +160,7 @@ public class HistoryGroupResourceConfigurationTable extends
Table<HistoryGroupRe
public void executeAction(ListGridRecord[] selection, Object actionValue)
{
CoreGUI.goToView(LinkManager.getGroupResourceConfigurationUpdateHistoryLink(
HistoryGroupResourceConfigurationTable.this.group.getId(), null)
- + "/" + selection[0].getAttribute(DataSource.Field.ID)
+ "/Settings");
+ + "/" +
selection[0].getAttribute(GroupResourceConfigurationDataSource.Field.ID) +
"/Settings");
}
});
@@ -173,7 +170,7 @@ public class HistoryGroupResourceConfigurationTable extends
Table<HistoryGroupRe
public void executeAction(ListGridRecord[] selection, Object actionValue)
{
CoreGUI.goToView(LinkManager.getGroupResourceConfigurationUpdateHistoryLink(
HistoryGroupResourceConfigurationTable.this.group.getId(), null)
- + "/" + selection[0].getAttribute(DataSource.Field.ID)
+ "/Members");
+ + "/" +
selection[0].getAttribute(GroupResourceConfigurationDataSource.Field.ID) +
"/Members");
}
});
@@ -182,7 +179,7 @@ public class HistoryGroupResourceConfigurationTable extends
Table<HistoryGroupRe
private String getStatusHtmlString(Record record) {
String html = null;
AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record
- .getAttributeAsObject(DataSource.Field.OBJECT);
+ .getAttributeAsObject(GroupResourceConfigurationDataSource.Field.OBJECT);
switch (obj.getStatus()) {
case SUCCESS: {
html = MSG.view_group_resConfig_table_statusSuccess();
@@ -217,69 +214,4 @@ public class HistoryGroupResourceConfigurationTable extends
Table<HistoryGroupRe
}
return html;
}
-
- class DataSource extends RPCDataSource<GroupResourceConfigurationUpdate,
GroupResourceConfigurationUpdateCriteria> {
-
- public class Field {
- public static final String ID = "id";
- public static final String DATECREATED = "dateCreated";
- public static final String LASTUPDATED = "lastUpdated";
- public static final String STATUS = "status";
- public static final String USER = "user";
- public static final String OBJECT = "object";
- }
-
- @Override
- public GroupResourceConfigurationUpdate copyValues(Record from) {
- return (GroupResourceConfigurationUpdate)
from.getAttributeAsObject(DataSource.Field.OBJECT);
- }
-
- @Override
- public ListGridRecord copyValues(GroupResourceConfigurationUpdate from) {
- ListGridRecord record = new ListGridRecord();
-
- record.setAttribute(Field.ID, from.getId());
- record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
- record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
- record.setAttribute(Field.STATUS, from.getStatus().name());
- record.setAttribute(Field.USER, from.getSubjectName());
-
- record.setAttribute(Field.OBJECT, from);
-
- return record;
- }
-
- @Override
- protected void executeFetch(final DSRequest request, final DSResponse response,
- final GroupResourceConfigurationUpdateCriteria criteria) {
- ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService();
-
-
configurationService.findGroupResourceConfigurationUpdatesByCriteria(criteria,
- new
AsyncCallback<PageList<GroupResourceConfigurationUpdate>>() {
-
- @Override
- public void
onSuccess(PageList<GroupResourceConfigurationUpdate> result) {
- response.setData(buildRecords(result));
- response.setTotalRows(result.getTotalSize());
- processResponse(request.getRequestId(), response);
- }
-
- @Override
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.view_group_resConfig_table_failFetch(),
caught);
- response.setStatus(DSResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
- });
- }
-
- @Override
- protected GroupResourceConfigurationUpdateCriteria getFetchCriteria(final
DSRequest request) {
- GroupResourceConfigurationUpdateCriteria criteria = new
GroupResourceConfigurationUpdateCriteria();
- ArrayList<Integer> groupList = new ArrayList<Integer>(1);
- groupList.add(HistoryGroupResourceConfigurationTable.this.group.getId());
- criteria.addFilterResourceGroupIds(groupList);
- return criteria;
- }
- }
}
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index fd78426..0e5dadc 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -109,6 +109,7 @@ common_title_configuration = Configuration
common_title_compatibleGroups = Compatible Groups
common_title_compatibleGroups_total = Compatible Group Total
common_title_component_errors = Component Errors
+common_title_config_update_status = Update Status
common_title_count = Count
common_title_custom = Custom
common_title_dashboard_name = Dashboard Name
@@ -146,6 +147,7 @@ common_title_mixedGroups_total = Mixed Group Total
common_title_name = Name
common_title_new_dashboard = New Dashboard
common_title_numeric_type = Numeric Type
+common_title_operation_status = Operation Status
common_title_operations = Operations
common_title_operations_range = Operation Range
common_title_over = Over
@@ -177,6 +179,8 @@ common_title_resource_inventory = Resource Inventory
common_title_resource_id = Resource ID
common_title_resource_name = Resource Name
common_title_resource_type = Resource Type
+common_title_results_count = Results Count
+common_title_results_count_tooltip = Displays this number of results
common_title_role = Role
common_title_roles = Roles
common_title_search = Search
@@ -189,6 +193,8 @@ common_title_service_total = Service Total
common_title_settings = Settings
common_title_show = Show
common_title_show_more = Show more...
+common_title_sort_order = Sort Order
+common_title_sort_order_tooltip = Sets sort order for results.
common_title_start = Start
common_title_status = Status
common_title_stop= Stop
@@ -230,12 +236,14 @@ common_val_na = N/A
common_val_none = None
# Common Statuses
-common_status_success = Success
+common_status_canceled = Canceled
+common_status_deferred = Deferred
common_status_failed = Failed
common_status_inprogress = In Progress
-common_status_canceled = Canceled
+common_status_nochange = No Change
+common_status_success = Success
common_status_unknown = Unknown
-common_status_deferred = Deferred
+
common_status_partial = Partial
# 1st, 2nd, 3rd, 4th, etc.
@@ -1468,6 +1476,7 @@ view_portlet_defaultName_tagCloud = Tag Count
view_portlet_defaultName_group_alerts =Group: Alerts
view_portlet_defaultName_group_bundles = Group: Bundle Deployments
+view_portlet_defaultName_group_config_updates = Group: Configuration Updates
view_portlet_defaultName_group_events = Group: Event Counts
view_portlet_defaultName_group_metrics = Group: Metrics
view_portlet_defaultName_group_oobs = Group: OOB Conditions
@@ -1475,6 +1484,7 @@ view_portlet_defaultName_group_operations = Group: Operations
view_portlet_defaultName_group_pkg_hisory = Group: Package History
view_portlet_defaultName_resource_alerts = Resource: Alerts
view_portlet_defaultName_resource_bundles = Resource: Bundle Deployments
+view_portlet_defaultName_resource_config_updates = Resource: Configuration Updates
view_portlet_defaultName_resource_events = Resource: Event Counts
view_portlet_defaultName_resource_metrics = Resource: Measurements
view_portlet_defaultName_resource_oobs = Resource: OOB Metrics
@@ -1483,6 +1493,7 @@ view_portlet_defaultName_resource_pkg_hisory = Resource: Package
History
view_portlet_help_autodiscovery = This portlet allows import or ignore of newly
discovered resources. Imported resources are added to inventory for monitoring and
management. Ignored resources are not imported and are hidden from view unless explicitly
unignored.
view_portlet_help_bundle_deps = This portlet shows relevant bundle deployments based on
display criteria configured.
+view_portlet_help_config_updates =This portlet displays recent configuration changes
consistent with configuration settings.
view_portlet_help_eventcounts = This portlet displays Event counts consistent with
display criteria configured.
view_portlet_help_favoriteResources = This portlet displays the current user''s
favorite resources.
view_portlet_help_graph = This portlet displays the resource metric graph.
commit 12cdec5fb2943458bc5b4bcfd4ab6f2c9c3718c3
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Mar 31 11:40:18 2011 -0400
remove redundant header for recentAlerts, trim space around operations portlet
widget.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
index 9a9a124..2ef5bd8 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
@@ -198,8 +198,6 @@ public class GroupOperationsPortlet extends LocatableVLayout
implements CustomSe
/**Defines layout for the portlet page.
*/
protected void initializeUi() {
- setPadding(5);
- setMembersMargin(5);
setHeight("*");
setWidth100();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
index 763ed79..93fd686 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
@@ -67,6 +67,7 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
setShowFilterForm(false); //disable filter form for portlet
setOverflow(Overflow.VISIBLE);
setShowFooterRefresh(false); //disable footer refresh button as redundant for
portlets
+ setShowHeader(false);//disable header for portlets
}
public Timer getRefreshTimer() {
commit 1ae7fb4e0b0221b83d3173417a384c48dec5ef89
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Apr 1 20:06:12 2011 -0400
Global Dash/Portlet work
- eliminate title from RecentAlertsPortlet. Was redundant with
window title and cost real estate.
- Fix issues with honoring max rows in ProblemResourcesPortlet and
OperationsPortlet
- Change default max-rows config for several portlets to speed up
default dash:
- max recent alerts to 5
- max recent ops to 5
- max scheduled ops to 5
- max problem resources to 20
- set sort for problem resources to alertCount,name (was just name)
- Changes to Default Dash for perf and monitoring focus
- Eliminate Discovery Queue from default dash. Relatively slow, not useful
for non-perm users, easily navigable to in Inventory
- Eliminate Recently imported from default dash. Not very useful and rarely
changing.
- Move Welcome to Left column. Did not need space and gives priority to
monitoring portlets. (When deleted it will put Inventory Summary at top
of Left Column)
- Move RHQ News Mashup to Left column to deprioritize and use less real estate
- resize a few portlets/row sizes for better presentation and space utilization
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
index 2746c41..0a64610 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
@@ -84,6 +84,10 @@ public class AlertHistoryView extends
TableSection<AlertDataSource> {
this(locatorId, SUBSYSTEM_VIEW_ID.getTitle(), entityContext, false);
}
+ public AlertHistoryView(String locatorId, String tableTitle, EntityContext
entityContext) {
+ this(locatorId, tableTitle, entityContext, false);
+ }
+
protected AlertHistoryView(String locatorId, String tableTitle, EntityContext
context, boolean hasWriteAccess) {
super(locatorId, tableTitle, new SortSpecifier[] { DEFAULT_SORT_SPECIFIER });
this.context = context;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
index f3d1c69..95780fd 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
@@ -61,13 +61,10 @@ import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.tab.NamedTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.NamedTabSet;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
-import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.RecentAlertsPortlet;
-import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.imported.RecentlyAddedResourcesPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.operations.OperationsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.problems.ProblemResourcesPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.InventorySummaryPortlet;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.TagCloudPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MashupPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
@@ -294,6 +291,66 @@ public class DashboardsView extends LocatableVLayout implements
DashboardContain
return dashboardName;
}
+ /*
+ protected Dashboard getDefaultDashboard() {
+
+ Dashboard dashboard = new Dashboard();
+ dashboard.setName(MSG.common_title_default());
+ dashboard.setCategory(DashboardCategory.INVENTORY);
+ dashboard.setColumns(2);
+ // only leftmost column width is currently settable, the rest are equally
divided
+ dashboard.setColumnWidths("32%");
+ dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND,
"#F1F2F3"));
+
+ // Left Column
+ DashboardPortlet summary = new DashboardPortlet(InventorySummaryPortlet.NAME,
InventorySummaryPortlet.KEY, 210);
+ dashboard.addPortlet(summary, 0, 0);
+
+ DashboardPortlet discoveryQueue = new
DashboardPortlet(AutodiscoveryPortlet.NAME, AutodiscoveryPortlet.KEY, 230);
+ dashboard.addPortlet(discoveryQueue, 0, 1);
+
+ DashboardPortlet recentlyAdded = new
DashboardPortlet(RecentlyAddedResourcesPortlet.NAME,
+ RecentlyAddedResourcesPortlet.KEY, 230);
+ dashboard.addPortlet(recentlyAdded, 0, 2);
+
+ DashboardPortlet tagCloud = new DashboardPortlet(TagCloudPortlet.NAME,
TagCloudPortlet.KEY, 230);
+ dashboard.addPortlet(tagCloud, 0, 3);
+
+ // Right Column
+ DashboardPortlet welcome = new DashboardPortlet(MessagePortlet.NAME,
MessagePortlet.KEY, 210);
+ welcome.getConfiguration().put(
+ new PropertySimple("message",
MSG.view_dashboardsManager_message_title_details()));
+ dashboard.addPortlet(welcome, 1, 0);
+
+ DashboardPortlet recentAlerts = new
DashboardPortlet(RecentAlertsPortlet.NAME, RecentAlertsPortlet.KEY, 230);
+ dashboard.addPortlet(recentAlerts, 1, 1);
+
+ DashboardPortlet problemResources = new
DashboardPortlet(ProblemResourcesPortlet.NAME,
+ ProblemResourcesPortlet.KEY, 230);
+ //initialize config for the problemResources portlet.
+ problemResources.getConfiguration()
+ .put(
+ new
PropertySimple(ProblemResourcesPortlet.PROBLEM_RESOURCE_SHOW_MAX,
+ ProblemResourcesPortlet.defaultValue));
+ problemResources.getConfiguration()
+ .put(
+ new
PropertySimple(ProblemResourcesPortlet.PROBLEM_RESOURCE_SHOW_HRS,
+ ProblemResourcesPortlet.defaultValue));
+ dashboard.addPortlet(problemResources, 1, 2);
+
+ DashboardPortlet operations = new DashboardPortlet(OperationsPortlet.NAME,
OperationsPortlet.KEY, 420);
+ dashboard.addPortlet(operations, 1, 3);
+
+ DashboardPortlet news = new DashboardPortlet(MashupPortlet.NAME,
MashupPortlet.KEY, 350);
+ news.getConfiguration().put(
+ new PropertySimple("address",
"http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
+ dashboard.addPortlet(news, 1, 4);
+
+ return dashboard;
+
+ }
+ */
+
protected Dashboard getDefaultDashboard() {
Dashboard dashboard = new Dashboard();
@@ -305,30 +362,25 @@ public class DashboardsView extends LocatableVLayout implements
DashboardContain
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND,
"#F1F2F3"));
// Left Column
- DashboardPortlet summary = new DashboardPortlet(InventorySummaryPortlet.NAME,
InventorySummaryPortlet.KEY, 210);
- dashboard.addPortlet(summary, 0, 0);
-
- DashboardPortlet discoveryQueue = new DashboardPortlet(AutodiscoveryPortlet.NAME,
AutodiscoveryPortlet.KEY, 230);
- dashboard.addPortlet(discoveryQueue, 0, 1);
+ DashboardPortlet welcome = new DashboardPortlet(MessagePortlet.NAME,
MessagePortlet.KEY, 250);
+ welcome.getConfiguration().put(
+ new PropertySimple("message",
MSG.view_dashboardsManager_message_title_details()));
+ dashboard.addPortlet(welcome, 0, 0);
- DashboardPortlet recentlyAdded = new
DashboardPortlet(RecentlyAddedResourcesPortlet.NAME,
- RecentlyAddedResourcesPortlet.KEY, 230);
- dashboard.addPortlet(recentlyAdded, 0, 2);
+ DashboardPortlet summary = new DashboardPortlet(InventorySummaryPortlet.NAME,
InventorySummaryPortlet.KEY, 250);
+ dashboard.addPortlet(summary, 0, 1);
- DashboardPortlet tagCloud = new DashboardPortlet(TagCloudPortlet.NAME,
TagCloudPortlet.KEY, 230);
- dashboard.addPortlet(tagCloud, 0, 3);
+ DashboardPortlet news = new DashboardPortlet(MashupPortlet.NAME,
MashupPortlet.KEY, 300);
+ news.getConfiguration().put(
+ new PropertySimple("address",
"http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
+ dashboard.addPortlet(news, 0, 2);
// Right Column
- DashboardPortlet welcome = new DashboardPortlet(MessagePortlet.NAME,
MessagePortlet.KEY, 210);
- welcome.getConfiguration().put(
- new PropertySimple("message",
MSG.view_dashboardsManager_message_title_details()));
- dashboard.addPortlet(welcome, 1, 0);
-
- DashboardPortlet recentAlerts = new DashboardPortlet(RecentAlertsPortlet.NAME,
RecentAlertsPortlet.KEY, 230);
- dashboard.addPortlet(recentAlerts, 1, 1);
+ DashboardPortlet recentAlerts = new DashboardPortlet(RecentAlertsPortlet.NAME,
RecentAlertsPortlet.KEY, 250);
+ dashboard.addPortlet(recentAlerts, 1, 0);
DashboardPortlet problemResources = new
DashboardPortlet(ProblemResourcesPortlet.NAME,
- ProblemResourcesPortlet.KEY, 230);
+ ProblemResourcesPortlet.KEY, 250);
//initialize config for the problemResources portlet.
problemResources.getConfiguration()
.put(
@@ -338,18 +390,17 @@ public class DashboardsView extends LocatableVLayout implements
DashboardContain
.put(
new PropertySimple(ProblemResourcesPortlet.PROBLEM_RESOURCE_SHOW_HRS,
ProblemResourcesPortlet.defaultValue));
- dashboard.addPortlet(problemResources, 1, 2);
+ dashboard.addPortlet(problemResources, 1, 1);
- DashboardPortlet operations = new DashboardPortlet(OperationsPortlet.NAME,
OperationsPortlet.KEY, 420);
- dashboard.addPortlet(operations, 1, 3);
-
- DashboardPortlet news = new DashboardPortlet(MashupPortlet.NAME,
MashupPortlet.KEY, 350);
- news.getConfiguration().put(
- new PropertySimple("address",
"http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
- dashboard.addPortlet(news, 1, 4);
+ DashboardPortlet operations = new DashboardPortlet(OperationsPortlet.NAME,
OperationsPortlet.KEY, 350);
+ //initialize config for the operations portlet.
+ operations.getConfiguration().put(
+ new PropertySimple(OperationsPortlet.OPERATIONS_RANGE_COMPLETED,
OperationsPortlet.defaultValue));
+ operations.getConfiguration().put(
+ new PropertySimple(OperationsPortlet.OPERATIONS_RANGE_SCHEDULED,
OperationsPortlet.defaultValue));
+ dashboard.addPortlet(operations, 1, 2);
return dashboard;
-
}
public void addNewDashboard() {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
index 388094a..763ed79 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
@@ -62,7 +62,7 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
private Timer refreshTimer;
public AbstractRecentAlertsPortlet(String locatorId, EntityContext entityContext) {
- super(locatorId, entityContext);
+ super(locatorId, null, entityContext);
setShowFilterForm(false); //disable filter form for portlet
setOverflow(Overflow.VISIBLE);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
index dad4578..0b02c38 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
@@ -98,7 +98,7 @@ public class OperationsPortlet extends LocatableVLayout implements
CustomSetting
private RecentOperationsDataSource dataSourceCompleted;
private ScheduledOperationsDataSource dataSourceScheduled;
public static String unlimited = MSG.common_label_unlimited();
- public static String defaultValue = unlimited;
+ public static String defaultValue = "5";
public static boolean defaultEnabled = true;
private Timer refreshTimer;
@@ -133,8 +133,7 @@ public class OperationsPortlet extends LocatableVLayout implements
CustomSetting
recentOperationsGrid.setHeaderSpans(new HeaderSpan(RECENT_OPERATIONS,
completedRows));
recentOperationsGrid.setHeaderSpanHeight(20);
recentOperationsGrid.setHeaderHeight(40);
- recentOperationsGrid.setResizeFieldsInRealTime(true);
- recentOperationsGrid.setCellHeight(50);
+ //recentOperationsGrid.setResizeFieldsInRealTime(true);
recentOperationsGrid.setWrapCells(true);
addMember(recentOperationsGrid);
@@ -154,8 +153,7 @@ public class OperationsPortlet extends LocatableVLayout implements
CustomSetting
scheduledOperationsGrid.setHeaderHeight(40);
scheduledOperationsGrid.setTitle(SCHEDULED_OPERATIONS);
- scheduledOperationsGrid.setResizeFieldsInRealTime(true);
- scheduledOperationsGrid.setCellHeight(50);
+ //scheduledOperationsGrid.setResizeFieldsInRealTime(true);
scheduledOperationsGrid.setWrapCells(true);
addMember(scheduledOperationsGrid);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
index f91c4cf..7eac876 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
@@ -92,7 +92,7 @@ public class ProblemResourcesPortlet extends
Table<ProblemResourcesDataSource> i
//constants
public static final String unlimited = MSG.common_label_unlimited();
- public static final String defaultValue = unlimited;
+ public static final String defaultValue = "20";
private Timer refreshTimer;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
index cf93986..1af0364 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
@@ -219,7 +219,15 @@ public class RecentOperationsDataSource extends
RPCDataSource<ResourceOperationL
record.setAttribute(AncestryUtil.RESOURCE_ANCESTRY_VALUE,
AncestryUtil.getAncestryValue(record));
}
response.setData(records);
- response.setTotalRows(result.getTotalSize()); // for paging to work we
have to specify size of full result set
+
+ // for paging to work we have to specify size of full result set, but if
a limit has been set,
+ // respect the limit
+ int resultSize = result.getTotalSize();
+ int limit = getOperationsRangeCompleted();
+ if (limit > 0 && limit < resultSize) {
+ resultSize = limit;
+ }
+ response.setTotalRows(resultSize);
processResponse(request.getRequestId(), response);
}
});
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
index ac4318a..3926fc5 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
@@ -131,7 +131,8 @@ public class ProblemResourcesDataSource extends
RPCDataSource<ProblemResourceCom
@Override
protected Criteria getFetchCriteria(DSRequest request) {
- // we don't use criterias for this datasource, just return null
+ // we don't use criteria fetch for this datasource, just return null
+
return null;
}
@@ -207,7 +208,13 @@ public class ProblemResourcesDataSource extends
RPCDataSource<ProblemResourceCom
record.setAttribute(AncestryUtil.RESOURCE_ANCESTRY_VALUE,
AncestryUtil.getAncestryValue(record));
}
response.setData(records);
- response.setTotalRows(result.getTotalSize()); // for paging to work we
have to specify size of full result set
+ // for paging to work we have to specify size of full result set, but if
a limit has been set,
+ // respect the limit
+ int resultSize = result.getTotalSize();
+ if (maximumProblemResourcesToDisplay > 0 &&
maximumProblemResourcesToDisplay < resultSize) {
+ resultSize = maximumProblemResourcesToDisplay;
+ }
+ response.setTotalRows(resultSize);
processResponse(request.getRequestId(), response);
}
});
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementProblemManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementProblemManagerBean.java
index 8d9bd4c..d398141 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementProblemManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementProblemManagerBean.java
@@ -34,6 +34,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
import org.rhq.core.server.PersistenceUtility;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
@@ -54,7 +55,8 @@ public class MeasurementProblemManagerBean implements
MeasurementProblemManagerL
@SuppressWarnings("unchecked")
public PageList<ProblemResourceComposite> findProblemResources(Subject subject,
long oldestDate, PageControl pc) {
- pc.initDefaultOrderingField("res.name");
+ pc.initDefaultOrderingField("COUNT(DISTINCT alert.id)",
PageOrdering.DESC);
+ pc.addDefaultOrderingField("res.name");
Query queryCount;
Query query;
commit 2ba64f818ae263bec15d3b76e3aebd9ead8ce823
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 1 16:24:00 2011 -0400
BZ 691504
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventContentJSON.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventContentJSON.jsp
index 61a7505..673d08e 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventContentJSON.jsp
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventContentJSON.jsp
@@ -62,8 +62,8 @@
String icon = "/images/icons/Content_" + extra +
"16.png";
- String link =
"/rhq/resource/content/installed_package_details.xhtml?id=" + resourceId +
- "¤tPackageId=" + installedPackage.getId();
+ String link = "#Resource/" + resourceId +
"/Content/Deployed";
+ // "/rhq/resource/content/installed_package_details.xhtml?id=" +
resourceId + "¤tPackageId=" + installedPackage.getId();
%>
{ "start" : "<%=sdf.format(new
Date(installedPackage.getTimestamp()))%>",
commit 78ac4ad74b991ed8f6b1a90df7cc31cba05e9620
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 1 16:12:58 2011 -0400
BZ 691504 - timeline now links to the new GWT UI where appropriate
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
index 173fe16..f4b9194 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
@@ -62,7 +62,7 @@
buf.append("<b>Value:</b>" + log.getValue() +
"</b>");
}
- String link = "/alerts/Alerts.do?mode=viewAlert&id=" +
resourceId + "&a=" + alert.getId();
+ String link = "/coregui/CoreGUI.html#Resource/" + resourceId +
"/Alerts/History/" + alert.getId();
%>
{ "start" : "<%=sdf.format(new Date(alert.getCtime()))%>",
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventConfigJSON.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventConfigJSON.jsp
index 6bb34c4..34baadf 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventConfigJSON.jsp
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventConfigJSON.jsp
@@ -43,7 +43,7 @@
String icon =
FunctionTagLibrary.getResourceConfigStatusURL(configUpdate.getStatus());
- String link = "/rhq/resource/configuration/history.xhtml?id=" +
resourceId + "&configId=" + configUpdate.getId();
+ String link = "/coregui/CoreGUI.html#Resource/" + resourceId +
"/Configuration/History/" + configUpdate.getId();
%>
{ "start" : "<%=sdf.format(configUpdate.getCreatedTime())%>",
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp
index 46f3480..463984e 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp
@@ -58,7 +58,7 @@
icon = "/images/icn_create_child.png"; // TODO
}
- String link = "/rhq/resource/inventory/view.xhtml?id=" + resourceId
;
+ String link = "/coregui/CoreGUI.html#Resource/" + resourceId ;
%>
@@ -95,7 +95,7 @@
icon = "/images/icn_delete_child.png"; // TODO
}
- String link = "/rhq/resource/inventory/view.xhtml?id=" + resourceId
;
+ String link = "/coregui/CoreGUI.html#Resource/" + resourceId ;
%>
{ "start" : "<%=sdf.format(entry.getCreatedTime())%>",
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventEventsJSON.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventEventsJSON.jsp
index 5b4320e..bb6ced8 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventEventsJSON.jsp
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventEventsJSON.jsp
@@ -157,13 +157,13 @@
String color = eventColor(event.getSeverity());
String icon = FunctionTagLibrary.getEventSeverityURL(event.getSeverity(),
grouped);
- String link = "/rhq/resource/events/history.xhtml?id=" + resourceId
+ "&eventId=" + event.getEventId();
+ String link = "/coregui/CoreGUI.html#Resource/" + resourceId +
"/Events/History/" + event.getEventId();
String detail = null;
if (grouped) {
StringBuilder buf = new StringBuilder();
for (EventComposite childEvent : ((GroupedEventComposite)event).events)
{
- buf.append("<a
href='/rhq/resource/events/history.xhtml?id=" + resourceId +
"&eventId=" + childEvent.getEventId() + "'>");
+ buf.append("<a
href='/coregui/CoreGUI.html#Resource/" + resourceId +
"/Events/History/" + childEvent.getEventId() + "'>");
buf.append("<font size=\"-1\" color=\"" +
color + "\">" +
escapeBackslashes(trimLength(childEvent.getEventDetail(),80)) +
"</font></a><br />");
}
detail = buf.toString();
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventOperationsJSON.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventOperationsJSON.jsp
index 0846050..5e28985 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventOperationsJSON.jsp
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventOperationsJSON.jsp
@@ -45,7 +45,7 @@
String icon =
FunctionTagLibrary.getOperationStatusURL(operation.getStatus());
- String link =
"/rhq/resource/operation/resourceOperationHistoryDetails.xhtml?id=" + resourceId
+ "&opId=" + operation.getId();
+ String link = "/coregui/CoreGUI.html#Resource/" + resourceId +
"/Operations/History/" + operation.getId();
// out.write(
// " <event start=\"" + sdf.format(new
Date(operation.getCreatedTime())) + "\" " +
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventPluginConfigJSON.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventPluginConfigJSON.jsp
index 06ff3aa..ed75a07 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventPluginConfigJSON.jsp
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventPluginConfigJSON.jsp
@@ -53,7 +53,7 @@
break;
}
- String link = "/rhq/resource/inventory/history.xhtml?id=" +
resourceId + "&configId=" + configUpdate.getId();
+ String link = "/coregui/CoreGUI.html#Resource/" + resourceId +
"/Inventory/PluginConfigurationHistoryView/" + configUpdate.getId();
%>
commit c30433b4d14efbeda2594b1f4a51ff74715793f8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 1 16:12:13 2011 -0400
make the timestamp col a link to the details
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
index 65ebb57..8456f2b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
@@ -50,6 +50,7 @@ import
org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellForma
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* @author Joseph Marques
@@ -177,6 +178,20 @@ public class EventCompositeHistoryView extends
TableSection<EventCompositeDataso
super.configureTable();
}
+ protected String getDetailsLinkColumnName() {
+ return "timestamp";
+ }
+
+ protected CellFormatter getDetailsLinkColumnCellFormatter() {
+ return new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int rowNum, int
colNum) {
+ Integer recordId = getId(record);
+ String detailsUrl = "#" + getBasePath() + "/" +
recordId;
+ return SeleniumUtility.getLocatableHref(detailsUrl,
TimestampCellFormatter.format(value), null);
+ }
+ };
+ }
+
private void setupTableInteractions() {
TableActionEnablement singleTargetEnablement = hasWriteAccess ?
TableActionEnablement.ANY
: TableActionEnablement.NEVER;
commit 24280444ac3904c3fe4e1d6a25334ff89d42ccfe
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Apr 1 15:45:33 2011 -0400
fix NPE that occurred when you edited an existing list-o-maps member map and then
clicked the member map editor modal's OK button
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 4d4e358..69a3c52 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -952,8 +952,8 @@ public class ConfigurationEditor extends LocatableVLayout {
PropertyMapListGridRecord record = (PropertyMapListGridRecord)
recordClickEvent.getRecord();
PropertyMap memberPropertyMap = (PropertyMap) record.getPropertyMap();
Log.debug("Editing property map: " + memberPropertyMap);
- displayMapEditor(summaryTable, record, memberPropertyDefinitionMap,
propertyList, memberPropertyMap,
- mapReadOnly);
+ displayMapEditor(summaryTable, record, propertyDefinitionList,
propertyList,
+ memberPropertyDefinitionMap, memberPropertyMap, mapReadOnly);
}
});
fieldsList.add(editField);
@@ -1005,8 +1005,8 @@ public class ConfigurationEditor extends LocatableVLayout {
addRowButton.setIcon(Window.getImgURL("[SKIN]/actions/add.png"));
addRowButton.addClickHandler(new
com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- displayMapEditor(summaryTable, null, memberPropertyDefinitionMap,
- propertyList, null, mapReadOnly);
+ displayMapEditor(summaryTable, null, propertyDefinitionList,
propertyList,
+ memberPropertyDefinitionMap, null, mapReadOnly);
}
});
toolStrip.addMember(addRowButton);
@@ -1538,15 +1538,15 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private void displayMapEditor(final ListGrid summaryTable, final
PropertyMapListGridRecord existingRecord,
- PropertyDefinitionMap definition, final PropertyList
list, final PropertyMap map,
+ final PropertyDefinitionList propertyDefinitionList,
final PropertyList propertyList, PropertyDefinitionMap memberMapDefinition, final
PropertyMap memberMap,
final boolean mapReadOnly) {
- final List<PropertyDefinition> memberDefinitions = new
ArrayList<PropertyDefinition>(definition
+ final List<PropertyDefinition> memberDefinitions = new
ArrayList<PropertyDefinition>(memberMapDefinition
.getPropertyDefinitions().values());
Collections.sort(memberDefinitions, new PropertyDefinitionComparator());
- final boolean newRow = (map == null);
- final PropertyMap workingMap = (newRow) ? new PropertyMap(definition.getName()) :
map.deepCopy(true);
+ final boolean newRow = (memberMap == null);
+ final PropertyMap workingMap = (newRow) ? new
PropertyMap(memberMapDefinition.getName()) : memberMap.deepCopy(true);
final LocatableWindow popup = new
LocatableWindow(extendLocatorId("MapEditor"));
String title = (mapReadOnly) ? MSG.view_configEdit_viewRow() :
MSG.view_configEdit_editRow();
@@ -1582,25 +1582,17 @@ public class ConfigurationEditor extends LocatableVLayout {
return;
}
if (newRow) {
- try {
- list.add(workingMap);
- int index = list.getList().size() - 1;
- PropertyMapListGridRecord record = new
PropertyMapListGridRecord(workingMap, index,
- memberDefinitions);
- summaryTable.addData(record);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ propertyList.add(workingMap);
+ int index = propertyList.getList().size() - 1;
+ PropertyMapListGridRecord record = new
PropertyMapListGridRecord(workingMap, index,
+ memberDefinitions);
+ summaryTable.addData(record);
} else {
- try {
- mergePropertyMap(workingMap, map, memberDefinitions);
- existingRecord.refresh();
- summaryTable.updateData(existingRecord);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ mergePropertyMap(workingMap, memberMap, memberDefinitions);
+ existingRecord.refresh();
+ summaryTable.updateData(existingRecord);
}
- firePropertyChangedEvent(list, null, true);
+ firePropertyChangedEvent(propertyList, propertyDefinitionList,
true);
summaryTable.redraw();
}
commit 836344458731d5d3e20032589875775a5fef1910
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 1 15:37:20 2011 -0400
format date col
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
index 40a342f..831408a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
@@ -36,6 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -114,7 +115,8 @@ public class EventCompositeDetailsView extends LocatableVLayout
implements Bookm
source.setValue(composite.getSourceLocation());
StaticTextItem timestamp = new StaticTextItem("timestamp",
MSG.view_inventory_eventHistory_timestamp());
- timestamp.setValue(composite.getTimestamp());
+ timestamp.setValue(TimestampCellFormatter.format(composite.getTimestamp(),
+ TimestampCellFormatter.DATE_TIME_FORMAT_FULL));
TextAreaItem detail = new TextAreaItem("details",
MSG.view_inventory_eventHistory_details());
detail.setValue(composite.getEventDetail());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
index 0657f04..65ebb57 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
@@ -46,6 +46,7 @@ import
org.rhq.enterprise.gui.coregui.client.components.form.EnumSelectItem;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
@@ -101,6 +102,7 @@ public class EventCompositeHistoryView extends
TableSection<EventCompositeDataso
@Override
protected void configureTable() {
ListGridField timestampField = new ListGridField("timestamp",
MSG.view_inventory_eventHistory_timestamp());
+ TimestampCellFormatter.prepareDateField(timestampField);
ListGridField severityField = new ListGridField("severity",
MSG.view_inventory_eventHistory_severity());
severityField.setAlign(Alignment.CENTER);
commit 4efc5ad73f2a0c2c942174e56c42b87c76deb5eb
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Apr 1 15:14:08 2011 -0400
fix bug in config editor that was causing inputs for optional props to get disabled
upon that input losing focus
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 35d61f2..4d4e358 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -1434,9 +1434,10 @@ public class ConfigurationEditor extends LocatableVLayout {
valueItem.addBlurHandler(new BlurHandler() {
public void onBlur(BlurEvent event) {
- boolean isUnset = (event.getItem().getValue() == null);
- unsetItem.setValue(isUnset);
- valueItem.disable();
+ if (event.getItem().getValue() == null) {
+ unsetItem.setValue(true);
+ valueItem.disable();
+ }
}
});
commit 6fba3dbee8ced1cfd281d1edb27c973dec557ff3
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 1 14:13:28 2011 -0400
BZ 689561 - have config description say that the units are in seconds
diff --git a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
index bf48dcd..b6169f0 100644
--- a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
@@ -350,23 +350,23 @@
<c:group name="plugincontainer" displayName="Plugin
Container" hiddenByDefault="false">
<c:description>Plugin Container configuration
properties</c:description>
<c:simple-property name="rhq.agent.plugins.directory"
type="string" activationPolicy="restart" required="true"
default="plugins" displayName="Plugins Directory"
description="Location on the file system where the plugin jar files are
stored"/>
- <c:simple-property
name="rhq.agent.plugins.server-discovery.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="10" displayName="Server Discovery
Initial Delay" description="Startup delay before the first server discovery is
run" />
- <c:simple-property
name="rhq.agent.plugins.server-discovery.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="900" displayName="Server Discovery Period"
description="Time between server discoveries" />
- <c:simple-property
name="rhq.agent.plugins.service-discovery.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="20" displayName="Service Discovery
Initial Delay" description="Startup delay before the first service discovery is
run" />
- <c:simple-property
name="rhq.agent.plugins.service-discovery.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="86400" displayName="Service Discovery Period"
description="Time between service discoveries" />
- <c:simple-property
name="rhq.agent.plugins.availability-scan.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="30" displayName="Availability Scan
Initial Delay" description="Startup delay before the first availability scan is
run" />
- <c:simple-property
name="rhq.agent.plugins.availability-scan.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="300" displayName="Availability Scan Period"
description="Time between availability scans" />
- <c:simple-property
name="rhq.agent.plugins.measurement-collection.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="30" displayName="Measurement Collection
Initial Delay" description="Startup delay before the first measurement
collection is run" />
+ <c:simple-property
name="rhq.agent.plugins.server-discovery.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="10" displayName="Server Discovery
Initial Delay" description="Startup delay before the first server discovery is
run (in seconds)" />
+ <c:simple-property
name="rhq.agent.plugins.server-discovery.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="900" displayName="Server Discovery Period"
description="Time between server discoveries (in seconds)" />
+ <c:simple-property
name="rhq.agent.plugins.service-discovery.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="20" displayName="Service Discovery
Initial Delay" description="Startup delay before the first service discovery is
run (in seconds)" />
+ <c:simple-property
name="rhq.agent.plugins.service-discovery.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="86400" displayName="Service Discovery Period"
description="Time between service discoveries (in seconds)" />
+ <c:simple-property
name="rhq.agent.plugins.availability-scan.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="30" displayName="Availability Scan
Initial Delay" description="Startup delay before the first availability scan is
run (in seconds)" />
+ <c:simple-property
name="rhq.agent.plugins.availability-scan.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="300" displayName="Availability Scan Period"
description="Time between availability scans (in seconds)" />
+ <c:simple-property
name="rhq.agent.plugins.measurement-collection.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="30" displayName="Measurement Collection
Initial Delay" description="Startup delay before the first measurement
collection is run (in seconds)" />
<c:simple-property
name="rhq.agent.plugins.measurement-collection.threadpool-size"
type="integer" activationPolicy="restart" required="false"
default="5" displayName="Measurement Collection Threadpool Size"
description="Number of concurrent measurement collections that can be run"
/>
- <c:simple-property
name="rhq.agent.plugins.operation-invocation-timeout-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="600" displayName="Operation Invocation
Timeout" description="Time before an operation invocation is aborted"
/>
+ <c:simple-property
name="rhq.agent.plugins.operation-invocation-timeout-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="600" displayName="Operation Invocation
Timeout" description="Time before an operation invocation is aborted (in
seconds)" />
<c:simple-property
name="rhq.agent.plugins.operation-invoker.threadpool-size"
type="integer" activationPolicy="restart" required="false"
default="5" displayName="Operation Invoker Threadpool Size"
description="Number of concurrent operation invocations that can be run" />
- <c:simple-property
name="rhq.agent.plugins.content-discovery.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="30" displayName="Content Discovery
Initial Delay" description="Startup delay before the first content discovery is
run" />
- <c:simple-property
name="rhq.agent.plugins.content-discovery.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="10" displayName="Content Discovery Period"
description="Time between content discoveries" />
+ <c:simple-property
name="rhq.agent.plugins.content-discovery.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="30" displayName="Content Discovery
Initial Delay" description="Startup delay before the first content discovery is
run (in seconds)" />
+ <c:simple-property
name="rhq.agent.plugins.content-discovery.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="10" displayName="Content Discovery Period"
description="Time between content discoveries (in seconds)" />
<c:simple-property
name="rhq.agent.plugins.content-discovery.threadpool-size"
type="integer" activationPolicy="restart" required="false"
default="10" displayName="Content Discovery Threadpool Size"
description="Number of concurrent content discoveries that can be run" />
- <c:simple-property
name="rhq.agent.plugins.configuration-discovery.initial-delay-secs"
type="integer" activationPolicy="restart" required="false"
default="300" displayName="Configuration Change Detection Startup
Delay" description="Time before configuration change detection starts in
seconds" />
- <c:simple-property
name="rhq.agent.plugins.configuration-discovery.period-secs"
type="integer" activationPolicy="restart" required="false"
default="3600" displayName="Configuration Change Detection Interval"
description="Time period for checking for configuration changes in seconds"
/>
- <c:simple-property
name="rhq.agent.plugins.event-sender.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="30" displayName="Event Sender Initial
Delay" description="Defines the delay before the first event report gets sent to
the server" />
- <c:simple-property
name="rhq.agent.plugins.event-sender.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="30" displayName="Event Sender Period"
description="Defines how often event reports get sent to the server" />
+ <c:simple-property
name="rhq.agent.plugins.configuration-discovery.initial-delay-secs"
type="integer" activationPolicy="restart" required="false"
default="300" displayName="Configuration Change Detection Startup
Delay" description="Time before configuration change detection starts (in
seconds)" />
+ <c:simple-property
name="rhq.agent.plugins.configuration-discovery.period-secs"
type="integer" activationPolicy="restart" required="false"
default="3600" displayName="Configuration Change Detection Interval"
description="Time period for checking for configuration changes (in seconds)"
/>
+ <c:simple-property
name="rhq.agent.plugins.event-sender.initial-delay-secs"
type="integer" units="seconds" activationPolicy="restart"
required="false" default="30" displayName="Event Sender Initial
Delay" description="Defines the delay before the first event report gets sent to
the server (in seconds)" />
+ <c:simple-property
name="rhq.agent.plugins.event-sender.period-secs" type="integer"
units="seconds" activationPolicy="restart" required="false"
default="30" displayName="Event Sender Period"
description="Defines how often event reports get sent to the server (in
seconds)" />
<c:simple-property
name="rhq.agent.plugins.event-report.max-per-source" type="integer"
activationPolicy="restart" required="false" default="200"
displayName="Event Report Max Per Source" description="Defines the maximum
number of events for any given event source that can be placed in a single event report
that is sent up to the server. If this number is larger than the max-total setting, then
this setting is ignored" />
<c:simple-property
name="rhq.agent.plugins.event-report.max-total" type="integer"
activationPolicy="restart" required="false" default="400"
displayName="Event Report Max Total" description="Defines the total maximum
number of events that can be placed in a single event report that is sent up to the
server" />
<c:simple-property name="rhq.agent.plugins.disabled"
type="string" activationPolicy="restart" required="false"
default="" displayName="Disabled Plugins" description="Defines
the plugins that should be disabled and not loaded by the plugin container. This is a
comma-separated list of plugin names." />
commit fac70debb685e058f92ea918522e019d1cf76028
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 1 12:57:55 2011 -0400
make consistent the name for the "platform summary", "cpu and memory
utilization"
portlet and report page. now named "platform utilization"
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
index a58c909..a0171c2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
@@ -61,7 +61,7 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
*/
public class PlatformSummaryPortlet extends LocatableListGrid implements Portlet {
- public static final ViewName VIEW_ID = new
ViewName("CpuAndMemoryUtilization", MSG.view_reports_platforms());
+ public static final ViewName VIEW_ID = new ViewName("PlatformUtilization",
MSG.view_reports_platforms());
// A non-displayed, persisted identifier for the portlet
public static final String KEY = "PlatformSummary";
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 26b3bf0..fd78426 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1460,7 +1460,7 @@ view_portlet_defaultName_inventorySummary = Inventory Summary
view_portlet_defaultName_mashup = Mashup
view_portlet_defaultName_message = Message
view_portlet_defaultName_operations = Operations
-view_portlet_defaultName_platformSummary = Platform Summary
+view_portlet_defaultName_platformSummary = Platform Utilization
view_portlet_defaultName_problemResources = Alerted or Unavailable Resources
view_portlet_defaultName_recentAlerts = Recent Alerts
view_portlet_defaultName_recentlyAddedResources = Recently Added Resources
@@ -1494,7 +1494,7 @@ view_portlet_help_oobs = This portlet displays OOB(Out of Bound)
metric conditio
view_portlet_help_operations = This portlet displays executing, completed and scheduled
operations for the current user''s inventory.
view_portlet_help_operations_criteria = This portlet displays Operations consistent with
display criteria configured.
view_portlet_help_pkg_history = This portlet shows relevant package history based on
display criteria configured.
-view_portlet_help_platformSummary = This portlet displays information about the current
user''s platform resources.
+view_portlet_help_platformSummary = This portlet displays utilization data (such as
current CPU and memory usage) for platform resources that are accessible by the current
user.
view_portlet_help_problemResources = This portlet displays the current user''s
alerted or unavailable resources.
view_portlet_help_recentAlerts = This portlet displays alerts recently fired on the
current user''s viewable inventory.
view_portlet_help_recentlyAdded = This portlet displays resources that have recently been
imported into inventory.
@@ -2016,7 +2016,7 @@ view_groupInventoryMembers_title_updateMembership = Update
Membership
view_reportsTop_title = Reports
view_reportsTop_description = This section provides access to global reports.
-view_reports_platforms = CPU And Memory Utilization
+view_reports_platforms = Platform Utilization
view_reports_subsystems = Subsystems
view_reports_alertDefinitions = Alert Definitions
commit 981d97853714fb8c54e50fc608535c1b0fd27ebf
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Apr 1 12:40:35 2011 -0400
add some more HTML escaping to bundle views (includes fix for
https://bugzilla.redhat.com/show_bug.cgi?id=676768)
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
index c188a42..ca08fdb 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
@@ -46,6 +46,7 @@ import
org.rhq.enterprise.gui.coregui.client.components.upload.TextFileRetriever
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
@@ -231,7 +232,9 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
}
public void onFailure(Throwable caught) {
- wizard.getView().showMessage(caught.getMessage());
+ // Escape it, since it contains the URL, which the user entered.
+ String message = StringUtility.escapeHtml(caught.getMessage());
+ wizard.getView().showMessage(message);
CoreGUI.getErrorHandler().handleError(MSG.view_bundle_createWizard_createFailure(),
caught);
wizard.setBundleVersion(null);
setButtonsDisableMode(false);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index 62bf4ed..e220cfc 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -25,6 +25,7 @@ package org.rhq.enterprise.gui.coregui.client.bundle.deployment;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.AnimationEffect;
@@ -347,9 +348,9 @@ public class BundleDeploymentView extends LocatableVLayout implements
Bookmarkab
resource.setAutoFitWidth(true);
resource.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
resource.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
+ public String format(Object value, ListGridRecord listGridRecord, int i, int
i1) {
return "<a href=\"" +
LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("resourceId"))
- + "\">" + o + "</a>";
+ + "\">" +
StringUtility.escapeHtml(String.valueOf(value)) + "</a>";
}
});
@@ -367,7 +368,7 @@ public class BundleDeploymentView extends LocatableVLayout implements
Bookmarkab
status.setShowValueIconOnly(true);
status.setWidth("*");
- ArrayList<ListGridRecord> records = new ArrayList<ListGridRecord>();
+ List<ListGridRecord> records = new ArrayList<ListGridRecord>();
for (BundleResourceDeployment rd : deployment.getResourceDeployments()) {
ListGridRecord record = new ListGridRecord();
Resource rr = rd.getResource();
commit d4aa795ddb93453c4649ffb7f08b28f08240f5e1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 1 12:16:51 2011 -0400
BZ 691526 - log the error properly when setting favorite fails
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
index d8020f3..6c7d628 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
@@ -316,7 +316,7 @@ public class ResourceGroupTitleBar extends LocatableVLayout {
} else {
m =
MSG.view_titleBar_common_removedFavFailure(ResourceGroupTitleBar.this.group.getName());
}
- CoreGUI.getMessageCenter().notify(new Message(m, Message.Severity.Error));
+ CoreGUI.getErrorHandler().handleError(m, throwable);
// Revert back to our original favorite status, since the server update
failed.
toggleFavoriteLocally();
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index dcdffd9..b3e801c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -356,7 +356,7 @@ public class ResourceTitleBar extends LocatableVLayout {
} else {
msg = MSG.view_titleBar_common_removedFavFailure(resource.getName());
}
- CoreGUI.getMessageCenter().notify(new Message(msg, Message.Severity.Info));
+ CoreGUI.getErrorHandler().handleError(msg, throwable);
// Revert back to our original favorite status, since the server update
failed.
toggleFavoriteLocally();
commit aafb9f840be235a83767c5469038f2ebcef72182
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Apr 1 12:07:12 2011 -0400
more HTML escaping
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
index dfe6bdb..4b85d4f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -16,7 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import java.util.ArrayList;
@@ -163,6 +162,7 @@ public class OverviewForm extends EnhancedDynamicForm {
nameItem.setName("name");
nameItem.setTitle(MSG.view_summaryOverviewForm_field_name());
nameItem.setValue(resource.getName());
+ nameItem.setAttribute(OUTPUT_AS_HTML_ATTRIBUTE, true);
if (nameItem instanceof EditableFormItem) {
EditableFormItem togglableNameItem = (EditableFormItem) nameItem;
togglableNameItem.setValidators(notEmptyOrNullValidator);
@@ -202,6 +202,7 @@ public class OverviewForm extends EnhancedDynamicForm {
descriptionItem.setName("description");
descriptionItem.setTitle(MSG.view_summaryOverviewForm_field_description());
descriptionItem.setValue(resource.getDescription());
+ descriptionItem.setAttribute(OUTPUT_AS_HTML_ATTRIBUTE, true);
if (descriptionItem instanceof EditableFormItem) {
EditableFormItem togglableDescriptionItem = (EditableFormItem)
descriptionItem;
togglableDescriptionItem.setValidators(notNullValidator);
@@ -242,6 +243,7 @@ public class OverviewForm extends EnhancedDynamicForm {
locationItem.setName("location");
locationItem.setTitle(MSG.view_summaryOverviewForm_field_location());
locationItem.setValue(resource.getLocation());
+ locationItem.setAttribute(OUTPUT_AS_HTML_ATTRIBUTE, true);
if (locationItem instanceof EditableFormItem) {
EditableFormItem togglableLocationItem = (EditableFormItem) locationItem;
togglableLocationItem.setValidators(notNullValidator);
commit 4e353c14ab0eb728ee8da5cfa165cb2185ae529d
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Apr 1 11:06:49 2011 -0400
make sure only users w/ group inventory perm can edit group general props
(
https://bugzilla.redhat.com/show_bug.cgi?id=692842); escape HTML resource/group props
when they're displayed as static text
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
index 09c2273..86f87b3 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -20,7 +20,6 @@
* if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
package org.rhq.enterprise.gui.coregui.client.components.form;
import java.util.Date;
@@ -54,11 +53,9 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
* but can be toggled into an "editable" form that allows the user to enter a
different value.
*
* This default implementation provides editing the value within a text field. However,
this class
- * is designed to be extended, thus allowing the subclasses to edit values via
- * checkboxes, radio buttons, etc.
+ * is designed to be extended, thus allowing the subclasses to edit values via
checkboxes, radio buttons, etc.
*
* @author John Mazzitelli
- *
*/
public class EditableFormItem extends CanvasItem {
@@ -103,7 +100,6 @@ public class EditableFormItem extends CanvasItem {
// if we are not in edit-mode, we want to show the edit icon, but only if the
mouse hovers over us
this.innerForm.addMouseOutHandler(new MouseOutHandler() {
- @Override
public void onMouseOut(MouseOutEvent event) {
if (!isEditing()) {
EditableFormItem.this.staticItem.setIcons(blankIcon);
@@ -112,7 +108,6 @@ public class EditableFormItem extends CanvasItem {
}
});
this.innerForm.addMouseOverHandler(new MouseOverHandler() {
- @Override
public void onMouseOver(MouseOverEvent event) {
if (!isEditing() && !isReadOnly()) {
EditableFormItem.this.staticItem.setIcons(editIcon);
@@ -135,12 +130,14 @@ public class EditableFormItem extends CanvasItem {
item.setIconWidth(16);
item.setShowIcons(true);
item.setShowIfCondition(new FormItemIfFunction() {
- @Override
public boolean execute(FormItem item, Object value, DynamicForm form) {
return !isEditing();
}
});
item.setTextBoxStyle("editableText");
+ if (item instanceof StaticTextItem) {
+ ((StaticTextItem)item).setOutputAsHTML(true);
+ }
return item;
}
@@ -156,7 +153,6 @@ public class EditableFormItem extends CanvasItem {
item.setIconWidth(16);
item.setShowIcons(true);
item.setShowIfCondition(new FormItemIfFunction() {
- @Override
public boolean execute(FormItem item, Object value, DynamicForm form) {
return isEditing();
}
@@ -183,6 +179,7 @@ public class EditableFormItem extends CanvasItem {
* @return the form item used to show the static (read-only) value
*/
protected FormItem instantiateStaticFormItem() {
+ @SuppressWarnings({"UnnecessaryLocalVariable"})
StaticTextItem item = new StaticTextItem();
return item;
}
@@ -197,6 +194,7 @@ public class EditableFormItem extends CanvasItem {
* @return the form item used to edit the value
*/
protected FormItem instantiateEditFormItem() {
+ @SuppressWarnings({"UnnecessaryLocalVariable"})
TextItem item = new TextItem();
return item;
}
@@ -206,7 +204,6 @@ public class EditableFormItem extends CanvasItem {
editIcon.setSrc(ImageManager.getEditIcon());
editIcon.setPrompt(MSG.common_button_edit()); // TODO have better message?
editIcon.addFormItemClickHandler(new FormItemClickHandler() {
- @Override
public void onFormItemClick(FormItemIconClickEvent event) {
// should never get here if read-only (the icon is hidden) but just to be
sure, check read-only status again
if (!isReadOnly()) {
@@ -222,7 +219,6 @@ public class EditableFormItem extends CanvasItem {
approveIcon.setSrc(ImageManager.getApproveIcon());
approveIcon.setPrompt(MSG.common_button_ok()); // TODO have better message?
approveIcon.addFormItemClickHandler(new FormItemClickHandler() {
- @Override
public void onFormItemClick(FormItemIconClickEvent event) {
if (EditableFormItem.this.innerForm.validate(false)) {
Object newValue = event.getItem().getValue();
@@ -239,7 +235,6 @@ public class EditableFormItem extends CanvasItem {
cancelIcon.setSrc(ImageManager.getCancelIcon());
cancelIcon.setPrompt(MSG.common_button_cancel()); // TODO have better message?
cancelIcon.addFormItemClickHandler(new FormItemClickHandler() {
- @Override
public void onFormItemClick(FormItemIconClickEvent event) {
switchToStaticMode();
}
@@ -434,4 +429,5 @@ public class EditableFormItem extends CanvasItem {
public static interface ValueEditedHandler {
public void editedValue(Object newValue);
}
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
index fde8d13..9d8eb61 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
@@ -42,6 +42,7 @@ import
org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem.Va
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -76,20 +77,18 @@ public class GeneralProperties extends LocatableVLayout {
List<FormItem> formItems = new ArrayList<FormItem>();
- boolean dynamic = (group.getGroupDefinition() != null);
+ boolean isDynaGroup = (group.getGroupDefinition() != null);
+ boolean hasInventoryPermission =
(this.groupComposite.getResourcePermission().isInventory());
+ boolean isEditable = (!isDynaGroup && hasInventoryPermission);
StringLengthValidator notEmptyOrNullValidator = new StringLengthValidator(1,
null, false);
StringLengthValidator notNullValidator = new StringLengthValidator(null, null,
false);
- final FormItem nameItem = (dynamic) ? new StaticTextItem() : new
EditableFormItem();
- nameItem.setName("name");
- nameItem.setTitle(MSG.common_title_name());
- nameItem.setValue(group.getName());
- if (nameItem instanceof EditableFormItem) {
- final EditableFormItem togglableNameItem = (EditableFormItem) nameItem;
+ final FormItem nameItem;
+ if (isEditable) {
+ final EditableFormItem togglableNameItem = new EditableFormItem();
togglableNameItem.setValidators(notEmptyOrNullValidator);
togglableNameItem.setValueEditedHandler(new ValueEditedHandler() {
- @Override
public void editedValue(Object newValue) {
final String newName = newValue.toString();
final String oldName = group.getName();
@@ -106,7 +105,7 @@ public class GeneralProperties extends LocatableVLayout {
// We failed to update it on the Server, so change back
the ResourceGroup and the form item
// to the original value.
group.setName(oldName);
- nameItem.setValue(oldName);
+ togglableNameItem.setValue(oldName);
}
public void onSuccess(Void result) {
@@ -119,16 +118,28 @@ public class GeneralProperties extends LocatableVLayout {
});
}
});
+ nameItem = togglableNameItem;
+ } else {
+ StaticTextItem staticNameItem = new StaticTextItem();
+ staticNameItem.setOutputAsHTML(true);
+ nameItem = staticNameItem;
}
+
+ nameItem.setName("name");
+ nameItem.setTitle(MSG.common_title_name());
+ nameItem.setValue(group.getName());
+
formItems.add(nameItem);
StaticTextItem typeItem = new StaticTextItem("memberType",
MSG.view_group_summary_memberType());
ResourceType type = group.getResourceType();
if (type != null) {
+ // compatible group
typeItem.setTooltip(MSG.common_title_plugin() + ": " +
type.getPlugin() + "\n<br>"
+ MSG.common_title_type() + ": " + type.getName());
typeItem.setValue(type.getName() + " (" + type.getPlugin() +
")");
} else {
+ // mixed group
typeItem.setValue("<i>" + MSG.view_group_summary_mixed() +
"</i>");
}
formItems.add(typeItem);
@@ -138,15 +149,12 @@ public class GeneralProperties extends LocatableVLayout {
countItem.setValue(memberCount);
formItems.add(countItem);
- final FormItem descriptionItem = (dynamic) ? new StaticTextItem() : new
EditableFormItem();
- descriptionItem.setName("description");
- descriptionItem.setTitle(MSG.common_title_description());
- descriptionItem.setValue(group.getDescription());
- if (descriptionItem instanceof EditableFormItem) {
- final EditableFormItem togglableDescriptionItem = (EditableFormItem)
descriptionItem;
+ final FormItem descriptionItem;
+ String value;
+ if (isEditable) {
+ final EditableFormItem togglableDescriptionItem = new EditableFormItem();
togglableDescriptionItem.setValidators(notNullValidator);
togglableDescriptionItem.setValueEditedHandler(new ValueEditedHandler() {
- @Override
public void editedValue(Object newValue) {
final String newDescription = newValue.toString();
final String oldDescription = group.getDescription();
@@ -162,7 +170,7 @@ public class GeneralProperties extends LocatableVLayout {
// We failed to update it on the Server, so change back
the ResourceGroup and the form item
// to the original value.
group.setDescription(oldDescription);
- descriptionItem.setValue(oldDescription);
+ togglableDescriptionItem.setValue(oldDescription);
}
public void onSuccess(Void result) {
@@ -172,33 +180,46 @@ public class GeneralProperties extends LocatableVLayout {
});
}
});
+ descriptionItem = togglableDescriptionItem;
+ value = group.getDescription();
+ } else {
+ descriptionItem = new StaticTextItem();
+ value = StringUtility.escapeHtml(group.getDescription());
}
+
+ descriptionItem.setName("description");
+ descriptionItem.setTitle(MSG.common_title_description());
+ descriptionItem.setValue(value);
+
formItems.add(descriptionItem);
StaticTextItem dynamicItem = new StaticTextItem("dynamic",
MSG.view_group_summary_dynamic());
- dynamicItem.setValue(dynamic ? MSG.common_val_yes() : MSG.common_val_no());
+ dynamicItem.setValue(isDynaGroup ? MSG.common_val_yes() : MSG.common_val_no());
formItems.add(dynamicItem);
- EditableFormItem recursiveItem = new
CheckboxEditableFormItem("recursive", MSG.view_group_summary_recursive());
- recursiveItem.setValueEditedHandler(new ValueEditedHandler() {
- @Override
- public void editedValue(Object newValue) {
- boolean isRecursive = (newValue != null) ? ((Boolean)
newValue).booleanValue() : false;
- resourceGroupService.setRecursive(group.getId(), isRecursive, new
AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new
Message(MSG.view_group_detail_recursiveChange(group.getName())));
- }
+ FormItem recursiveItem;
+ if (isEditable) {
+ CheckboxEditableFormItem editableRecursiveItem = new
CheckboxEditableFormItem("recursive", MSG.view_group_summary_recursive());
+ editableRecursiveItem.setValueEditedHandler(new ValueEditedHandler() {
+ public void editedValue(Object newValue) {
+ boolean isRecursive = ((newValue != null) &&
(Boolean)newValue);
+ resourceGroupService.setRecursive(group.getId(), isRecursive, new
AsyncCallback<Void>() {
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new
Message(MSG.view_group_detail_recursiveChange(group.getName())));
+ }
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_group_detail_failRecursiveChange(String.valueOf(group.getName())));
- }
- });
- }
- });
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.view_group_detail_failRecursiveChange(String.valueOf(group.getName())));
+ }
+ });
+ }
+ });
+ recursiveItem = editableRecursiveItem;
+ } else {
+ recursiveItem = new StaticTextItem("recursive",
MSG.view_group_summary_recursive());
+ }
recursiveItem.setValue((group.isRecursive()) ? MSG.common_val_yes() :
MSG.common_val_no());
formItems.add(recursiveItem);
@@ -214,20 +235,21 @@ public class GeneralProperties extends LocatableVLayout {
lastModifiedByItem.setValue(group.getModifiedBy());
formItems.add(lastModifiedByItem);
- if (dynamic) {
+ if (isDynaGroup) {
StaticTextItem groupDefinitionItem = new
StaticTextItem("groupDefinition", MSG
.view_group_summary_groupDefinition());
GroupDefinition groupDefinition = group.getGroupDefinition();
String groupDefinitionUrl =
LinkManager.getGroupDefinitionLink(groupDefinition.getId());
+ String groupDefinitionName =
StringUtility.escapeHtml(groupDefinition.getName());
groupDefinitionItem
- .setValue("<a href=\"" + groupDefinitionUrl +
"\">" + groupDefinition.getName() + "</a>");
+ .setValue("<a href=\"" + groupDefinitionUrl +
"\">" + groupDefinitionName + "</a>");
formItems.add(groupDefinitionItem);
}
generalPropsForm.setItems(formItems.toArray(new FormItem[formItems.size()]));
addMember(generalPropsForm);
- if (dynamic) {
+ if (isDynaGroup) {
spacer = new HLayout();
spacer.setHeight(10);
addMember(spacer);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
index 7547339..dfe6bdb 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
@@ -277,8 +277,9 @@ public class OverviewForm extends EnhancedDynamicForm {
// Version
StaticTextItem versionItem = new StaticTextItem("version",
MSG.view_summaryOverviewForm_field_version());
- versionItem.setValue((resource.getVersion() != null) ? resource.getVersion() :
"<i>" + MSG.common_label_none()
- + "</i>");
+ String version = (resource.getVersion() != null) ? resource.getVersion() :
"<i>" + MSG.common_label_none()
+ + "</i>";
+ versionItem.setValue(version);
versionItem.setEndRow(true);
formItems.add(versionItem);
commit ce940eefcecc42c3a4c545dc17010d7773725a6c
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Mar 31 17:28:25 2011 -0400
...
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/StringUtility.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/StringUtility.java
index 0c93099..e14b9db 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/StringUtility.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/StringUtility.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2010-2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -19,6 +19,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.util;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* A collection of utility methods for working with Strings.
*
@@ -27,6 +30,41 @@ package org.rhq.enterprise.gui.coregui.client.util;
public class StringUtility {
/**
+ * Split a string on delimiter boundaries, and place each element into a List.
+ *
+ * @param s String to split up
+ * @param delim Delimiting token, ala StringTokenizer
+ *
+ * @return a List comprised of elements split by the tokenizing
+ */
+ public static List<String> explode(String s, String delim) {
+ List<String> res = new ArrayList<String>();
+ if (s == null)
+ return res;
+
+ String[] tokens = s.split(delim);
+ for (String token : tokens) {
+ res.add(token);
+ }
+
+ return res;
+ }
+
+ // TODO: I18N. The logic here may need to be pluggable for different localizations.
+ public static String pluralize(String singularNoun) {
+ String pluralNoun;
+ if (singularNoun.endsWith("y") &&
!singularNoun.endsWith("ay") && !singularNoun.endsWith("ey")
+ && !singularNoun.endsWith("oy")) {
+ pluralNoun = singularNoun.substring(0, singularNoun.length() - 1) +
"ies";
+ } else if (!singularNoun.endsWith("s")) {
+ pluralNoun = singularNoun + "s";
+ } else {
+ pluralNoun = singularNoun;
+ }
+ return pluralNoun;
+ }
+
+ /**
* Escapes HTML in a string to eliminate cross site scripting (XSS) vulnerabilities.
Note, this impl is designed
* to be highly efficient to minimize the impact on performance.
*
commit 170b9a147fce855f8196a7e13803e5a0e3d2f7bb
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Mar 31 17:25:56 2011 -0400
escape or sanitize HTML in user-controlled text, which could be used for XSS attacks
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
index 58cde04..178acd0 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
@@ -305,11 +305,13 @@ public class RoleEditView extends
AbstractRecordEditor<RolesDataSource> implemen
TextItem nameItem = new TextItem(RolesDataSource.Field.NAME);
nameItem.setShowTitle(true);
+ nameItem.setAttribute(EnhancedDynamicForm.OUTPUT_AS_HTML_ATTRIBUTE, true);
items.add(nameItem);
TextItem descriptionItem = new TextItem(RolesDataSource.Field.DESCRIPTION);
descriptionItem.setShowTitle(true);
descriptionItem.setColSpan(form.getNumCols());
+ descriptionItem.setAttribute(EnhancedDynamicForm.OUTPUT_AS_HTML_ATTRIBUTE,
true);
items.add(descriptionItem);
return items;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 46fa148..6aaf418 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -34,6 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
+import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
@@ -62,6 +63,7 @@ public class RolesView extends TableSection<RolesDataSource>
implements Bookmark
final RolesDataSource datasource = RolesDataSource.getInstance();
setDataSource(datasource);
setHeaderIcon(HEADER_ICON);
+ setEscapeHtmlInDetailsLinkColumn(true);
}
@Override
@@ -108,6 +110,7 @@ public class RolesView extends TableSection<RolesDataSource>
implements Bookmark
fields.add(nameField);
ListGridField descriptionField = new
ListGridField(RolesDataSource.Field.DESCRIPTION);
+ descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());
fields.add(descriptionField);
return fields;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 4ce9950..ba10fef 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -137,6 +137,7 @@ public class UserEditView extends
AbstractRecordEditor<UsersDataSource> {
nameItem = new TextItem(UsersDataSource.Field.NAME);
} else {
nameItem = new StaticTextItem(UsersDataSource.Field.NAME);
+ ((StaticTextItem)nameItem).setOutputAsHTML(true);
}
items.add(nameItem);
@@ -167,20 +168,25 @@ public class UserEditView extends
AbstractRecordEditor<UsersDataSource> {
TextItem firstNameItem = new TextItem(UsersDataSource.Field.FIRST_NAME);
firstNameItem.setShowTitle(true);
+ firstNameItem.setAttribute(EnhancedDynamicForm.OUTPUT_AS_HTML_ATTRIBUTE, true);
items.add(firstNameItem);
TextItem lastNameItem = new TextItem(UsersDataSource.Field.LAST_NAME);
lastNameItem.setShowTitle(true);
+ lastNameItem.setAttribute(EnhancedDynamicForm.OUTPUT_AS_HTML_ATTRIBUTE, true);
items.add(lastNameItem);
TextItem emailAddressItem = new TextItem(UsersDataSource.Field.EMAIL_ADDRESS);
emailAddressItem.setShowTitle(true);
+ emailAddressItem.setAttribute(EnhancedDynamicForm.OUTPUT_AS_HTML_ATTRIBUTE,
true);
items.add(emailAddressItem);
TextItem phoneNumberItem = new TextItem(UsersDataSource.Field.PHONE_NUMBER);
+ phoneNumberItem.setAttribute(EnhancedDynamicForm.OUTPUT_AS_HTML_ATTRIBUTE,
true);
items.add(phoneNumberItem);
TextItem departmentItem = new TextItem(UsersDataSource.Field.DEPARTMENT);
+ departmentItem.setAttribute(EnhancedDynamicForm.OUTPUT_AS_HTML_ATTRIBUTE, true);
items.add(departmentItem);
boolean userBeingEditedIsRhqadmin = (getRecordId() == SUBJECT_ID_RHQADMIN);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
index d6f536b..6bdf6a5 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
@@ -107,7 +107,9 @@ public class UsersDataSource extends RPCDataSource<Subject,
SubjectCriteria> {
fields.add(idDataField);
DataSourceTextField usernameField = createTextField(Field.NAME,
MSG.dataSource_users_field_name(), 3, 100, true);
-
+ // Don't allow characters that could be used in HTML intended for an XSS
attack.
+ RegExpValidator regExpValidator = new
RegExpValidator("[^&<]*");
+ usernameField.setValidators(regExpValidator);
fields.add(usernameField);
DataSourceTextField ldapField = createBooleanField(Field.LDAP,
MSG.dataSource_users_field_ldap(), true);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index f124703..4fae91e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -33,6 +33,7 @@ import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
+import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
@@ -64,6 +65,7 @@ public class UsersView extends TableSection<UsersDataSource> {
setDataSource(dataSource);
setHeaderIcon(HEADER_ICON);
+ setEscapeHtmlInDetailsLinkColumn(true);
fetchManageSecurityPermissionAsync();
}
@@ -131,12 +133,15 @@ public class UsersView extends TableSection<UsersDataSource>
{
fields.add(ldapField);
ListGridField firstNameField = new
ListGridField(UsersDataSource.Field.FIRST_NAME, 150);
+ firstNameField.setCellFormatter(new EscapedHtmlCellFormatter());
fields.add(firstNameField);
ListGridField lastNameField = new ListGridField(UsersDataSource.Field.LAST_NAME,
150);
+ lastNameField.setCellFormatter(new EscapedHtmlCellFormatter());
fields.add(lastNameField);
ListGridField departmentField = new
ListGridField(UsersDataSource.Field.DEPARTMENT, 150);
+ departmentField.setCellFormatter(new EscapedHtmlCellFormatter());
fields.add(departmentField);
// TODO: instead of fetching roles, use a composite object that will pull the
role count across the wire.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
index 376d659..4d8b846 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.alert.definitions;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -34,9 +35,11 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
/**
* Superclass to the different alert definition views. This should be subclassed
@@ -48,6 +51,8 @@ public abstract class AbstractAlertDefinitionsView extends
TableSection<Abstract
public AbstractAlertDefinitionsView(String locatorId, String tableTitle) {
super(locatorId, tableTitle);
+
+ setEscapeHtmlInDetailsLinkColumn(true);
}
@Override
@@ -66,6 +71,12 @@ public abstract class AbstractAlertDefinitionsView extends
TableSection<Abstract
listGrid.setFixedRecordHeights(false);
//listGrid.getField("id").setWidth(55);
+ // name and description are user-editable, so escape HTML to prevent XSS attacks
+ ListGridField nameField =
listGrid.getField(AbstractAlertDefinitionsDataSource.FIELD_NAME);
+ nameField.setCellFormatter(new EscapedHtmlCellFormatter());
+ ListGridField descriptionField =
listGrid.getField(AbstractAlertDefinitionsDataSource.FIELD_DESCRIPTION);
+ descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());
+
boolean permitted = isAllowedToModifyAlertDefinitions();
TableActionEnablement enablement = (permitted) ? TableActionEnablement.ALWAYS :
TableActionEnablement.NEVER;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
index 90f09f4..7d6b0d5 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
@@ -209,11 +209,15 @@ public class GeneralPropertiesAlertDefinitionForm extends
LocatableDynamicForm i
nameTextField.setWidth(300);
nameTextField.setDefaultValue("");
nameStatic = new StaticTextItem("nameStatic",
MSG.common_title_name());
+ // name is user-editable, so escape HTML to prevent XSS attacks
+ nameStatic.setOutputAsHTML(true);
descriptionTextField = new TextAreaItem("description",
MSG.common_title_description());
descriptionTextField.setWidth(300);
descriptionTextField.setDefaultValue("");
descriptionStatic = new StaticTextItem("descriptionStatic",
MSG.common_title_description());
+ // description is user-editable, so escape HTML to prevent XSS attacks
+ descriptionStatic.setOutputAsHTML(true);
prioritySelection = new SelectItem("priority",
MSG.view_alerts_field_priority());
LinkedHashMap<String, String> priorities = new LinkedHashMap<String,
String>(3);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
index 42711b6..b2763d9 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
@@ -40,8 +40,10 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleVersionDataSource;
+import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
/**
* @author Greg Hinkle
@@ -76,16 +78,21 @@ public class BundleDeploymentListView extends
Table<BundleDeploymentDataSource>
// only users that are authorized can see deployments
if (canManageBundles) {
nameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord record, int i, int i1) {
+ public String format(Object value, ListGridRecord record, int i, int i1)
{
return "<a href=\""
+ LinkManager.getBundleDeploymentLink(record
.getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID), record
- .getAttributeAsInt(BundleDeploymentDataSource.FIELD_ID)) +
"\">" + String.valueOf(o)
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_ID)) +
"\">"
+ + StringUtility.escapeHtml(String.valueOf(value))
+ "</a>";
}
});
+ } else {
+ nameField.setCellFormatter(new EscapedHtmlCellFormatter());
}
+ descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());
+
bundleVersionField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord record, int i, int i1) {
return "<a href=\""
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index c00a454..62bf4ed 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -77,6 +77,7 @@ import
org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
@@ -146,7 +147,7 @@ public class BundleDeploymentView extends LocatableVLayout implements
Bookmarkab
LinkItem bundleName = new LinkItem("bundle");
bundleName.setTitle(MSG.view_bundle_bundle());
bundleName.setValue(LinkManager.getBundleLink(bundle.getId()));
- bundleName.setLinkTitle(bundle.getName());
+ bundleName.setLinkTitle(StringUtility.escapeHtml(bundle.getName()));
bundleName.setTarget("_self");
CanvasItem actionItem = new CanvasItem("actions");
@@ -172,14 +173,14 @@ public class BundleDeploymentView extends LocatableVLayout
implements Bookmarkab
LinkItem destinationGroup = new LinkItem("group");
destinationGroup.setTitle(MSG.common_title_resource_group());
destinationGroup.setValue(LinkManager.getResourceGroupLink(deployment.getDestination().getGroup().getId()));
- destinationGroup.setLinkTitle(deployment.getDestination().getGroup().getName());
+
destinationGroup.setLinkTitle(StringUtility.escapeHtml((deployment.getDestination().getGroup().getName())));
destinationGroup.setTarget("_self");
StaticTextItem path = new StaticTextItem("path",
MSG.view_bundle_deployDir());
path.setValue(deployment.getDestination().getDeployDir());
StaticTextItem description = new StaticTextItem("description",
MSG.common_title_description());
- description.setValue(deployment.getDescription());
+ description.setValue(StringUtility.escapeHtml(deployment.getDescription()));
StaticTextItem status = new StaticTextItem("status",
MSG.common_title_status());
status.setValue(deployment.getStatus().name());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
index d3ca12c..bbd20f6 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
@@ -38,6 +38,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
/**
* @author Greg Hinkle
@@ -77,24 +78,27 @@ public class BundleDestinationListView extends
Table<BundleDestinationDataSource
TimestampCellFormatter.prepareDateField(latestDeploymentDateField);
nameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
+ public String format(Object value, ListGridRecord listGridRecord, int i, int
i1) {
Integer bundleId =
listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
Integer bundleDestId =
listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_ID);
- return "<a href=\"" +
LinkManager.getBundleDestinationLink(bundleId, bundleDestId) + "\">" + o
+ "</a>";
+ return "<a href=\"" +
LinkManager.getBundleDestinationLink(bundleId, bundleDestId) + "\">"
+ + StringUtility.escapeHtml(value.toString()) +
"</a>";
}
});
groupNameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
+ public String format(Object value, ListGridRecord listGridRecord, int i, int
i1) {
Integer groupId =
listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_GROUP_ID);
- return "<a href=\"" +
LinkManager.getResourceGroupLink(groupId) + "\">" + o +
"</a>";
+ return "<a href=\"" +
LinkManager.getResourceGroupLink(groupId) + "\">"
+ + StringUtility.escapeHtml(value.toString()) +
"</a>";
}
});
bundleNameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
+ public String format(Object value, ListGridRecord listGridRecord, int i, int
i1) {
Integer bid =
listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
- return "<a href=\"" + LinkManager.getBundleLink(bid) +
"\">" + o + "</a>";
+ return "<a href=\"" + LinkManager.getBundleLink(bid) +
"\">"
+ + StringUtility.escapeHtml(value.toString()) +
"</a>";
}
});
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index da52896..0a805e0 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -57,6 +57,7 @@ import
org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
@@ -89,10 +90,10 @@ public class BundleDestinationView extends LocatableVLayout implements
Bookmarka
this.bundle = bundleDestination.getBundle();
BackButton backButton = new BackButton(extendLocatorId("BackButton"),
MSG.view_bundle_dest_backToBundle()
- + ": " + bundle.getName(), "Bundles/Bundle/" +
bundle.getId());
+ + ": " + StringUtility.escapeHtml(bundle.getName()),
"Bundles/Bundle/" + bundle.getId());
HeaderLabel header = new
HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleDestination_24.png"),
- destination.getName());
+ StringUtility.escapeHtml(destination.getName()));
detail = new Canvas();
detail.setHeight("50%");
@@ -121,7 +122,7 @@ public class BundleDestinationView extends LocatableVLayout implements
Bookmarka
LinkItem bundleName = new LinkItem("bundle");
bundleName.setTitle(MSG.view_bundle_bundle());
bundleName.setValue(LinkManager.getBundleLink(bundle.getId()));
- bundleName.setLinkTitle(bundle.getName());
+ bundleName.setLinkTitle(StringUtility.escapeHtml(bundle.getName()));
bundleName.setTarget("_self");
CanvasItem actionItem = new CanvasItem("actions");
@@ -136,14 +137,14 @@ public class BundleDestinationView extends LocatableVLayout
implements Bookmarka
LinkItem destinationGroup = new LinkItem("group");
destinationGroup.setTitle(MSG.view_bundle_dest_group());
destinationGroup.setValue(LinkManager.getResourceGroupLink(destination.getGroup().getId()));
- destinationGroup.setLinkTitle(destination.getGroup().getName());
+
destinationGroup.setLinkTitle(StringUtility.escapeHtml(destination.getGroup().getName()));
destinationGroup.setTarget("_self");
StaticTextItem path = new StaticTextItem("path",
MSG.view_bundle_dest_deployDir());
path.setValue(destination.getDeployDir());
StaticTextItem description = new StaticTextItem("description",
MSG.common_title_description());
- description.setValue(destination.getDescription());
+ description.setValue(StringUtility.escapeHtml(destination.getDescription()));
form.setFields(bundleName, actionItem, created, destinationGroup, path,
description);
return form;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index f4801ea..74eaa68 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -60,6 +60,7 @@ import
org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
@@ -98,7 +99,7 @@ public class BundleView extends LocatableVLayout implements
BookmarkableView {
BackButton backButton = new BackButton(extendLocatorId("BackButton"),
MSG.view_bundle_list_backToAll(),
BundleTopView.VIEW_ID.getTitle());
- headerLabel = new HeaderLabel("subsystems/bundle/Bundle_24.png",
bundle.getName());
+ headerLabel = new HeaderLabel("subsystems/bundle/Bundle_24.png",
StringUtility.escapeHtml(bundle.getName()));
tabs = new LocatableTabSet(getLocatorId());
versionsTab = createVersionsTab();
destinationsTab = createDestinationsTab();
@@ -188,7 +189,7 @@ public class BundleView extends LocatableVLayout implements
BookmarkableView {
destinationsCountItem.setValue(bundle.getDestinations() != null ?
bundle.getDestinations().size() : 0);
StaticTextItem descriptionItem = new StaticTextItem("description",
MSG.common_title_description());
- descriptionItem.setValue(bundle.getDescription());
+ descriptionItem.setValue(StringUtility.escapeHtml(bundle.getDescription()));
form.setFields(versionCountItem, actionItem, destinationsCountItem,
descriptionItem);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 023fd1f..ea25046 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -47,6 +47,7 @@ import
org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablem
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
@@ -80,7 +81,6 @@ public class BundlesListView extends
Table<BundlesWithLatestVersionDataSource> {
@Override
protected void configureTable() {
-
ListGridField idField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_ID, MSG.common_title_id());
idField.setType(ListGridFieldType.INTEGER);
idField.setWidth("50");
@@ -89,15 +89,20 @@ public class BundlesListView extends
Table<BundlesWithLatestVersionDataSource> {
.common_title_name());
nameField.setWidth("33%");
nameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord record, int i, int i1) {
+ public String format(Object value, ListGridRecord record, int i, int i1) {
return "<a href=\"" +
record.getAttribute(BundlesWithLatestVersionDataSource.FIELD_NAMELINK) +
"\">"
- + String.valueOf(o) + "</a>";
+ + StringUtility.escapeHtml(String.valueOf(value)) +
"</a>";
}
});
ListGridField descField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_DESCRIPTION, MSG
.common_title_description());
descField.setWidth("33%");
+ descField.setCellFormatter(new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int i, int i1) {
+ return StringUtility.escapeHtml(String.valueOf(value));
+ }
+ });
ListGridField latestVersionField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_LATEST_VERSION,
MSG.view_bundle_latestVersion());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
index 552ab4d..33d20e2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
@@ -31,6 +31,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
@@ -68,24 +69,27 @@ public class GetRevertInfoStep extends AbstractWizardStep {
.getId(), //
new AsyncCallback<String>() {
- public void onSuccess(String result) {
+ public void onSuccess(String bundleDeploymentName) {
final StaticTextItem nameTextItem = new
StaticTextItem("name", MSG
.view_bundle_revertWizard_getInfoStep_revertDeployName());
nameTextItem.setWidth(300);
- wizard.setSubtitle(result);
- nameTextItem.setValue(result);
+ String escapedBundleDeploymentName =
StringUtility.escapeHtml(bundleDeploymentName);
+ wizard.setSubtitle(escapedBundleDeploymentName);
+ nameTextItem.setValue(escapedBundleDeploymentName);
final TextAreaItem descriptionTextAreaItem = new
TextAreaItem("description", MSG
.view_bundle_revertWizard_getInfoStep_revertDeployDesc());
descriptionTextAreaItem.setWidth(300);
String liveDesc = wizard.getLiveDeployment().getDescription();
liveDesc = (null == liveDesc) ?
wizard.getLiveDeployment().getName() : liveDesc;
+ String escapedLiveDesc = StringUtility.escapeHtml(liveDesc);
String prevDesc =
wizard.getPreviousDeployment().getDescription();
prevDesc = (null == prevDesc) ?
wizard.getPreviousDeployment().getName() : prevDesc;
- wizard.setDeploymentDescription("[REVERT From]\n" +
liveDesc + "\n\n[REVERT To]\n" + prevDesc);
+ String escapedPrevDesc = StringUtility.escapeHtml(prevDesc);
+ wizard.setDeploymentDescription("[REVERT From]\n" +
escapedLiveDesc + "\n\n[REVERT To]\n" + escapedPrevDesc);
wizard.setDeploymentDescription(MSG.view_bundle_revertWizard_getInfoStep_revertDeployDescFull(
- liveDesc, prevDesc));
-
descriptionTextAreaItem.setValue(wizard.getDeploymentDescription());
+ escapedLiveDesc, escapedPrevDesc));
+
descriptionTextAreaItem.setValue(StringUtility.escapeHtml(wizard.getDeploymentDescription()));
descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
Object value = event.getValue();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
index 039bc3e..39b84e7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
@@ -49,6 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
/**
* @author Greg Hinkle
@@ -244,7 +245,7 @@ public class BundleTreeDataSource extends RPCDataSource<Object,
Criteria> {
node.setIsFolder(true);
node.setIcon("subsystems/bundle/Bundle_16.png");
node.setID(String.valueOf(bundle.getId()));
- node.setName(bundle.getName());
+ node.setName(StringUtility.escapeHtml(bundle.getName()));
} else if (from instanceof BundleVersion) {
BundleVersion version = (BundleVersion) from;
@@ -262,10 +263,11 @@ public class BundleTreeDataSource extends RPCDataSource<Object,
Criteria> {
parentID = bundleId + "_destinations_" +
deployment.getDestination().getId();
node.setParentID(parentID);
node.setID(bundleId + "_deployments_" + deployment.getId());
+ String name = StringUtility.escapeHtml(deployment.getName());
if (deployment.isLive()) {
- node.setName("<span style=\"color: green; font-weight:
bold\">(live)</span> " + deployment.getName());
+ node.setName("<span style=\"color: green; font-weight:
bold\">(live)</span> " + name);
} else {
- node.setName(deployment.getName());
+ node.setName(name);
}
} else if (from instanceof BundleDestination) {
@@ -275,7 +277,7 @@ public class BundleTreeDataSource extends RPCDataSource<Object,
Criteria> {
parentID = destination.getBundle().getId() + "_destinations";
node.setParentID(parentID);
node.setID(parentID + '_' + destination.getId());
- node.setName(destination.getName());
+ node.setName(StringUtility.escapeHtml(destination.getName()));
}
return node;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index ac2d132..35d61f2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -1261,7 +1261,10 @@ public class ConfigurationEditor extends LocatableVLayout {
// TODO (ips, 03/25/11): We eventually want to use StaticTextItems for read-only
PASSWORD props too, but we have
// to wait until we implement masking/unmasking of PASSWORD
props at the SLSB layer first.
if (propertyIsReadOnly && propertyDefinitionSimple.getType() !=
PropertySimpleType.PASSWORD) {
- valueItem = new StaticTextItem();
+ StaticTextItem staticItem = new StaticTextItem();
+ // Property values are user-editable, so escape HTML to prevent an XSS
attack.
+ staticItem.setOutputAsHTML(true);
+ valueItem = staticItem;
} else {
List<PropertyDefinitionEnumeration> enumeratedValues =
propertyDefinitionSimple.getEnumeratedValues();
if (enumeratedValues != null && !enumeratedValues.isEmpty()) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
index 59c8b9d..02c2752 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -45,6 +45,8 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
*/
public class EnhancedDynamicForm extends LocatableDynamicForm {
+ public static final String OUTPUT_AS_HTML_ATTRIBUTE = "outputAsHTML";
+
private static final String FIELD_ID = "id";
private boolean isReadOnly;
@@ -116,6 +118,10 @@ public class EnhancedDynamicForm extends LocatableDynamicForm {
staticItem.setTooltip(item.getTooltip());
staticItem.setValue(item.getDisplayValue());
staticItem.setColSpan(item.getAttribute("colSpan"));
+ Boolean outputAsHtml =
item.getAttributeAsBoolean(OUTPUT_AS_HTML_ATTRIBUTE);
+ if (Boolean.TRUE.equals(outputAsHtml)) {
+ staticItem.setOutputAsHTML(true);
+ }
// TODO: Any other fields we should copy? icons?
if ((item instanceof BooleanItem) || (item instanceof CheckboxItem))
{
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EscapedHtmlCellFormatter.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EscapedHtmlCellFormatter.java
new file mode 100644
index 0000000..c60236c
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EscapedHtmlCellFormatter.java
@@ -0,0 +1,19 @@
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
+
+/**
+ * A cell formatter that escapes any HTML in the cell's value.
+ *
+ * @author Ian Springer
+ */
+public class EscapedHtmlCellFormatter implements CellFormatter {
+
+ public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+ return (value != null) ? StringUtility.escapeHtml(value.toString()) :
"";
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/IconField.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/IconField.java
new file mode 100644
index 0000000..82d6071
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/IconField.java
@@ -0,0 +1,73 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.grid.ListGridField;
+
+/**
+ * @author Ian Springer
+ */
+public class IconField extends ListGridField {
+
+ private static final String DEFAULT_NAME = "icon";
+ private static final String DEFAULT_TITLE = " ";
+ private static final int DEFAULT_WIDTH = 25;
+
+ public IconField() {
+ super(DEFAULT_NAME, DEFAULT_TITLE, DEFAULT_WIDTH);
+ init();
+ }
+
+ public IconField(JavaScriptObject jsObj) {
+ super(DEFAULT_NAME, DEFAULT_TITLE, DEFAULT_WIDTH);
+ setJsObj(jsObj);
+ init();
+ }
+
+ public IconField(String name) {
+ super(name, DEFAULT_TITLE, DEFAULT_WIDTH);
+ init();
+ }
+
+ public IconField(String name, int width) {
+ super(name, DEFAULT_TITLE, width);
+ init();
+ }
+
+ public IconField(String name, String title) {
+ super(name, title, DEFAULT_WIDTH);
+ init();
+ }
+
+ public IconField(String name, String title, int width) {
+ super(name, title, width);
+ init();
+ }
+
+ private void init() {
+ setType(ListGridFieldType.IMAGE);
+ setAlign(Alignment.CENTER);
+ setShowDefaultContextMenu(false);
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index e551deb..b19abfd 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -44,6 +44,7 @@ import org.rhq.enterprise.gui.coregui.client.DetailsView;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
@@ -56,6 +57,7 @@ public abstract class TableSection<DS extends RPCDataSource>
extends Table<DS> i
private VLayout detailsHolder;
private Canvas detailsView;
private String basePath;
+ private boolean escapeHtmlInDetailsLinkColumn;
protected TableSection(String locatorId, String tableTitle) {
super(locatorId, tableTitle);
@@ -110,7 +112,7 @@ public abstract class TableSection<DS extends RPCDataSource>
extends Table<DS> i
/**
* The default implementation wraps the {@link getDetailsLinkColumnCellFormatter()}
column with the
- * {@link getDetailsLinkColumnCellFormatter()}. This is typically the 'name'
column linking to the detail
+ * {@link #getDetailsLinkColumnCellFormatter()}. This is typically the 'name'
column linking to the detail
* view, given the 'id'. Also, establishes a double click handler for the row
which invokes
* {@link showDetails()}</br>
* </br>
@@ -146,6 +148,10 @@ public abstract class TableSection<DS extends RPCDataSource>
extends Table<DS> i
return true;
}
+ public void setEscapeHtmlInDetailsLinkColumn(boolean escapeHtmlInDetailsLinkColumn)
{
+ this.escapeHtmlInDetailsLinkColumn = escapeHtmlInDetailsLinkColumn;
+ }
+
/**
* Override if you don't want FIELD_NAME to be wrapped ina link.
* @return the name of the field to be wrapped, or null if no field should be
wrapped.
@@ -161,9 +167,13 @@ public abstract class TableSection<DS extends RPCDataSource>
extends Table<DS> i
protected CellFormatter getDetailsLinkColumnCellFormatter() {
return new CellFormatter() {
public String format(Object value, ListGridRecord record, int i, int i1) {
+ if (value == null) {
+ return "";
+ }
Integer recordId = getId(record);
String detailsUrl = "#" + getBasePath() + "/" +
recordId;
- return SeleniumUtility.getLocatableHref(detailsUrl, value.toString(),
null);
+ String formattedValue = (escapeHtmlInDetailsLinkColumn) ?
StringUtility.escapeHtml(value.toString()) : value.toString();
+ return SeleniumUtility.getLocatableHref(detailsUrl, formattedValue,
null);
}
};
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java
index 15e13fa..1bae1e2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,7 @@ import com.smartgwt.client.widgets.tree.TreeNode;
* @author Ian Springer
*/
public class EnhancedTreeNode extends TreeNode {
+
public EnhancedTreeNode() {
super();
}
@@ -55,7 +56,7 @@ public class EnhancedTreeNode extends TreeNode {
public void setName(String name) {
super.setName(name);
if (name != null && getTitle() == null) {
- setTitle(name);
+ super.setTitle(name);
}
}
@@ -110,4 +111,5 @@ public class EnhancedTreeNode extends TreeNode {
private Attributes() {
}
}
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
index 8fcaba0..f91c4cf 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
@@ -49,6 +49,7 @@ import
org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.configuration.definition.PropertySimpleType;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.table.IconField;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableWidget;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
@@ -139,12 +140,9 @@ public class ProblemResourcesPortlet extends
Table<ProblemResourcesDataSource> i
ListGridField alertsField = new ListGridField(ALERTS.propertyName(),
ALERTS.title(), 70);
- ListGridField availabilityField = new ListGridField(AVAILABILITY.propertyName(),
AVAILABILITY.title(), 70);
- availabilityField.setType(ListGridFieldType.IMAGE);
- availabilityField.setAlign(Alignment.CENTER);
+ IconField availabilityField = new IconField(AVAILABILITY.propertyName(),
AVAILABILITY.title(), 70);
setListGridFields(resourceField, ancestryField, alertsField, availabilityField);
-
}
@Override
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
index 8da6a8b..ead9cc2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
@@ -34,6 +34,7 @@ import
org.rhq.enterprise.gui.coregui.client.dashboard.ConfigurablePortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
/**
@@ -46,15 +47,17 @@ public class MessagePortlet extends LocatableHTMLPane implements
ConfigurablePor
// A default displayed, persisted name for the portlet
public static final String NAME = MSG.view_portlet_defaultName_message();
+ private static final String MESSAGE_PROPERTY = "message";
+
public MessagePortlet(String locatorId) {
super(locatorId);
setContentsType(ContentsType.PAGE);
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- String contents =
storedPortlet.getConfiguration().getSimpleValue("message", null);
+ String contents =
storedPortlet.getConfiguration().getSimpleValue(MESSAGE_PROPERTY, null);
if (contents != null) {
- setContents(contents);
+ setContents(StringUtility.sanitizeHtml(contents));
} else {
setContents("<br/><i>" +
MSG.view_portlet_configure_needed() + "</i>");
}
@@ -68,7 +71,7 @@ public class MessagePortlet extends LocatableHTMLPane implements
ConfigurablePor
ConfigurationDefinition definition = new
ConfigurationDefinition(MSG.view_portlet_configure_definitionTitle(),
MSG.view_portlet_configure_definitionDesc());
- definition.put(new PropertyDefinitionSimple("message",
MSG.view_portlet_message_title(), true,
+ definition.put(new PropertyDefinitionSimple(MESSAGE_PROPERTY,
MSG.view_portlet_message_title(), true,
PropertySimpleType.LONG_STRING));
return definition;
@@ -78,8 +81,8 @@ public class MessagePortlet extends LocatableHTMLPane implements
ConfigurablePor
public static PortletViewFactory INSTANCE = new Factory();
public final Portlet getInstance(String locatorId) {
-
return new MessagePortlet(locatorId);
}
}
+
}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java
index 27b1040..236e994 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java
@@ -167,6 +167,8 @@ public abstract class AbstractOperationHistoryDetailsView<T extends
OperationHis
StaticTextItem requesterItem = new
StaticTextItem(AbstractOperationHistoryDataSource.Field.SUBJECT, MSG
.view_operationHistoryDetails_requestor());
+
+ requesterItem.setOutputAsHTML(true);
requesterItem.setValue(operationHistory.getSubjectName());
items.add(requesterItem);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
index ff577d0..387c4d5 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
@@ -263,7 +263,9 @@ public abstract class AbstractOperationScheduleDetailsView extends
AbstractRecor
Integer integerValue = TypeConversionUtility.toInteger(value);
timeoutItem.setValue(integerValue, UnitType.TIME);
- FormItem notesItem =
this.notesForm.getField(AbstractOperationScheduleDataSource.Field.DESCRIPTION);
+ StaticTextItem notesItem = (StaticTextItem)
this.notesForm.getField(AbstractOperationScheduleDataSource.Field.DESCRIPTION);
+ // Notes field is user-editable, so escape HTML to prevent an XSS attack.
+ notesItem.setOutputAsHTML(true);
notesItem.setValue(getForm().getValue(AbstractOperationScheduleDataSource.Field.DESCRIPTION));
this.parameters = (Configuration)
record.getAttributeAsObject(AbstractOperationScheduleDataSource.Field.PARAMETERS);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
index 82ac645..5fec813 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
@@ -401,7 +401,7 @@ public abstract class AbstractActivityView extends LocatableVLayout
implements R
/** Create empty display row(LocatableDynamicForm) that is constently defined and
displayed.
*
- * @param column Locatable parent colum.
+ * @param locatorId locator ID of Locatable parent column
* @param emptyMessage Contents of the empty region
* @return
*/
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
index 04fbfbd..a469fa9 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -281,7 +281,9 @@ public class ResourceGroupTreeView extends LocatableVLayout implements
Bookmarka
ResourceGroupTreeView.this.rootResourceGroup = group;
ResourceGroupTreeView.this.rootGroupId =
rootResourceGroup.getId();
ResourceGroupEnhancedTreeNode fakeRoot = new
ResourceGroupEnhancedTreeNode("fakeRootNode");
- ResourceGroupEnhancedTreeNode rootNode = new
ResourceGroupEnhancedTreeNode(group.getName());
+ String groupName = group.getName();
+ String escapedGroupName = StringUtility.escapeHtml(groupName);
+ ResourceGroupEnhancedTreeNode rootNode = new
ResourceGroupEnhancedTreeNode(escapedGroupName);
String icon = ImageManager.getGroupIcon(GroupCategory.MIXED);
rootNode.setIcon(icon);
rootNode.setID(String.valueOf(rootResourceGroup.getId()));
@@ -387,7 +389,9 @@ public class ResourceGroupTreeView extends LocatableVLayout implements
Bookmarka
ResourceGroupEnhancedTreeNode fakeRoot = new
ResourceGroupEnhancedTreeNode("fakeRootNode");
fakeRoot.setID(FAKE_ROOT_ID);
- ResourceGroupEnhancedTreeNode rootNode = new
ResourceGroupEnhancedTreeNode(rootResourceGroup.getName());
+ String groupName = rootResourceGroup.getName();
+ String escapedGroupName = StringUtility.escapeHtml(groupName);
+ ResourceGroupEnhancedTreeNode rootNode = new
ResourceGroupEnhancedTreeNode(escapedGroupName);
rootNode.setID(rootKey.getKey());
rootNode.setParentID(fakeRoot.getID());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
index 2393132..ba890d4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
@@ -34,6 +34,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
@@ -42,6 +43,7 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
* @author Jay Shaughnessy
*/
public abstract class AncestryUtil {
+
// ListGrid Record attribute names expected to be set on records processed by the
utility
public static final String RESOURCE_ANCESTRY = "resourceAncestry";
public static final String RESOURCE_ANCESTRY_VALUE =
"resourceAncestryDecoded";
@@ -115,8 +117,8 @@ public abstract class AncestryUtil {
continue;
}
String[] ancestryEntries = ancestry.split(Resource.ANCESTRY_DELIM);
- for (int i = 0; i < ancestryEntries.length; ++i) {
- String[] entryTokens =
ancestryEntries[i].split(Resource.ANCESTRY_ENTRY_DELIM);
+ for (String ancestryEntry : ancestryEntries) {
+ String[] entryTokens =
ancestryEntry.split(Resource.ANCESTRY_ENTRY_DELIM);
int rtId = Integer.valueOf(entryTokens[0]);
result.add(rtId);
}
@@ -148,7 +150,7 @@ public abstract class AncestryUtil {
String[] entryTokens =
ancestryEntries[i].split(Resource.ANCESTRY_ENTRY_DELIM);
int ancestorTypeId = Integer.valueOf(entryTokens[0]);
int ancestorResourceId = Integer.valueOf(entryTokens[1]);
- String ancestorName = entryTokens[2];
+ String ancestorName = StringUtility.escapeHtml(entryTokens[2]);
sbResources.append((i > 0) ? " < " : "");
//sbResources.append(" < ");
@@ -201,17 +203,15 @@ public abstract class AncestryUtil {
return "";
}
- Integer resourceId = record.getAttributeAsInt(RESOURCE_ID);
- // if not set assume the standard "id" attr is a resourceId
- resourceId = (null != resourceId) ? resourceId :
record.getAttributeAsInt("id");
+ Integer resourceId = getResourceId(record);
StringBuilder sbResources = new StringBuilder();
String[] ancestryEntries = ancestry.split(Resource.ANCESTRY_DELIM);
for (int i = 0; i < ancestryEntries.length; ++i) {
String[] entryTokens =
ancestryEntries[i].split(Resource.ANCESTRY_ENTRY_DELIM);
int ancestorResourceId = Integer.valueOf(entryTokens[1]);
- String ancestorName = entryTokens[2];
+ String ancestorName = StringUtility.escapeHtml(entryTokens[2]);
- sbResources.append((i > 0) ? " < " : "");
+ sbResources.append((i > 0) ? " < " : "");
if (generateLinks) {
String url = LinkManager.getResourceLink(ancestorResourceId);
String suffix = resourceId + "_" + entryTokens[1];
@@ -231,18 +231,14 @@ public abstract class AncestryUtil {
return ancestryHover;
}
- Integer resourceId = listGridRecord.getAttributeAsInt(RESOURCE_ID);
- // if not set assume the standard "id" attr is a resourceId
- resourceId = (null != resourceId) ? resourceId :
listGridRecord.getAttributeAsInt("id");
- String resourceName = listGridRecord.getAttribute(RESOURCE_NAME);
- // if not set assume the standard "name" attr is a resourceName
- resourceName = (null != resourceName) ? resourceName :
listGridRecord.getAttribute("name");
+ String resourceName = getResourceName(listGridRecord);
+
Map<Integer, ResourceType> types = ((MapWrapper)
listGridRecord.getAttributeAsObject(RESOURCE_ANCESTRY_TYPES))
.getMap();
Integer resourceTypeId = listGridRecord.getAttributeAsInt(RESOURCE_TYPE_ID);
String ancestry = listGridRecord.getAttributeAsString(RESOURCE_ANCESTRY);
- String result = getAncestryHoverHTMLString(resourceId, resourceName, ancestry,
resourceTypeId, types, width);
+ String result = getAncestryHoverHTMLString(resourceName, ancestry,
resourceTypeId, types, width);
listGridRecord.setAttribute(RESOURCE_ANCESTRY_HOVER, result);
return result;
@@ -250,12 +246,12 @@ public abstract class AncestryUtil {
public static String getAncestryHoverHTMLForResource(Resource resource,
Map<Integer, ResourceType> types, int width) {
- return getAncestryHoverHTMLString(resource.getId(), resource.getName(),
resource.getAncestry(), resource
+ return getAncestryHoverHTMLString(resource.getName(), resource.getAncestry(),
resource
.getResourceType().getId(), types, width);
}
- private static String getAncestryHoverHTMLString(int resourceId, String resourceName,
String ancestry,
- int resourceTypeId, Map<Integer, ResourceType> types, int width) {
+ private static String getAncestryHoverHTMLString(String resourceName, String
ancestry,
+ int resourceTypeId, Map<Integer,
ResourceType> types, int width) {
ResourceType type = types.get(resourceTypeId);
String resourceLongName = getResourceLongName(resourceName, type);
@@ -282,7 +278,7 @@ public abstract class AncestryUtil {
for (int i = ancestryEntries.length - 1, j = 0; i >= 0; --i, ++j) {
String[] entryTokens =
ancestryEntries[i].split(Resource.ANCESTRY_ENTRY_DELIM);
int ancestorTypeId = Integer.valueOf(entryTokens[0]);
- String ancestorName = entryTokens[2];
+ String ancestorName = StringUtility.escapeHtml(entryTokens[2]);
// indent with spaces
if (j > 0) {
@@ -323,9 +319,10 @@ public abstract class AncestryUtil {
/**
* Get a resource name that combines type and resource information. This is useful
for when we want to
- * use a single column for dispay of the resource "name". The name is
wrapped in a navigable link.
+ * use a single column for display of the resource "name". The name is
wrapped in a navigable link.
*
- * @param resource The resource
+ * @param record the resource record
+ * @param width the width, in pixels, of the returned HTML <code>p</code>
tag
*
* @return the long name for the resource
*/
@@ -335,9 +332,7 @@ public abstract class AncestryUtil {
return resourceHover;
}
- String resourceName = record.getAttribute(RESOURCE_NAME);
- // if not set assume the standard "name" attr is a resourceName
- resourceName = (null != resourceName) ? resourceName :
record.getAttribute("name");
+ String resourceName = getResourceName(record);
Map<Integer, ResourceType> types = ((MapWrapper)
record.getAttributeAsObject(RESOURCE_ANCESTRY_TYPES)).getMap();
Integer resourceTypeId = record.getAttributeAsInt(RESOURCE_TYPE_ID);
ResourceType type = types.get(resourceTypeId);
@@ -365,6 +360,21 @@ public abstract class AncestryUtil {
return result;
}
+ private static Integer getResourceId(Record record) {
+ Integer resourceId = record.getAttributeAsInt(RESOURCE_ID);
+ // if not set assume the standard "id" attr is a resourceId
+ resourceId = (null != resourceId) ? resourceId :
record.getAttributeAsInt("id");
+ return resourceId;
+ }
+
+ private static String getResourceName(Record record) {
+ String resourceName = record.getAttribute(RESOURCE_NAME);
+ // if not set assume the standard "name" attr is a resourceName
+ resourceName = (null != resourceName) ? resourceName :
record.getAttribute("name");
+ resourceName = StringUtility.escapeHtml(resourceName);
+ return resourceName;
+ }
+
// We do not want smargwt to see we are storing our map into an attribute because it
barfs on our key/value pairs
// so instead we have to wrap it in a non-Map POJO Object so smartgwt just handles it
as a java.lang.Object.
public static class MapWrapper {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index 32a6227..b53a127 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -33,8 +33,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.SortSpecifier;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
@@ -52,12 +50,14 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.RecordExtractor;
import
org.rhq.enterprise.gui.coregui.client.components.table.ResourceAuthorizedTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.IconField;
import
org.rhq.enterprise.gui.coregui.client.components.table.ResourceCategoryCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.TableUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
@@ -125,14 +125,9 @@ public class ResourceSearchView extends Table {
@Override
protected void configureTable() {
- ListGridField iconField = new ListGridField("icon",
MSG.common_title_icon(), 25);
- iconField.setType(ListGridFieldType.IMAGE);
- iconField.setShowDefaultContextMenu(false);
- iconField.setCanSort(false);
- iconField.setTitle(" ");
+ IconField iconField = new IconField();
iconField.setShowHover(true);
iconField.setHoverCustomizer(new HoverCustomizer() {
- @Override
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int
colNum) {
String resCat = record.getAttribute(CATEGORY.propertyName());
switch (ResourceCategory.valueOf(resCat)) {
@@ -149,14 +144,14 @@ public class ResourceSearchView extends Table {
ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title(),
250);
nameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
- String url =
LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("id"));
- return SeleniumUtility.getLocatableHref(url, o.toString(), null);
+ public String format(Object value, ListGridRecord record, int rowNum, int
colNum) {
+ String url =
LinkManager.getResourceLink(record.getAttributeAsInt("id"));
+ String name = StringUtility.escapeHtml(value.toString());
+ return SeleniumUtility.getLocatableHref(url, name, null);
}
});
nameField.setShowHover(true);
nameField.setHoverCustomizer(new HoverCustomizer() {
-
public String hoverHTML(Object value, ListGridRecord listGridRecord, int
rowNum, int colNum) {
return AncestryUtil.getResourceHoverHTML(listGridRecord, 0);
}
@@ -174,9 +169,7 @@ public class ResourceSearchView extends Table {
categoryField.setCellFormatter(new ResourceCategoryCellFormatter());
categoryField.setHidden(true); // the icon field already shows us this, no need
to show it in another column
- ListGridField availabilityField = new ListGridField(AVAILABILITY.propertyName(),
AVAILABILITY.title(), 70);
- availabilityField.setType(ListGridFieldType.IMAGE);
- availabilityField.setAlign(Alignment.CENTER);
+ IconField availabilityField = new IconField(AVAILABILITY.propertyName(),
AVAILABILITY.title(), 70);
setListGridFields(iconField, nameField, ancestryField, descriptionField,
typeNameField, pluginNameField,
categoryField, availabilityField);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index bd86104..dcdffd9 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -49,6 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableImg;
@@ -310,7 +311,7 @@ public class ResourceTitleBar extends LocatableVLayout {
if (!resource.getName().equals(resourceName)) {
resource.setName(resourceName); // the name must have been changed by the
user via the editable field
}
- this.title.setContents("<span class=\"SectionHeader\">"
+ resource.getName()
+ this.title.setContents("<span class=\"SectionHeader\">"
+ StringUtility.escapeHtml(resourceName)
+ "</span> <span
class=\"subtitle\">" + resource.getResourceType().getName() +
"</span>");
this.title.markForRedraw();
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index 336e12e..6a38008 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -334,10 +334,14 @@ public class ResourceTreeDatasource extends DataSource {
}
this.setParentID(parentId);
+ // name and description are user-editable, so escape HTML to prevent XSS
attacks
String name = resource.getName();
- setName(name);
+ String escapedName = StringUtility.escapeHtml(name);
+ setName(escapedName);
- setAttribute(Attributes.DESCRIPTION, resource.getDescription());
+ String description = resource.getDescription();
+ String escapedDescription = StringUtility.escapeHtml(description);
+ setAttribute(Attributes.DESCRIPTION, escapedDescription);
Set<ResourceType> childTypes =
resource.getResourceType().getChildResourceTypes();
setIsFolder((childTypes != null && !childTypes.isEmpty()));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/StringUtility.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/StringUtility.java
index 984ca22..0c93099 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/StringUtility.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/StringUtility.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -19,53 +19,72 @@
*/
package org.rhq.enterprise.gui.coregui.client.util;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* A collection of utility methods for working with Strings.
- *
- * TODO: I18N. The logic here may need to be pluggable for different localizations.
*
* @author Ian Springer
*/
public class StringUtility {
/**
- * Split a string on delimiter boundaries, and place each element into a List.
+ * Escapes HTML in a string to eliminate cross site scripting (XSS) vulnerabilities.
Note, this impl is designed
+ * to be highly efficient to minimize the impact on performance.
*
- * @param s String to split up
- * @param delim Delimiting token, ala StringTokenizer
+ * @param string the string to be escaped
*
- * @return a List comprised of elements split by the tokenizing
+ * @return the escaped string
*/
-
- public static List<String> explode(String s, String delim) {
- List<String> res = new ArrayList<String>();
- if (s == null)
- return res;
-
- String[] tokens = s.split(delim);
- for (String token : tokens) {
- res.add(token);
+ public static String escapeHtml(String string) {
+ if (string == null) {
+ return null;
}
-
- return res;
+ StringBuilder buffer = null;
+ for (int i = 0; i < string.length(); i++) {
+ char c = string.charAt(i);
+ if (c == '&') {
+ if (buffer == null) {
+ buffer = new StringBuilder(string.substring(0, i));
+ }
+ buffer.append("&");
+ } else if (c == '<') {
+ if (buffer == null) {
+ buffer = new StringBuilder(string.substring(0, i));
+ }
+ buffer.append("<");
+ } else if (c == '>') {
+ if (buffer == null) {
+ buffer = new StringBuilder(string.substring(0, i));
+ }
+ buffer.append(">");
+ } else {
+ if (buffer != null) {
+ buffer.append(c);
+ }
+ }
+ }
+ return (buffer != null) ? buffer.toString() : string;
}
- public static String pluralize(String singularNoun) {
- String pluralNoun;
- if (singularNoun.endsWith("y") &&
!singularNoun.endsWith("ay") && !singularNoun.endsWith("ey")
- && !singularNoun.endsWith("oy")) {
- pluralNoun = singularNoun.substring(0, singularNoun.length() - 1) +
"ies";
- } else if (!singularNoun.endsWith("s")) {
- pluralNoun = singularNoun + "s";
- } else {
- pluralNoun = singularNoun;
+ /**
+ * Sanitizes HTML (i.e. removes unsafe HTML such as SCRIPT tags) in a string to
eliminate cross site scripting (XSS)
+ * vulnerabilities.
+ *
+ * @param string the string to be sanitized
+ *
+ * @return the sanitized string
+ */
+ // TODO (ips, 03/31/11): Replace this lame impl with a much more robust one - easiest
way would be to upgrade to GWT
+ // 2.1 or later and use the new Safe HTML APIs. See also
+ //
http://tomerdoron.blogspot.com/2011/03/less-simple-safe-html-sanitizer.html.
+ public static String sanitizeHtml(String string) {
+ if (string == null) {
+ return null;
}
- return pluralNoun;
+
+ return string.replaceAll("<script",
"<script").replaceAll("<SCRIPT",
"<SCRIPT");
}
private StringUtility() {
}
+
}
commit fec4fb5d697c886ca6ba8cb03b4686efedcb8815
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 31 16:55:59 2011 -0400
BZ 640396 - when you change the name of a resource or group, the title bar header name
also changes now
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
index ba62aa4..fde8d13 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
@@ -54,10 +54,12 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class GeneralProperties extends LocatableVLayout {
private ResourceGroupGWTServiceAsync resourceGroupService =
GWTServiceLookup.getResourceGroupService();
private ResourceGroupComposite groupComposite;
+ private final ResourceGroupTitleBar titleBar;
- public GeneralProperties(String locatorId, ResourceGroupComposite groupComposite) {
+ public GeneralProperties(String locatorId, ResourceGroupComposite groupComposite,
ResourceGroupTitleBar titleBar) {
super(locatorId);
this.groupComposite = groupComposite;
+ this.titleBar = titleBar;
}
@Override
@@ -108,6 +110,8 @@ public class GeneralProperties extends LocatableVLayout {
}
public void onSuccess(Void result) {
+ titleBar.displayGroupName(newName);
+
CoreGUI.getMessageCenter().notify(
new
Message(MSG.view_group_summary_nameUpdateSuccessful(String.valueOf(group
.getId()), oldName, newName),
Message.Severity.Info));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
index 26e826c..d8020f3 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
@@ -137,7 +137,8 @@ public class ResourceGroupTitleBar extends LocatableVLayout {
ResourceGroupComposite resultComposite = result.get(0);
setGroupIcons(resultComposite);
- generalProperties = new
GeneralProperties(extendLocatorId("genProps"), resultComposite);
+ generalProperties = new
GeneralProperties(extendLocatorId("genProps"), resultComposite,
+ ResourceGroupTitleBar.this);
generalProperties.setVisible(false);
ResourceGroupTitleBar.this.addMember(generalProperties);
expandCollapseArrow.addClickHandler(new ClickHandler() {
@@ -234,6 +235,21 @@ public class ResourceGroupTitleBar extends LocatableVLayout {
this.group = groupComposite.getResourceGroup();
update();
+ displayGroupName(group.getName());
+
+ Set<Integer> favorites =
UserSessionManager.getUserPreferences().getFavoriteResourceGroups();
+ this.favorite = favorites.contains(group.getId());
+ updateFavoriteButton();
+
+ setGroupIcons(groupComposite);
+ markForRedraw();
+ }
+
+ void displayGroupName(String groupName) {
+ if (!group.getName().equals(groupName)) {
+ group.setName(groupName); // the name must have been changed by the user via
the editable field
+ }
+
String catName = null;
switch (group.getGroupCategory()) {
case COMPATIBLE: {
@@ -248,13 +264,7 @@ public class ResourceGroupTitleBar extends LocatableVLayout {
this.title.setContents("<span class=\"SectionHeader\">"
+ group.getName()
+ "</span> <span
class=\"subtitle\">" + catName + "</span>");
-
- Set<Integer> favorites =
UserSessionManager.getUserPreferences().getFavoriteResourceGroups();
- this.favorite = favorites.contains(group.getId());
- updateFavoriteButton();
-
- setGroupIcons(groupComposite);
- markForRedraw();
+ this.title.markForRedraw();
}
private void setGroupIcons(ResourceGroupComposite groupComposite) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
new file mode 100644
index 0000000..7547339
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/OverviewForm.java
@@ -0,0 +1,336 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EnumSet;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.HeaderItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+
+import org.rhq.core.domain.measurement.DataType;
+import org.rhq.core.domain.measurement.DisplayType;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem;
+import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.components.form.StringLengthValidator;
+import
org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem.ValueEditedHandler;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * The Resource Summary>Overview tab - Resource general properties + summary traits.
+ *
+ * @author Greg Hinkle
+ * @author Ian Springer
+ */
+public class OverviewForm extends EnhancedDynamicForm {
+
+ private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService();
+ private ResourceComposite resourceComposite;
+ private boolean headerEnabled = true;
+ private boolean displayCondensed = false;
+ private final ResourceTitleBar titleBar;
+
+ public OverviewForm(String locatorId, ResourceComposite resourceComposite,
ResourceTitleBar titleBar) {
+ super(locatorId);
+ this.resourceComposite = resourceComposite;
+ this.titleBar = titleBar;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ setLeft("10%");
+ setWidth("80%");
+ if (isDisplayCondensed()) {
+ setPadding(5);
+ setColWidths(150, 220, 150, 220);
+ setWidth("45%");
+ }
+
+ if (this.resourceComposite != null) {
+ setResource(this.resourceComposite);
+ }
+ }
+
+ public void setResource(ResourceComposite resourceComposite) {
+
+ this.resourceComposite = resourceComposite;
+ Resource resource = resourceComposite.getResource();
+
+ // Load metric defs.
+
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ buildForm(type);
+ loadTraitValues();
+ }
+ });
+ }
+
+ private void loadTraitValues() {
+ final Resource resource = resourceComposite.getResource();
+
GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(resource.getId(),
+ DisplayType.SUMMARY, new
AsyncCallback<List<MeasurementDataTrait>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.view_summaryOverviewForm_error_traitsLoadFailure(resource.toString()), caught);
+ }
+
+ public void onSuccess(List<MeasurementDataTrait> result) {
+ for (MeasurementDataTrait trait : result) {
+ String formItemId =
buildFormItemIdFromTraitDisplayName(trait.getName());
+ FormItem item = getItem(formItemId);
+ if (item != null) {
+ setValue(formItemId, trait.getValue());
+ }
+ }
+ markForRedraw();
+ }
+ });
+ }
+
+ private static String buildFormItemIdFromTraitDisplayName(String traitName) {
+ return traitName.replaceAll("\\.", "_").replaceAll("
", "__");
+ }
+
+ private void buildForm(ResourceType type) {
+ List<MeasurementDefinition> traits = new
ArrayList<MeasurementDefinition>();
+
+ for (MeasurementDefinition measurement : type.getMetricDefinitions()) {
+ if (measurement.getDataType() == DataType.TRAIT &&
measurement.getDisplayType() == DisplayType.SUMMARY) {
+ traits.add(measurement);
+ }
+ }
+
+ StringLengthValidator notEmptyOrNullValidator = new StringLengthValidator(1,
null, false);
+ StringLengthValidator notNullValidator = new StringLengthValidator(null, null,
false);
+
+ List<FormItem> formItems = new ArrayList<FormItem>();
+
+ if (isHeaderEnabled()) {//conditionally display header
+ HeaderItem headerItem = new HeaderItem("header",
MSG.view_summaryOverviewForm_header_summary());
+ headerItem.setValue(MSG.view_summaryOverviewForm_header_summary());
+ formItems.add(headerItem);
+ }
+
+ // Type
+ StaticTextItem typeItem = new StaticTextItem("type",
MSG.view_summaryOverviewForm_field_type());
+ typeItem.setTooltip(MSG.view_summaryOverviewForm_label_plugin() +
type.getPlugin() + "\n<br>"
+ + MSG.view_summaryOverviewForm_label_type() + type.getName());
+ typeItem.setValue(AncestryUtil.getFormattedType(type));
+ formItems.add(typeItem);
+
+ final Resource resource = this.resourceComposite.getResource();
+ boolean modifiable =
this.resourceComposite.getResourcePermission().isInventory();
+
+ // Name
+ final FormItem nameItem = (modifiable) ? new EditableFormItem() : new
StaticTextItem();
+ nameItem.setName("name");
+ nameItem.setTitle(MSG.view_summaryOverviewForm_field_name());
+ nameItem.setValue(resource.getName());
+ if (nameItem instanceof EditableFormItem) {
+ EditableFormItem togglableNameItem = (EditableFormItem) nameItem;
+ togglableNameItem.setValidators(notEmptyOrNullValidator);
+ togglableNameItem.setValueEditedHandler(new ValueEditedHandler() {
+ public void editedValue(Object newValue) {
+ final String newName = newValue.toString();
+ final String oldName = resource.getName();
+ if (newName.equals(oldName)) {
+ return;
+ }
+ resource.setName(newName);
+ OverviewForm.this.resourceService.updateResource(resource, new
AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.view_summaryOverviewForm_error_nameChangeFailure(String.valueOf(resource.getId()),
+ oldName, newName), caught);
+ // We failed to update it on the Server, so change back the
Resource and the form item to
+ // the original value.
+ resource.setName(oldName);
+ nameItem.setValue(oldName);
+ }
+
+ public void onSuccess(Void result) {
+ titleBar.displayResourceName(newName);
+ CoreGUI.getMessageCenter().notify(
+ new
Message(MSG.view_summaryOverviewForm_message_nameChangeSuccess(String
+ .valueOf(resource.getId()), oldName, newName),
Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(nameItem);
+
+ // Description
+ final FormItem descriptionItem = (modifiable) ? new EditableFormItem() : new
StaticTextItem();
+ descriptionItem.setName("description");
+ descriptionItem.setTitle(MSG.view_summaryOverviewForm_field_description());
+ descriptionItem.setValue(resource.getDescription());
+ if (descriptionItem instanceof EditableFormItem) {
+ EditableFormItem togglableDescriptionItem = (EditableFormItem)
descriptionItem;
+ togglableDescriptionItem.setValidators(notNullValidator);
+ togglableDescriptionItem.setValueEditedHandler(new ValueEditedHandler() {
+ public void editedValue(Object newValue) {
+ final String newDescription = newValue.toString();
+ final String oldDescription = resource.getDescription();
+ if (newDescription.equals(oldDescription)) {
+ return;
+ }
+ resource.setDescription(newDescription);
+ OverviewForm.this.resourceService.updateResource(resource, new
AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.view_summaryOverviewForm_error_descriptionChangeFailure(String.valueOf(resource
+ .getId()), oldDescription, newDescription), caught);
+ // We failed to update it on the Server, so change back the
Resource and the form item to
+ // the original value.
+ resource.setDescription(oldDescription);
+ descriptionItem.setValue(oldDescription);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter()
+ .notify(
+ new
Message(MSG.view_summaryOverviewForm_message_nameChangeSuccess(String
+ .valueOf(resource.getId()), oldDescription,
newDescription),
+ Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(descriptionItem);
+
+ // Location
+ final FormItem locationItem = (modifiable) ? new EditableFormItem() : new
StaticTextItem();
+ locationItem.setName("location");
+ locationItem.setTitle(MSG.view_summaryOverviewForm_field_location());
+ locationItem.setValue(resource.getLocation());
+ if (locationItem instanceof EditableFormItem) {
+ EditableFormItem togglableLocationItem = (EditableFormItem) locationItem;
+ togglableLocationItem.setValidators(notNullValidator);
+ togglableLocationItem.setValueEditedHandler(new ValueEditedHandler() {
+ public void editedValue(Object newValue) {
+ final String newLocation = newValue.toString();
+ final String oldLocation = resource.getLocation();
+ if (newLocation.equals(oldLocation)) {
+ return;
+ }
+ resource.setLocation(newLocation);
+ OverviewForm.this.resourceService.updateResource(resource, new
AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.view_summaryOverviewForm_error_locationChangeFailure(String.valueOf(resource
+ .getId()), oldLocation, newLocation), caught);
+ // We failed to update it on the Server, so change back the
Resource and the form item to
+ // the original value.
+ resource.setLocation(oldLocation);
+ locationItem.setValue(oldLocation);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new
Message(MSG.view_summaryOverviewForm_message_nameChangeSuccess(String
+ .valueOf(resource.getId()), oldLocation,
newLocation), Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(locationItem);
+
+ // Version
+ StaticTextItem versionItem = new StaticTextItem("version",
MSG.view_summaryOverviewForm_field_version());
+ versionItem.setValue((resource.getVersion() != null) ? resource.getVersion() :
"<i>" + MSG.common_label_none()
+ + "</i>");
+ versionItem.setEndRow(true);
+ formItems.add(versionItem);
+
+ // Traits
+ Collections.sort(traits, new Comparator<MeasurementDefinition>() {
+ public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
+ return new
Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
+ }
+ });
+
+ for (MeasurementDefinition trait : traits) {
+ String formItemId =
buildFormItemIdFromTraitDisplayName(trait.getDisplayName());
+ StaticTextItem formItem = new StaticTextItem(formItemId,
trait.getDisplayName());
+ formItem.setTooltip(trait.getDescription());
+ formItems.add(formItem);
+ // item.setValue("?");
+ }
+
+ // SectionItem section = new SectionItem("Summary",
"Summary");
+ // section.setTitle("Summary");
+ // section.setDefaultValue("Summary");
+ // section.setCanCollapse(true);
+ // section.setCellStyle("HidablePlainSectionHeader");
+ // section.setItemIds(itemIds.toArray(new String[itemIds.size()]));
+ // formItems.add(0, section);
+ if (!isDisplayCondensed()) {
+ formItems.add(new SpacerItem());
+ }
+
+ setItems(formItems.toArray(new FormItem[formItems.size()]));
+ }
+
+ public void loadData() {
+ // TODO: Reload the ResourceComposite too.
+ loadTraitValues();
+ markForRedraw();
+ }
+
+ public boolean isHeaderEnabled() {
+ return headerEnabled;
+ }
+
+ public void setHeaderEnabled(boolean headerEnabled) {
+ this.headerEnabled = headerEnabled;
+ }
+
+ public boolean isDisplayCondensed() {
+ return displayCondensed;
+ }
+
+ public void setDisplayCondensed(boolean displayCondensed) {
+ this.displayCondensed = displayCondensed;
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceErrorsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceErrorsDataSource.java
new file mode 100644
index 0000000..0b8f830
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceErrorsDataSource.java
@@ -0,0 +1,106 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+
+import java.util.Date;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.Criteria;
+import org.rhq.core.domain.resource.ResourceError;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Lukas Krejci
+ * @author Simeon Pinder
+ * @author John Mazzitelli
+ */
+public class ResourceErrorsDataSource extends RPCDataSource<ResourceError,
Criteria> {
+
+ public static abstract class Field {
+ public static final String ID = "id";
+ public static final String SUMMARY = "summary";
+ public static final String DETAIL = "detail";
+ public static final String ERROR_TYPE = "errorType";
+ public static final String TIME_OCCURED = "timeOccured";
+ }
+
+ ResourceGWTServiceAsync resourceService;
+ int resourceId;
+
+ public ResourceErrorsDataSource(int resourceId) {
+ resourceService = GWTServiceLookup.getResourceService();
+ this.resourceId = resourceId;
+ List<DataSourceField> fields = addDataSourceFields();
+ addFields(fields);
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response, final
Criteria unused) {
+ resourceService.findResourceErrors(resourceId, new
AsyncCallback<List<ResourceError>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.dataSource_resourceErrors_error_fetchFailure(String.valueOf(resourceId)), caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(List<ResourceError> result) {
+ response.setData(buildRecords(result));
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ @Override
+ protected Criteria getFetchCriteria(DSRequest request) {
+ // we don't use criterias for this datasource, just return null
+ return null;
+ }
+
+ @Override
+ public ResourceError copyValues(Record from) {
+ //This is read-only datasource, so no need to implement this.
+ return null;
+ }
+
+ @Override
+ public ListGridRecord copyValues(ResourceError from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.DETAIL, from.getDetail());
+ record.setAttribute(Field.ERROR_TYPE, from.getErrorType().name());
+ record.setAttribute(Field.SUMMARY, from.getSummary());
+ record.setAttribute(Field.TIME_OCCURED, new Date(from.getTimeOccurred()));
+
+ return record;
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceErrorsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceErrorsView.java
new file mode 100644
index 0000000..c881819
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceErrorsView.java
@@ -0,0 +1,189 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.AutoFitWidthApproach;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceErrorsDataSource.Field;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
+
+public class ResourceErrorsView extends Table<ResourceErrorsDataSource> {
+ private static final String ERROR_ICON = "[SKIN]/Dialog/warn.png";
+
+ public ResourceErrorsView(String locatorId, String string, Criteria criteria, Object
object, String[] strings) {
+ super(locatorId, MSG.common_title_component_errors(), criteria);
+ setWidth100();
+ setHeight100();
+ setShowHeader(false);
+ }
+
+ @Override
+ protected SelectionStyle getDefaultSelectionStyle() {
+ return SelectionStyle.MULTIPLE;
+ }
+
+ @Override
+ protected void configureTable() {
+ ListGridField errorTypeField = new ListGridField(Field.ERROR_TYPE, MSG
+ .dataSource_resourceErrors_field_errorType());
+ errorTypeField.setAlign(Alignment.CENTER);
+ errorTypeField.setAutoFitWidth(true);
+ errorTypeField.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
+
+ ListGridField timeField = new ListGridField(Field.TIME_OCCURED, MSG
+ .dataSource_resourceErrors_field_timeOccured());
+ timeField.setType(ListGridFieldType.DATE);
+ timeField.setAlign(Alignment.CENTER);
+ timeField.setWidth("20%");
+ TimestampCellFormatter.prepareDateField(timeField);
+
+ ListGridField summaryField = new ListGridField(Field.SUMMARY,
MSG.dataSource_resourceErrors_field_summary());
+ summaryField.setAlign(Alignment.CENTER);
+ summaryField.setCellAlign(Alignment.LEFT);
+ summaryField.setWidth("*");
+
+ ListGridField iconField = new ListGridField("icon");
+ iconField.setType(ListGridFieldType.ICON);
+ iconField.setAlign(Alignment.CENTER);
+ iconField.setIcon(ERROR_ICON);
+ iconField.setCellIcon(ERROR_ICON);
+ iconField.setWidth("50");
+ iconField.setCanSort(false);
+ iconField.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ String details = event.getRecord().getAttribute(Field.DETAIL);
+ popupDetails(details);
+ }
+ });
+ iconField.setShowHover(true);
+ iconField.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int
colNum) {
+ String html = record.getAttribute(Field.DETAIL);
+ if (html.length() > 80) {
+ // this was probably an error stack trace, snip it so the tooltip
isn't too big
+ html = "<pre>" + html.substring(0, 80) +
"...</pre><p>"
+ + MSG.dataSource_resourceErrors_clickStatusIcon() +
"</p>";
+ }
+ return html;
+ }
+ });
+
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length > 0) {
+ String details = selectedRows[0].getAttribute(Field.DETAIL);
+ popupDetails(details);
+ }
+ }
+ });
+
+ setListGridFields(errorTypeField, timeField, summaryField, iconField);
+
+ addTableAction(extendLocatorId("delete"), MSG.common_button_delete(),
MSG.common_msg_areYouSure(),
+ new AbstractTableAction(TableActionEnablement.ANY) {
+ @Override
+ public void executeAction(final ListGridRecord[] selection, Object
actionValue) {
+ if (selection == null || selection.length == 0) {
+ return;
+ }
+ int[] resourceErrorIds = new int[selection.length];
+ int i = 0;
+ for (ListGridRecord record : selection) {
+ resourceErrorIds[i++] = record.getAttributeAsInt(Field.ID);
+ }
+
GWTServiceLookup.getResourceService().deleteResourceErrors(resourceErrorIds,
+ new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ Message msg = new
Message(MSG.dataSource_resourceErrors_deleteSuccess(String
+ .valueOf(selection.length)), Severity.Info);
+ CoreGUI.getMessageCenter().notify(msg);
+ refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.dataSource_resourceErrors_deleteFailure(),
+ caught);
+ }
+ });
+ }
+ });
+ }
+
+ private void popupDetails(String details) {
+ final Window winModal = new
LocatableWindow(extendLocatorId("errorDetailsWin"));
+ winModal.setTitle(MSG.common_title_component_errors());
+ winModal.setOverflow(Overflow.VISIBLE);
+ winModal.setShowMinimizeButton(false);
+ winModal.setShowMaximizeButton(true);
+ winModal.setIsModal(true);
+ winModal.setShowModalMask(true);
+ winModal.setAutoSize(true);
+ winModal.setAutoCenter(true);
+ winModal.setShowResizer(true);
+ winModal.setCanDragResize(true);
+ winModal.centerInPage();
+ winModal.addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ winModal.markForDestroy();
+ }
+ });
+
+ LocatableHTMLPane htmlPane = new
LocatableHTMLPane(extendLocatorId("errorDetailsPane"));
+ htmlPane.setMargin(10);
+ htmlPane.setDefaultWidth(700);
+ htmlPane.setDefaultHeight(500);
+ htmlPane.setContents("<pre>" + details +
"</pre>");
+ winModal.addItem(htmlPane);
+ winModal.show();
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index 7bc1cdd..bd86104 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -49,9 +49,6 @@ import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.OverviewForm;
-import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ResourceErrorsDataSource;
-import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ResourceErrorsView;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableImg;
@@ -243,7 +240,7 @@ public class ResourceTitleBar extends LocatableVLayout {
detailsForm.setHeight(10);
detailsForm.setAlign(Alignment.LEFT);
- detailsFormSummary = new
OverviewForm(extendLocatorId("Title_Optional_Summary"), resourceComposite);
+ detailsFormSummary = new
OverviewForm(extendLocatorId("Title_Optional_Summary"), resourceComposite,
this);
detailsFormSummary.setWidth100();
detailsFormSummary.setPadding(3);
detailsFormSummary.setMargin(3);
@@ -294,8 +291,7 @@ public class ResourceTitleBar extends LocatableVLayout {
this.resourceComposite = resourceComposite;
update();
- this.title.setContents("<span
class=\"SectionHeader\">" + resource.getName()
- + "</span> <span
class=\"subtitle\">" + resource.getResourceType().getName() +
"</span>");
+ displayResourceName(resource.getName());
Set<Integer> favorites =
UserSessionManager.getUserPreferences().getFavoriteResources();
this.favorite = favorites.contains(resource.getId());
@@ -310,6 +306,15 @@ public class ResourceTitleBar extends LocatableVLayout {
}
}
+ void displayResourceName(String resourceName) {
+ if (!resource.getName().equals(resourceName)) {
+ resource.setName(resourceName); // the name must have been changed by the
user via the editable field
+ }
+ this.title.setContents("<span class=\"SectionHeader\">"
+ resource.getName()
+ + "</span> <span
class=\"subtitle\">" + resource.getResourceType().getName() +
"</span>");
+ this.title.markForRedraw();
+ }
+
private void updateFavoriteButton() {
this.favoriteButton.setSrc(favorite ? FAV_ICON : NOT_FAV_ICON);
if (favorite) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
deleted file mode 100644
index 3cecbe9..0000000
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.EnumSet;
-import java.util.List;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.HeaderItem;
-import com.smartgwt.client.widgets.form.fields.SpacerItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-
-import org.rhq.core.domain.measurement.DataType;
-import org.rhq.core.domain.measurement.DisplayType;
-import org.rhq.core.domain.measurement.MeasurementDataTrait;
-import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem;
-import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
-import org.rhq.enterprise.gui.coregui.client.components.form.StringLengthValidator;
-import
org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem.ValueEditedHandler;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
-import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
-/**
- * The Resource Summary>Overview tab - Resource general properties + summary traits.
- *
- * @author Greg Hinkle
- * @author Ian Springer
- */
-public class OverviewForm extends EnhancedDynamicForm {
-
- private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService();
- private ResourceComposite resourceComposite;
- private boolean headerEnabled = true;
- private boolean displayCondensed = false;
-
- public OverviewForm(String locatorId, ResourceComposite resourceComposite) {
- super(locatorId);
- this.resourceComposite = resourceComposite;
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- setLeft("10%");
- setWidth("80%");
- if (isDisplayCondensed()) {
- setPadding(5);
- setColWidths(150, 220, 150, 220);
- setWidth("45%");
- }
-
- if (this.resourceComposite != null) {
- setResource(this.resourceComposite);
- }
- }
-
- public void setResource(ResourceComposite resourceComposite) {
-
- this.resourceComposite = resourceComposite;
- Resource resource = resourceComposite.getResource();
-
- // Load metric defs.
-
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- buildForm(type);
- loadTraitValues();
- }
- });
- }
-
- private void loadTraitValues() {
- final Resource resource = resourceComposite.getResource();
-
GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(resource.getId(),
- DisplayType.SUMMARY, new
AsyncCallback<List<MeasurementDataTrait>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_summaryOverviewForm_error_traitsLoadFailure(resource.toString()), caught);
- }
-
- public void onSuccess(List<MeasurementDataTrait> result) {
- for (MeasurementDataTrait trait : result) {
- String formItemId =
buildFormItemIdFromTraitDisplayName(trait.getName());
- FormItem item = getItem(formItemId);
- if (item != null) {
- setValue(formItemId, trait.getValue());
- }
- }
- markForRedraw();
- }
- });
- }
-
- private static String buildFormItemIdFromTraitDisplayName(String traitName) {
- return traitName.replaceAll("\\.", "_").replaceAll("
", "__");
- }
-
- private void buildForm(ResourceType type) {
- List<MeasurementDefinition> traits = new
ArrayList<MeasurementDefinition>();
-
- for (MeasurementDefinition measurement : type.getMetricDefinitions()) {
- if (measurement.getDataType() == DataType.TRAIT &&
measurement.getDisplayType() == DisplayType.SUMMARY) {
- traits.add(measurement);
- }
- }
-
- StringLengthValidator notEmptyOrNullValidator = new StringLengthValidator(1,
null, false);
- StringLengthValidator notNullValidator = new StringLengthValidator(null, null,
false);
-
- List<FormItem> formItems = new ArrayList<FormItem>();
-
- if (isHeaderEnabled()) {//conditionally display header
- HeaderItem headerItem = new HeaderItem("header",
MSG.view_summaryOverviewForm_header_summary());
- headerItem.setValue(MSG.view_summaryOverviewForm_header_summary());
- formItems.add(headerItem);
- }
-
- // Type
- StaticTextItem typeItem = new StaticTextItem("type",
MSG.view_summaryOverviewForm_field_type());
- typeItem.setTooltip(MSG.view_summaryOverviewForm_label_plugin() +
type.getPlugin() + "\n<br>"
- + MSG.view_summaryOverviewForm_label_type() + type.getName());
- typeItem.setValue(AncestryUtil.getFormattedType(type));
- formItems.add(typeItem);
-
- final Resource resource = this.resourceComposite.getResource();
- boolean modifiable =
this.resourceComposite.getResourcePermission().isInventory();
-
- // Name
- final FormItem nameItem = (modifiable) ? new EditableFormItem() : new
StaticTextItem();
- nameItem.setName("name");
- nameItem.setTitle(MSG.view_summaryOverviewForm_field_name());
- nameItem.setValue(resource.getName());
- if (nameItem instanceof EditableFormItem) {
- EditableFormItem togglableNameItem = (EditableFormItem) nameItem;
- togglableNameItem.setValidators(notEmptyOrNullValidator);
- togglableNameItem.setValueEditedHandler(new ValueEditedHandler() {
- public void editedValue(Object newValue) {
- final String newName = newValue.toString();
- final String oldName = resource.getName();
- if (newName.equals(oldName)) {
- return;
- }
- resource.setName(newName);
- OverviewForm.this.resourceService.updateResource(resource, new
AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_summaryOverviewForm_error_nameChangeFailure(String.valueOf(resource.getId()),
- oldName, newName), caught);
- // We failed to update it on the Server, so change back the
Resource and the form item to
- // the original value.
- resource.setName(oldName);
- nameItem.setValue(oldName);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new
Message(MSG.view_summaryOverviewForm_message_nameChangeSuccess(String
- .valueOf(resource.getId()), oldName, newName),
Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(nameItem);
-
- // Description
- final FormItem descriptionItem = (modifiable) ? new EditableFormItem() : new
StaticTextItem();
- descriptionItem.setName("description");
- descriptionItem.setTitle(MSG.view_summaryOverviewForm_field_description());
- descriptionItem.setValue(resource.getDescription());
- if (descriptionItem instanceof EditableFormItem) {
- EditableFormItem togglableDescriptionItem = (EditableFormItem)
descriptionItem;
- togglableDescriptionItem.setValidators(notNullValidator);
- togglableDescriptionItem.setValueEditedHandler(new ValueEditedHandler() {
- public void editedValue(Object newValue) {
- final String newDescription = newValue.toString();
- final String oldDescription = resource.getDescription();
- if (newDescription.equals(oldDescription)) {
- return;
- }
- resource.setDescription(newDescription);
- OverviewForm.this.resourceService.updateResource(resource, new
AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_summaryOverviewForm_error_descriptionChangeFailure(String.valueOf(resource
- .getId()), oldDescription, newDescription), caught);
- // We failed to update it on the Server, so change back the
Resource and the form item to
- // the original value.
- resource.setDescription(oldDescription);
- descriptionItem.setValue(oldDescription);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter()
- .notify(
- new
Message(MSG.view_summaryOverviewForm_message_nameChangeSuccess(String
- .valueOf(resource.getId()), oldDescription,
newDescription),
- Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(descriptionItem);
-
- // Location
- final FormItem locationItem = (modifiable) ? new EditableFormItem() : new
StaticTextItem();
- locationItem.setName("location");
- locationItem.setTitle(MSG.view_summaryOverviewForm_field_location());
- locationItem.setValue(resource.getLocation());
- if (locationItem instanceof EditableFormItem) {
- EditableFormItem togglableLocationItem = (EditableFormItem) locationItem;
- togglableLocationItem.setValidators(notNullValidator);
- togglableLocationItem.setValueEditedHandler(new ValueEditedHandler() {
- public void editedValue(Object newValue) {
- final String newLocation = newValue.toString();
- final String oldLocation = resource.getLocation();
- if (newLocation.equals(oldLocation)) {
- return;
- }
- resource.setLocation(newLocation);
- OverviewForm.this.resourceService.updateResource(resource, new
AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_summaryOverviewForm_error_locationChangeFailure(String.valueOf(resource
- .getId()), oldLocation, newLocation), caught);
- // We failed to update it on the Server, so change back the
Resource and the form item to
- // the original value.
- resource.setLocation(oldLocation);
- locationItem.setValue(oldLocation);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new
Message(MSG.view_summaryOverviewForm_message_nameChangeSuccess(String
- .valueOf(resource.getId()), oldLocation,
newLocation), Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(locationItem);
-
- // Version
- StaticTextItem versionItem = new StaticTextItem("version",
MSG.view_summaryOverviewForm_field_version());
- versionItem.setValue((resource.getVersion() != null) ? resource.getVersion() :
"<i>" + MSG.common_label_none()
- + "</i>");
- versionItem.setEndRow(true);
- formItems.add(versionItem);
-
- // Traits
- Collections.sort(traits, new Comparator<MeasurementDefinition>() {
- public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
- return new
Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
- }
- });
-
- for (MeasurementDefinition trait : traits) {
- String formItemId =
buildFormItemIdFromTraitDisplayName(trait.getDisplayName());
- StaticTextItem formItem = new StaticTextItem(formItemId,
trait.getDisplayName());
- formItem.setTooltip(trait.getDescription());
- formItems.add(formItem);
- // item.setValue("?");
- }
-
- // SectionItem section = new SectionItem("Summary",
"Summary");
- // section.setTitle("Summary");
- // section.setDefaultValue("Summary");
- // section.setCanCollapse(true);
- // section.setCellStyle("HidablePlainSectionHeader");
- // section.setItemIds(itemIds.toArray(new String[itemIds.size()]));
- // formItems.add(0, section);
- if (!isDisplayCondensed()) {
- formItems.add(new SpacerItem());
- }
-
- setItems(formItems.toArray(new FormItem[formItems.size()]));
- }
-
- public void loadData() {
- // TODO: Reload the ResourceComposite too.
- loadTraitValues();
- markForRedraw();
- }
-
- public boolean isHeaderEnabled() {
- return headerEnabled;
- }
-
- public void setHeaderEnabled(boolean headerEnabled) {
- this.headerEnabled = headerEnabled;
- }
-
- public boolean isDisplayCondensed() {
- return displayCondensed;
- }
-
- public void setDisplayCondensed(boolean displayCondensed) {
- this.displayCondensed = displayCondensed;
- }
-
-}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsDataSource.java
deleted file mode 100644
index be76956..0000000
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsDataSource.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
-
-import java.util.Date;
-import java.util.List;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.rpc.RPCResponse;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-
-import org.rhq.core.domain.criteria.Criteria;
-import org.rhq.core.domain.resource.ResourceError;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
-/**
- * @author Lukas Krejci
- * @author Simeon Pinder
- * @author John Mazzitelli
- */
-public class ResourceErrorsDataSource extends RPCDataSource<ResourceError,
Criteria> {
-
- public static abstract class Field {
- public static final String ID = "id";
- public static final String SUMMARY = "summary";
- public static final String DETAIL = "detail";
- public static final String ERROR_TYPE = "errorType";
- public static final String TIME_OCCURED = "timeOccured";
- }
-
- ResourceGWTServiceAsync resourceService;
- int resourceId;
-
- public ResourceErrorsDataSource(int resourceId) {
- resourceService = GWTServiceLookup.getResourceService();
- this.resourceId = resourceId;
- List<DataSourceField> fields = addDataSourceFields();
- addFields(fields);
- }
-
- @Override
- protected void executeFetch(final DSRequest request, final DSResponse response, final
Criteria unused) {
- resourceService.findResourceErrors(resourceId, new
AsyncCallback<List<ResourceError>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.dataSource_resourceErrors_error_fetchFailure(String.valueOf(resourceId)), caught);
- response.setStatus(RPCResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
-
- public void onSuccess(List<ResourceError> result) {
- response.setData(buildRecords(result));
- processResponse(request.getRequestId(), response);
- }
- });
- }
-
- @Override
- protected Criteria getFetchCriteria(DSRequest request) {
- // we don't use criterias for this datasource, just return null
- return null;
- }
-
- @Override
- public ResourceError copyValues(Record from) {
- //This is read-only datasource, so no need to implement this.
- return null;
- }
-
- @Override
- public ListGridRecord copyValues(ResourceError from) {
- ListGridRecord record = new ListGridRecord();
-
- record.setAttribute(Field.ID, from.getId());
- record.setAttribute(Field.DETAIL, from.getDetail());
- record.setAttribute(Field.ERROR_TYPE, from.getErrorType().name());
- record.setAttribute(Field.SUMMARY, from.getSummary());
- record.setAttribute(Field.TIME_OCCURED, new Date(from.getTimeOccurred()));
-
- return record;
- }
-}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsView.java
deleted file mode 100644
index e4e62e8..0000000
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsView.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.AutoFitWidthApproach;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
-import com.smartgwt.client.widgets.events.DoubleClickEvent;
-import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.grid.HoverCustomizer;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
-import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ResourceErrorsDataSource.Field;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
-
-public class ResourceErrorsView extends Table<ResourceErrorsDataSource> {
- private static final String ERROR_ICON = "[SKIN]/Dialog/warn.png";
-
- public ResourceErrorsView(String locatorId, String string, Criteria criteria, Object
object, String[] strings) {
- super(locatorId, MSG.common_title_component_errors(), criteria);
- setWidth100();
- setHeight100();
- setShowHeader(false);
- }
-
- @Override
- protected SelectionStyle getDefaultSelectionStyle() {
- return SelectionStyle.MULTIPLE;
- }
-
- @Override
- protected void configureTable() {
- ListGridField errorTypeField = new ListGridField(Field.ERROR_TYPE, MSG
- .dataSource_resourceErrors_field_errorType());
- errorTypeField.setAlign(Alignment.CENTER);
- errorTypeField.setAutoFitWidth(true);
- errorTypeField.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
-
- ListGridField timeField = new ListGridField(Field.TIME_OCCURED, MSG
- .dataSource_resourceErrors_field_timeOccured());
- timeField.setType(ListGridFieldType.DATE);
- timeField.setAlign(Alignment.CENTER);
- timeField.setWidth("20%");
- TimestampCellFormatter.prepareDateField(timeField);
-
- ListGridField summaryField = new ListGridField(Field.SUMMARY,
MSG.dataSource_resourceErrors_field_summary());
- summaryField.setAlign(Alignment.CENTER);
- summaryField.setCellAlign(Alignment.LEFT);
- summaryField.setWidth("*");
-
- ListGridField iconField = new ListGridField("icon");
- iconField.setType(ListGridFieldType.ICON);
- iconField.setAlign(Alignment.CENTER);
- iconField.setIcon(ERROR_ICON);
- iconField.setCellIcon(ERROR_ICON);
- iconField.setWidth("50");
- iconField.setCanSort(false);
- iconField.addRecordClickHandler(new RecordClickHandler() {
- @Override
- public void onRecordClick(RecordClickEvent event) {
- String details = event.getRecord().getAttribute(Field.DETAIL);
- popupDetails(details);
- }
- });
- iconField.setShowHover(true);
- iconField.setHoverCustomizer(new HoverCustomizer() {
- @Override
- public String hoverHTML(Object value, ListGridRecord record, int rowNum, int
colNum) {
- String html = record.getAttribute(Field.DETAIL);
- if (html.length() > 80) {
- // this was probably an error stack trace, snip it so the tooltip
isn't too big
- html = "<pre>" + html.substring(0, 80) +
"...</pre><p>"
- + MSG.dataSource_resourceErrors_clickStatusIcon() +
"</p>";
- }
- return html;
- }
- });
-
- setListGridDoubleClickHandler(new DoubleClickHandler() {
- @Override
- public void onDoubleClick(DoubleClickEvent event) {
- ListGrid listGrid = (ListGrid) event.getSource();
- ListGridRecord[] selectedRows = listGrid.getSelection();
- if (selectedRows != null && selectedRows.length > 0) {
- String details = selectedRows[0].getAttribute(Field.DETAIL);
- popupDetails(details);
- }
- }
- });
-
- setListGridFields(errorTypeField, timeField, summaryField, iconField);
-
- addTableAction(extendLocatorId("delete"), MSG.common_button_delete(),
MSG.common_msg_areYouSure(),
- new AbstractTableAction(TableActionEnablement.ANY) {
- @Override
- public void executeAction(final ListGridRecord[] selection, Object
actionValue) {
- if (selection == null || selection.length == 0) {
- return;
- }
- int[] resourceErrorIds = new int[selection.length];
- int i = 0;
- for (ListGridRecord record : selection) {
- resourceErrorIds[i++] = record.getAttributeAsInt(Field.ID);
- }
-
GWTServiceLookup.getResourceService().deleteResourceErrors(resourceErrorIds,
- new AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- Message msg = new
Message(MSG.dataSource_resourceErrors_deleteSuccess(String
- .valueOf(selection.length)), Severity.Info);
- CoreGUI.getMessageCenter().notify(msg);
- refresh();
- }
-
- @Override
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.dataSource_resourceErrors_deleteFailure(),
- caught);
- }
- });
- }
- });
- }
-
- private void popupDetails(String details) {
- final Window winModal = new
LocatableWindow(extendLocatorId("errorDetailsWin"));
- winModal.setTitle(MSG.common_title_component_errors());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setShowMaximizeButton(true);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setAutoSize(true);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- LocatableHTMLPane htmlPane = new
LocatableHTMLPane(extendLocatorId("errorDetailsPane"));
- htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(700);
- htmlPane.setDefaultHeight(500);
- htmlPane.setContents("<pre>" + details +
"</pre>");
- winModal.addItem(htmlPane);
- winModal.show();
- }
-}
commit 5422bf4365ea656d41399ec67a4c91cf573b9f0e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Mar 31 16:50:13 2011 -0400
Button Enablement Work
- Disable group Delete and New buttons for non inv-managers
- Disable uninventory button for non-resource-delete users
- updated text for delete perm on role detail page
- Added some support for authorized button enablement
(see AuthorizedTableAction)
- Added an interface for record extraction (see RecordExtractor)
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AuthorizedTableAction.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AuthorizedTableAction.java
new file mode 100644
index 0000000..710aa53
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AuthorizedTableAction.java
@@ -0,0 +1,95 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
+
+/**
+ * This class allows for TableAction (ie. Button) enablement based on row selection and
global perm authorization.
+ *
+ * For Resource Perm authorization see {@link ResourceAuthorizedTableAction}.
+ *
+ * @author Jay Shaughnessy
+ */
+public abstract class AuthorizedTableAction extends AbstractTableAction {
+
+ Table<?> table;
+
+ HashSet<Permission> globalPermissions = new HashSet<Permission>();
+
+ Boolean isGlobalAuthorized;
+
+ protected AuthorizedTableAction(Table<?> table, Permission... permissions) {
+ this(table, TableActionEnablement.ALWAYS, permissions);
+ }
+
+ protected AuthorizedTableAction(Table<?> table, TableActionEnablement
enablement, Permission... permissions) {
+ super(enablement);
+
+ this.table = table;
+
+ for (Permission p : permissions) {
+ switch (p.getTarget()) {
+ case GLOBAL:
+ globalPermissions.add(p);
+ break;
+ case RESOURCE:
+ throw new IllegalArgumentException("Does not support Resource
permissions");
+ }
+ }
+
+ if (globalPermissions.isEmpty()) {
+ isGlobalAuthorized = Boolean.TRUE;
+ }
+ }
+
+ @Override
+ public boolean isEnabled(ListGridRecord[] selection) {
+ if (!super.isEnabled(selection)) {
+ return false;
+ }
+
+ if (null == isGlobalAuthorized) {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new
PermissionsLoadedListener() {
+
+ public void onPermissionsLoaded(Set<Permission> grantedPermissions)
{
+ for (Permission requiredPermission : globalPermissions) {
+ if (!grantedPermissions.contains(requiredPermission)) {
+ return;
+ }
+ }
+ isGlobalAuthorized = true;
+ table.refreshTableInfo();
+ }
+ });
+
+ return false;
+ }
+
+ return isGlobalAuthorized;
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/RecordExtractor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/RecordExtractor.java
new file mode 100644
index 0000000..1fe84d0
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/RecordExtractor.java
@@ -0,0 +1,38 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import java.util.Collection;
+
+import com.smartgwt.client.data.Record;
+
+/**
+ * Typically used for anaonymous class definition for extracting any data from a set of
Records, typically
+ * ListGridRecords. For example, a utility that needs the resource ids extracted from
the record set's attributes
+ * but does not know what the attributes are, could be passed a RecordExtractor.
+ *
+ * @author Jay Shaughnessy
+ *
+ */
+public interface RecordExtractor<T extends Object> {
+
+ Collection<T> extract(Record[] records);
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/ResourceAuthorizedTableAction.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/ResourceAuthorizedTableAction.java
new file mode 100644
index 0000000..8931446
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/ResourceAuthorizedTableAction.java
@@ -0,0 +1,101 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import java.util.Collection;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.authz.Permission.Target;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+/**
+ * This class allows for TableAction (ie. Button) enablement based on row selection and
resource perm authorization
+ * on the selected rows. If possible it is recommended that the table be built using
composites that include the
+ * resource permission information already, as performance will be better. This approach
will require an async
+ * authz call to the server on each refresh of the TableActions (i.e. each time selection
changes in the Table).
+ *
+ * For Global Perm authorization see {@link AuthorizedTableAction}.
+ *
+ * TODO: This class has yet to be tested.
+ *
+ * @author Jay Shaughnessy
+ */
+public abstract class ResourceAuthorizedTableAction extends AbstractTableAction {
+
+ Table<?> table;
+ Permission requiredPermission;
+ RecordExtractor<Integer> extractor;
+
+ Boolean isAuthorized;
+
+ protected ResourceAuthorizedTableAction(Table<?> table, Permission
requiredPermission,
+ RecordExtractor<Integer> extractor) {
+ this(table, TableActionEnablement.ALWAYS, requiredPermission, extractor);
+ }
+
+ protected ResourceAuthorizedTableAction(Table<?> table, TableActionEnablement
enablement,
+ Permission requiredPermission, RecordExtractor<Integer> extractor) {
+ super(enablement);
+
+ this.table = table;
+ this.requiredPermission = requiredPermission;
+ this.extractor = extractor;
+
+ if (Target.RESOURCE != this.requiredPermission.getTarget()) {
+ throw new IllegalArgumentException("Does not support Global
permission");
+ }
+ }
+
+ @Override
+ public boolean isEnabled(ListGridRecord[] selection) {
+ // first make sure row selection enablement passes
+ if (!super.isEnabled(selection)) {
+ return false;
+ }
+
+ // if we've performed the required auth check, return the result and reset.
+ if (null != isAuthorized) {
+ boolean result = isAuthorized;
+ isAuthorized = null;
+ return result;
+ }
+
+ // otherwise, kick off the async auth check. return false initially and update
when the async call returns
+ Collection<Integer> resourceIds = extractor.extract(selection);
+
GWTServiceLookup.getAuthorizationService().hasResourcePermission(requiredPermission,
resourceIds,
+ new AsyncCallback<Boolean>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("", caught);
+ }
+
+ public void onSuccess(Boolean result) {
+ isAuthorized = result;
+ table.refreshTableInfo();
+ }
+
+ });
+
+ return false;
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AuthorizationGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AuthorizationGWTService.java
index 249a655..3d14c3a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AuthorizationGWTService.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AuthorizationGWTService.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
+import java.util.Collection;
import java.util.Set;
import com.google.gwt.user.client.rpc.RemoteService;
@@ -72,4 +73,17 @@ public interface AuthorizationGWTService extends RemoteService {
*/
Set<Permission> getExplicitGlobalPermissions() throws RuntimeException;
+ /**
+ * Returns true if the current user possesses either: 1) the specified resource
permission for *all* of the
+ * specified resources, or 2) the global MANAGE_INVENTORY permission which, by
definition, gives full access to the
+ * inventory (all resources and all groups) NOTE: The size of the collection must be
less than or equal to 1000 (due
+ * to an Oracle limitation).
+ *
+ * @param permission a resource permission (i.e. permission.getTarget() ==
Permission.Target.RESOURCE)
+ * @param resourceIds the ids of some Resources to check permissions against (size
of collection must be <= 1000)
+ *
+ * @return true if the current user possesses the specified resource permission for
the specified resource
+ */
+ boolean hasResourcePermission(Permission permission, Collection<Integer>
resourceIds);
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index 8ed410d..066b4a2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -40,12 +40,14 @@ import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.search.SearchSubsystem;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.AuthorizedTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -169,7 +171,8 @@ public class ResourceGroupListView extends
Table<ResourceGroupCompositeDataSourc
if (this.showDeleteButton) {
addTableAction(extendLocatorId("Delete"),
MSG.common_button_delete(), MSG.common_msg_areYouSure(),
- new AbstractTableAction(TableActionEnablement.ANY) {
+ new AuthorizedTableAction(this, TableActionEnablement.ANY,
Permission.MANAGE_INVENTORY) {
+
public void executeAction(ListGridRecord[] selections, Object
actionValue) {
int[] groupIds = new int[selections.length];
int index = 0;
@@ -195,7 +198,8 @@ public class ResourceGroupListView extends
Table<ResourceGroupCompositeDataSourc
}
if (this.showNewButton) {
- addTableAction(extendLocatorId("New"), MSG.common_button_new(), new
AbstractTableAction() {
+ addTableAction(extendLocatorId("New"), MSG.common_button_new(), new
AuthorizedTableAction(this,
+ Permission.MANAGE_INVENTORY) {
public void executeAction(ListGridRecord[] selection, Object actionValue)
{
new GroupCreateWizard(ResourceGroupListView.this).startWizard();
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index 27e67d7..32a6227 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -26,10 +26,12 @@ import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceD
import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
@@ -41,13 +43,15 @@ import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.search.SearchSubsystem;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.RecordExtractor;
+import
org.rhq.enterprise.gui.coregui.client.components.table.ResourceAuthorizedTableAction;
import
org.rhq.enterprise.gui.coregui.client.components.table.ResourceCategoryCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
@@ -100,6 +104,7 @@ public class ResourceSearchView extends Table {
*
* @param headerIcons 24x24 icon(s) to be displayed in the header
*/
+ @SuppressWarnings("unchecked")
public ResourceSearchView(String locatorId, Criteria criteria, String title,
SortSpecifier[] sortSpecifier,
String[] excludeFields, String... headerIcons) {
super(locatorId, title, criteria, sortSpecifier, excludeFields);
@@ -177,7 +182,19 @@ public class ResourceSearchView extends Table {
categoryField, availabilityField);
addTableAction(extendLocatorId("Uninventory"),
MSG.common_button_uninventory(), MSG
- .view_inventory_resources_uninventoryConfirm(), new
AbstractTableAction(TableActionEnablement.ANY) {
+ .view_inventory_resources_uninventoryConfirm(), new
ResourceAuthorizedTableAction(ResourceSearchView.this,
+ TableActionEnablement.ANY, Permission.DELETE_RESOURCE, new
RecordExtractor<Integer>() {
+
+ public Collection<Integer> extract(Record[] records) {
+ List<Integer> result = new
ArrayList<Integer>(records.length);
+ for (Record record : records) {
+ result.add(record.getAttributeAsInt("id"));
+ }
+
+ return result;
+ }
+ }) {
+
public void executeAction(ListGridRecord[] selection, Object actionValue) {
int[] resourceIds = TableUtility.getIds(selection);
ResourceGWTServiceAsync resourceManager =
GWTServiceLookup.getResourceService();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
index bf56c99..d31b5d8 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
@@ -18,11 +18,11 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.AuthorizationGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
@@ -83,4 +83,13 @@ public class AuthorizationGWTServiceImpl extends AbstractGWTServiceImpl
implemen
}
}
+ public boolean hasResourcePermission(Permission permission, Collection<Integer>
resourceIds) {
+ try {
+ boolean result =
authorizationManager.hasResourcePermission(getSessionSubject(), permission, resourceIds);
+ return result;
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 1867bf7..26b3bf0 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -702,7 +702,7 @@ view_adminRoles_permissions_permReadDesc_createChildResources =
(IMPLIED) view c
view_adminRoles_permissions_permWriteDesc_createChildResources = create new child
Resources (for child Resources of types that are creatable)
view_adminRoles_permissions_perm_deleteChildResources = Delete Child Resources
view_adminRoles_permissions_permReadDesc_deleteChildResources = (IMPLIED) view child
Resource deletion history
-view_adminRoles_permissions_permWriteDesc_deleteChildResources = delete child Resources
(for child Resources of types that are deletable)
+view_adminRoles_permissions_permWriteDesc_deleteChildResources = uninventory resources;
delete Resources (for Resources of types that are deletable)
# Administration/Topology/RemoteAgentInstall/#
#--------------------------------
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 30c2334..fdfb2d1 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -267,6 +267,9 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
}
// make sure the user is authorized to delete this resource (which implies you
can delete all its children)
+ // TODO: There is a pretty good argument for this being replaced with
MANAGE_INVENTORY. It takes an
+ // inventory manager to import resources, so why not to remove them? But, since
no one has complained
+ // we're timid about making a change that may hamstring existing setups.
if (!authorizationManager.hasResourcePermission(user, Permission.DELETE_RESOURCE,
resourceId)) {
throw new PermissionException("You do not have permission to uninventory
resource [" + resourceId + "]");
}
commit 0ac2a805a2ebdeb345a6058fb77695f3ec907ac1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 31 16:04:47 2011 -0400
BZ 692299 - correct the resource link
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
index b4e1257..87c8b14 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
@@ -47,7 +47,7 @@ public class GroupMemberResourceOperationHistoryListView extends
resourceField.setWidth("25%");
resourceField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
- String url =
LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("id"));
+ String url =
LinkManager.getResourceLink(listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
return SeleniumUtility.getLocatableHref(url, o.toString(), null);
}
});
commit 8bd52cd028bd7fc6547c52c846de539fd46a21aa
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 31 15:39:49 2011 -0400
BZ 610791 - hide the event tracking bar in the monitor graphs jsf page since its
broken. we'll fix this kind of display when we move the graph page to gwt
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/measurement/graphs/EventsTimelineUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/measurement/graphs/EventsTimelineUIBean.java
index 5f9fb22..b7461c3 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/measurement/graphs/EventsTimelineUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/measurement/graphs/EventsTimelineUIBean.java
@@ -47,8 +47,11 @@ public class EventsTimelineUIBean {
context = WebUtility.getEntityContext();
+ /* see BZ 610791
EventSeverity[] eventsCounts =
eventManager.getSeverityBucketsByContext(user.getSubject(), context, begin, end,
numberOfBuckets);
+ */
+ EventSeverity[] eventsCounts = new EventSeverity[numberOfBuckets]; // dummy event
counts, all nulls, for BZ 610791
data = new ArrayList<TimelineBean>();
long interval = TimeUtil.getInterval(begin, end, numberOfBuckets);
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/events/data-plain.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/events/data-plain.xhtml
index 068f97b..90b09cc 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/events/data-plain.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/events/data-plain.xhtml
@@ -55,6 +55,7 @@
<td colspan="62" style="height: 2px;"></td>
</tr>
+ <!-- BZ 610791
<tr style="height: 12px;">
<td></td>
<c:forEach var="timeTick" items="#{EventsTimelineUIBean.data}"
varStatus="status">
@@ -84,7 +85,6 @@
</c:choose>
</c:if>
- <!-- put onmousedown in table data element not the div, which gives the user a
larger clickable area -->
<c:if test="#{empty timeTick.severity}">
<td style="background-image: url(#{icon});
background-repeat:no-repeat;" align="center" valign="middle">
</td>
@@ -102,7 +102,7 @@
<h:outputFormat
value="#{msg['resource.common.monitor.label.elc']}" />
</td>
</tr>
-
+ -->
<tr>
<td colspan="62" valign="top">
<a name="eventDetail"></a>
commit a3356e841e795aeaea76903e5b10bc0fef82c0fd
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Mar 31 10:07:12 2011 -0400
enable refresh for config changes and hide refresh button for portlets.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
index 013e5be..388094a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/AbstractRecentAlertsPortlet.java
@@ -66,6 +66,7 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
setShowFilterForm(false); //disable filter form for portlet
setOverflow(Overflow.VISIBLE);
+ setShowFooterRefresh(false); //disable footer refresh button as redundant for
portlets
}
public Timer getRefreshTimer() {
@@ -171,6 +172,8 @@ public abstract class AbstractRecentAlertsPortlet extends
AlertHistoryView imple
// persist and reload portlet
storedPortlet.setConfiguration(portletConfig);
configure(portletWindow, storedPortlet);
+ //apply latest settings to the visible result set
+ refresh();
}
});
commit 1756884b035d86857aba75d826fd19ef4a5a153b
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Mar 30 19:01:51 2011 -0400
BZ 689993: enable start/stop WAIT_MAX for AS4 and Tomcat server components.
diff --git
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
index 8e967ae..f241200 100644
---
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
+++
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
@@ -133,6 +133,8 @@ public class JBossASServerComponent implements MeasurementFacet,
OperationFacet,
public static final String SCRIPT_PREFIX_CONFIG_PROP = "scriptPrefix";
public static final String CONFIGURATION_SET_CONFIG_PROP =
"configurationSet";
public static final String START_SCRIPT_CONFIG_PROP = "startScript";
+ public static final String START_WAIT_MAX_PROP = "startWaitMax";
+ public static final String STOP_WAIT_MAX_PROP = "stopWaitMax";
public static final String SHUTDOWN_SCRIPT_CONFIG_PROP = "shutdownScript";
public static final String SHUTDOWN_MBEAN_CONFIG_PROP =
"shutdownMbeanName";
public static final String SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP =
"shutdownMbeanOperation";
diff --git
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerOperationsDelegate.java
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerOperationsDelegate.java
index 7bb941d..269f16c 100644
---
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerOperationsDelegate.java
+++
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerOperationsDelegate.java
@@ -1,25 +1,25 @@
- /*
- * Jopr Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * Jopr Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.plugins.jbossas;
import java.io.File;
@@ -34,6 +34,7 @@ import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.mc4j.ems.connection.bean.parameter.EmsParameter;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.operation.OperationResult;
import org.rhq.core.pluginapi.util.ProcessExecutionUtility;
@@ -51,7 +52,7 @@ import org.rhq.core.system.SystemInfo;
public class JBossASServerOperationsDelegate {
/** max amount of time to wait for server to show as unavailable after executing stop
- in milliseconds */
- private static final long STOP_WAIT_MAX = 1000L * 150; // 2.5 minutes
+ private static long STOP_WAIT_MAX = 1000L * 150; // 2.5 minutes
/** amount of time to wait between availability checks when performing a stop - in
milliseconds */
private static final long STOP_WAIT_INTERVAL = 1000L * 10; // 10 seconds
@@ -61,7 +62,7 @@ public class JBossASServerOperationsDelegate {
private static final long STOP_WAIT_FINAL = 1000L * 30; // 30 seconds
/** max amount of time to wait for start to complete - in milliseconds */
- private static final long START_WAIT_MAX = 1000L * 300; // 5 minutes
+ private static long START_WAIT_MAX = 1000L * 300; // 5 minutes
/** amount of time to wait between availability checks when performing a start - in
milliseconds */
private static final long START_WAIT_INTERVAL = 1000L * 10; // 10 seconds
@@ -369,24 +370,34 @@ public class JBossASServerOperationsDelegate {
try {
shutdown();
} catch (Exception e) {
- throw new RuntimeException("Shutdown may have failed: " +e );
+ throw new RuntimeException("Shutdown may have failed: " + e);
}
-
try {
// Perform the restart.
start();
} catch (Exception e) {
- throw new RuntimeException("Re-Startup may have failed: " +e );
+ throw new RuntimeException("Re-Startup may have failed: " + e);
}
- return"Server has been restarted.";
+ return "Server has been restarted.";
}
private AvailabilityType waitForServerToStart(long start) throws InterruptedException
{
AvailabilityType avail;
+ //detect whether startWaitMax property has been set.
+ Configuration pluginConfig = serverComponent.getPluginConfiguration();
+ PropertySimple property =
pluginConfig.getSimple(JBossASServerComponent.START_WAIT_MAX_PROP);
+ //if set and valid, update startWaitMax value
+ if ((property != null) && (property.getIntegerValue() != null)) {
+ int newValue = property.getIntegerValue();
+ if (newValue >= 1) {
+ START_WAIT_MAX = 1000L * 60 * newValue;
+ }
+ }
+
while (((avail = this.serverComponent.getAvailability()) ==
AvailabilityType.DOWN)
&& (System.currentTimeMillis() < (start + START_WAIT_MAX))) {
try {
@@ -399,6 +410,17 @@ public class JBossASServerOperationsDelegate {
}
private AvailabilityType waitForServerToShutdown() {
+ //detect whether stopWaitMax property has been set.
+ Configuration pluginConfig = serverComponent.getPluginConfiguration();
+ PropertySimple property =
pluginConfig.getSimple(JBossASServerComponent.STOP_WAIT_MAX_PROP);
+ //if set and valid, update startWaitMax value
+ if ((property != null) && (property.getIntegerValue() != null)) {
+ int newValue = property.getIntegerValue();
+ if (newValue >= 1) {
+ STOP_WAIT_MAX = 1000L * 60 * newValue;
+ }
+ }
+
for (long wait = 0L; (wait < STOP_WAIT_MAX) && (AvailabilityType.UP ==
this.serverComponent.getAvailability()); wait += STOP_WAIT_INTERVAL) {
try {
Thread.sleep(STOP_WAIT_INTERVAL);
diff --git a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
index 28240ef..192c7f1 100644
--- a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
@@ -74,6 +74,19 @@
description="The absolute path to a JRE or JDK
installation directory containing
the JVM that should be used to start and
shutdown the JBossAS instance;
defaults to the home directory of the RHQ
agent JRE."/>
+
+ <c:simple-property name="startWaitMax"
required="false"
+ description="The time, in minutes,(e.g. 1 or 8) that
must elapse before the server is considered to have failed to start up. The default is 5
minutes.">
+ <c:constraint>
+ <c:integer-constraint minimum="1"/>
+ </c:constraint>
+ </c:simple-property>
+ <c:simple-property name="stopWaitMax"
required="false"
+ description="The time, in minutes,(e.g. 1 or 8) that
must elapse before the server is considered to have failed to stop. The default is 2.5
minutes.">
+ <c:constraint>
+ <c:integer-constraint minimum="1"/>
+ </c:constraint>
+ </c:simple-property>
</c:group>
<c:group name="event" displayName="Events">
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
index 89cbd72..d67f072 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
@@ -104,6 +104,8 @@ public class TomcatServerComponent implements JMXComponent,
MeasurementFacet, Op
public static final String PLUGIN_CONFIG_SCRIPT_PREFIX = "scriptPrefix";
public static final String PLUGIN_CONFIG_SHUTDOWN_SCRIPT =
"shutdownScript";
public static final String PLUGIN_CONFIG_START_SCRIPT = "startScript";
+ public static final String START_WAIT_MAX_PROP = "startWaitMax";
+ public static final String STOP_WAIT_MAX_PROP = "stopWaitMax";
private Log log = LogFactory.getLog(this.getClass());
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerOperationsDelegate.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerOperationsDelegate.java
index b0f3f7c..ce542a9 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerOperationsDelegate.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerOperationsDelegate.java
@@ -41,6 +41,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.operation.OperationResult;
import org.rhq.core.pluginapi.util.ProcessExecutionUtility;
@@ -64,7 +65,7 @@ public class TomcatServerOperationsDelegate {
private static final String SERVER_MBEAN_NAME = "Catalina:type=Server";
/** max amount of time to wait for server to show as unavailable after executing stop
- in milliseconds */
- private static final long STOP_WAIT_MAX = 1000L * 150; // 2.5 minutes
+ private static long STOP_WAIT_MAX = 1000L * 150; // 2.5 minutes
/** amount of time to wait between availability checks when performing a stop - in
milliseconds */
private static final long STOP_WAIT_INTERVAL = 1000L * 10; // 10 seconds
@@ -74,7 +75,7 @@ public class TomcatServerOperationsDelegate {
private static final long STOP_WAIT_FINAL = 1000L * 30; // 30 seconds
/** max amount of time to wait for start to complete - in milliseconds */
- private static final long START_WAIT_MAX = 1000L * 300; // 5 minutes
+ private static long START_WAIT_MAX = 1000L * 300; // 5 minutes
/** amount of time to wait between availability checks when performing a start - in
milliseconds */
private static final long START_WAIT_INTERVAL = 1000L * 10; // 10 seconds
@@ -466,6 +467,18 @@ public class TomcatServerOperationsDelegate {
private AvailabilityType waitForServerToStart(long start) throws InterruptedException
{
AvailabilityType avail;
+
+ //detect whether startWaitMax property has been set.
+ Configuration pluginConfig =
serverComponent.getResourceContext().getPluginConfiguration();
+ PropertySimple property =
pluginConfig.getSimple(TomcatServerComponent.START_WAIT_MAX_PROP);
+ //if set and valid, update startWaitMax value
+ if ((property != null) && (property.getIntegerValue() != null)) {
+ int newValue = property.getIntegerValue();
+ if (newValue >= 1) {
+ START_WAIT_MAX = 1000L * 60 * newValue;
+ }
+ }
+
while (((avail = this.serverComponent.getAvailability()) ==
AvailabilityType.DOWN)
&& (System.currentTimeMillis() < (start + START_WAIT_MAX))) {
try {
@@ -478,6 +491,16 @@ public class TomcatServerOperationsDelegate {
}
private AvailabilityType waitForServerToShutdown() {
+ //detect whether stopWaitMax property has been set.
+ Configuration pluginConfig =
serverComponent.getResourceContext().getPluginConfiguration();
+ PropertySimple property =
pluginConfig.getSimple(TomcatServerComponent.STOP_WAIT_MAX_PROP);
+ //if set and valid, update startWaitMax value
+ if ((property != null) && (property.getIntegerValue() != null)) {
+ int newValue = property.getIntegerValue();
+ if (newValue >= 1) {
+ STOP_WAIT_MAX = 1000L * 60 * newValue;
+ }
+ }
for (long wait = 0L; (wait < STOP_WAIT_MAX) && (AvailabilityType.UP ==
this.serverComponent.getAvailability()); wait += STOP_WAIT_INTERVAL) {
try {
Thread.sleep(STOP_WAIT_INTERVAL);
diff --git a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
index 5d511cc..24307ef 100644
--- a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
@@ -96,6 +96,19 @@
description="The path to the script used by the 'Shutdown'
operation to shutdown this Tomcat server;
if the path is not absolute it will be
resolved relative to {installationPath}." />
+ <c:simple-property name="startWaitMax"
required="false"
+ description="The time, in minutes,(e.g. 1 or 8) that
must elapse before the server is considered to have failed to start up. The default is 5
minutes.">
+ <c:constraint>
+ <c:integer-constraint minimum="1"/>
+ </c:constraint>
+ </c:simple-property>
+ <c:simple-property name="stopWaitMax"
required="false"
+ description="The time, in minutes,(e.g. 1 or 8) that
must elapse before the server is considered to have failed to stop. The default is 2.5
minutes.">
+ <c:constraint>
+ <c:integer-constraint minimum="1"/>
+ </c:constraint>
+ </c:simple-property>
+
<c:list-property
name="startScriptEnvironment"
displayName="Start Script Environment Variables"