modules/core/dbutils/pom.xml | 2
modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java | 2
modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml | 143 ++-
modules/core/dbutils/src/main/scripts/dbsetup/dbsetup-schema.xsd | 1
modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml | 30
modules/core/dbutils/src/main/scripts/dbsetup/obsolete-schema.xml | 19
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 236 ++++++
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java | 31
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java | 31
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java | 30
modules/core/domain/src/main/java/org/rhq/core/domain/common/Tag.java | 121 ---
modules/core/domain/src/main/java/org/rhq/core/domain/common/Taggable.java | 38 -
modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java | 99 --
modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoTag.java | 129 ---
modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoTagPK.java | 122 ---
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java | 6
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java | 6
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/TagCriteria.java | 86 ++
modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallInfo.java | 120 +++
modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallStep.java | 63 +
modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/RemoteAccessInfo.java | 93 ++
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java | 29
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java | 29
modules/core/domain/src/main/java/org/rhq/core/domain/tagging/Tag.java | 310 ++++++++
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BookmarkableView.java | 31
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java | 63 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 152 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UnknownViewException.java | 33
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java | 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java | 70 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java | 75 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java | 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 363 ++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java | 303 ++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java | 167 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java | 131 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java | 199 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TaggingDataSource.java | 76 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagsChangedCallback.java | 35
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java | 276 ++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java | 125 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/OldDashboardView.java | 265 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java | 57 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java | 79 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletView.java | 36
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletViewFactory.java | 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResource.java | 78 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java | 226 ------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedView.java | 56 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java | 56 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java | 59 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformMetricDataSource.java | 58 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java | 364 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java | 56 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResource.java | 78 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourceDS.java | 226 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedView.java | 85 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java | 140 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/store/DashboardStore.java | 58 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/store/StoredDashboard.java | 77 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/store/StoredPortlet.java | 104 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AvailabilityGWTService.java | 36
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RemoteInstallGWTService.java | 48 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TagGWTService.java | 57 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java | 46 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 77 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java | 73 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 132 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java | 81 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/AlertEditOldStyleView.java | 206 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/AlertEditView.java | 329 +++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java | 103 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java | 171 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java | 78 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java | 46 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceOverviewView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java | 259 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeTreeDataSource.java | 26
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java | 110 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java | 25
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AvailabilityGWTServiceImpl.java | 46 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RemoteInstallGWTServiceImpl.java | 68 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TagGWTServiceImpl.java | 76 ++
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css | 32
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html | 1
modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml | 24
modules/enterprise/gui/coregui/src/main/webapp/images/availBar/down.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/availBar/leftCap.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/availBar/rightCap.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/availBar/unknown.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/availBar/up.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/alert/Alert_HIGH_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/alert/Alert_LOW_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/alert/Alert_MEDIUM_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/alert/Alerts_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_green_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_green_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_grey_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_grey_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_red_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_red_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_yellow_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_yellow_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/configure/Configure_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/configure/Configure_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/configure/Configure_failed_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/configure/Configure_grey_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/configure/Configure_ok_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Content_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Content_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Content_cancel_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Content_failed_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Content_grey_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Content_ok_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/control/Operation_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/control/Operation_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/control/Operation_cancel_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/control/Operation_failed_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/control/Operation_grey_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/control/Operation_ok_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_11.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_debug_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_debug_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_debug_multi_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_debug_multi_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_error_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_error_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_error_multi_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_error_multi_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_fatal_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_fatal_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_fatal_multi_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_fatal_multi_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_grey_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_info_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_info_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_info_multi_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_info_multi_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_warning_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_warning_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_warning_multi_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/event/Events_warning_multi_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/inventory/Inventory_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/inventory/Inventory_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/inventory/Inventory_grey_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/monitor/Monitor_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/monitor/Monitor_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/monitor/Monitor_failed_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/monitor/Monitor_failed_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/monitor/Monitor_grey_16.png |binary
modules/enterprise/server/jar/pom.xml | 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerBean.java | 80 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerLocal.java | 50 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerRemote.java | 50 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHFileSend.java | 149 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java | 351 +++++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java | 168 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerLocal.java | 33
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerRemote.java | 61 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java | 16
186 files changed, 7480 insertions(+), 1920 deletions(-)
New commits:
commit d59510cc70304da46a4ae3e2d1cfdd7e0ee276ab
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Apr 28 10:51:35 2010 -0400
Resource tag loading fix
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
index 91bbbde..6aba3bf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
@@ -72,6 +72,15 @@ public class TagEditorView extends HLayout {
this.callback = callback;
}
+ public LinkedHashSet<Tag> getTags() {
+ return tags;
+ }
+
+ public void setTags(LinkedHashSet<Tag> tags) {
+ this.tags = tags;
+ setup();
+ }
+
@Override
protected void onDraw() {
super.onDraw();
@@ -180,6 +189,7 @@ public class TagEditorView extends HLayout {
});
addMember(modeImg);
}
+ markForRedraw();
}
private void save() {
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 93b6512..7d0c499 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
@@ -21,9 +21,11 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.tagging.Tag;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
@@ -38,6 +40,7 @@ import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Set;
/**
@@ -101,6 +104,8 @@ public class ResourceTitleBar extends HLayout {
}
});
+ loadTags(tagEditorView);
+
addMember(badge);
addMember(title);
@@ -109,6 +114,25 @@ public class ResourceTitleBar extends HLayout {
addMember(favoriteButton);
}
+ private void loadTags(final TagEditorView tagEditorView) {
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(resource.getId());
+ criteria.fetchTags(true);
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Could not load resource tags",caught);
+ }
+
+ public void onSuccess(PageList<Resource> result) {
+ LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
+ tags.addAll(result.get(0).getTags());
+ tagEditorView.setTags(tags);
+ }
+ });
+ }
+
+
+
public void setResource(Resource resource) {
this.resource = resource;
update();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index add7a25..31dd771 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -95,11 +95,11 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
// "resourceRepos \n" +
"schedules",
// "availability \n" +
- "currentAvailability"
+ "currentAvailability",
// "resourceErrors \n" +
// "eventSources \n" +
// "productVersion "}
-
+ "tags"
};
private static Set<String> importantFieldsSet = new HashSet<String>(Arrays.asList(importantFields));
commit a294b967a0f8304c81d0e852704a409ec184f7c1
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Apr 28 10:50:25 2010 -0400
merge of schema setup
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 2985e71..acfa021 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2734,7 +2734,6 @@
</schemaSpec>
-
<!-- Remove the old tagging system -->
<schemaSpec version="2.84">
<schema-dropTable table="RHQ_REPO_TAG_MAP"/>
@@ -2963,15 +2962,11 @@
REFERENCES RHQ_TAGGING ( ID )
</statement>
</schema-directSQL>
+ </schemaSpec>
-
-
-
- </schemaSpec>
-
</dbupgrade>
</target>
</project>
commit 570086740595768de3cb113f49b62956f12d8fd3
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Apr 28 10:49:28 2010 -0400
Too verbose on dbsetup for builds
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java
index 993b044..eb1d0eb 100644
--- a/modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/setup/DBSetup.java
@@ -1018,7 +1018,7 @@ public class DBSetup {
}
long duration = System.currentTimeMillis() - start;
- log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_DURATION, duration);
+// log(LogPriority.DEBUG, DbUtilsI18NResourceKeys.DBSETUP_DURATION, duration);
// Reset the commit option
this.getConnection().setAutoCommit(committing);
commit fa0b68b79053fa43f9b06d9fa25c0ce5c634f5cd
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Apr 28 08:14:36 2010 -0400
Fix bug where manually inventoried servers are not being set to committed on the agent side
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 8b6cf68..e309286 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -672,6 +672,7 @@ public class InventoryManager extends AgentService implements ContainerService,
if (log.isDebugEnabled()) {
log.debug("Adding manually discovered resource [" + resource + "] to inventory...");
}
+ resource.setInventoryStatus(InventoryStatus.COMMITTED);
parentResource.addChildResource(resource);
initResourceContainer(resource);
}
commit 938e1f638b7058aa3f8accc7edd916ac7a75e5ed
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Apr 28 08:13:06 2010 -0400
remote agent install for gwt
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 6550626..2985e71 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2706,18 +2706,10 @@
</schema-directSQL>
</schemaSpec>
-<<<<<<< HEAD
- <schemaSpec version="2.83">
+ <schemaSpec version="2.83">
<schema-directSQL>
<statement desc="Creating table RHQ_SUBJECT_ROLE_LDAP_MAP">
CREATE TABLE RHQ_SUBJECT_ROLE_LDAP_MAP ( SUBJECT_ID INTEGER, ROLE_ID INTEGER )
-=======
- <schemaSpec version="2.83">
- <!-- The following constraint change shortens the constraint name < 30 chars for Oracle. -->
- <schema-directSQL>
- <statement targetDBVendor="postgresql" desc="Dropping RHQ_SUBJECT_ROLE_LDAP_MAP constraint RHQ_SUBJECT_ROLE_LDAP_MAPPING_KEY.">
- ALTER TABLE RHQ_SUBJECT_ROLE_LDAP_MAP DROP CONSTRAINT RHQ_SUBJECT_ROLE_LDAP_MAPPING_KEY;
->>>>>>> New tag system for bundle system
</statement>
<statement desc="Creating composite PK for RHQ_SUBJECT_ROLE_LDAP_MAP">
ALTER TABLE RHQ_SUBJECT_ROLE_LDAP_MAP
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallInfo.java b/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallInfo.java
new file mode 100644
index 0000000..c40440e
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallInfo.java
@@ -0,0 +1,120 @@
+/*
+ * RHQ 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 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.core.domain.install.remote;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Greg Hinkle
+ */
+public class AgentInstallInfo implements Serializable {
+
+ private String serverAddress;
+ private String agentAddress;
+
+ private String path;
+ private String owner;
+ private String version;
+
+
+ public List<AgentInstallStep> steps = new ArrayList<AgentInstallStep>();
+
+ public static final String SETUP_PROP = "rhq.agent.configuration-setup-flag";
+
+
+ public static final String SERVER_ADDRESS_PROP = "rhq.agent.server.bind-address";
+ public static final String SERVER_PORT_PROP = "rhq.agent.server.bind-port";
+
+ public static final String AGENT_ADDRESS_PROP = "rhq.communications.connector.bind-address";
+ public static final String AGENT_PORT_PROP = "rhq.communications.connector.bind-port";
+
+ public static final int DEFAULT_SERVER_PORT = 7080;
+ public static final int DEFAULT_AGENT_PORT = 16163;
+
+
+ public AgentInstallInfo() {
+ }
+
+ public AgentInstallInfo(String serverAddress, String agentAddress) {
+ this.serverAddress = serverAddress;
+ this.agentAddress = agentAddress;
+ }
+
+ public AgentInstallInfo(String path, String owner, String version) {
+ this.path = path;
+ this.owner = owner;
+ this.version = version;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+
+ public void addStep(AgentInstallStep step) {
+ steps.add(step);
+ }
+
+ public List<AgentInstallStep> getSteps() {
+ return steps;
+ }
+
+
+
+
+ public String getConfigurationStartString() {
+ StringBuilder buf = new StringBuilder();
+
+ buf.append("-D").append(SERVER_ADDRESS_PROP).append("=").append(serverAddress);
+ buf.append(" ");
+
+ buf.append("-D").append(AGENT_ADDRESS_PROP).append("=").append(agentAddress);
+ buf.append(" ");
+
+ buf.append("-D").append(SETUP_PROP).append("=").append("true");
+ buf.append(" ");
+ buf.append("-d ");
+
+ return buf.toString();
+ }
+
+
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallStep.java b/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallStep.java
new file mode 100644
index 0000000..91b1d8e
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallStep.java
@@ -0,0 +1,63 @@
+/*
+ * 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.core.domain.install.remote;
+
+import java.io.Serializable;
+
+/**
+* @author Greg Hinkle
+*/
+public class AgentInstallStep implements Serializable {
+ int resultCode;
+ String command;
+ String description;
+ String result;
+ long time;
+
+ public AgentInstallStep() {
+ }
+
+ public AgentInstallStep(int resultCode, String command, String description, String result, long time) {
+ this.resultCode = resultCode;
+ this.command = command;
+ this.description = description;
+ this.result = result;
+ this.time = time;
+ }
+
+ public int getResultCode() {
+ return resultCode;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public long getTime() {
+ return time;
+ }
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/RemoteAccessInfo.java b/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/RemoteAccessInfo.java
new file mode 100644
index 0000000..67857ce
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/RemoteAccessInfo.java
@@ -0,0 +1,93 @@
+/*
+ * RHQ 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 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.core.domain.install.remote;
+
+import java.io.Serializable;
+
+/**
+ * @author Greg Hinkle
+ */
+public class RemoteAccessInfo implements Serializable {
+
+ private String host, user, pass;
+ byte[] key;
+ private int port = 22;
+
+
+ public RemoteAccessInfo(String host, String user, byte[] key) {
+ this.host = host;
+ this.user = user;
+ this.key = key;
+ }
+
+ public RemoteAccessInfo(String host, String user, String pass) {
+ this(host, 22, user, pass);
+ }
+
+ public RemoteAccessInfo(String host, int port, String user, String pass) {
+ this.host = host;
+ this.port = port;
+ this.user = user;
+ this.pass = pass;
+ }
+
+ public RemoteAccessInfo() {
+
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ public String getPass() {
+ return pass;
+ }
+
+ public void setPass(String pass) {
+ this.pass = pass;
+ }
+
+ public byte[] getKey() {
+ return key;
+ }
+
+ public void setKey(byte[] key) {
+ this.key = key;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index b980d6a..4faf4ff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -59,5 +59,6 @@
<servlet path="/AuthorizationGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AuthorizationGWTServiceImpl"/>
<servlet path="/AvailabilityGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AvailabilityGWTServiceImpl"/>
<servlet path="/TagGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.TagGWTServiceImpl"/>
+ <servlet path="/RemoteInstallGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.RemoteInstallGWTServiceImpl"/>
</module>
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 913ff6c..5c31020 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.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.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.admin.agent.install.RemoteAgentInstallView;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
@@ -238,8 +239,7 @@ public class AdministrationView extends HLayout implements BookmarkableView {
} else if ("Auto Discovery Queue".equals(page)) {
content = new ResourceAutodiscoveryView();
} else if ("Remote Agent Install".equals(page)) {
- // todo
- //content = new RemoteAgentInstallView();
+ content = new RemoteAgentInstallView();
}
} else if ("Configuration".equals(section)) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
new file mode 100644
index 0000000..76c64a2
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
@@ -0,0 +1,303 @@
+/*
+ * 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, 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.enterprise.gui.coregui.client.admin.agent.install;
+
+import java.util.ArrayList;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Autofit;
+import com.smartgwt.client.types.ExpansionMode;
+import com.smartgwt.client.types.TitleOrientation;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.FormItemIfFunction;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.HeaderItem;
+import com.smartgwt.client.widgets.form.fields.PasswordItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+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.layout.VLayout;
+
+import org.rhq.core.domain.install.remote.AgentInstallInfo;
+import org.rhq.core.domain.install.remote.AgentInstallStep;
+import org.rhq.core.domain.measurement.MeasurementConverterClient;
+import org.rhq.core.domain.measurement.MeasurementUnits;
+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.RemoteInstallGWTServiceAsync;
+import org.rhq.core.domain.install.remote.RemoteAccessInfo;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * @author Greg Hinkle
+ */
+public class RemoteAgentInstallView extends VLayout {
+
+ private RemoteInstallGWTServiceAsync remoteInstallService = GWTServiceLookup.getRemoteInstallService();
+
+ private DynamicForm form;
+ private VLayout agentInfoLayout;
+
+ public RemoteAgentInstallView() {
+ setMembersMargin(10);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+
+ addMember(getConnectionForm());
+
+ agentInfoLayout = new VLayout();
+ agentInfoLayout.setWidth100();
+ addMember(agentInfoLayout);
+
+
+ }
+
+
+ DynamicForm getConnectionForm() {
+
+ form = new DynamicForm();
+ form.setWidth100();
+
+ HeaderItem connectionHeader = new HeaderItem();
+ connectionHeader.setValue("Connection Information");
+
+ TextItem host = new TextItem("host");
+ host.setRequired(true);
+
+ TextItem username = new TextItem("username");
+ username.setRequired(true);
+
+ PasswordItem password = new PasswordItem("password");
+// password.setRequired(true);
+
+
+ ButtonItem statusCheck = new ButtonItem("updateStatus", "Update Status");
+
+
+ final StaticTextItem agentStatus = new StaticTextItem("agentStatus", "Agent Status");
+ agentStatus.setRedrawOnChange(true);
+
+
+ statusCheck.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ if (form.validate()) {
+ agentStatusCheck();
+ }
+ }
+ });
+
+
+ ButtonItem startButton = new ButtonItem("start", "Start Agent");
+ startButton.setEndRow(false);
+// startButton.setShowIfCondition(new FormItemIfFunction() {
+// public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+// return form.getValue("agentStatus") != null && !"Agent Not Installed".equals(form.getValue("agentStatus"));
+// }
+// });
+ startButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ remoteInstallService.startAgent(getRemoteAccessInfo(), new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to start agent", caught);
+ }
+
+ public void onSuccess(String result) {
+ CoreGUI.getMessageCenter().notify(new Message("Agent successfully started.", Message.Severity.Info));
+ agentStatusCheck();
+ }
+ });
+ }
+ });
+
+
+ ButtonItem stopButton = new ButtonItem("stop", "Stop Agent");
+ stopButton.setStartRow(false);
+// stopButton.setShowIfCondition(new FormItemIfFunction() {
+// public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+// return form.getValue("agentStatus") != null && !"Agent Not Installed".equals(form.getValue("agentStatus"));
+// }
+// });
+ stopButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ remoteInstallService.stopAgent(getRemoteAccessInfo(), new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to stop agent", caught);
+ }
+
+ public void onSuccess(String result) {
+ CoreGUI.getMessageCenter().notify(new Message("Agent successfully stopped.", Message.Severity.Info));
+ agentStatusCheck();
+ }
+ });
+ }
+ });
+
+
+ ButtonItem installButton = new ButtonItem("install", "Install Agent");
+ installButton.setRedrawOnChange(true);
+// installButton.setShowIfCondition(new FormItemIfFunction() {
+// public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+// return form.getValue("agentStatus") != null && "Agent Not Installed".equals(form.getValue("agentStatus"));
+// }
+// });
+
+
+ installButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ remoteInstallService.installAgent(getRemoteAccessInfo(), "/tmp/rhqAgent", new AsyncCallback<AgentInstallInfo>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to install agent", caught);
+ }
+
+ public void onSuccess(AgentInstallInfo result) {
+ CoreGUI.getMessageCenter().notify(new Message("Agent successfully installed.", Message.Severity.Info));
+
+ for (Canvas child : agentInfoLayout.getChildren()) {
+ child.destroy();
+ }
+ agentInfoLayout.addMember(buildInstallInfoCanvas(result));
+ agentInfoLayout.markForRedraw();
+ agentStatusCheck();
+ }
+ });
+ }
+ });
+
+
+ form.setFields(connectionHeader, host, username, password, statusCheck, agentStatus, new SpacerItem(), startButton, stopButton, new SpacerItem(), installButton, new SpacerItem());
+
+ return form;
+ }
+
+ private void agentStatusCheck() {
+ remoteInstallService.agentStatus(getRemoteAccessInfo(), new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ form.setValue("agentStatus", caught.getMessage());
+ }
+
+ public void onSuccess(String result) {
+ form.setValue("agentStatus", result);
+ }
+ });
+ }
+
+
+ private Canvas buildInstallInfoCanvas(AgentInstallInfo info) {
+
+ VLayout installInfo = new VLayout();
+ installInfo.setWidth100();
+
+ DynamicForm infoForm = new DynamicForm();
+ infoForm.setWidth100();
+ HeaderItem infoHeader = new HeaderItem();
+ infoHeader.setValue("Agent Installation Information");
+ StaticTextItem version = new StaticTextItem("version", "Version");
+ version.setValue(info.getVersion());
+
+ StaticTextItem path = new StaticTextItem("path", "Path");
+ path.setValue(info.getPath());
+
+ StaticTextItem owner = new StaticTextItem("owner", "Owner");
+ owner.setValue(info.getOwner());
+
+ StaticTextItem config = new StaticTextItem("config", "Configuration");
+ config.setValue(info.getConfigurationStartString());
+
+ infoForm.setFields(infoHeader, version, path, owner, config);
+
+ installInfo.addMember(infoForm);
+
+
+ ListGrid listGrid = new ListGrid() {
+ @Override
+ protected Canvas getExpansionComponent(ListGridRecord record) {
+ Canvas canvas = super.getExpansionComponent(record);
+ canvas.setPadding(5);
+ return canvas;
+ }
+ };
+ listGrid.setWidth(800);
+ listGrid.setHeight(500);
+ listGrid.setCanExpandRecords(true);
+ listGrid.setExpansionMode(ExpansionMode.DETAIL_FIELD);
+ listGrid.setDetailField("result");
+
+
+ listGrid.setAutoFitData(Autofit.VERTICAL);
+ ListGridField step = new ListGridField("description", "Step");
+ ListGridField resultCode = new ListGridField("resultCode", "Result Code", 90);
+ ListGridField time = new ListGridField("time", "Time", 90);
+
+
+ listGrid.setFields(step, resultCode, time);
+
+ listGrid.setData(getStepRecords(info));
+
+
+ installInfo.addMember(listGrid);
+
+ for (ListGridRecord rec : listGrid.getRecords()) {
+ listGrid.expandRecord(rec);
+ }
+
+ return installInfo;
+
+ }
+
+ private ListGridRecord[] getStepRecords(AgentInstallInfo info) {
+ ArrayList<ListGridRecord> steps = new ArrayList<ListGridRecord>();
+
+ for (AgentInstallStep step : info.getSteps()) {
+ ListGridRecord rec = new ListGridRecord();
+ rec.setAttribute("description", step.getDescription());
+ rec.setAttribute("result", step.getResult());
+ rec.setAttribute("resultCode", "" + step.getResultCode());
+ rec.setAttribute("time", MeasurementConverterClient.format((double) step.getTime(), MeasurementUnits.MILLISECONDS, true));
+ steps.add(rec);
+ }
+
+ return steps.toArray(new ListGridRecord[steps.size()]);
+ }
+
+
+ private RemoteAccessInfo getRemoteAccessInfo() {
+ RemoteAccessInfo info = new RemoteAccessInfo(
+ form.getValueAsString("host"),
+ form.getValueAsString("username"),
+ form.getValueAsString("password")
+ );
+ return info;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index d251630..689c26f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -92,6 +92,10 @@ public class GWTServiceLookup {
return secure(TagGWTServiceAsync.Util.getInstance());
}
+ public static RemoteInstallGWTServiceAsync getRemoteInstallService() {
+ return secure(RemoteInstallGWTServiceAsync.Util.getInstance());
+ }
+
private static <T> T secure(Object sdt) {
if (!(sdt instanceof ServiceDefTarget))
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RemoteInstallGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RemoteInstallGWTService.java
new file mode 100644
index 0000000..d25a9d3
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RemoteInstallGWTService.java
@@ -0,0 +1,48 @@
+/*
+ * 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, 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.enterprise.gui.coregui.client.gwt;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.rhq.core.domain.install.remote.AgentInstallInfo;
+import org.rhq.core.domain.install.remote.RemoteAccessInfo;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface RemoteInstallGWTService extends RemoteService {
+
+ // RemoteInstallManagerRemote
+ AgentInstallInfo agentInstallCheck(RemoteAccessInfo remoteAccessInfo);
+
+ AgentInstallInfo installAgent(RemoteAccessInfo remoteAccessInfo, String path);
+
+ String[] remotePathDiscover(RemoteAccessInfo remoteAccessInfo, String parentPath);
+
+ String startAgent(RemoteAccessInfo remoteAccessInfo);
+
+ String stopAgent(RemoteAccessInfo remoteAccessInfo);
+
+ String agentStatus(RemoteAccessInfo remoteAccessInfo);
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RemoteInstallGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RemoteInstallGWTServiceImpl.java
new file mode 100644
index 0000000..1a6af99
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RemoteInstallGWTServiceImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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, 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.enterprise.gui.coregui.server.gwt;
+
+import org.rhq.core.domain.install.remote.AgentInstallInfo;
+import org.rhq.core.domain.install.remote.RemoteAccessInfo;
+import org.rhq.enterprise.gui.coregui.client.gwt.RemoteInstallGWTService;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.install.remote.RemoteInstallManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author Greg Hinkle
+ */
+public class RemoteInstallGWTServiceImpl extends AbstractGWTServiceImpl implements RemoteInstallGWTService {
+
+ private RemoteInstallManagerLocal remoteInstallManager = LookupUtil.getRemoteInstallManager();
+
+ public AgentInstallInfo agentInstallCheck(RemoteAccessInfo remoteAccessInfo) {
+ return SerialUtility.prepare(remoteInstallManager.agentInstallCheck(getSessionSubject(), remoteAccessInfo),
+ "RemoteInstallService.agentInstallCheck");
+ }
+
+ public AgentInstallInfo installAgent(RemoteAccessInfo remoteAccessInfo, String path) {
+ return SerialUtility.prepare(remoteInstallManager.installAgent(getSessionSubject(), remoteAccessInfo, path),
+ "RemoteInstallService.installAgent");
+ }
+
+ public String[] remotePathDiscover(RemoteAccessInfo remoteAccessInfo, String parentPath) {
+ return SerialUtility.prepare((remoteInstallManager.remotePathDiscover(getSessionSubject(), remoteAccessInfo, parentPath)),
+ "RemoteInstallService.remotePathDiscover");
+ }
+
+ public String startAgent(RemoteAccessInfo remoteAccessInfo) {
+ return SerialUtility.prepare(remoteInstallManager.startAgent(getSessionSubject(), remoteAccessInfo),
+ "RemoteInstallService.startAgent");
+ }
+
+ public String stopAgent(RemoteAccessInfo remoteAccessInfo) {
+ return SerialUtility.prepare(remoteInstallManager.stopAgent(getSessionSubject(), remoteAccessInfo),
+ "RemoteInstallService.stopAgent");
+ }
+
+ public String agentStatus(RemoteAccessInfo remoteAccessInfo) {
+ return SerialUtility.prepare(remoteInstallManager.agentStatus(getSessionSubject(), remoteAccessInfo),
+ "RemoteInstallService.agentStatus");
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index ce0e2eb..87b0f0e 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -80,6 +80,10 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI TagGWTService</servlet-name>
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.TagGWTServiceImpl</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RemoteInstallGWTService</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.RemoteInstallGWTServiceImpl</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RoleGWTService</servlet-name>
@@ -151,4 +155,8 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI TagGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/TagGWTService</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RemoteInstallGWTService</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/RemoteInstallGWTService</url-pattern>
+ </servlet-mapping>
</web-app>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index 6e9b09c..e718952 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -330,6 +330,12 @@
</dependency>
+ <dependency>
+ <groupId>com.jcraft</groupId>
+ <artifactId>jsch</artifactId>
+ <version>0.1.29</version>
+ </dependency>
+
<!--================ Test Deps ================-->
<dependency>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerBean.java
new file mode 100644
index 0000000..4763ed5
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerBean.java
@@ -0,0 +1,80 @@
+/*
+ * 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, 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.enterprise.server.install.remote;
+
+import javax.ejb.Stateless;
+
+import org.rhq.core.domain.install.remote.AgentInstallInfo;
+import org.rhq.core.domain.install.remote.RemoteAccessInfo;
+import org.rhq.enterprise.server.authz.RequiredPermission;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+
+/**
+ * @author Greg Hinkle
+ */
+@Stateless
+public class RemoteInstallManagerBean implements RemoteInstallManagerLocal, RemoteInstallManagerRemote {
+
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public AgentInstallInfo agentInstallCheck(Subject subject, RemoteAccessInfo remoteAccessInfo) {
+ SSHInstallUtility sshUtil = new SSHInstallUtility(remoteAccessInfo);
+
+ return sshUtil.installAgent();
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public AgentInstallInfo installAgent(Subject subject, RemoteAccessInfo remoteAccessInfo, String path) {
+ SSHInstallUtility sshUtil = new SSHInstallUtility(remoteAccessInfo);
+
+ return sshUtil.installAgent();
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public String[] remotePathDiscover(Subject subject, RemoteAccessInfo remoteAccessInfo, String parentPath) {
+ SSHInstallUtility ssh = new SSHInstallUtility(remoteAccessInfo);
+ ssh.connect();
+ return ssh.pathDiscovery(parentPath);
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public String startAgent(Subject subject, RemoteAccessInfo remoteAccessInfo) {
+ SSHInstallUtility sshUtil = new SSHInstallUtility(remoteAccessInfo);
+ return sshUtil.agentStart();
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public String stopAgent(Subject subject, RemoteAccessInfo remoteAccessInfo) {
+ SSHInstallUtility sshUtil = new SSHInstallUtility(remoteAccessInfo);
+ return sshUtil.agentStop();
+ }
+
+ public String agentStatus(Subject subject, RemoteAccessInfo remoteAccessInfo) {
+ if (remoteAccessInfo.getHost() == null) {
+ return "Enter a host";
+ }
+ SSHInstallUtility sshUtil = new SSHInstallUtility(remoteAccessInfo);
+ return sshUtil.agentStatus();
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerLocal.java
new file mode 100644
index 0000000..c50dd52
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerLocal.java
@@ -0,0 +1,50 @@
+/*
+ * 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, 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.enterprise.server.install.remote;
+
+import javax.ejb.Local;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.install.remote.AgentInstallInfo;
+import org.rhq.core.domain.install.remote.RemoteAccessInfo;
+
+/**
+ * @author Greg Hinkle
+ */
+@Local
+public interface RemoteInstallManagerLocal {
+
+
+ AgentInstallInfo agentInstallCheck(Subject subject, RemoteAccessInfo remoteAccessInfo);
+
+ AgentInstallInfo installAgent(Subject subject, RemoteAccessInfo remoteAccessInfo, String path);
+
+ String[] remotePathDiscover(Subject subject, RemoteAccessInfo remoteAccessInfo, String parentPath);
+
+ String startAgent(Subject subject, RemoteAccessInfo remoteAccessInfo);
+
+ String stopAgent(Subject subject, RemoteAccessInfo remoteAccessInfo);
+
+ String agentStatus(Subject subject, RemoteAccessInfo remoteAccessInfo);
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerRemote.java
new file mode 100644
index 0000000..cca5c4e
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/RemoteInstallManagerRemote.java
@@ -0,0 +1,50 @@
+/*
+ * 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, 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.enterprise.server.install.remote;
+
+import javax.ejb.Remote;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.install.remote.AgentInstallInfo;
+import org.rhq.core.domain.install.remote.RemoteAccessInfo;
+
+/**
+ * @author Greg Hinkle
+ */
+@Remote
+public interface RemoteInstallManagerRemote {
+
+
+ AgentInstallInfo agentInstallCheck(Subject subject, RemoteAccessInfo remoteAccessInfo);
+
+ AgentInstallInfo installAgent(Subject subject, RemoteAccessInfo remoteAccessInfo, String path);
+
+ String[] remotePathDiscover(Subject subject, RemoteAccessInfo remoteAccessInfo, String parentPath);
+
+ String startAgent(Subject subject, RemoteAccessInfo remoteAccessInfo);
+
+ String stopAgent(Subject subject, RemoteAccessInfo remoteAccessInfo);
+
+ String agentStatus(Subject subject, RemoteAccessInfo remoteAccessInfo);
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHFileSend.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHFileSend.java
new file mode 100644
index 0000000..ece76af
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHFileSend.java
@@ -0,0 +1,149 @@
+/*
+ * 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, 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.enterprise.server.install.remote;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.Session;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author Greg Hinkle
+ */
+public class SSHFileSend {
+
+
+ public static boolean sendFile(Session session, String sourceFilename, String destFilename) {
+ FileInputStream fis = null;
+
+ try {
+
+ String command = "scp -p -t " + destFilename;
+ Channel channel = session.openChannel("exec");
+ ((ChannelExec) channel).setCommand(command);
+
+ OutputStream out = channel.getOutputStream();
+ InputStream in = channel.getInputStream();
+
+ channel.connect();
+
+ if (checkAck(in) != 0) {
+ return false;
+ }
+
+ //send "C0644 filesize filename" where filename doesn't contain a /
+ long filesize = (new File(sourceFilename)).length();
+ command = "C0644 " + filesize + " ";
+ if (sourceFilename.lastIndexOf('/') > 0) {
+ command += sourceFilename.substring(sourceFilename.lastIndexOf('/') + 1);
+ } else {
+ command += sourceFilename;
+ }
+ command += "\n";
+
+ out.write(command.getBytes());
+ out.flush();
+
+ if (checkAck(in) != 0) {
+ return false;
+ }
+
+ //send the contents of the source file
+ fis = new FileInputStream(sourceFilename);
+ byte[] buf = new byte[1024];
+ while (true) {
+ int len = fis.read(buf, 0, buf.length);
+
+ if (len <= 0) {
+ break;
+ }
+
+ out.write(buf, 0, len);
+ }
+
+ fis.close();
+ fis = null;
+
+ //send '\0' to end it
+ buf[0] = 0;
+ out.write(buf, 0, 1);
+ out.flush();
+
+ if (checkAck(in) != 0) {
+ return false;
+ }
+
+ out.close();
+
+ channel.disconnect();
+
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ try {
+ if (fis != null) {
+ fis.close();
+ }
+ } catch (Exception ee) {
+ ee.printStackTrace();
+ }
+ }
+
+ return false;
+ }
+
+
+ public static int checkAck(InputStream in) throws IOException {
+ int b = in.read();
+ // b may be 0 for success,
+ // 1 for error,
+ // 2 for fatal error,
+ // -1
+ if (b == 0) return b;
+ if (b == -1) return b;
+
+ if (b == 1 || b == 2) {
+ StringBuffer sb = new StringBuffer();
+ int c;
+ do {
+ c = in.read();
+ sb.append((char) c);
+ }
+ while (c != '\n');
+ if (b == 1) { // error
+ System.out.print(sb.toString());
+ }
+ if (b == 2) { // fatal error
+ System.out.print(sb.toString());
+ }
+ }
+ return b;
+ }
+
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java
new file mode 100644
index 0000000..3f94c86
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java
@@ -0,0 +1,351 @@
+/*
+ * 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, 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.enterprise.server.install.remote;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.install.remote.AgentInstallInfo;
+import org.rhq.core.domain.install.remote.AgentInstallStep;
+import org.rhq.core.domain.install.remote.RemoteAccessInfo;
+import org.rhq.core.util.file.FileUtil;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author Greg Hinkle
+ */
+public class SSHInstallUtility {
+
+ static final int DEFAULT_BUFFER_SIZE = 4096;
+ static final long TIMEOUT = 10000L;
+ static final long POLL_TIMEOUT = 1000L;
+
+ private Log log = LogFactory.getLog(SSHInstallUtility.class);
+
+ private RemoteAccessInfo accessInfo;
+ private Session session;
+
+ private String agentDestination = "/tmp/rhqAgent"; // todo: Make configurable
+
+
+ private String agentFile = "rhq-enterprise-agent-3.0.0-SNAPSHOT.jar"; // Corrected below
+ private String agentPath = "/projects/rhq/dev-container/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-agent/" + agentFile; // corrected below
+
+
+ public SSHInstallUtility(RemoteAccessInfo accessInfo) {
+ this.accessInfo = accessInfo;
+
+ try {
+ File agentBinaryFile = LookupUtil.getAgentManager().getAgentUpdateBinaryFile();
+ agentPath = agentBinaryFile.getCanonicalPath();
+ agentFile = agentBinaryFile.getName();
+ } catch (Exception e) {
+ // Could not find agent file, leave the default
+ log.warn("Failed agent binary file lookup", e);
+ }
+
+ if (!new File(agentPath).exists()) {
+ throw new RuntimeException("Unable to find agent binary file for installation at [" + agentPath + "]");
+ }
+
+ connect();
+ }
+
+
+ public void connect() {
+ try {
+ JSch jsch = new JSch();
+
+
+// if (accessInfo.getKey() != null) {
+ jsch.addIdentity("/Users/ghinkle/.ssh/ghinkleawskey.pem");
+
+// }
+
+ session = jsch.getSession(accessInfo.getUser(), accessInfo.getHost(), 22); // accessInfo.getPort());
+
+ if (accessInfo.getPass() != null) {
+ session.setPassword(accessInfo.getPass());
+ }
+
+ java.util.Properties config = new java.util.Properties();
+ config.put("StrictHostKeyChecking", "no");
+ session.setConfig(config);
+
+ //session.connect();
+ session.connect(30000); // making a connection with timeout.
+ } catch (JSchException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void disconnect() {
+ session.disconnect();
+ }
+
+
+ public String[] pathDiscovery(String parentPath) {
+ String full = executeCommand("ls" + parentPath);
+ return full.split("\n");
+ }
+
+
+ private String executeCommand(String command, String description) {
+ return executeCommand(command, description, new AgentInstallInfo(null, null));
+ }
+
+
+ private String executeCommand(String command, String description, AgentInstallInfo info) {
+ log.info("Running: " + description);
+ long start = System.currentTimeMillis();
+ String result = null;
+ try {
+ result = executeCommand(command);
+ info.addStep(new AgentInstallStep(0, command, description, result, (System.currentTimeMillis() - start)));
+ } catch (ExecuteException e) {
+ info.addStep(new AgentInstallStep(e.errorCode, command, e.message, description, (System.currentTimeMillis() - start)));
+ }
+ log.info("Result [" + description + "]: " + result);
+ return result;
+ }
+
+
+ private String executeCommand(String command) {
+ ChannelExec channel = null;
+ int exitStatus = 0;
+
+ InputStream is = null;
+ InputStream es = null;
+
+ try {
+ channel = (ChannelExec) session.openChannel("exec");
+ ((ChannelExec) channel).setCommand(command);
+
+ is = channel.getInputStream();
+ es = channel.getErrStream();
+
+ channel.connect(10000); // connect and execute command
+
+ String out = read(is, channel);
+ String err = read(es, channel);
+
+ // System.out.println("Output: " + out);
+ if (err.length() > 0) {
+ // System.out.println("Error [" + channel.getExitStatus() + "]: " + err);
+ if (channel.getExitStatus() != 0) {
+ throw new ExecuteException(channel.getExitStatus(), err);
+ } else if (out.length() == 0) {
+ return err;
+ }
+ }
+ return out;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ is.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ try {
+ es.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ if (channel != null) {
+ channel.disconnect();
+ }
+ }
+ return "exit: " + exitStatus;
+ }
+
+
+ public String read(InputStream is, Channel channel) throws IOException {
+ // read command output
+ byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final long endTime = System.currentTimeMillis() + TIMEOUT;
+ while (System.currentTimeMillis() < endTime) {
+ while (is.available() > 0) {
+ int count = is.read(buffer, 0, DEFAULT_BUFFER_SIZE);
+ if (count >= 0) {
+ bos.write(buffer, 0, count);
+ } else {
+ break;
+ }
+ }
+ if (channel.isClosed()) {
+ // int exitStatus = channel.getExitStatus();
+ // System.out.println("exit status: " + exitStatus);
+ break;
+ }
+ try {
+ Thread.sleep(POLL_TIMEOUT);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ return bos.toString();
+ }
+
+
+ public String read2(BufferedReader reader) throws IOException {
+ StringBuilder buf = new StringBuilder();
+ while (true) {
+ String line = reader.readLine();
+ if (line == null) {
+ break;
+ }
+ buf.append(line + "\n");
+ }
+ return buf.toString();
+ }
+
+ public String agentStop() {
+ String agentWrapperScript = agentDestination + "/rhq-agent/bin/rhq-agent-wrapper.sh ";
+
+ return executeCommand(agentWrapperScript + " stop", "Agent Stop");
+ }
+
+ public String agentStart() {
+ String agentWrapperScript = agentDestination + "/rhq-agent/bin/rhq-agent-wrapper.sh ";
+
+ return executeCommand(agentWrapperScript + " start", "Agent Start");
+ }
+
+ public String agentStatus() {
+ String agentWrapperScript = agentDestination + "/rhq-agent/bin/rhq-agent-wrapper.sh ";
+
+
+ String value = executeCommand("if [ -f " + agentWrapperScript + " ]; then echo \"exists\"; fi");
+ if (value == null || value.length() == 0) {
+ return "Agent Not Installed";
+ }
+
+ return executeCommand(agentWrapperScript + " status", "Agent Status");
+ }
+
+ public AgentInstallInfo installAgent() {
+
+
+ AgentInstallInfo info = new AgentInstallInfo(agentDestination, accessInfo.getUser(), "3.0.0-SNAPSHOT");
+
+
+ executeCommand("uname -a", "Machine uname", info);
+
+ executeCommand("java -version", "Java Version Check", info);
+
+ executeCommand("mkdir -p " + agentDestination, "Create Agent Install Directory", info);
+
+
+ log.info("Copying Agent Distribution");
+ long start = System.currentTimeMillis();
+ boolean fileSent = SSHFileSend.sendFile(session, agentPath, agentDestination);
+ info.addStep(new AgentInstallStep(0, "scp agent-installer", "Remote copy the agent distribution", fileSent ? "Success" : "Failed", (System.currentTimeMillis() - start)));
+ log.info("Agent Distribution Copied");
+
+
+ executeCommand("cd " + agentDestination, "Change to install directory", info);
+
+ executeCommand("java -jar " + agentDestination + "/" + agentFile + " --install=" + agentDestination, "Install Agent", info);
+
+
+ String serverAddress = LookupUtil.getCloudManager().getAllCloudServers().get(0).getAddress();
+
+ System.out.println("Install an agent at " + accessInfo.getHost() + " point to the server " + serverAddress);
+
+
+ AgentInstallInfo agentInfo = new AgentInstallInfo(serverAddress, accessInfo.getHost());
+
+ String agentScript = agentDestination + "/rhq-agent/bin/rhq-agent.sh ";
+ String agentWrapperScript = agentDestination + "/rhq-agent/bin/rhq-agent-wrapper.sh ";
+
+
+ String properties = agentInfo.getConfigurationStartString();
+
+ // Tell the script to store a pid file to make the wrapper script work
+ String pidFileProp = "export RHQ_AGENT_IN_BACKGROUND=" + agentDestination + "/rhq-agent/bin/rhq-agent.pid";
+
+ String startCommand = pidFileProp + " ; nohup " + agentScript + properties + "&";
+ executeCommand(startCommand, "Agent Start With Configuration", info);
+
+
+ return info;
+ }
+
+
+ public static class ExecuteException extends RuntimeException {
+ int errorCode;
+ String message;
+
+ public ExecuteException(int errorCode, String message) {
+ this.errorCode = errorCode;
+ this.message = message;
+ }
+ }
+
+
+ public static void main(String[] args) throws IOException {
+
+ String pass = null;
+ if (args.length > 2) {
+ pass = args[2];
+ }
+ RemoteAccessInfo info = new RemoteAccessInfo(args[0], args[1], pass);
+
+ SSHInstallUtility ssh = new SSHInstallUtility(info);
+
+ System.out.println("Agent status: " + ssh.agentStatus());
+
+ System.out.println("Set server address: " + ssh.executeCommand("echo '71.162.145.95 ghinkle' >> /etc/hosts"));
+
+ ssh.agentStop();
+
+ ssh.installAgent();
+
+ ssh.agentStatus();
+
+ ssh.agentStop();
+ ssh.agentStatus();
+ ssh.agentStart();
+
+ ssh.disconnect();
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
index 39b2c47..9367bdc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
@@ -107,6 +107,8 @@ import org.rhq.enterprise.server.entitlement.EntitlementManagerBean;
import org.rhq.enterprise.server.entitlement.EntitlementManagerLocal;
import org.rhq.enterprise.server.event.EventManagerBean;
import org.rhq.enterprise.server.event.EventManagerLocal;
+import org.rhq.enterprise.server.install.remote.RemoteInstallManagerBean;
+import org.rhq.enterprise.server.install.remote.RemoteInstallManagerLocal;
import org.rhq.enterprise.server.measurement.AvailabilityManagerBean;
import org.rhq.enterprise.server.measurement.AvailabilityManagerLocal;
import org.rhq.enterprise.server.measurement.CallTimeDataManagerBean;
@@ -478,6 +480,10 @@ public final class LookupUtil {
return lookupLocal(CacheConsistencyManagerBean.class);
}
+ public static RemoteInstallManagerLocal getRemoteInstallManager() {
+ return lookupLocal(RemoteInstallManagerBean.class);
+ }
+
public static ResourceMetadataManagerLocal getResourceMetadataManager() {
return lookupLocal(ResourceMetadataManagerBean.class);
}
@@ -669,4 +675,4 @@ public final class LookupUtil {
return lookupLocal(LdapGroupManagerBean.class);
}
-}
\ No newline at end of file
+}
commit 1fae5bf95800ffc0b803f00a9ba9e4b364cd2c6e
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Apr 26 15:17:53 2010 -0400
dashboard tweaks
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 14334e7..944a612 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
@@ -100,9 +100,10 @@ public class DashboardsView extends VLayout {
StoredPortlet graph = new StoredPortlet("ghinkle (MAC OS X) CPU", GraphPortlet.KEY, 250);
col1.add(graph);
- StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
- col2.add(platformSummary);
-
+ // Experimental
+// StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
+// col2.add(platformSummary);
+//
StoredPortlet discoveryQueue = new StoredPortlet("Discovery Queue", AutodiscoveryPortlet.KEY, 250);
col2.add(discoveryQueue);
commit 345d917cabf93f72ed07c0cc69c6f5a2bb4efae4
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Apr 26 15:16:59 2010 -0400
Tag editor component
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
new file mode 100644
index 0000000..91bbbde
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
@@ -0,0 +1,189 @@
+/*
+ * 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, 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.enterprise.gui.coregui.client.components.tagging;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.smartgwt.client.types.TextMatchStyle;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
+import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
+import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+import org.rhq.core.domain.tagging.Tag;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+/**
+ * @author Greg Hinkle
+ */
+public class TagEditorView extends HLayout {
+
+ private LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
+
+ private boolean editing = false;
+
+ private DynamicForm form;
+ private boolean readOnly;
+ private TagsChangedCallback callback;
+
+ public TagEditorView(Set<Tag> tags, boolean readOnly, TagsChangedCallback callback) {
+ if (tags != null) {
+ this.tags.addAll(tags);
+ }
+ this.readOnly = readOnly;
+ this.callback = callback;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ setup();
+ }
+
+
+ private void setup() {
+ for (Canvas child : getChildren()) {
+ child.destroy();
+ }
+
+ HTMLFlow title = new HTMLFlow("<b>Tags:</b>");
+ title.setAutoWidth();
+ addMember(title);
+
+ for (final Tag tag : tags) {
+ HTMLFlow tagString = new HTMLFlow(tag.toString());
+ tagString.setAutoWidth();
+ addMember(tagString);
+ if (editing) {
+ Img remove = new Img("[skin]/images/actions/remove.png", 16, 16);
+ remove.setTooltip("Click to remove this tag");
+ remove.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ tags.remove(tag);
+ TagEditorView.this.setup();
+ }
+ });
+ addMember(remove);
+ }
+
+ Canvas spacer = new Canvas();
+ spacer.setWidth(8);
+ addMember(spacer);
+ }
+
+ if (editing) {
+ form = new DynamicForm();
+ ComboBoxItem tagInput = new ComboBoxItem("tag");
+ tagInput.setShowTitle(false);
+ tagInput.setHideEmptyPickList(true);
+ tagInput.setOptionDataSource(new TaggingDataSource());
+ tagInput.setValueField("tag");
+ tagInput.setDisplayField("tag");
+ tagInput.setType("comboBox");
+ tagInput.setTextMatchStyle(TextMatchStyle.SUBSTRING);
+ tagInput.setTooltip("Enter a tag in the format \"(namespace:)(semantic=)tagname\" (e.g. it:env=QA, or owner=John)");
+ tagInput.addBlurHandler(new BlurHandler() {
+ public void onBlur(BlurEvent blurEvent) {
+ String tag = form.getValueAsString("tag");
+ if (tag != null) {
+ Tag newTag = new Tag(tag);
+ tags.add(newTag);
+ TagEditorView.this.setup();
+ }
+ }
+ });
+ tagInput.addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(KeyPressEvent event) {
+ if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
+ String tag = form.getValueAsString("tag");
+ if (tag != null) {
+ Tag newTag = new Tag(tag);
+ tags.add(newTag);
+ TagEditorView.this.setup();
+ }
+ }
+ }
+ });
+
+ form.setFields(tagInput);
+ addMember(form);
+ }
+
+
+ if (!readOnly) {
+ Img modeImg = new Img("[skin]/images/actions/" + (editing ? "approve" : "edit") + ".png", 16, 16);
+ modeImg.setTooltip(editing ? "Click to save edits" : "Click to edit tags");
+ modeImg.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+
+ if (editing) {
+ save();
+ // save the tags
+ /* GWTServiceLookup.getTagService().addTags(tags, new AsyncCallback<Set<Tag>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Tag add failed", caught);
+ HashMap<String, String> errors = new HashMap<String, String>();
+ errors.put("tag", "Tag add failed");
+ form.setErrors(errors, true);
+ }
+
+ public void onSuccess(Set<Tag> result) {
+ editing = !editing;
+ tags.addAll(result);
+ TagEditorView.this.setup();
+ }
+ });*/
+ } else {
+ editing = !editing;
+ TagEditorView.this.setup();
+ }
+ }
+ });
+ addMember(modeImg);
+ }
+ }
+
+ private void save() {
+ this.callback.tagsChanged(tags);
+ TagEditorView.this.setup();
+ }
+}
commit dddd1229ef9a88c7b64dc9b99be270a6e8012a74
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Apr 26 15:16:36 2010 -0400
Tag core domain, service, gwt services, editing component
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
index 11a1b2c..f14fb59 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
@@ -24,6 +24,7 @@ package org.rhq.core.domain.bundle;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -184,6 +185,21 @@ public class Bundle implements Serializable {
this.tags = tags;
}
+ public void addTag(Tag tag) {
+ if (this.tags == null) {
+ tags = new HashSet<Tag>();
+ }
+ tags.add(tag);
+ }
+
+ public boolean removeTag(Tag tag) {
+ if (tags != null) {
+ return tags.remove(tag);
+ } else {
+ return false;
+ }
+ }
+
@Override
public String toString() {
return "Bundle[id=" + id + ",name=" + name + ",bundleType=" + bundleType + ",packageType=" + packageType + "]";
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
index 081815b..e86236d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
@@ -24,6 +24,7 @@ package org.rhq.core.domain.bundle;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -221,6 +222,21 @@ public class BundleDeployment implements Serializable {
this.tags = tags;
}
+ public void addTag(Tag tag) {
+ if (this.tags == null) {
+ tags = new HashSet<Tag>();
+ }
+ tags.add(tag);
+ }
+
+ public boolean removeTag(Tag tag) {
+ if (tags != null) {
+ return tags.remove(tag);
+ } else {
+ return false;
+ }
+ }
+
@Override
public String toString() {
return "BundleDeployment[id=" + id + ", name=" + name + "]";
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
index 55cffad..d8b09bb 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
@@ -24,6 +24,7 @@ package org.rhq.core.domain.bundle;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -243,6 +244,21 @@ public class BundleVersion implements Serializable {
this.tags = tags;
}
+ public void addTag(Tag tag) {
+ if (this.tags == null) {
+ tags = new HashSet<Tag>();
+ }
+ tags.add(tag);
+ }
+
+ public boolean removeTag(Tag tag) {
+ if (tags != null) {
+ return tags.remove(tag);
+ } else {
+ return false;
+ }
+ }
+
@Override
public String toString() {
return "BundleVersion[id=" + id + ",name=" + name + ",version=" + version + ",bundle=" + bundle + "]";
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index d77e1bf..23186e5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -1701,6 +1701,20 @@ public class Resource implements Comparable<Resource>, Serializable {
this.tags = tags;
}
+ public void addTag(Tag tag) {
+ if (this.tags == null) {
+ tags = new HashSet<Tag>();
+ }
+ tags.add(tag);
+ }
+ public boolean removeTag (Tag tag) {
+ if (tags != null) {
+ return tags.remove (tag);
+ } else {
+ return false;
+ }
+ }
+
public int compareTo(Resource that) {
return this.name.compareTo(that.getName());
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
index 35804c8..abe2ca0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
@@ -657,6 +657,21 @@ public class ResourceGroup extends Group {
this.tags = tags;
}
+ public void addTag(Tag tag) {
+ if (this.tags == null) {
+ tags = new HashSet<Tag>();
+ }
+ tags.add(tag);
+ }
+
+ public boolean removeTag(Tag tag) {
+ if (tags != null) {
+ return tags.remove(tag);
+ } else {
+ return false;
+ }
+ }
+
@PrePersist
@PreUpdate
void onPersist() {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/tagging/Tag.java b/modules/core/domain/src/main/java/org/rhq/core/domain/tagging/Tag.java
index 623ec87..c8c7db6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/tagging/Tag.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/tagging/Tag.java
@@ -23,6 +23,7 @@
package org.rhq.core.domain.tagging;
import java.io.Serializable;
+import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
@@ -72,24 +73,24 @@ public class Tag implements Serializable {
@Column(name = "NAME", nullable = false)
private String name;
- @JoinTable(name = "RHQ_TAGGING_RESOURCE_MAP", joinColumns = { @JoinColumn(name = "TAG_ID") }, inverseJoinColumns = { @JoinColumn(name = "RESOURCE_ID") })
+ @JoinTable(name = "RHQ_TAGGING_RESOURCE_MAP", joinColumns = {@JoinColumn(name = "TAG_ID")}, inverseJoinColumns = {@JoinColumn(name = "RESOURCE_ID")})
@ManyToMany
private Set<Resource> resources;
- @JoinTable(name = "RHQ_TAGGING_RES_GRP_MAP", joinColumns = { @JoinColumn(name = "TAG_ID") }, inverseJoinColumns = { @JoinColumn(name = "RESOURCE_GROUP_ID") })
+ @JoinTable(name = "RHQ_TAGGING_RES_GRP_MAP", joinColumns = {@JoinColumn(name = "TAG_ID")}, inverseJoinColumns = {@JoinColumn(name = "RESOURCE_GROUP_ID")})
@ManyToMany
private Set<ResourceGroup> resourceGroups;
- @JoinTable(name = "RHQ_TAGGING_BUNDLE_MAP", joinColumns = { @JoinColumn(name = "TAG_ID") }, inverseJoinColumns = { @JoinColumn(name = "BUNDLE_ID") })
+ @JoinTable(name = "RHQ_TAGGING_BUNDLE_MAP", joinColumns = {@JoinColumn(name = "TAG_ID")}, inverseJoinColumns = {@JoinColumn(name = "BUNDLE_ID")})
@ManyToMany
private Set<Bundle> bundles;
- @JoinTable(name = "RHQ_TAGGING_BND_VER_MAP", joinColumns = { @JoinColumn(name = "TAG_ID") }, inverseJoinColumns = { @JoinColumn(name = "BUNDLE_VERSION_ID") })
+ @JoinTable(name = "RHQ_TAGGING_BND_VER_MAP", joinColumns = {@JoinColumn(name = "TAG_ID")}, inverseJoinColumns = {@JoinColumn(name = "BUNDLE_VERSION_ID")})
@ManyToMany
private Set<BundleVersion> bundleVersions;
- @JoinTable(name = "RHQ_TAGGING_BND_DEP_MAP", joinColumns = { @JoinColumn(name = "TAG_ID") }, inverseJoinColumns = { @JoinColumn(name = "BUNDLE_DEPLOYMENT_ID") })
+ @JoinTable(name = "RHQ_TAGGING_BND_DEP_MAP", joinColumns = {@JoinColumn(name = "TAG_ID")}, inverseJoinColumns = {@JoinColumn(name = "BUNDLE_DEPLOYMENT_ID")})
@ManyToMany
private Set<BundleDeployment> bundleDeployments;
@@ -146,6 +147,137 @@ public class Tag implements Serializable {
}
+ public Set<Resource> getResources() {
+ return resources;
+ }
+
+ public void setResources(Set<Resource> resources) {
+ this.resources = resources;
+ }
+
+ public void addResource(Resource resource) {
+ if (resources == null) {
+ resources = new HashSet<Resource>();
+ }
+ resource.addTag(this);
+ resources.add(resource);
+ }
+
+ public boolean removeResource(Resource resource) {
+ if (resources != null) {
+ resource.removeTag(this);
+ return resources.remove(resource);
+ } else {
+ return false;
+ }
+ }
+
+
+ public Set<ResourceGroup> getResourceGroups() {
+ return resourceGroups;
+ }
+
+ public void setResourceGroups(Set<ResourceGroup> resourceGroups) {
+ this.resourceGroups = resourceGroups;
+ }
+
+ public void addResourceGroup(ResourceGroup resourceGroup) {
+ if (resourceGroups == null) {
+ resourceGroups = new HashSet<ResourceGroup>();
+ }
+ resourceGroup.addTag(this);
+ resourceGroups.add(resourceGroup);
+ }
+
+ public boolean removeResourceGroup(ResourceGroup resourceGroup) {
+ if (resourceGroups != null) {
+ resourceGroup.removeTag(this);
+ return resourceGroups.remove(resourceGroup);
+ } else {
+ return false;
+ }
+ }
+
+
+ public Set<Bundle> getBundles() {
+ return bundles;
+ }
+
+ public void setBundles(Set<Bundle> bundles) {
+ this.bundles = bundles;
+ }
+
+ public void addBundle(Bundle bundle) {
+ if (bundles == null) {
+ bundles = new HashSet<Bundle>();
+ }
+ bundle.addTag(this);
+ bundles.add(bundle);
+ }
+
+ public boolean removeBundle(Bundle bundle) {
+ if (bundles != null) {
+ bundle.removeTag(this);
+ return bundles.remove(bundle);
+ } else {
+ return false;
+ }
+ }
+
+
+ public Set<BundleVersion> getBundleVersions() {
+ return bundleVersions;
+ }
+
+ public void setBundleVersions(Set<BundleVersion> bundleVersions) {
+ this.bundleVersions = bundleVersions;
+ }
+
+ public void addBundleVersion(BundleVersion bundleVersion) {
+ if (bundleVersions == null) {
+ bundleVersions = new HashSet<BundleVersion>();
+ }
+ bundleVersion.addTag(this);
+ bundleVersions.add(bundleVersion);
+ }
+
+ public boolean removeBundleVersion(BundleVersion bundleVersion) {
+ if (bundleVersions != null) {
+ bundleVersion.removeTag(this);
+ return bundleVersions.remove(bundleVersion);
+ } else {
+ return false;
+ }
+ }
+
+
+ public Set<BundleDeployment> getBundleDeployments() {
+ return bundleDeployments;
+ }
+
+ public void setBundleDeployments(Set<BundleDeployment> bundleDeployments) {
+ this.bundleDeployments = bundleDeployments;
+ }
+
+
+ public void addBundleDeployment(BundleDeployment bundleDeployment) {
+ if (bundleDeployments == null) {
+ bundleDeployments = new HashSet<BundleDeployment>();
+ }
+ bundleDeployment.addTag(this);
+ bundleDeployments.add(bundleDeployment);
+ }
+
+ public boolean removeBundleDeployment(BundleDeployment bundleDeployment) {
+ if (bundleDeployments != null) {
+ bundleDeployment.removeTag(this);
+ return bundleDeployments.remove(bundleDeployment);
+ } else {
+ return false;
+ }
+ }
+
+
@Override
public String toString() {
return (namespace != null ? namespace + ":" : "") +
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TaggingDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TaggingDataSource.java
new file mode 100644
index 0000000..fe6c3c7
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TaggingDataSource.java
@@ -0,0 +1,76 @@
+/*
+ * 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, 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.enterprise.gui.coregui.client.components.tagging;
+
+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.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.TagCriteria;
+import org.rhq.core.domain.tagging.Tag;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class TaggingDataSource extends RPCDataSource<Tag> {
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ GWTServiceLookup.getTagService().findTagsByCriteria(new TagCriteria(),
+ new AsyncCallback<PageList<Tag>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load tags",caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<Tag> result) {
+ response.setData(buildRecords(result));
+ processResponse(request.getRequestId(), response);
+ }
+ });
+
+ }
+
+ @Override
+ public Tag copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
+ }
+
+ @Override
+ public ListGridRecord copyValues(Tag from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id",from.getId());
+ record.setAttribute("namespace",from.getNamespace());
+ record.setAttribute("semantic",from.getSemantic());
+ record.setAttribute("name",from.getName());
+ record.setAttribute("tag",from.toString());
+ return record;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagsChangedCallback.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagsChangedCallback.java
new file mode 100644
index 0000000..1de8ca7
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagsChangedCallback.java
@@ -0,0 +1,35 @@
+/*
+ * 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, 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.enterprise.gui.coregui.client.components.tagging;
+
+import java.util.HashSet;
+
+import org.rhq.core.domain.tagging.Tag;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface TagsChangedCallback {
+
+ void tagsChanged(HashSet<Tag> tags);
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TagGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TagGWTService.java
index 8f191d0..9ab2919 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TagGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TagGWTService.java
@@ -43,5 +43,15 @@ public interface TagGWTService extends RemoteService {
void removeTags(Set<Tag> tags);
+ void updateResourceTags(int resourceId, Set<Tag> tags);
+
+ void updateResourceGroupTags(int resourceGroupId, Set<Tag> tags);
+
+ void updateBundleTags(int bundleId, Set<Tag> tags);
+
+ void updateBundleVersionTags(int bundleVersionId, Set<Tag> tags);
+
+ void updateBundleDeploymentTags(int bundleDeploymentId, Set<Tag> tags);
+
}
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 3a010dd..93b6512 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
@@ -23,15 +23,21 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.tagging.Tag;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+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.message.Message;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
+import java.util.HashSet;
import java.util.Set;
/**
@@ -58,9 +64,10 @@ public class ResourceTitleBar extends HLayout {
setMembersMargin(5);
}
- @Override
- protected void onInit() {
- super.onInit();
+ public void update() {
+ for (Canvas child : getChildren()) {
+ child.destroy();
+ }
this.title = new HTMLFlow();
this.title.setWidth("*");
@@ -78,14 +85,33 @@ public class ResourceTitleBar extends HLayout {
badge = new Img("types/Service_up_24.png", 24, 24);
+ TagEditorView tagEditorView = new TagEditorView(resource.getTags(), false, new TagsChangedCallback() {
+ public void tagsChanged(final HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateResourceTags(resource.getId(), tags, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update resource tags", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Resource tags updated", Message.Severity.Info));
+ // update what is essentially our local cache
+ resource.setTags(tags);
+ }
+ });
+ }
+ });
+
+
addMember(badge);
addMember(title);
+ addMember(tagEditorView);
addMember(availabilityImage);
addMember(favoriteButton);
}
public void setResource(Resource resource) {
this.resource = resource;
+ update();
this.title.setContents("<span class=\"SectionHeader\">" + resource.getName() + "</span> <span class=\"subtitle\">" + resource.getResourceType().getName() + "</span>");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 86d3f8d..898b56a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -314,7 +314,7 @@ public class ResourceTreeView extends VLayout {
// Update breadcrumbs
viewId.getBreadcrumbs().clear();
- for (int i = parents.length-1; i >= 0; i--) {
+ for (int i = parents.length - 1; i >= 0; i--) {
TreeNode n = parents[i];
if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
@@ -367,15 +367,17 @@ public class ResourceTreeView extends VLayout {
treeGrid.markForRedraw();
// Update breadcrumbs
- viewId.getBreadcrumbs().clear();
- for (int i = parents.length-1; i >= 0; i--) {
- TreeNode n = parents[i];
- if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
- viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
+ if (viewId != null) {
+ viewId.getBreadcrumbs().clear();
+ for (int i = parents.length - 1; i >= 0; i--) {
+ TreeNode n = parents[i];
+ if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
+ viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
+ }
}
+ viewId.getBreadcrumbs().add(new Breadcrumb(selectedNode.getAttribute("id"), selectedNode.getName(), true));
+ CoreGUI.refreshBreadCrumbTrail();
}
- viewId.getBreadcrumbs().add(new Breadcrumb(selectedNode.getAttribute("id"), selectedNode.getName(), true));
- CoreGUI.refreshBreadCrumbTrail();
}
}
}
@@ -428,7 +430,7 @@ public class ResourceTreeView extends VLayout {
// Update breadcrumbs
viewId.getBreadcrumbs().clear();
- for (int i = parents.length-1; i >= 0; i--) {
+ for (int i = parents.length - 1; i >= 0; i--) {
TreeNode n = parents[i];
if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TagGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TagGWTServiceImpl.java
index a99f389..fb27c52 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TagGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TagGWTServiceImpl.java
@@ -53,4 +53,24 @@ public class TagGWTServiceImpl extends AbstractGWTServiceImpl implements TagGWTS
public void removeTags(Set<Tag> tags) {
tagManager.removeTags(getSessionSubject(), tags);
}
+
+ public void updateResourceTags(int resourceId, Set<Tag> tags) {
+ tagManager.updateResourceTags(getSessionSubject(), resourceId, tags);
+ }
+
+ public void updateResourceGroupTags(int resourceGroupId, Set<Tag> tags) {
+ tagManager.updateResourceGroupTags(getSessionSubject(), resourceGroupId, tags);
+ }
+
+ public void updateBundleTags(int bundleId, Set<Tag> tags) {
+ tagManager.updateBundleTags(getSessionSubject(), bundleId, tags);
+ }
+
+ public void updateBundleVersionTags(int bundleVersionId, Set<Tag> tags) {
+ tagManager.updateBundleVersionTags(getSessionSubject(), bundleVersionId, tags);
+ }
+
+ public void updateBundleDeploymentTags(int bundleDeploymentId, Set<Tag> tags) {
+ tagManager.updateBundleDeploymentTags(getSessionSubject(), bundleDeploymentId, tags);
+ }
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
index f18733e..4b34270 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
@@ -22,6 +22,8 @@
*/
package org.rhq.enterprise.server.tagging;
+import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.ejb.EJB;
@@ -33,11 +35,19 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.criteria.TagCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
+import org.rhq.enterprise.server.authz.PermissionException;
+import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -56,7 +66,6 @@ public class TagManagerBean implements TagManagerLocal {
private AuthorizationManagerLocal authorizationManager;
-
public PageList<Tag> findTagsByCriteria(Subject subject, TagCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
@@ -68,17 +77,92 @@ public class TagManagerBean implements TagManagerLocal {
public Set<Tag> addTags(Subject subject, Set<Tag> tags) {
+ Set<Tag> results = new HashSet<Tag>();
+
// This isn't efficient, but then how many tags will you really be creating at once
for (Tag tag : tags) {
- entityManager.persist(tag);
+ TagCriteria criteria = new TagCriteria();
+ criteria.addFilterNamespace(tag.getNamespace());
+ criteria.addFilterSemantic(tag.getSemantic());
+ criteria.addFilterName(tag.getName());
+ criteria.setStrict(true);
+ List<Tag> found = findTagsByCriteria(subject, criteria);
+ if (!found.isEmpty()) {
+ assert found.size() == 1; // should never be more than one
+ results.add(found.get(0));
+ } else {
+ entityManager.persist(tag);
+ results.add(tag);
+ }
}
- return tags;
+ return results;
}
public void removeTags(Subject subject, Set<Tag> tags) {
// This isn't efficient, but then how many tags will you really be deleting at once
for (Tag tag : tags) {
- entityManager.remove(entityManager.find(Tag.class,tag.getId()));
+ entityManager.remove(entityManager.find(Tag.class, tag.getId()));
+ }
+ }
+
+
+ public void updateResourceTags(Subject subject, int resourceId, Set<Tag> tags) {
+ if (!authorizationManager.hasResourcePermission(subject, Permission.MODIFY_RESOURCE, resourceId)) {
+ throw new PermissionException("You do not have permission to modify resource");
+ }
+
+ Set<Tag> definedTags = addTags(subject, tags);
+ Resource resource = entityManager.find(Resource.class, resourceId);
+ for (Tag tag : definedTags) {
+ tag.addResource(resource);
+ }
+ }
+
+ public void updateResourceGroupTags(Subject subject, int resourceGroupId, Set<Tag> tags) {
+ if (!authorizationManager.hasGroupPermission(subject, Permission.MODIFY_RESOURCE, resourceGroupId)) {
+ throw new PermissionException("You do not have permission to modify group");
+ }
+
+ Set<Tag> definedTags = addTags(subject, tags);
+ ResourceGroup group = entityManager.find(ResourceGroup.class, resourceGroupId);
+ group.setTags(definedTags);
+ for (Tag tag : definedTags) {
+ tag.addResourceGroup(group);
+ }
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ // todo verify
+ public void updateBundleTags(Subject subject, int bundleId, Set<Tag> tags) {
+
+ Set<Tag> definedTags = addTags(subject, tags);
+ Bundle bundle = entityManager.find(Bundle.class, bundleId);
+ for (Tag tag : definedTags) {
+ tag.addBundle(bundle);
+ }
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ // todo verify
+ public void updateBundleVersionTags(Subject subject, int bundleVersionId, Set<Tag> tags) {
+
+ Set<Tag> definedTags = addTags(subject, tags);
+ BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
+ bundleVersion.setTags(definedTags);
+ for (Tag tag : definedTags) {
+ tag.addBundleVersion(bundleVersion);
+ }
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ // todo verify
+ public void updateBundleDeploymentTags(Subject subject, int bundleDeploymentId, Set<Tag> tags) {
+
+ Set<Tag> definedTags = addTags(subject, tags);
+ BundleDeployment bundleDeployment = entityManager.find(BundleDeployment.class, bundleDeploymentId);
+ bundleDeployment.setTags(definedTags);
+ for (Tag tag : definedTags) {
+ tag.addBundleDeployment(bundleDeployment);
}
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerRemote.java
index 65e566a..9dcbd74 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerRemote.java
@@ -46,5 +46,16 @@ public interface TagManagerRemote {
void removeTags(Subject subject, Set<Tag> tags);
+ void updateResourceTags(Subject subject, int resourceId, Set<Tag> tags);
+
+ void updateResourceGroupTags(Subject subject, int resourceGroupId, Set<Tag> tags);
+
+ void updateBundleTags(Subject subject, int bundleId, Set<Tag> tags);
+
+ void updateBundleVersionTags(Subject subject, int bundleVersionId, Set<Tag> tags);
+
+ void updateBundleDeploymentTags(Subject subject, int bundleDeploymentId, Set<Tag> tags);
+
+
}
commit 9b2d60404d8ec10df7b8325f1b6d84042dbe7261
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Apr 26 15:12:29 2010 -0400
Tag gwt service exposure
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 51dcca6..b980d6a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -58,5 +58,6 @@
<servlet path="/ResourceBossGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.ResourceBossGWTServiceImpl"/>
<servlet path="/AuthorizationGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AuthorizationGWTServiceImpl"/>
<servlet path="/AvailabilityGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AvailabilityGWTServiceImpl"/>
+ <servlet path="/TagGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.TagGWTServiceImpl"/>
</module>
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index 10e8f01..ce0e2eb 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -76,6 +76,10 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI AvailabilityGWTService</servlet-name>
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.AvailabilityGWTServiceImpl</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI TagGWTService</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.TagGWTServiceImpl</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RoleGWTService</servlet-name>
@@ -143,4 +147,8 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI AvailabilityGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/AvailabilityGWTService</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI TagGWTService</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/TagGWTService</url-pattern>
+ </servlet-mapping>
</web-app>
commit 8a1bd9af2d92bd45f16448763bb412c3c20809bd
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 22 15:39:57 2010 -0400
Basic Tag infrastructure merged with latest from gwt branch, tables updated, etc.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java
index 3d7b11a..3cd52f8 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java
@@ -48,6 +48,8 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlTransient;
+import org.jetbrains.annotations.NotNull;
+
import org.rhq.core.domain.resource.Resource;
/**
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
index 9495b80..d6fd9a7 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
@@ -45,6 +45,7 @@ public class BundleCriteria extends Criteria {
private boolean fetchBundleVersions;
private boolean fetchPackageType;
private boolean fetchRepo;
+ private boolean fetchTags;
private PageOrdering sortName;
private PageOrdering sortDescription;
@@ -102,6 +103,11 @@ public class BundleCriteria extends Criteria {
this.fetchRepo = fetchRepo;
}
+ public void fetchTags(boolean fetchTags) {
+ this.fetchTags = fetchTags;
+ }
+
+
public void addSortName(PageOrdering sortName) {
addSortField("name");
this.sortName = sortName;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
index a8bf932..1ad7f05 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
@@ -40,6 +40,7 @@ public class BundleDeploymentCriteria extends Criteria {
private boolean fetchConfiguration;
private boolean fetchDeployments;
private boolean fetchGroupDeployments;
+ private boolean fetchTags;
public BundleDeploymentCriteria() {
}
@@ -77,4 +78,8 @@ public class BundleDeploymentCriteria extends Criteria {
this.fetchGroupDeployments = fetchGroupDeployments;
}
+ public void fetchTags(boolean fetchTags) {
+ this.fetchTags = fetchTags;
+ }
+
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
index 68d8913..d9ccb8e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
@@ -45,6 +45,7 @@ public class BundleVersionCriteria extends Criteria {
private boolean fetchBundleDeployments;
private boolean fetchBundleFiles;
private boolean fetchConfigurationDefinition;
+ private boolean fetchTags;
public BundleVersionCriteria() {
filterOverrides.put("bundleId", "bundle.id = ?");
@@ -95,4 +96,10 @@ public class BundleVersionCriteria extends Criteria {
public void fetchConfigurationDefinition(boolean fetchConfigurationDefinition) {
this.fetchConfigurationDefinition = fetchConfigurationDefinition;
}
+
+ public void fetchTags(boolean fetchTags) {
+ this.fetchTags = fetchTags;
+ }
+
+
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index 69be135..d27a7e5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -85,6 +85,7 @@ public class ResourceCriteria extends Criteria {
private boolean fetchResourceErrors;
private boolean fetchEventSources;
private boolean fetchProductVersion;
+ private boolean fetchTags;
private PageOrdering sortName;
private PageOrdering sortInventoryStatus;
@@ -291,6 +292,10 @@ public class ResourceCriteria extends Criteria {
this.fetchProductVersion = fetchProductVersion;
}
+ public void fetchTags(boolean fetchTags) {
+ this.fetchTags = fetchTags;
+ }
+
public void addSortName(PageOrdering sortName) {
addSortField("name");
this.sortName = sortName;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
index 6f831ce..2f98b5b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
@@ -58,6 +58,7 @@ public class ResourceGroupCriteria extends Criteria {
private boolean fetchGroupDefinition;
private boolean fetchResourceType;
private boolean fetchRoles;
+ private boolean fetchTags;
private PageOrdering sortName;
private PageOrdering sortResourceTypeName; // requires overrides
@@ -159,6 +160,11 @@ public class ResourceGroupCriteria extends Criteria {
this.fetchResourceType = fetchResourceType;
}
+ public void fetchTags(boolean fetchTags) {
+ this.fetchTags = fetchTags;
+ }
+
+
/**
* Requires MANAGE_SECURITY
* @param fetchRoles
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/TagCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/TagCriteria.java
new file mode 100644
index 0000000..2c93450
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/TagCriteria.java
@@ -0,0 +1,86 @@
+/*
+ * 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, 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.core.domain.criteria;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.rhq.core.domain.tagging.Tag;
+import org.rhq.core.domain.util.PageOrdering;
+
+/**
+ * @author Greg Hinkle
+ */
+@XmlRootElement
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@SuppressWarnings("unused")
+public class TagCriteria extends Criteria {
+ private static final long serialVersionUID = 1L;
+
+ private String filterNamespace;
+ private String filterSemantic;
+ private String filterName;
+
+ private PageOrdering sortNamespace;
+ private PageOrdering sortSemantic;
+ private PageOrdering sortName;
+
+
+ @Override
+ public Class<?> getPersistentClass() {
+ return Tag.class;
+ }
+
+
+ public void addFilterNamespace(String filterNamespace) {
+ this.filterNamespace = filterNamespace;
+ }
+
+ public void addFilterSemantic(String filterSemantic) {
+ this.filterSemantic = filterSemantic;
+ }
+
+ public void addFilterName(String filterName) {
+ this.filterName = filterName;
+ }
+
+
+ public void addSortNamespace(PageOrdering sortNamespace) {
+ addSortField("namespace");
+ this.sortNamespace = sortNamespace;
+ }
+
+ public void addSortSemantic(PageOrdering sortSemantic) {
+ addSortField("semantic");
+ this.sortSemantic = sortSemantic;
+ }
+
+ public void addSortName(PageOrdering sortName) {
+ addSortField("name");
+ this.sortName = sortName;
+ }
+
+
+
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/tagging/Tag.java b/modules/core/domain/src/main/java/org/rhq/core/domain/tagging/Tag.java
index 3749413..623ec87 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/tagging/Tag.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/tagging/Tag.java
@@ -26,6 +26,7 @@ import java.io.Serializable;
import java.util.Set;
import javax.persistence.Column;
+import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@@ -47,7 +48,8 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
/**
* @author Greg Hinkle
*/
-@SequenceGenerator(name = "id", sequenceName = "RHQ_TAGGING_ID_SEQ")
+@Entity
+@SequenceGenerator(name = "RHQ_TAGGING_SEQ", sequenceName = "RHQ_TAGGING_ID_SEQ", allocationSize = 10)
@Table(name = "RHQ_TAGGING")
@XmlAccessorType(XmlAccessType.FIELD)
public class Tag implements Serializable {
@@ -56,7 +58,7 @@ public class Tag implements Serializable {
@Column(name = "ID", nullable = false)
- @GeneratedValue(strategy = GenerationType.AUTO, generator = "RHQ_TAGGING_ID_SEQ")
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "RHQ_TAGGING_SEQ")
@Id
private int id;
@@ -74,7 +76,6 @@ public class Tag implements Serializable {
@ManyToMany
private Set<Resource> resources;
-
@JoinTable(name = "RHQ_TAGGING_RES_GRP_MAP", joinColumns = { @JoinColumn(name = "TAG_ID") }, inverseJoinColumns = { @JoinColumn(name = "RESOURCE_GROUP_ID") })
@ManyToMany
private Set<ResourceGroup> resourceGroups;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index d887f8c..d251630 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -88,6 +88,10 @@ public class GWTServiceLookup {
return secure(AvailabilityGWTServiceAsync.Util.getInstance());
}
+ public static TagGWTServiceAsync getTagService() {
+ return secure(TagGWTServiceAsync.Util.getInstance());
+ }
+
private static <T> T secure(Object sdt) {
if (!(sdt instanceof ServiceDefTarget))
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
index 9fcb5cc..99234dc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
@@ -51,6 +51,8 @@ public interface ResourceGWTService extends RemoteService {
List<Integer> deleteResources(int[] resourceIds);
+ void updateResource(Resource resource);
+
void createResource(int parentResourceId, int newResourceTypeId, String newResourceName, Configuration newResourceConfiguration);
Map<Resource, List<Resource>> getQueuedPlatformsAndServers(HashSet<InventoryStatus> statuses, PageControl pc);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TagGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TagGWTService.java
new file mode 100644
index 0000000..8f191d0
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TagGWTService.java
@@ -0,0 +1,47 @@
+/*
+ * 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, 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.enterprise.gui.coregui.client.gwt;
+
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.TagCriteria;
+import org.rhq.core.domain.tagging.Tag;
+import org.rhq.core.domain.util.PageList;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface TagGWTService extends RemoteService {
+
+
+ PageList<Tag> findTagsByCriteria(TagCriteria tagCriteria);
+
+ Set<Tag> addTags(Set<Tag> tags);
+
+ void removeTags(Set<Tag> tags);
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 503db39..e342628 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -86,6 +86,7 @@ public class ResourceView extends HLayout implements BookmarkableView {
} else {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(resourceId);
+ criteria.fetchTags(true);
//criteria.fetchParentResource(true);
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 3434a67..add7a25 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -162,6 +162,10 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
"ResourceService.deleteResources");
}
+ public void updateResource(Resource resource) {
+ resourceManager.updateResource(getSessionSubject(), resource);
+ }
+
public void createResource(int parentResourceId, int newResourceTypeId, String newResourceName, Configuration newResourceConfiguration) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TagGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TagGWTServiceImpl.java
new file mode 100644
index 0000000..a99f389
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TagGWTServiceImpl.java
@@ -0,0 +1,56 @@
+/*
+ * 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, 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.enterprise.gui.coregui.server.gwt;
+
+import java.util.Set;
+
+import org.rhq.core.domain.criteria.TagCriteria;
+import org.rhq.core.domain.tagging.Tag;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.gwt.TagGWTService;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.tagging.TagManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author Greg Hinkle
+ */
+public class TagGWTServiceImpl extends AbstractGWTServiceImpl implements TagGWTService {
+
+ private TagManagerLocal tagManager = LookupUtil.getTagManager();
+
+ public PageList<Tag> findTagsByCriteria(TagCriteria tagCriteria) {
+ return SerialUtility.prepare(tagManager.findTagsByCriteria(getSessionSubject(), tagCriteria),
+ "TagService.findTagsByCriteria");
+ }
+
+ public Set<Tag> addTags(Set<Tag> tags) {
+ return SerialUtility.prepare(
+ tagManager.addTags(getSessionSubject(), tags),
+ "TagService.addTags");
+ }
+
+ public void removeTags(Set<Tag> tags) {
+ tagManager.removeTags(getSessionSubject(), tags);
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
new file mode 100644
index 0000000..f18733e
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
@@ -0,0 +1,84 @@
+/*
+ * 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, 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.enterprise.server.tagging;
+
+import java.util.Set;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.TagCriteria;
+import org.rhq.core.domain.tagging.Tag;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
+import org.rhq.enterprise.server.util.CriteriaQueryRunner;
+
+/**
+ * @author Greg Hinkle
+ */
+@Stateless
+public class TagManagerBean implements TagManagerLocal {
+
+ private final Log log = LogFactory.getLog(TagManagerBean.class);
+
+ @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
+ private EntityManager entityManager;
+
+ @EJB
+ private AuthorizationManagerLocal authorizationManager;
+
+
+
+ public PageList<Tag> findTagsByCriteria(Subject subject, TagCriteria criteria) {
+
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
+
+ CriteriaQueryRunner<Tag> queryRunner = new CriteriaQueryRunner<Tag>(criteria, generator, entityManager);
+
+ return queryRunner.execute();
+ }
+
+
+ public Set<Tag> addTags(Subject subject, Set<Tag> tags) {
+ // This isn't efficient, but then how many tags will you really be creating at once
+ for (Tag tag : tags) {
+ entityManager.persist(tag);
+ }
+ return tags;
+ }
+
+ public void removeTags(Subject subject, Set<Tag> tags) {
+ // This isn't efficient, but then how many tags will you really be deleting at once
+ for (Tag tag : tags) {
+ entityManager.remove(entityManager.find(Tag.class,tag.getId()));
+ }
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerLocal.java
new file mode 100644
index 0000000..6197db3
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerLocal.java
@@ -0,0 +1,33 @@
+/*
+ * 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, 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.enterprise.server.tagging;
+
+import javax.ejb.Local;
+
+/**
+ * @author Greg Hinkle
+ */
+@Local
+public interface TagManagerLocal extends TagManagerRemote {
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerRemote.java
new file mode 100644
index 0000000..65e566a
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerRemote.java
@@ -0,0 +1,50 @@
+/*
+ * 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, 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.enterprise.server.tagging;
+
+import java.util.Set;
+
+import javax.ejb.Local;
+import javax.ejb.Remote;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.TagCriteria;
+import org.rhq.core.domain.tagging.Tag;
+import org.rhq.core.domain.util.PageList;
+
+/**
+ * @author Greg Hinkle
+ */
+@Remote
+public interface TagManagerRemote {
+
+
+ PageList<Tag> findTagsByCriteria(Subject subject, TagCriteria tagCriteria);
+
+ Set<Tag> addTags(Subject subject, Set<Tag> tags);
+
+ void removeTags(Subject subject, Set<Tag> tags);
+
+
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
index e5171e9..39b2c47 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
@@ -179,6 +179,8 @@ import org.rhq.enterprise.server.support.SupportManagerBean;
import org.rhq.enterprise.server.support.SupportManagerLocal;
import org.rhq.enterprise.server.system.SystemManagerBean;
import org.rhq.enterprise.server.system.SystemManagerLocal;
+import org.rhq.enterprise.server.tagging.TagManagerBean;
+import org.rhq.enterprise.server.tagging.TagManagerLocal;
import org.rhq.enterprise.server.test.AccessBean;
import org.rhq.enterprise.server.test.AccessLocal;
import org.rhq.enterprise.server.test.AlertTemplateTestBean;
@@ -560,6 +562,12 @@ public final class LookupUtil {
return lookupLocal(ServerPluginsBean.class);
}
+ public static TagManagerLocal getTagManager() {
+ return lookupLocal(TagManagerBean.class);
+ }
+
+
+
public static CoreServerMBean getCoreServer() {
MBeanServer jBossMBeanServer = MBeanServerLocator.locateJBoss();
CoreServerMBean jonServer = (CoreServerMBean) MBeanProxyExt.create(CoreServerMBean.class,
commit 1a412ccbc69c9c5981bf16dfaa2037bd7ab07917
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 22 11:19:32 2010 -0400
resource column for alerts for dashboard view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index c02de80..de4d5ea 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -38,6 +38,7 @@ import com.smartgwt.client.data.fields.DataSourceBooleanField;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.types.FieldType;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -94,9 +95,17 @@ public class AlertDataSource extends RPCDataSource<Alert> {
conditionValueField.setCanSortClientOnly(true);
fields.add(conditionValueField);
- DataSourceTextField recoveryInfoField = new DataSourceTextField("recoveryInfo", "Recovery Info");
- recoveryInfoField.setCanSortClientOnly(true);
- fields.add(recoveryInfoField);
+ DataSourceTextField resourceName = new DataSourceTextField("resourceName", "Resource");
+ resourceName.setCanSortClientOnly(true);
+ fields.add(resourceName);
+
+
+// DataSourceTextField recoveryInfoField = new DataSourceTextField("recoveryInfo", "Recovery Info");
+// recoveryInfoField.setCanSortClientOnly(true);
+// fields.add(recoveryInfoField);
+
+
+
// TODO: Will using DataSourceEnumField here allow us to do
// record.setAttribute("priority", alert.getAlertDefinition().getPriority()), rather than
@@ -201,6 +210,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
ListGridRecord record = new ListGridRecord();
record.setAttribute("id", from.getId());
record.setAttribute("resourceId", from.getAlertDefinition().getResource().getId());
+ record.setAttribute("resourceName", from.getAlertDefinition().getResource().getName());
record.setAttribute("name", from.getAlertDefinition().getName());
record.setAttribute("priority", from.getAlertDefinition().getPriority().name());
record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(from.getCtime())));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index fe64b84..adf12c5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -27,11 +27,13 @@ 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.types.SortDirection;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+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;
@@ -56,9 +58,9 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
public class AlertsView extends VLayout {
private static final String TITLE = "Alerts";
- private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[] {
- new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING),
- new SortSpecifier(AlertCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING)
+ private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[]{
+ new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING),
+ new SortSpecifier(AlertCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING)
};
private static final String DELETE_CONFIRM_MESSAGE = "Are you sure you want to delete the selected alert(s)?";
@@ -70,8 +72,20 @@ public class AlertsView extends VLayout {
private VerticalPanel vpanel;
private static final String SENDER = "sender";
+ Criteria criteria;
+ String[] excludedFieldNames;
+ boolean showDetails;
+
+ public AlertsView() {
+ this(null, null);
+ showDetails = false;
+
+ }
+
public AlertsView(Criteria criteria, String[] excludedFieldNames) {
- this.table = new Table(TITLE, criteria, SORT_SPECIFIERS, excludedFieldNames);
+ this.criteria = criteria;
+ this.excludedFieldNames = excludedFieldNames;
+ showDetails = false;
}
@@ -88,59 +102,72 @@ public class AlertsView extends VLayout {
protected void onDraw() {
super.onDraw();
+ if (table == null) {
+ this.table = new Table(TITLE, criteria, SORT_SPECIFIERS, excludedFieldNames);
+
+
+ // Add the list table as the top half of the view.
+ //Criteria criteria = new Criteria(AlertCriteria.);
+ this.table.setHeight("50%");
+ ListGrid listGrid = this.table.getListGrid();
+ this.dataSource = new AlertDataSource();
+ this.table.setDataSource(this.dataSource);
+ listGrid.getField("name").setWidth("15%");
+ listGrid.getField("conditionText").setWidth("30%");
+ listGrid.getField("conditionValue").setWidth("10%");
+ listGrid.getField("resourceName").setWidth("20%");
+// listGrid.getField("recoveryInfo").setWidth("20%");
+ listGrid.getField("priority").setWidth("7%");
+ listGrid.getField("ctime").setWidth("13%");
+ listGrid.getField("ack").setWidth("5%");
+
+ listGrid.getField("resourceName").setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ return "<a href=\"#Resource/" + listGridRecord.getAttribute("resourceId") + "\">" + o + "</a>";
+ }
+ });
- // Add the list table as the top half of the view.
- //Criteria criteria = new Criteria(AlertCriteria.);
- this.table.setHeight("50%");
- ListGrid listGrid = this.table.getListGrid();
- this.dataSource = new AlertDataSource();
- this.table.setDataSource(this.dataSource);
- listGrid.getField("name").setWidth("10%");
- listGrid.getField("conditionText").setWidth("30%");
- listGrid.getField("conditionValue").setWidth("15%");
- listGrid.getField("recoveryInfo").setWidth("20%");
- listGrid.getField("priority").setWidth("7%");
- listGrid.getField("ctime").setWidth("13%");
- listGrid.getField("ack").setWidth("5%");
-
- this.table.addTableAction("Delete", Table.SelectionEnablement.ANY, DELETE_CONFIRM_MESSAGE, new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- AlertsView.this.dataSource.deleteAlerts(AlertsView.this);
- }
- });
- this.table.addTableAction("Acknowledge", Table.SelectionEnablement.ANY, null, new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- AlertsView.this.dataSource.acknowledgeAlerts(AlertsView.this);
- }
- });
-
- listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent event) {
- ListGridRecord[] selectedRecords = AlertsView.this.table.getListGrid().getSelection();
- String contents;
- if (selectedRecords.length == 1) {
- ListGridRecord record = selectedRecords[0];
-
- // Clean out existing details and provide new ones
- for (int i = 1 ; i <= getChildren().length ; i ++)
- getChildren()[1].destroy();
-
- addMember(getDetailsTabSet(record));
-
- } else {
- // Clean out existing details and show the "nothing selected message"
- for (int i = 1 ; i <= getChildren().length ; i ++)
- getChildren()[1].destroy();
- addMember(getNoAlertSelectedMessage());
+ this.table.addTableAction("Delete", Table.SelectionEnablement.ANY, DELETE_CONFIRM_MESSAGE, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ AlertsView.this.dataSource.deleteAlerts(AlertsView.this);
}
+ });
+ this.table.addTableAction("Acknowledge", Table.SelectionEnablement.ANY, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ AlertsView.this.dataSource.acknowledgeAlerts(AlertsView.this);
+ }
+ });
+
+ if (showDetails) {
+ listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent event) {
+ ListGridRecord[] selectedRecords = AlertsView.this.table.getListGrid().getSelection();
+ String contents;
+ if (selectedRecords.length == 1) {
+ ListGridRecord record = selectedRecords[0];
+
+ // Clean out existing details and provide new ones
+ for (int i = 1; i <= getChildren().length; i++)
+ getChildren()[1].destroy();
+
+ addMember(getDetailsTabSet(record));
+
+ } else {
+ // Clean out existing details and show the "nothing selected message"
+ for (int i = 1; i <= getChildren().length; i++)
+ getChildren()[1].destroy();
+ addMember(getNoAlertSelectedMessage());
+ }
+ }
+ });
}
- });
- addMember(this.table);
+ addMember(this.table);
+ }
- // Add the details panel as the bottom half of the view.
- // Default is the "nothing selected" message
- addMember(getNoAlertSelectedMessage());
+// // Add the details panel as the bottom half of the view.
+// // Default is the "nothing selected" message
+// addMember(getNoAlertSelectedMessage());
}
@@ -185,27 +212,27 @@ public class AlertsView extends VLayout {
descriptionTextItem.setValue(record.getAttribute("description"));
items.add(descriptionTextItem);
- StaticTextItem prioTextItem = new StaticTextItem("priority","Priority");
+ StaticTextItem prioTextItem = new StaticTextItem("priority", "Priority");
prioTextItem.setValue(record.getAttribute("priority"));
items.add(prioTextItem);
- StaticTextItem createdTextItem = new StaticTextItem("ctime","Created at");
+ StaticTextItem createdTextItem = new StaticTextItem("ctime", "Created at");
createdTextItem.setValue(record.getAttribute("ctime"));
items.add(createdTextItem);
- StaticTextItem ackByItem = new StaticTextItem("ack_by","Acknowledged by");
- if (record.getAttribute("ack_by")!=null) {
+ StaticTextItem ackByItem = new StaticTextItem("ack_by", "Acknowledged by");
+ if (record.getAttribute("ack_by") != null) {
ackByItem.setValue(record.getAttribute("ack_by"));
}
items.add(ackByItem);
- StaticTextItem ackTimeItem = new StaticTextItem("ack_time","Acknowledged at");
- if (record.getAttribute("ack_time")!=null) {
+ StaticTextItem ackTimeItem = new StaticTextItem("ack_time", "Acknowledged at");
+ if (record.getAttribute("ack_time") != null) {
ackTimeItem.setValue(record.getAttribute("ack_time"));
}
items.add(ackTimeItem);
- StaticTextItem recoveryItem = new StaticTextItem("recovery","Recovery Info");
+ StaticTextItem recoveryItem = new StaticTextItem("recovery", "Recovery Info");
recoveryItem.setValue(record.getAttribute("recoveryInfo"));
items.add(recoveryItem);
@@ -219,25 +246,25 @@ public class AlertsView extends VLayout {
DataClass[] input = record.getAttributeAsRecordArray("notificationLogs");
- Table notifTable = new Table("Notifications",false);
+ Table notifTable = new Table("Notifications", false);
notifTable.setHeight("35%");
notifTable.setWidth100();
ListGrid grid = notifTable.getListGrid();
grid.setData((Record[]) input);
- ListGridField sender = new ListGridField(SENDER,"Sender");
+ ListGridField sender = new ListGridField(SENDER, "Sender");
sender.setWidth("10%");
- ListGridField status = new ListGridField("status","Result");
+ ListGridField status = new ListGridField("status", "Result");
status.setWidth("8%");
- ListGridField message = new ListGridField("message","Message");
+ ListGridField message = new ListGridField("message", "Message");
message.setWidth("32%");
- ListGridField allEmails = new ListGridField("allEmails","All Emails");
+ ListGridField allEmails = new ListGridField("allEmails", "All Emails");
allEmails.setWidth("25%");
- ListGridField badEmails = new ListGridField("badEmails","Bad Emails");
+ ListGridField badEmails = new ListGridField("badEmails", "Bad Emails");
badEmails.setWidth("25%");
- grid.setFields(sender,status,message,allEmails,badEmails);
+ grid.setFields(sender, status, message, allEmails, badEmails);
return notifTable;
}
@@ -248,18 +275,18 @@ public class AlertsView extends VLayout {
String mode = record.getAttribute("conditionExpression");
- Table table = new Table("Conditions: match = " + mode,false);
+ Table table = new Table("Conditions: match = " + mode, false);
table.setHeight("35%");
table.setWidth100();
ListGrid grid = table.getListGrid();
grid.setData((Record[]) input);
- ListGridField condition = new ListGridField("text","Matching condition");
+ ListGridField condition = new ListGridField("text", "Matching condition");
condition.setWidth("60%");
- ListGridField value = new ListGridField("value","Value");
+ ListGridField value = new ListGridField("value", "Value");
- grid.setFields(condition,value);
+ grid.setFields(condition, value);
return table;
commit fc98d9d53d9d0943984842beb63a1ab842a933c5
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 22 11:18:50 2010 -0400
Continued prototyping of new alert def ui
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/AlertEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/AlertEditView.java
index 4bc4a03..8ef2feb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/AlertEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/AlertEditView.java
@@ -24,6 +24,7 @@ import java.util.LinkedHashMap;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.FormItemIfFunction;
import com.smartgwt.client.widgets.form.ValuesManager;
import com.smartgwt.client.widgets.form.fields.BlurbItem;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
@@ -72,6 +73,7 @@ public class AlertEditView extends VLayout {
addMember(buildEditForm());
+ addMember(buildConditionSection(0));
}
@@ -119,12 +121,6 @@ public class AlertEditView extends VLayout {
conditionsHeader.setValue("Alert Conditions");
- CanvasItem conditionOne = new CanvasItem("condition0");
- conditionOne.setShowTitle(false);
- conditionOne.setColSpan(4);
- conditionOne.setCanvas(buildConditionSection(0));
-
-
/*
LinkedHashMap valuesMap = new LinkedHashMap();
valuesMap.put("Metric", buildMetricSectionCavans(vm));
@@ -134,7 +130,7 @@ public class AlertEditView extends VLayout {
RadioGroupWithComponentsItem conditionGroup = new RadioGroupWithComponentsItem("radioTest", "Test", valuesMap, form);
*/
- form.setItems(alertPropertiesHeader, alertName, priority, description, active, conditionsHeader, conditionOne);
+ form.setItems(alertPropertiesHeader, alertName, priority, description, active, conditionsHeader);
return form;
@@ -152,22 +148,26 @@ public class AlertEditView extends VLayout {
ALERT("Alert Fired"), //
RESOURCE_CONFIG("Resource Configuration Property Value Change"), //
EVENT("Log Event");
+ */
- */
+ private DynamicForm buildConditionSection(final int ci) {
- private DynamicForm buildConditionSection(int ci) {
+ final DynamicForm form = new DynamicForm();
+
+ ValuesManager vm = new ValuesManager();
+ form.setValuesManager(vm);
- DynamicForm form = new DynamicForm();
form.setNumCols(3);
form.setColWidths("30","120","*");
ArrayList<FormItem> items = new ArrayList<FormItem>();
-//
-// RadioGroupItem conditionType = new RadioGroupItem("conditionType" + ci, "Condition Type");
-// conditionType.setImageURLPrefix("subsystems/");
-// conditionType.setImageURLSuffix("_16.png");
+
+ RadioGroupItem conditionType = new RadioGroupItem("conditionType" + ci, "Condition Type");
+ conditionType.setImageURLPrefix("subsystems/");
+ conditionType.setImageURLSuffix("_16.png");
+ items.add(conditionType);
LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
valueMap.put(AlertConditionCategory.AVAILABILITY.name(), AlertConditionCategory.AVAILABILITY.getDisplayName());
@@ -175,7 +175,7 @@ public class AlertEditView extends VLayout {
valueMap.put(AlertConditionCategory.TRAIT.name(), AlertConditionCategory.TRAIT.getDisplayName());
valueMap.put(AlertConditionCategory.CONTROL.name(), AlertConditionCategory.CONTROL.getDisplayName());
valueMap.put(AlertConditionCategory.EVENT.name(), AlertConditionCategory.EVENT.getDisplayName());
-// conditionType.setValueMap(valueMap);
+ conditionType.setValueMap(valueMap);
LinkedHashMap<String, String> iconMap = new LinkedHashMap<String, String>();
@@ -185,11 +185,12 @@ public class AlertEditView extends VLayout {
iconMap.put(AlertConditionCategory.CONTROL.name(), "control/Operation");
iconMap.put(AlertConditionCategory.EVENT.name(), "event/Events_error");
-// conditionType.setValueIcons(iconMap);
-//// conditionType.setValueIconSize(24);http://localhost:7080/coregui/images/availability/availability_red
-// conditionType.setShowIcons(true);
-
+ conditionType.setValueIcons(iconMap);
+ conditionType.setValue(AlertConditionCategory.AVAILABILITY.name());
+// conditionType.setValueIconSize(24);http://localhost:7080/coregui/images/availability/availability_red
+ conditionType.setShowIcons(true);
+/*
for (final String key : valueMap.keySet()) {
BlurbItem icon = new BlurbItem();
icon.setColSpan(1);
@@ -204,6 +205,7 @@ public class AlertEditView extends VLayout {
radio.setStartRow(false);
radio.setShowTitle(false);
radio.setValueMap(valueMap.get(key));
+ radio.setRedrawOnChange(true);
items.add(radio);
icon.addClickHandler(new ClickHandler() {
@@ -212,16 +214,32 @@ public class AlertEditView extends VLayout {
}
});
- }
+ }*/
+
+ CanvasItem metricCanvas = buildMetricSectionCavans(vm);
+ metricCanvas.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return "metric".equals(form.getValue("conditionType" + ci));
+ }
+ });
+ items.add(metricCanvas);
+ CanvasItem propertyCanvas = buildInventoryPropertySectionCavans(vm);
+ propertyCanvas.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return AlertConditionCategory.AVAILABILITY.name().equals(form.getValue("conditionType" + ci));
+ }
+ });
+ items.add(propertyCanvas);
+
form.setItems(items.toArray(new FormItem[items.size()]));
return form;
}
- private DynamicForm buildMetricSectionCavans(ValuesManager vm) {
+ private CanvasItem buildMetricSectionCavans(ValuesManager vm) {
DynamicForm form = new DynamicForm();
form.setTitleSuffix("");
@@ -281,11 +299,16 @@ public class AlertEditView extends VLayout {
metricConditionType.setShowTitle(false);
form.setItems(metricSelect, new SpacerItem(), metricConditionType);
- return form;
+
+ CanvasItem canvasItem = new CanvasItem("metricConditionCanvas");
+ canvasItem.setShowTitle(false);
+ canvasItem.setCanvas(form);
+
+ return canvasItem;
}
- private DynamicForm buildInventoryPropertySectionCavans(ValuesManager vm) {
+ private CanvasItem buildInventoryPropertySectionCavans(ValuesManager vm) {
DynamicForm form = new DynamicForm();
form.setValuesManager(vm);
@@ -297,6 +320,10 @@ public class AlertEditView extends VLayout {
form.setItems(inventoryProperty);
- return form;
+ CanvasItem canvasItem = new CanvasItem("inventoryPropertyCanvas");
+ canvasItem.setShowTitle(false);
+ canvasItem.setCanvas(form);
+
+ return canvasItem;
}
}
commit c0deec533226d9f6de0ddb85f9bb39243f443a52
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 22 11:18:24 2010 -0400
Support resource column for alerts for dasbhoard view
Add operation execution popup
Add error message on op results page
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
index fd79d76..b6f6702 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation;
+import java.util.Date;
+
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.util.PageList;
@@ -95,7 +97,7 @@ public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationH
ListGridRecord record = new ListGridRecord();
record.setAttribute("id", from.getId());
record.setAttribute("createdTime", from.getCreatedTime());
- record.setAttribute("startedTime", from.getStartedTime());
+ record.setAttribute("startedTime", new Date(from.getStartedTime()));
record.setAttribute("duration", from.getDuration());
record.setAttribute("resource", from.getResource());
record.setAttribute("subject", from.getSubjectName());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index 758cc3d..9a04cdc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -18,19 +18,31 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation;
+import java.util.EnumSet;
+
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
+import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.resource.Resource;
+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.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.detail.OperationDetailsView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuButton;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.events.ClickHandler;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
/**
* @author Greg Hinkle
@@ -38,6 +50,7 @@ import com.smartgwt.client.widgets.layout.VLayout;
public class OperationHistoryView extends VLayout {
Table table;
+ Resource resource;
Criteria criteria;
@Override
@@ -50,8 +63,9 @@ public class OperationHistoryView extends VLayout {
public OperationHistoryView() {
}
- public OperationHistoryView(Criteria criteria) {
- this.criteria = criteria;
+ public OperationHistoryView(Resource resource) {
+ this.resource = resource;
+ this.criteria = new Criteria("resourceId", String.valueOf(resource.getId()));
}
@Override
@@ -95,13 +109,35 @@ public class OperationHistoryView extends VLayout {
});
+ final Menu operationMenu = new Menu();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ for (final OperationDefinition od : type.getOperationDefinitions()) {
+ MenuItem menuItem = new MenuItem(od.getDisplayName());
+ operationMenu.addItem(menuItem);
+ menuItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ new OperationCreateWizard(resource, od).startOperationWizard();
+ }
+ });
+ }
+ }
+ });
+
+ MenuButton operationsButton = new MenuButton("Run Operation",operationMenu);
+ operationsButton.setShowMenuBelow(false);
+ table.addExtraWidget(operationsButton);
+
+
addMember(table);
}
- public static OperationHistoryView getResourceHistoryView(int resourceId) {
- Criteria criteria = new Criteria("resourceId", String.valueOf(resourceId));
+ public static OperationHistoryView getResourceHistoryView(Resource resource) {
- return new OperationHistoryView(criteria);
+ return new OperationHistoryView(resource);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
index 9c14c0e..de1747b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
@@ -20,8 +20,10 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operatio
import java.util.Date;
+import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.AutoFitTextAreaItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -83,11 +85,20 @@ public class OperationDetailsView extends VLayout {
// Results configuration view
+ if (operationHistory.getErrorMessage() != null) {
+
+ DynamicForm errorDisplay = new DynamicForm();
+ errorDisplay.setNumCols(1);
+ AutoFitTextAreaItem errorText = new AutoFitTextAreaItem("error","Error");
+ errorText.setTitleOrientation(TitleOrientation.TOP);
+ errorText.setValue(operationHistory.getErrorMessage());
+
+ }
if (operationHistory.getResults() != null) {
ConfigurationEditor resultsEditor = new ConfigurationEditor(definition.getResultsConfigurationDefinition(), operationHistory.getResults());
-
+ resultsEditor.setReadOnly(true);
addMember(resultsEditor);
}
commit 7acaed8260593d6a0b4027c52337cb14e94c1cd2
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 22 11:17:31 2010 -0400
Updated resource tree icons
Cleaned up resource title bar
Bookmarkable view fixes
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
index d7543fb..cd5e060 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
@@ -42,12 +42,10 @@ public class CustomResourceTreeGrid extends TreeGrid {
boolean up = resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP;
- if (resource.getResourceType().getChildResourceTypes() == null || resource.getResourceType().getChildResourceTypes().isEmpty()) {
- return "resources/Service_" + (up ? "up" : "down") + "_16.png";
+ String category = resource.getResourceType().getCategory().getDisplayName();
+
+ return "types/" + category + "_" + (up ? "up" : "down") + "_16.png";
- } else {
- return "resources/folder_" + (up ? "" : "down_") + (open ? "opened" : "closed") + ".png";
- }
} else {
return "resources/folder_group_" + (open ? "opened" : "closed") + ".png";
}
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 f6c31da..cdf3025 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
@@ -18,20 +18,25 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+import java.util.EnumSet;
+import java.util.Set;
+
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Side;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.Tab;
+
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourcePermission;
-import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.UnknownViewException;
-import org.rhq.enterprise.gui.coregui.client.View;
import org.rhq.enterprise.gui.coregui.client.ViewId;
-import org.rhq.enterprise.gui.coregui.client.ViewRenderer;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.alert.definitions.AlertDefinitionsView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.components.SimpleCollapsiblePanel;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
@@ -42,27 +47,19 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectLi
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert.ResourceAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ResourceConfigurationEditView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.calltime.CallTimeView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.overview.ResourceOverviewView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Side;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.tab.Tab;
-
-import java.util.EnumSet;
-import java.util.Set;
-
/**
* Right panel of the resource view.
*
* @author Greg Hinkle
*/
-public class ResourceDetailView extends VLayout implements ViewRenderer, ResourceSelectListener, TwoLevelTabSelectedHandler {
+public class ResourceDetailView extends VLayout implements BookmarkableView, ResourceSelectListener, TwoLevelTabSelectedHandler {
private Resource resource;
private ResourcePermission permissions;
@@ -81,8 +78,9 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
private ResourceTitleBar titleBar;
- private ViewId currentView;
- private ViewId baseViewId;
+ private ViewId tabView;
+ private ViewId subtabView;
+
public void setResource(Resource resource) {
this.resource = resource;
@@ -165,9 +163,9 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
- inventoryTab.updateSubTab("Connection Settings", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
+ inventoryTab.updateSubTab("Connection Settings", new PluginConfigurationEditView(resource)); // new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
- operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resource.getId()));
+ operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resource));
configurationTab.updateSubTab("Current", new ResourceConfigurationEditView(resource));
configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
@@ -275,41 +273,34 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
}
}
- public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
- if (baseViewId == null) {
- baseViewId = viewId;
- }
- currentView = viewId;
+ public void renderView(ViewPath viewPath) {
+ // TODO: Implement this method.
- String[] parts = currentView.getPath().split("/");
- Breadcrumb crumb = null;
- if (parts.length >= 3) {
- for (Tab t : topTabSet.getTabs()) {
- TwoLevelTab tab = (TwoLevelTab) t;
+ if (viewPath.isEnd()) {
+ // default
- if (tab.getTitle().equals(parts[2])) {
+ } else {
- if (parts.length == 3) {
- crumb = new Breadcrumb(parts[2], parts[2], false);
- }
+ tabView = viewPath.getCurrent();
+ subtabView = viewPath.getNext();
+ for (Tab t : topTabSet.getTabs()) {
+ TwoLevelTab tab = (TwoLevelTab) t;
- if (parts.length >= 4) {
- tab.getLayout().selectTab(parts[3]);
+ if (tab.getTitle().equals(tabView.getPath())) {
+ topTabSet.selectTab(tabView.getPath());
- // Switch the top tab after the subtab to avoid an extra subtab render
- topTabSet.selectTab(tab);
+ tab.getLayout().selectTab(subtabView.getPath());
- if (parts.length == 4) {
- crumb = new Breadcrumb(parts[3], parts[3], false);
- }
- }
}
+
}
+
+
}
- return new View(viewId, crumb);
+
}
}
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 426d84e..3a010dd 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
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import com.google.gwt.user.client.rpc.AsyncCallback;
+
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
@@ -54,6 +55,7 @@ public class ResourceTitleBar extends HLayout {
setWidth100();
setHeight(30);
setPadding(5);
+ setMembersMargin(5);
}
@Override
@@ -96,7 +98,9 @@ public class ResourceTitleBar extends HLayout {
"_24.png");
String category = this.resource.getResourceType().getCategory().getDisplayName();
- String avail = resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase();
+
+ String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
+ ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
badge.setSrc("types/" + category + "_" + avail + "_24.png");
markForRedraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 30822c5..86d3f8d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -21,7 +21,10 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
@@ -67,11 +70,13 @@ public class ResourceTreeView extends VLayout {
private TreeGrid treeGrid;
Menu contextMenu;
+ private ViewId currentViewId;
+
private ArrayList<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
private boolean initialSelect = false;
- public ResourceTreeView(Resource selectedResource) {
+ public ResourceTreeView() {
super();
this.selectedResource = selectedResource;
@@ -79,10 +84,6 @@ public class ResourceTreeView extends VLayout {
setHeight100();
setShowResizeBar(true);
-
- if (selectedResource != null) {
- setSelectedResource(selectedResource);
- }
}
public void onInit() {
@@ -137,43 +138,48 @@ public class ResourceTreeView extends VLayout {
public void onNodeContextClick(final NodeContextClickEvent event) {
event.getNode();
- buildContextMenu(event.getNode());
-
- contextMenu.showContextMenu();
+ if (event.getNode() instanceof ResourceTreeDatasource.TypeTreeNode) {
+ showContextMenu((ResourceTreeDatasource.TypeTreeNode) event.getNode());
+ } else if (event.getNode() instanceof ResourceTreeDatasource.ResourceTreeNode) {
+ showContextMenu((ResourceTreeDatasource.ResourceTreeNode) event.getNode());
+ }
}
});
}
- private void buildContextMenu(TreeNode node) {
- if (node instanceof ResourceTreeDatasource.TypeTreeNode) {
- buildContextMenu((ResourceTreeDatasource.TypeTreeNode) node);
- } else if (node instanceof ResourceTreeDatasource.ResourceTreeNode) {
- buildContextMenu((ResourceTreeDatasource.ResourceTreeNode) node);
- }
- }
-
-
- private void buildContextMenu(ResourceTreeDatasource.TypeTreeNode node) {
+ private void showContextMenu(ResourceTreeDatasource.TypeTreeNode node) {
contextMenu.setItems(new MenuItem(node.getName()));
+ contextMenu.showContextMenu();
+ }
+ private void showContextMenu(final ResourceTreeDatasource.ResourceTreeNode node) {
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ node.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children, ResourceTypeRepository.MetadataType.subCategory,
+ ResourceTypeRepository.MetadataType.pluginConfigurationDefinition, ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ buildResourceContextMenu(node.getResource(), type);
+ contextMenu.showContextMenu();
+ }
+ });
}
- private void buildContextMenu(final ResourceTreeDatasource.ResourceTreeNode node) {
- contextMenu.setItems(new MenuItem(node.getName()));
+ private void buildResourceContextMenu(final Resource resource, final ResourceType resourceType) {
+ contextMenu.setItems(new MenuItem(resource.getName()));
- contextMenu.addItem(new MenuItem("Type: " + node.getResourceType().getName()));
+ contextMenu.addItem(new MenuItem("Type: " + resourceType.getName()));
MenuItem editPluginConfiguration = new MenuItem("Plugin Configuration");
editPluginConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
- Resource resource = node.getResource();
- int resourceId = node.getResource().getId();
- int resourceTypeId = node.getResourceType().getId();
+ int resourceId = resource.getId();
+ int resourceTypeId = resourceType.getId();
Window configEditor = new Window();
configEditor.setTitle("Edit " + resource.getName() + " plugin configuration");
@@ -188,16 +194,15 @@ public class ResourceTreeView extends VLayout {
}
});
- editPluginConfiguration.setEnabled(node.getResource().getResourceType().getPluginConfigurationDefinition() != null);
+ editPluginConfiguration.setEnabled(resourceType.getPluginConfigurationDefinition() != null);
contextMenu.addItem(editPluginConfiguration);
MenuItem editResourceConfiguration = new MenuItem("Resource Configuration");
editResourceConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
- Resource resource = node.getResource();
- int resourceId = node.getResource().getId();
- int resourceTypeId = node.getResourceType().getId();
+ int resourceId = resource.getId();
+ int resourceTypeId = resourceType.getId();
final Window configEditor = new Window();
configEditor.setTitle("Edit " + resource.getName() + " resource configuration");
@@ -218,7 +223,7 @@ public class ResourceTreeView extends VLayout {
}
});
- editResourceConfiguration.setEnabled(node.getResource().getResourceType().getResourceConfigurationDefinition() != null);
+ editResourceConfiguration.setEnabled(resourceType.getResourceConfigurationDefinition() != null);
contextMenu.addItem(editResourceConfiguration);
contextMenu.addItem(new MenuItemSeparator());
@@ -227,7 +232,7 @@ public class ResourceTreeView extends VLayout {
// Operations Menu
MenuItem operations = new MenuItem("Operations");
Menu opSubMenu = new Menu();
- for (final OperationDefinition operationDefinition : node.getResourceType().getOperationDefinitions()) {
+ for (final OperationDefinition operationDefinition : resourceType.getOperationDefinitions()) {
MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
operationItem.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
@@ -237,7 +242,7 @@ public class ResourceTreeView extends VLayout {
opSubMenu.addItem(operationItem);
// todo action
}
- operations.setEnabled(!node.getResourceType().getOperationDefinitions().isEmpty());
+ operations.setEnabled(!resourceType.getOperationDefinitions().isEmpty());
operations.setSubmenu(opSubMenu);
contextMenu.addItem(operations);
@@ -245,13 +250,13 @@ public class ResourceTreeView extends VLayout {
// Create Menu
MenuItem createChildMenu = new MenuItem("Create Child");
Menu createChildSubMenu = new Menu();
- for (final ResourceType childType : node.getResourceType().getChildResourceTypes()) {
+ for (final ResourceType childType : resourceType.getChildResourceTypes()) {
if (childType.isCreatable()) {
MenuItem createItem = new MenuItem(childType.getName());
createChildSubMenu.addItem(createItem);
createItem.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
- ResourceFactoryCreateWizard.showCreateWizard(node.getResource(), childType);
+ ResourceFactoryCreateWizard.showCreateWizard(resource, childType);
}
});
@@ -262,10 +267,10 @@ public class ResourceTreeView extends VLayout {
contextMenu.addItem(createChildMenu);
- // Manually Menu
+ // Manually Add Menu
MenuItem importChildMenu = new MenuItem("Import");
Menu importChildSubMenu = new Menu();
- for (ResourceType childType : node.getResourceType().getChildResourceTypes()) {
+ for (ResourceType childType : resourceType.getChildResourceTypes()) {
if (childType.isSupportsManualAdd()) {
importChildSubMenu.addItem(new MenuItem(childType.getName()));
//todo action
@@ -274,9 +279,9 @@ public class ResourceTreeView extends VLayout {
importChildMenu.setSubmenu(importChildSubMenu);
importChildMenu.setEnabled(importChildSubMenu.getItems().length > 0);
contextMenu.addItem(importChildMenu);
-
}
+
Resource getResource(int resourceId) {
if (this.treeGrid != null && this.treeGrid.getTree() != null) {
ResourceTreeDatasource.ResourceTreeNode treeNode =
@@ -292,7 +297,7 @@ public class ResourceTreeView extends VLayout {
this.rootResource = rootResource;
}
- public void setSelectedResource(final Resource selectedResource) {
+ public void setSelectedResource(final Resource selectedResource, final ViewId viewId) {
this.selectedResource = selectedResource;
TreeNode node = null;
@@ -305,8 +310,25 @@ public class ResourceTreeView extends VLayout {
treeGrid.deselectAllRecords();
treeGrid.selectRecord(node);
+
+
+ // Update breadcrumbs
+ viewId.getBreadcrumbs().clear();
+ for (int i = parents.length-1; i >= 0; i--) {
+ TreeNode n = parents[i];
+ if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
+ viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
+ }
+ }
+ viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), node.getName(), true));
+ CoreGUI.refreshBreadCrumbTrail();
+
+
+ // Todo: update viewId's breadcrumbs with known data
} else {
+
final ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+ // This is an expensive call, but loads all nodes that are visible in the tree given a selected resource
resourceService.getResourceLineageAndSiblings(selectedResource.getId(), new AsyncCallback<List<Resource>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to lookup platform for tree", caught);
@@ -343,6 +365,17 @@ public class ResourceTreeView extends VLayout {
treeGrid.selectRecord(selectedNode);
initialSelect = true;
treeGrid.markForRedraw();
+
+ // Update breadcrumbs
+ viewId.getBreadcrumbs().clear();
+ for (int i = parents.length-1; i >= 0; i--) {
+ TreeNode n = parents[i];
+ if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
+ viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
+ }
+ }
+ viewId.getBreadcrumbs().add(new Breadcrumb(selectedNode.getAttribute("id"), selectedNode.getName(), true));
+ CoreGUI.refreshBreadCrumbTrail();
}
}
}
@@ -392,6 +425,18 @@ public class ResourceTreeView extends VLayout {
TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
treeGrid.getTree().openFolders(parents);
treeGrid.getTree().openFolder(selectedNode);
+
+ // Update breadcrumbs
+ viewId.getBreadcrumbs().clear();
+ for (int i = parents.length-1; i >= 0; i--) {
+ TreeNode n = parents[i];
+ if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
+ viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
+ }
+ }
+ viewId.getBreadcrumbs().add(new Breadcrumb(selectedNode.getAttribute("id"), selectedNode.getName(), true));
+ CoreGUI.refreshBreadCrumbTrail();
+
} else {
CoreGUI.getMessageCenter().notify(new Message("Failed to select resource [" + selectedResource.getId() + "] in tree.", Message.Severity.Warning));
}
@@ -403,6 +448,13 @@ public class ResourceTreeView extends VLayout {
}
+ TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()));
+// System.out.println("Trying to preopen: " + selectedNode);
+ if (selectedNode != null) {
+ TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
+
+ // todo update viewPath's breadcrumbs
+ }
// CoreGUI.addBreadCrumb(new Place(String.valueOf(result.getId()), result.getName()));
}
@@ -439,6 +491,10 @@ public class ResourceTreeView extends VLayout {
public void addResourceSelectListener(ResourceSelectListener listener) {
this.selectListeners.add(listener);
}
+
+ public void renderView(ViewPath viewPath) {
+ currentViewId = viewPath.getCurrent();
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index f2dd8b8..503db39 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -18,33 +18,30 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.layout.HLayout;
+
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
-import org.rhq.enterprise.gui.coregui.client.UnknownViewException;
-import org.rhq.enterprise.gui.coregui.client.View;
-import org.rhq.enterprise.gui.coregui.client.ViewId;
-import org.rhq.enterprise.gui.coregui.client.ViewRenderer;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
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.InventoryView;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.layout.HLayout;
-
/**
* @author Greg Hinkle
*/
-public class ResourceView extends HLayout implements ViewRenderer {
+public class ResourceView extends HLayout implements BookmarkableView {
private Canvas contentCanvas;
- private Resource selectedResource;
+ private Resource currentResource;
//private Resource resourcePlatform;
private ResourceTreeView treeView;
@@ -57,12 +54,6 @@ public class ResourceView extends HLayout implements ViewRenderer {
}
- public ResourceView(Resource selectedResource) {
- this.selectedResource = selectedResource;
-
- System.out.println("Displaying Resource: " + selectedResource);
- }
-
@Override
protected void onInit() {
super.onInit();
@@ -71,7 +62,7 @@ public class ResourceView extends HLayout implements ViewRenderer {
setHeight100();
- treeView = new ResourceTreeView(selectedResource);
+ treeView = new ResourceTreeView();
addMember(treeView);
contentCanvas = new Canvas();
@@ -88,7 +79,7 @@ public class ResourceView extends HLayout implements ViewRenderer {
}
- public void setSelectedResource(final int resourceId, final View view) {
+ public void setSelectedResource(final int resourceId, final ViewPath view) {
Resource resource = this.treeView.getResource(resourceId);
if (resource != null) {
setSelectedResource(resource, view);
@@ -117,15 +108,9 @@ public class ResourceView extends HLayout implements ViewRenderer {
}
}
- private void setSelectedResource(Resource resource, View view) {
- view.getBreadcrumb().setDisplayName(resource.getName());
- CoreGUI.refreshBreadCrumbTrail();
- setSelectedResource(resource);
- }
-
- public void setSelectedResource(Resource resource) {
- this.selectedResource = resource;
- this.treeView.setSelectedResource(resource);
+ private void setSelectedResource(Resource resource, ViewPath viewPath) {
+ this.currentResource = resource;
+ this.treeView.setSelectedResource(resource, viewPath.getCurrent());
this.detailView.onResourceSelected(resource);
}
@@ -136,28 +121,27 @@ public class ResourceView extends HLayout implements ViewRenderer {
contentCanvas.markForRedraw();
}
- public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
- String parentPath = viewId.getParent().getPath();
- if (!parentPath.equals("Resource")) {
- throw new UnknownViewException();
- }
- int resourceId;
- try {
- resourceId = Integer.parseInt(viewId.getName());
- } catch (NumberFormatException e) {
- // not a valid Resource id - nothing for us to do
- throw new UnknownViewException("Invalid Resource id [" + viewId + "]");
+
+ public void renderView(ViewPath viewPath) {
+ if (viewPath.isEnd()) {
+ // default detail view
+ viewPath.getViewPath().add(new ViewId("Summary"));
+ viewPath.getViewPath().add(new ViewId("Overview"));
}
- // Use "..." as temporary display name for breadcrumb. If the Resource is fetched successfully, the display name
- // will be updated to be the Resource's name.
- Breadcrumb breadcrumb = new Breadcrumb(viewId.getName(), "...");
+ Integer resourceId = Integer.parseInt(viewPath.getCurrent().getPath());
- View view = new View(viewId, detailView, breadcrumb);
- if (this.selectedResource == null || this.selectedResource.getId() != resourceId) {
- setSelectedResource(resourceId, view);
- }
+ if (currentResource == null || currentResource.getId() != resourceId) {
- return view;
+ setSelectedResource(resourceId, viewPath);
+
+ this.treeView.renderView(viewPath);
+
+ viewPath.next();
+
+ this.detailView.renderView(viewPath);
+
+ }
}
+
}
commit 5465c814f1635f311f583810e1be24b16d44e7e7
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 22 11:16:31 2010 -0400
Fix resource section menu highlight
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index e134f04..c80b21d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -56,6 +56,10 @@ public class MenuBarView extends VLayout {
public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) {
String first = stringValueChangeEvent.getValue().split("/")[0];
+ if ("Resource".equals(first)) {
+ first = "Inventory";
+ }
+
selected = first;
linksPane.setContents(setupLinks());
linksPane.markForRedraw();
@@ -91,6 +95,7 @@ public class MenuBarView extends VLayout {
HLayout helpLayout = new HLayout();
Label loggedInAs = new Label("Logged in as " + CoreGUI.getSessionSubject().getName());
+ loggedInAs.setWrap(false);
loggedInAs.setValign(VerticalAlignment.CENTER);
helpLayout.addMember(loggedInAs);
helpLayout.addMember(new Hyperlink("Help", "Help"));
commit ec7c8fdc6aa1a58fdbfe131be2459c72f1e24cc1
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 22 11:16:07 2010 -0400
New admin view for updated history system
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index ff6f3ee..913ff6c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -18,16 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin;
-import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
-import org.rhq.enterprise.gui.coregui.client.UnknownViewException;
-import org.rhq.enterprise.gui.coregui.client.View;
-import org.rhq.enterprise.gui.coregui.client.ViewId;
-import org.rhq.enterprise.gui.coregui.client.ViewRenderer;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
-import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
-import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
+import java.util.LinkedHashMap;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
@@ -41,25 +32,31 @@ import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
-import java.util.ArrayList;
-import java.util.List;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
+import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
/**
- *
* @author Greg Hinkle
*/
-public class AdministrationView extends HLayout implements ViewRenderer {
+public class AdministrationView extends HLayout implements BookmarkableView {
+
public static final String VIEW_PATH = "Administration";
- public static final String SUBVIEW_PATH_REPORTS = VIEW_PATH + ViewId.PATH_SEPARATOR + "Reports";
- public static final String SUBVIEW_PATH_REPORTS_INVENTORY_SUMMARY = SUBVIEW_PATH_REPORTS + ViewId.PATH_SEPARATOR + "InventorySummary";
- private static final String IFRAME_URL_INVENTORY_SUMMARY_REPORT = "/rhq/admin/report/resourceInstallReport-body.xhtml";
+ private ViewId currentSectionViewId;
+ private ViewId currentPageViewId;
+
private SectionStack sectionStack;
private Canvas contentCanvas;
- private List<TreeGrid> treeGrids;
+ private LinkedHashMap<String, TreeGrid> treeGrids = new LinkedHashMap<String, TreeGrid>();
@Override
protected void onInit() {
@@ -78,21 +75,39 @@ public class AdministrationView extends HLayout implements ViewRenderer {
sectionStack.setWidth(250);
sectionStack.setHeight100();
- this.treeGrids = new ArrayList<TreeGrid>(5);
- sectionStack.addSection(buildSecuritySection());
- sectionStack.addSection(buildPluginsSection());
- sectionStack.addSection(buildManagementClusterSection());
- sectionStack.addSection(buildSystemConfigurationSection());
- sectionStack.addSection(buildReportsSection());
+
+ treeGrids.put("Security", buildSecuritySection());
+ treeGrids.put("Configuration", buildSystemConfigurationSection());
+ treeGrids.put("Cluster", buildManagementClusterSection());
+ treeGrids.put("Reports", buildReportsSection());
+ treeGrids.put("Security", buildSecuritySection());
+
+
+ for (final String name : treeGrids.keySet()) {
+ TreeGrid grid = treeGrids.get(name);
+
+ grid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ CoreGUI.goTo("Administration/" + name + "/" + selectionEvent.getRecord().getAttribute("name"));
+ }
+ });
+
+
+ SectionStackSection section = new SectionStackSection(name);
+ section.setExpanded(true);
+ section.addItem(grid);
+
+ sectionStack.addSection(section);
+ }
+
addMember(sectionStack);
addMember(contentCanvas);
- setContent(buildLanding());
}
- private HTMLFlow buildLanding() {
+ private HTMLFlow defaultView() {
String contents = "<h1>Administration</h1>\n" +
"From this section, the RHQ global settings can be administered. This includes configuring \n" +
"<a href=\"\">Security</a>, setting up <a href=\"\">Plugins</a> and other stuff.";
@@ -102,61 +117,32 @@ public class AdministrationView extends HLayout implements ViewRenderer {
}
- private SectionStackSection buildSecuritySection() {
- final SectionStackSection section = new SectionStackSection("Security");
- section.setExpanded(true);
+ private TreeGrid buildSecuritySection() {
final TreeGrid securityTreeGrid = new TreeGrid();
securityTreeGrid.setShowHeader(false);
- this.treeGrids.add(securityTreeGrid);
Tree tree = new Tree();
final TreeNode manageUsersNode = new TreeNode("Manage Users");
final TreeNode manageRolesNode = new TreeNode("Manage Roles");
final TreeNode discoveryQueue = new TreeNode("Auto Discovery Queue");
+ final TreeNode remoteAgentInstall = new TreeNode("Remote Agent Install");
tree.setRoot(new TreeNode("security",
manageUsersNode,
manageRolesNode,
- discoveryQueue));
+ discoveryQueue,
+ remoteAgentInstall));
securityTreeGrid.setData(tree);
- securityTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- Canvas content;
- if (selectionEvent.getRecord() == manageUsersNode) {
- content = new UsersView();
- } else if (selectionEvent.getRecord() == manageRolesNode) {
- content = new RolesView();
- } else if (selectionEvent.getRecord() == discoveryQueue) {
- content = new ResourceAutodiscoveryView();
- } else {
- throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
- }
- setContent(content);
-
- for (TreeGrid treeGrid : treeGrids) {
- if (treeGrid != securityTreeGrid) {
- treeGrid.deselectAllRecords();
- }
- }
- }
- }
- });
-
- section.addItem(securityTreeGrid);
-
- return section;
+ return securityTreeGrid;
}
- private SectionStackSection buildManagementClusterSection() {
- final SectionStackSection section = new SectionStackSection("Management Cluster");
- section.setExpanded(true);
+
+ private TreeGrid buildManagementClusterSection() {
final TreeGrid mgmtClusterTreeGrid = new TreeGrid();
mgmtClusterTreeGrid.setShowHeader(false);
- this.treeGrids.add(mgmtClusterTreeGrid);
Tree tree = new Tree();
final TreeNode manageServersNode = new TreeNode("Servers");
@@ -172,144 +158,37 @@ public class AdministrationView extends HLayout implements ViewRenderer {
mgmtClusterTreeGrid.setData(tree);
- mgmtClusterTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- String url;
- if (selectionEvent.getRecord() == manageServersNode) {
- url = "/rhq/ha/listServers.xhtml";
- } else if (selectionEvent.getRecord() == manageAgentsNode) {
- url = "/rhq/ha/listAgents.xhtml";
- } else if (selectionEvent.getRecord() == manageAffinityGroupsNode) {
- url = "/rhq/ha/listAffinityGroups.xhtml";
- } else if (selectionEvent.getRecord() == managePartitionEventsNode) {
- url = "/rhq/ha/listPartitionEvents.xhtml";
- } else {
- throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
- }
- url = addQueryStringParam(url, "nomenu=true");
- FullHTMLPane pane = new FullHTMLPane(url);
- setContent(pane);
-
- for (TreeGrid treeGrid : treeGrids) {
- if (treeGrid != mgmtClusterTreeGrid) {
- treeGrid.deselectAllRecords();
- }
- }
- }
- }
- });
-
- section.addItem(mgmtClusterTreeGrid);
-
- return section;
+ return mgmtClusterTreeGrid;
}
- private SectionStackSection buildPluginsSection() {
- final SectionStackSection section = new SectionStackSection("Plugins");
- section.setExpanded(true);
- final TreeGrid pluginsTreeGrid = new TreeGrid();
- pluginsTreeGrid.setShowHeader(false);
- this.treeGrids.add(pluginsTreeGrid);
-
- Tree tree = new Tree();
- final TreeNode managePlugins = new TreeNode("Plugins");
-
- tree.setRoot(new TreeNode("clustering",
- managePlugins));
-
- pluginsTreeGrid.setData(tree);
-
- pluginsTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- String url = null;
- if (selectionEvent.getRecord() == managePlugins) {
- url = "/rhq/admin/plugin/plugin-list.xhtml";
- } else {
- throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
- }
- url = addQueryStringParam(url, "nomenu=true");
- FullHTMLPane pane = new FullHTMLPane(url);
- setContent(pane);
-
- for (TreeGrid treeGrid : treeGrids) {
- if (treeGrid != pluginsTreeGrid) {
- treeGrid.deselectAllRecords();
- }
- }
- }
- }
- });
-
- section.addItem(pluginsTreeGrid);
-
- return section;
- }
-
-
- private SectionStackSection buildSystemConfigurationSection() {
- final SectionStackSection section = new SectionStackSection("System Configuration");
- section.setExpanded(true);
+ private TreeGrid buildSystemConfigurationSection() {
final TreeGrid systemConfigTreeGrid = new TreeGrid();
systemConfigTreeGrid.setShowHeader(false);
- this.treeGrids.add(systemConfigTreeGrid);
Tree tree = new Tree();
final TreeNode manageSettings = new TreeNode("System Settings");
final TreeNode manageTemplates = new TreeNode("Templates");
final TreeNode manageDownloads = new TreeNode("Downloads");
final TreeNode manageLicense = new TreeNode("License");
+ final TreeNode managePlugins = new TreeNode("Plugins");
+ FullHTMLPane pane = new FullHTMLPane("/rhq/admin/plugin/plugin-list.xhtml");
+
tree.setRoot(new TreeNode("System Configuration",
- manageSettings, manageTemplates, manageDownloads, manageLicense));
+ manageSettings, manageTemplates, manageDownloads, manageLicense, managePlugins));
systemConfigTreeGrid.setData(tree);
-
- systemConfigTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- String url;
- if (selectionEvent.getRecord() == manageSettings) {
- url = "/admin/config/Config.do?mode=edit";
- } else if (selectionEvent.getRecord() == manageTemplates) {
- url = "/admin/config/EditDefaults.do?mode=monitor&viewMode=all";
- } else if (selectionEvent.getRecord() == manageDownloads) {
- url = "/rhq/admin/downloads-body.xhtml";
- } else if (selectionEvent.getRecord() == manageLicense) {
- url = "/admin/license/LicenseAdmin.do?mode=view";
- } else {
- throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
- }
- url = addQueryStringParam(url, "nomenu=true");
- FullHTMLPane pane = new FullHTMLPane(url);
- setContent(pane);
-
- for (TreeGrid treeGrid : treeGrids) {
- if (treeGrid != systemConfigTreeGrid) {
- treeGrid.deselectAllRecords();
- }
- }
- }
- }
- });
-
- section.addItem(systemConfigTreeGrid);
-
- return section;
+ return systemConfigTreeGrid;
}
- private SectionStackSection buildReportsSection() {
- final SectionStackSection section = new SectionStackSection("Reports");
- section.setID("Reports");
- section.setExpanded(true);
+
+ private TreeGrid buildReportsSection() {
final TreeGrid reportsTreeGrid = new TreeGrid();
reportsTreeGrid.setShowHeader(false);
- this.treeGrids.add(reportsTreeGrid);
Tree tree = new Tree();
final TreeNode inventorySummaryNode = new TreeNode("Inventory Summary");
@@ -319,24 +198,10 @@ public class AdministrationView extends HLayout implements ViewRenderer {
reportsTreeGrid.setData(tree);
- reportsTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- CoreGUI.goTo(SUBVIEW_PATH_REPORTS_INVENTORY_SUMMARY);
- for (TreeGrid treeGrid : treeGrids) {
- if (treeGrid != reportsTreeGrid) {
- treeGrid.deselectAllRecords();
- }
- }
- }
- }
- });
-
- section.addItem(reportsTreeGrid);
-
- return section;
+ return reportsTreeGrid;
}
+
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
@@ -346,22 +211,104 @@ public class AdministrationView extends HLayout implements ViewRenderer {
contentCanvas.markForRedraw();
}
- public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
- String parentPath = viewId.getParent().getPath();
- if (parentPath.equals("Administration")) {
- SectionStackSection stackSection = this.sectionStack.getSection(viewId.getName());
- if (stackSection != null) {
- stackSection.setExpanded(true);
- if (lastNode) {
- // TODO: Render some default content for the e.g. Administration/Reports view.
- }
- return new View(viewId, new Breadcrumb(viewId.getName(), false));
+
+ private void renderContentView(ViewPath viewPath) {
+
+ currentSectionViewId = viewPath.getCurrent();
+ currentPageViewId = viewPath.getNext();
+
+ String section = currentSectionViewId.getPath();
+ String page = currentPageViewId.getPath();
+
+
+ Canvas content = null;
+ if ("Reports".equals(section)) {
+
+ if ("Inventory Summary".equals(page)) {
+ content = new FullHTMLPane("/rhq/admin/report/resourceInstallReport-body.xhtml");
+ }
+
+
+ } else if ("Security".equals(section)) {
+
+ if ("Manage Users".equals(page)) {
+ content = new UsersView();
+ } else if ("Manage Roles".equals(page)) {
+ content = new RolesView();
+ } else if ("Auto Discovery Queue".equals(page)) {
+ content = new ResourceAutodiscoveryView();
+ } else if ("Remote Agent Install".equals(page)) {
+ // todo
+ //content = new RemoteAgentInstallView();
+ }
+ } else if ("Configuration".equals(section)) {
+
+ String url = null;
+ if ("System Settings".equals(page)) {
+ url = "/admin/config/Config.do?mode=edit";
+ } else if ("Templates".equals(page)) {
+ url = "/admin/config/EditDefaults.do?mode=monitor&viewMode=all";
+ } else if ("Downloads".equals(page)) {
+ url = "/rhq/admin/downloads-body.xhtml";
+ } else if ("License".equals(page)) {
+ url = "/admin/license/LicenseAdmin.do?mode=view";
}
- } else if (parentPath.equals("Administration/Reports")) {
- setContent(new FullHTMLPane(IFRAME_URL_INVENTORY_SUMMARY_REPORT));
- return new View(viewId);
+ url = addQueryStringParam(url, "nomenu=true");
+ content = new FullHTMLPane(url);
+
+
+ } else if ("Cluster".equals(section)) {
+ String url = null;
+ if ("Servers".equals(page)) {
+ url = "/rhq/ha/listServers.xhtml";
+ } else if ("Agents".equals(page)) {
+ url = "/rhq/ha/listAgents.xhtml";
+ } else if ("Affinity Groups".equals(page)) {
+ url = "/rhq/ha/listAffinityGroups.xhtml";
+ } else if ("Partition Events".equals(page)) {
+ url = "/rhq/ha/listPartitionEvents.xhtml";
+ }
+ url = addQueryStringParam(url, "nomenu=true");
+ content = new FullHTMLPane(url);
+ }
+
+
+ for (String name : treeGrids.keySet()) {
+
+ TreeGrid treeGrid = treeGrids.get(name);
+ if (name.equals(section)) {
+ treeGrid.setSelectedPaths(page);
+ } else {
+ treeGrid.deselectAllRecords();
+ }
+ }
+
+
+
+ setContent(content);
+
+
+ if (content instanceof BookmarkableView) {
+ ((BookmarkableView) content).renderView(viewPath.next().next());
}
- throw new UnknownViewException();
+
+
+ }
+
+
+ public void renderView(ViewPath viewPath) {
+
+ if (!viewPath.isCurrent(currentSectionViewId) || !viewPath.isNext(currentPageViewId)) {
+
+ if (viewPath.isEnd()) {
+ // Display default view
+ setContent(defaultView());
+ } else {
+ renderContentView(viewPath);
+ }
+ }
+
+
}
private static String addQueryStringParam(String url, String param) {
commit eab57e81e77edf0f1342358f4f0b78c5b2202b74
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 22 11:15:48 2010 -0400
New Dashboard system, storage, portlet factory, loading engine and layout
Cleanup of existin portlets, some new ones
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UnknownViewException.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UnknownViewException.java
deleted file mode 100644
index d5ff736..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UnknownViewException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 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;
-
-/**
- * TODO
- *
- * @author Ian Springer
- */
-public class UnknownViewException extends Exception {
- public UnknownViewException() {
- }
-
- public UnknownViewException(String message) {
- super(message);
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java
deleted file mode 100644
index 8a9279a..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 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;
-
-/**
- * TODO
- *
- * @author Ian Springer
- */
-public interface ViewRenderer {
- /**
- * TODO
- *
- * @param viewId
- * @param lastNode @throws UnknownViewException
- */
- View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException;
-}
\ No newline at end of file
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 2125a39..9f3a1c5 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
@@ -18,7 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard;
-import com.google.gwt.user.client.Random;
+import java.util.ArrayList;
+
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.AnimationCallback;
import com.smartgwt.client.widgets.Canvas;
@@ -26,29 +27,35 @@ import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuButton;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.events.ItemClickEvent;
+import com.smartgwt.client.widgets.menu.events.ItemClickHandler;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.RecentlyAddedView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.SmallGraphView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.AutodiscoveryQueueDataSource;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
-import org.rhq.enterprise.gui.coregui.client.inventory.summary.SummaryCountsView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.store.StoredDashboard;
+import org.rhq.enterprise.gui.coregui.client.dashboard.store.StoredPortlet;
/**
* @author Greg Hinkle
*/
public class DashboardView extends VLayout {
+ StoredDashboard storedDashboard;
boolean editMode = false;
PortalLayout portalLayout;
DynamicForm form;
- ButtonItem addPortlet;
+ MenuButton addPortlet;
+
- public DashboardView() {
+ public DashboardView(StoredDashboard storedDashboard) {
+ this.storedDashboard = storedDashboard;
setOverflow(Overflow.AUTO);
setPadding(5);
}
@@ -72,42 +79,13 @@ public class DashboardView extends VLayout {
setHeight100();
- portalLayout = new PortalLayout(2);
+ portalLayout = new PortalLayout(storedDashboard.getColumns());
portalLayout.setWidth100();
portalLayout.setHeight100();
- Portlet summaryPortlet = new Portlet(editMode);
- summaryPortlet.setTitle("Inventory Summary");
- summaryPortlet.addItem(new SummaryCountsView());
- summaryPortlet.setHeight(300);
- portalLayout.addPortlet(summaryPortlet);
-
-
- Portlet adPortlet = new Portlet(editMode);
- adPortlet.setTitle("Auto Discovery Queue");
- adPortlet.addItem(new ResourceAutodiscoveryView(true));
- adPortlet.setHeight(250);
- portalLayout.addPortlet(adPortlet);
-
+ loadPortlets();
- // create portlets...
- for (int i = 1; i <= 2; i++) {
- Portlet portlet = new Portlet(editMode);
- portlet.setTitle("Portlet");
-
- // Label label = new Label();
- // label.setAlign(Alignment.CENTER);
- // label.setLayoutAlign(VerticalAlignment.CENTER);
- // label.setContents("Portlet contents");
- // label.setBackgroundColor(colors[Random.nextInt(colors.length - 1)]);
-
- portlet.addItem(new SmallGraphView());
- portlet.setHeight(400);
- portalLayout.addPortlet(portlet);
- }
-
- final VLayout vLayout = new VLayout(15);
form = new DynamicForm();
form.setAutoWidth();
@@ -165,23 +143,36 @@ public class DashboardView extends VLayout {
}
});
- addPortlet = new ButtonItem("addPortlet", "Add Portlet");
- addPortlet.setIcon("[skin]/images/actions/add.png");
- addPortlet.setAutoFit(true);
- addPortlet.setStartRow(false);
- addPortlet.setEndRow(false);
- addPortlet.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
- public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
+ Menu addPorletMenu = new Menu();
+ for (String portletName : PortletFactory.getRegisteredPortlets()) {
+ addPorletMenu.addItem(new MenuItem(portletName));
+ }
+
+
+ addPortlet = new MenuButton("Add Portlet", addPorletMenu);
- addPortlet();
+// addPortlet = new ButtonItem("addPortlet", "Add Portlet");
+ addPortlet.setIcon("[skin]/images/actions/add.png");
+ addPortlet.setAutoFit(true);
+
+ addPorletMenu.addItemClickHandler(new ItemClickHandler() {
+ public void onItemClick(ItemClickEvent itemClickEvent) {
+ String portalTitle = itemClickEvent.getItem().getTitle();
+ addPortlet(portalTitle);
}
});
+ CanvasItem addCanvas = new CanvasItem();
+ addCanvas.setShowTitle(false);
+ addCanvas.setCanvas(addPortlet);
+ addCanvas.setStartRow(false);
+ addCanvas.setEndRow(false);
+
if (editMode) {
- form.setItems(numColItem, addPortlet, addColumn, removeColumn, editButton);
+ form.setItems(numColItem, addCanvas, addColumn, removeColumn, editButton);
} else {
form.setItems(editButton);
}
@@ -190,69 +181,84 @@ public class DashboardView extends VLayout {
}
+ private void loadPortlets() {
- private void addPortlet() {
- final Portlet newPortlet = new Portlet(true);
- newPortlet.setTitle("Portlet ");
-
-// Label label = new Label();
-// label.setAlign(Alignment.CENTER);
-// label.setLayoutAlign(VerticalAlignment.CENTER);
-// label.setContents("Portlet contents");
-// label.setBackgroundColor(colors[Random.nextInt(colors.length - 1)]);
-// newPortlet.addItem(label);
-
- int nextInt = Random.nextInt() % 3;
-
-// if (nextInt == 0) {
-// ResourceSearchView item = new ResourceSearchView();
-// newPortlet.addItem(item);
-//
-// } else if (nextInt == 1) {
-// newPortlet.addItem(new RolesView());
-// } else {
-// newPortlet.addItem(new SummaryCountsView());
-// }
-
- ClickHandler handler = new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- PortletSettingsWindow settingsWindow = new PortletSettingsWindow("Recently Added Resources");
- settingsWindow.show();
+ int col = 0;
+ for (ArrayList<StoredPortlet> column : storedDashboard.getPortlets()) {
+
+ for (StoredPortlet storedPortlet : column) {
+ Canvas portalCanvas = PortletFactory.buildPortlet(storedPortlet.getPortletKey());
+
+ final Portlet portlet = new Portlet(editMode);
+ portlet.addItem(portalCanvas);
+ portlet.setTitle(storedPortlet.getName());
+
+ portlet.setHeight(storedPortlet.getHeight());
+ portlet.setVisible(true);
+
+// newPortlet.setHelpClickHandler(handler);
+// newPortlet.setSettingsClickHandler(handler);
+
+ portalLayout.addPortlet(portlet, col);
+ }
+
+ col++;
+ }
+
+
+ }
+
+
+ private void addPortlet(String portletName) {
+ final Portlet newPortlet = new Portlet(true);
+
+ Canvas canvas = PortletFactory.buildPortlet(portletName);
+
+ newPortlet.setTitle(portletName);
+
+
+ ClickHandler handler = new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ PortletSettingsWindow settingsWindow = new PortletSettingsWindow("Recently Added Resources");
+ settingsWindow.show();
+ }
+ };
+
+ newPortlet.addItem(canvas);
+
+ newPortlet.setHeight(350);
+ newPortlet.setVisible(false);
+ newPortlet.setHelpClickHandler(handler);
+ newPortlet.setSettingsClickHandler(handler);
+
+
+ PortalColumn column = portalLayout.addPortlet(newPortlet);
+
+ // also insert a blank spacer element, which will trigger the built-in
+ // animateMembers layout animation
+ final LayoutSpacer placeHolder = new LayoutSpacer();
+ placeHolder.setRect(newPortlet.getRect());
+ column.addMember(placeHolder, 0); // add to top
+
+ // create an outline around the clicked button
+ final Canvas outline = new Canvas();
+ outline.setLeft(form.getAbsoluteLeft() + addPortlet.getLeft());
+ outline.setTop(form.getAbsoluteTop());
+ outline.setWidth(addPortlet.getWidth());
+ outline.setHeight(addPortlet.getHeight());
+ outline.setBorder("2px solid 8289A6");
+ outline.draw();
+ outline.bringToFront();
+
+ outline.animateRect(newPortlet.getPageLeft(), newPortlet.getPageTop(),
+ newPortlet.getVisibleWidth(), newPortlet.getViewportHeight(),
+ new AnimationCallback() {
+ public void execute(boolean earlyFinish) {
+ // callback at end of animation - destroy placeholder and outline; show the new portlet
+ placeHolder.destroy();
+ outline.destroy();
+ newPortlet.show();
}
- };
-
- newPortlet.addItem(new RecentlyAddedView());
- newPortlet.setHeight(350);
- newPortlet.setVisible(false);
- newPortlet.setHelpClickHandler(handler);
- newPortlet.setSettingsClickHandler(handler);
- PortalColumn column = portalLayout.addPortlet(newPortlet);
-
- // also insert a blank spacer element, which will trigger the built-in
- // animateMembers layout animation
- final LayoutSpacer placeHolder = new LayoutSpacer();
- placeHolder.setRect(newPortlet.getRect());
- column.addMember(placeHolder, 0); // add to top
-
- // create an outline around the clicked button
- final Canvas outline = new Canvas();
- outline.setLeft(form.getAbsoluteLeft() + addPortlet.getLeft());
- outline.setTop(form.getAbsoluteTop());
- outline.setWidth(addPortlet.getWidth());
- outline.setHeight(addPortlet.getHeight());
- outline.setBorder("2px solid 8289A6");
- outline.draw();
- outline.bringToFront();
-
- outline.animateRect(newPortlet.getPageLeft(), newPortlet.getPageTop(),
- newPortlet.getVisibleWidth(), newPortlet.getViewportHeight(),
- new AnimationCallback() {
- public void execute(boolean earlyFinish) {
- // callback at end of animation - destroy placeholder and outline; show the new portlet
- placeHolder.destroy();
- outline.destroy();
- newPortlet.show();
- }
- }, 750);
+ }, 750);
}
}
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
new file mode 100644
index 0000000..14334e7
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
@@ -0,0 +1,124 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.Tab;
+import com.smartgwt.client.widgets.tab.TabSet;
+
+import org.rhq.core.domain.resource.InventorySummary;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.graph.GraphPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform.PlatformPortletView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.RecentAlertsPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.imported.RecentlyAddedView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.InventorySummaryView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.store.DashboardStore;
+import org.rhq.enterprise.gui.coregui.client.dashboard.store.StoredDashboard;
+import org.rhq.enterprise.gui.coregui.client.dashboard.store.StoredPortlet;
+
+/**
+ * @author Greg Hinkle
+ */
+public class DashboardsView extends VLayout {
+
+ private TabSet tabSet;
+
+ private DashboardStore dashboardStore;
+
+
+ public DashboardsView() {
+ setOverflow(Overflow.AUTO);
+ setPadding(5);
+ setWidth100();
+ setHeight100();
+
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ tabSet = new TabSet();
+ tabSet.setWidth100();
+ tabSet.setHeight100();
+
+ dashboardStore = new DashboardStore();
+
+ dashboardStore.getStoredDashboards().add(getDefaultDashboard());
+
+
+ for (StoredDashboard dashboard : dashboardStore.getStoredDashboards()) {
+ DashboardView dashboardView = new DashboardView(dashboard);
+
+ Tab tab = new Tab(dashboard.getName());
+ tab.setPane(dashboardView);
+
+ tabSet.addTab(tab);
+ }
+
+ addMember(tabSet);
+ }
+
+
+ protected StoredDashboard getDefaultDashboard() {
+
+ StoredDashboard dashboard = new StoredDashboard();
+ dashboard.setName("Default Dashboard");
+ dashboard.setColumns(2);
+ dashboard.setColumnWidths("30%","70%");
+
+
+ ArrayList<StoredPortlet> col1 = new ArrayList<StoredPortlet>();
+ ArrayList<StoredPortlet> col2 = new ArrayList<StoredPortlet>();
+
+
+
+
+ StoredPortlet summary = new StoredPortlet("Inventory Summary", InventorySummaryView.KEY, 300);
+ col1.add(summary);
+
+ StoredPortlet graph = new StoredPortlet("ghinkle (MAC OS X) CPU", GraphPortlet.KEY, 250);
+ col1.add(graph);
+
+ StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
+ col2.add(platformSummary);
+
+ StoredPortlet discoveryQueue = new StoredPortlet("Discovery Queue", AutodiscoveryPortlet.KEY, 250);
+ col2.add(discoveryQueue);
+
+ StoredPortlet recentAlerts = new StoredPortlet("Recent Alerts", RecentAlertsPortlet.KEY, 250);
+ col2.add(recentAlerts);
+
+ StoredPortlet recentlyAdded = new StoredPortlet("Recently Added Resources", RecentlyAddedView.KEY, 250);
+ col2.add(recentlyAdded);
+
+
+ dashboard.getPortlets().add(col1);
+ dashboard.getPortlets().add(col2);
+
+
+
+ return dashboard;
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/OldDashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/OldDashboardView.java
new file mode 100644
index 0000000..2fc4826
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/OldDashboardView.java
@@ -0,0 +1,265 @@
+/*
+ * 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;
+
+import com.google.gwt.user.client.Random;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.AnimationCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.imported.RecentlyAddedView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform.PlatformPortletView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.InventorySummaryView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.SmallGraphView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OldDashboardView extends VLayout {
+
+
+ boolean editMode = false;
+
+ PortalLayout portalLayout;
+ DynamicForm form;
+ ButtonItem addPortlet;
+
+ public OldDashboardView() {
+ setOverflow(Overflow.AUTO);
+ setPadding(5);
+ }
+
+ public void redraw() {
+ for (Canvas c : getChildren()) {
+ c.destroy();
+ }
+
+ buildPortlets();
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ buildPortlets();
+ }
+
+ public void buildPortlets() {
+ setWidth100();
+ setHeight100();
+
+
+ portalLayout = new PortalLayout(2);
+ portalLayout.setWidth100();
+ portalLayout.setHeight100();
+
+
+ Portlet summaryPortlet = new Portlet(editMode);
+ summaryPortlet.setTitle("Inventory Summary");
+ summaryPortlet.addItem(new InventorySummaryView());
+ summaryPortlet.setHeight(300);
+ portalLayout.addPortlet(summaryPortlet);
+
+
+ Portlet platformsPortlet = new Portlet(editMode);
+ platformsPortlet.setTitle("Platform Portlet");
+ platformsPortlet.addItem(new PlatformPortletView());
+ platformsPortlet.setHeight(300);
+ portalLayout.addPortlet(platformsPortlet);
+
+
+ Portlet adPortlet = new Portlet(editMode);
+ adPortlet.setTitle("Auto Discovery Queue");
+ adPortlet.addItem(new ResourceAutodiscoveryView(true));
+ adPortlet.setHeight(250);
+ portalLayout.addPortlet(adPortlet);
+
+
+ // create portlets...
+ for (int i = 1; i <= 2; i++) {
+ Portlet portlet = new Portlet(editMode);
+ portlet.setTitle("Portlet");
+
+ // Label label = new Label();
+ // label.setAlign(Alignment.CENTER);
+ // label.setLayoutAlign(VerticalAlignment.CENTER);
+ // label.setContents("Portlet contents");
+ // label.setBackgroundColor(colors[Random.nextInt(colors.length - 1)]);
+
+ portlet.addItem(new SmallGraphView());
+ portlet.setHeight(400);
+ portalLayout.addPortlet(portlet);
+ }
+
+ final VLayout vLayout = new VLayout(15);
+
+ form = new DynamicForm();
+ form.setAutoWidth();
+