[rhq] modules/core
by mazz
modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 20be9ec33fb3c843c0a7da2bc90922e2742e958e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Aug 31 13:37:10 2010 -0400
add resource to the log output to more easily see which resource is slow
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java
index 269f626..b952bd5 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementCollectorRunner.java
@@ -111,7 +111,8 @@ public class MeasurementCollectorRunner implements Callable<MeasurementReport>,
measurementComponent.getValues(report, (Set<MeasurementScheduleRequest>) requests);
long duration = (System.currentTimeMillis() - start);
if (duration > 2000) {
- log.info("[PERF] Collection of measurements for [" + measurementComponent + "] took [" + duration + "ms]");
+ log.info("[PERF] Collection of measurements for [" + resource + "] (component=[" + measurementComponent
+ + "]) took [" + duration + "]ms");
}
} catch (Throwable t) {
this.measurementManager.incrementFailedCollections(requests.size());
13 years, 3 months
[rhq] modules/enterprise
by Greg Hinkle
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java | 29 ++++++++--
1 file changed, 26 insertions(+), 3 deletions(-)
New commits:
commit a0529e94999413a7c78b50b9a7ebdaeb7860e33d
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 30 15:11:56 2010 -0400
Missing tweaks to the group tree
root showing, icon fix, header hidden
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
index ffbbc6e..8f0f711 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -29,6 +29,7 @@ import java.util.Set;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -79,9 +80,14 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView {
super.onInit();
this.treeGrid = new TreeGrid();
- treeGrid.setShowRoot(true);
this.treeGrid.setWidth100();
this.treeGrid.setHeight100();
+ treeGrid.setAnimateFolders(false);
+ treeGrid.setSelectionType(SelectionStyle.SINGLE);
+ treeGrid.setShowRollOver(false);
+ treeGrid.setSortField("name");
+ treeGrid.setShowHeader(false);
+
addMember(this.treeGrid);
@@ -171,6 +177,13 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView {
treeGrid.getTree().openFolder(selectedNode);
treeGrid.selectRecord(selectedNode);
+ } else {
+ TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(this.selectedGroup.getId()));
+ TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
+ treeGrid.getTree().openFolders(parents);
+ treeGrid.getTree().openFolder(selectedNode);
+
+ treeGrid.selectRecord(selectedNode);
}
@@ -226,16 +239,26 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView {
}
private void loadTree(ClusterFlyweight root) {
+ TreeNode fakeRoot = new TreeNode("fakeRootNode");
+
+
TreeNode rootNode = new TreeNode(rootResourceGroup.getName());
rootNode.setID(String.valueOf(root.getGroupId())); //getClusterKey().toString());
- rootNode.setAttribute("resourceType", typeMap.get(rootResourceGroup.getResourceType().getId()));
+ ResourceType rootResourceType = typeMap.get(rootResourceGroup.getResourceType().getId());
+ rootNode.setAttribute("resourceType", rootResourceType);
+ String icon = "types/" + rootResourceType.getCategory().getDisplayName() + "_up_16.png";
+ rootNode.setIcon(icon);
+
+ fakeRoot.setChildren(new TreeNode[]{rootNode});
ClusterKey rootKey = new ClusterKey(root.getGroupId());
loadTree(rootNode, root, rootKey);
+
+
Tree tree = new Tree();
- tree.setRoot(rootNode);
+ tree.setRoot(fakeRoot);
treeGrid.setData(tree);
13 years, 3 months
[rhq] 4 commits - modules/core modules/enterprise
by Greg Hinkle
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 170 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 52 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java | 349 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java | 216 +++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java | 78 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 75 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java | 23
13 files changed, 798 insertions(+), 232 deletions(-)
New commits:
commit d9c6f5bd8d0de9bb4f101db8200a0912b3012cae
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 30 14:56:39 2010 -0400
Fix history event for root node
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
index eae4e0b..ffbbc6e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -97,7 +97,7 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView {
ClusterKey key = (ClusterKey) selectionEvent.getRecord().getAttributeAsObject("key");
if (key == null) {
// selected the root group
- setSelectedGroup(Integer.parseInt(selectionEvent.getRecord().getAttribute("id")));
+ History.newItem("ResourceGroup/" + selectionEvent.getRecord().getAttribute("id"));
} else {
System.out.println("Select group: " + key);
commit 91a0c3f00ce6afcaf515ad7c6c7b5c395cd81081
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 30 14:49:23 2010 -0400
Lost this work in the rebase
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index 1dee039..2ae4974 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -285,6 +285,6 @@ public class LinkManager {
public static String getTagLink(String tag) {
- return "Reports/Inventory/Tag%20Cloud/" + tag;
+ return "#Reports/Inventory/Tag%20Cloud/" + tag;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
index af48596..e0dd4aa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
@@ -54,6 +54,7 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
public static final String CFG_RESOURCE_ID = "resourceId";
public static final String CFG_DEFINITION_ID = "definitionId";
+ public static final String CFG_RESOURCE_GROUP_ID = "resourceGroupId";
public GraphPortlet(String locatorId) {
super(locatorId);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 064e06a..41ad327 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -24,14 +24,18 @@ 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.Canvas;
+import com.smartgwt.client.widgets.tab.Tab;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.ResourceTypeFacet;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
@@ -57,6 +61,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class ResourceGroupDetailView extends LocatableVLayout implements BookmarkableView, TwoLevelTabSelectedHandler {
private static final String DEFAULT_TAB_NAME = "Inventory";
+ private int groupId;
private ResourceGroupComposite groupComposite;
private ResourcePermission permissions;
@@ -88,13 +93,11 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
private ResourceGroupTitleBar titleBar;
+ private String tabName;
+ private String subTabName;
+
public ResourceGroupDetailView(String locatorId) {
super(locatorId);
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
setWidth100();
setHeight100();
@@ -114,7 +117,7 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
summaryTab.registerSubTabs(summaryOverview, summaryTimeline);
monitoringTab = new TwoLevelTab(topTabSet.extendLocatorId("Monitoring"), "Monitoring",
- "/images/icons/Monitor_grey_16.png");
+ "/images/icons/Monitor_grey_16.png");
monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), "Graphs", null);
monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), "Tables", null);
monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"), "Schedules", null);
@@ -122,13 +125,13 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
monitoringTab.registerSubTabs(monitorGraphs, monitorTables, monitorSched, monitorCallTime);
inventoryTab = new TwoLevelTab(topTabSet.extendLocatorId("Inventory"), "Inventory",
- "/images/icons/Inventory_grey_16.png");
+ "/images/icons/Inventory_grey_16.png");
inventoryMembers = new SubTab(inventoryTab.extendLocatorId("Members"), "Members", null);
inventoryConn = new SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), "Connection Settings", null);
inventoryTab.registerSubTabs(this.inventoryMembers, this.inventoryConn);
operationsTab = new TwoLevelTab(topTabSet.extendLocatorId("Operations"), "Operations",
- "/images/icons/Operation_grey_16.png");
+ "/images/icons/Operation_grey_16.png");
this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), "History", null);
this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), "Scheduled", null);
operationsTab.registerSubTabs(this.opHistory, this.opSched);
@@ -139,7 +142,7 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
alertsTab.registerSubTabs(alertHistory, alertDef);
configurationTab = new TwoLevelTab(topTabSet.extendLocatorId("Configuration"), "Configuration",
- "/images/icons/Configure_grey_16.png");
+ "/images/icons/Configure_grey_16.png");
this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), "Current", null);
this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), "History", null);
configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
@@ -149,7 +152,7 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
eventsTab.registerSubTabs(eventHistory);
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab,
- eventsTab);
+ eventsTab);
topTabSet.addTwoLevelTabSelectedHandler(this);
@@ -161,12 +164,16 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
// CoreGUI.addBreadCrumb(getPlace());
}
- public void onGroupSelected(ResourceGroupComposite groupComposite) {
+ public void updateDetailViews(ResourceGroupComposite groupComposite) {
this.groupComposite = groupComposite;
this.titleBar.setGroup(groupComposite.getResourceGroup());
+ for (Tab top : topTabSet.getTabs()) {
+ ((TwoLevelTab) top).getLayout().destroyViews();
+ }
+
// FullHTMLPane timelinePane = new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
// summaryTab.updateSubTab("Overview", new DashboardView(resource));
// summaryTab.updateSubTab("Timeline", timelinePane);
@@ -189,23 +196,23 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
// inventoryTab.updateSubTab("Connection Settings", new GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
this.opHistory.setCanvas(new FullHTMLPane("/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.opSched.setCanvas(new FullHTMLPane("/rhq/group/operation/groupOperationSchedules-plain.xhtml?groupId="
- + groupId));
+ + groupId));
operationsTab.updateSubTab(this.opHistory);
operationsTab.updateSubTab(this.opSched);
this.alertHistory.setCanvas(new FullHTMLPane("/rhq/group/alert/listGroupAlertHistory-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.alertDef.setCanvas(new FullHTMLPane("/rhq/group/alert/listGroupAlertDefinitions-plain.xhtml?groupId="
- + groupId));
+ + groupId));
alertsTab.updateSubTab(this.alertHistory);
alertsTab.updateSubTab(this.alertDef);
this.configCurrent.setCanvas(new FullHTMLPane("/rhq/group/configuration/viewCurrent-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.configHistory
- .setCanvas(new FullHTMLPane("/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId));
+ .setCanvas(new FullHTMLPane("/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId));
configurationTab.updateSubTab(this.configCurrent);
configurationTab.updateSubTab(this.configHistory);
@@ -213,42 +220,10 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
eventsTab.updateSubTab(this.eventHistory);
// topTabSet.setSelectedTab(selectedTab);
+ completeTabUpdate();
- updateTabStatus();
-
- topTabSet.markForRedraw();
}
- private void updateTabStatus() {
- final ResourceGroup group = this.groupComposite.getResourceGroup();
-
- if (group.getGroupCategory() == GroupCategory.COMPATIBLE) {
-
- // Load the fully fetched ResourceType.
- ResourceType groupType = group.getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- groupType.getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.events,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- group.setResourceType(type);
- GWTServiceLookup.getAuthorizationService().getImplicitGroupPermissions(group.getId(),
- new AsyncCallback<Set<Permission>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load group permissions.", caught);
- }
-
- public void onSuccess(Set<Permission> result) {
- ResourceGroupDetailView.this.permissions = new ResourcePermission(result);
- completeTabUpdate();
- }
- });
- }
- });
- }
- }
private void completeTabUpdate() {
@@ -261,7 +236,7 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
// Inventory>Connection Settings subtab is only enabled for compat groups that define conn props.
inventoryTab.setSubTabEnabled("Connection Settings", groupCategory == GroupCategory.COMPATIBLE
- && facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
+ && facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
// Monitoring and Alerts tabs are always enabled for compatible groups and always disabled for mixed groups.
if (groupCategory == GroupCategory.COMPATIBLE) {
@@ -300,26 +275,98 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
if (this.groupComposite == null) {
- History.fireCurrentHistoryState();
+// History.fireCurrentHistoryState();
} else {
// Switch tabs directly, rather than letting the history framework do it, to avoid redrawing the outer views.
- selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
+// selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
String path = "ResourceGroup/" + this.groupComposite.getResourceGroup().getId() + tabPath;
// But still add an item to the history, specifying false to tell it not to fire an event.
- History.newItem(path, false);
+ History.newItem(path, true);
}
}
public void renderView(ViewPath viewPath) {
// e.g. #ResourceGroup/10010/Inventory/Overview
- String tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
- String subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
- selectTab(tabName, subTabName);
+ int groupId = Integer.parseInt(viewPath.getCurrent().getPath());
+
+ viewPath.next();
+
+
+ tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
+ subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
+
+ viewPath.next();
+ viewPath.next();
+
+
+ if (this.groupId != groupId) {
+ loadSelectedGroup(groupId, viewPath);
+ } else {
+ // Same group just switching tabs
+ selectTab(tabName, subTabName, viewPath);
+ }
+ }
+
+ public void loadSelectedGroup(int groupId, final ViewPath viewPath) {
+ this.groupId = groupId;
+
+
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(groupId);
+ criteria.addFilterVisible(null);
+
+ GWTServiceLookup.getResourceGroupService().findResourceGroupCompositesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroupComposite>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load group composite", caught);
+ }
+
+ @Override
+ public void onSuccess(PageList<ResourceGroupComposite> result) {
+ groupComposite = result.get(0);
+ loadResourceType(groupComposite, viewPath);
+ }
+ });
}
- public void selectTab(String tabName, String subtabName) {
+
+ private void loadResourceType(final ResourceGroupComposite groupComposite, final ViewPath viewPath) {
+ final ResourceGroup group = this.groupComposite.getResourceGroup();
+
+ if (group.getGroupCategory() == GroupCategory.COMPATIBLE) {
+
+ // Load the fully fetched ResourceType.
+ ResourceType groupType = group.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ groupType.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
+ ResourceTypeRepository.MetadataType.events,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ group.setResourceType(type);
+ GWTServiceLookup.getAuthorizationService().getImplicitGroupPermissions(group.getId(),
+ new AsyncCallback<Set<Permission>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load group permissions.", caught);
+ }
+
+ public void onSuccess(Set<Permission> result) {
+ ResourceGroupDetailView.this.permissions = new ResourcePermission(result);
+ updateDetailViews(groupComposite);
+ selectTab(tabName, subTabName, viewPath);
+ }
+ });
+ }
+ });
+ }
+ }
+
+
+ public void selectTab(String tabName, String subtabName, ViewPath viewPath) {
if (tabName == null) {
tabName = DEFAULT_TAB_NAME;
}
@@ -335,8 +382,13 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
CoreGUI.getErrorHandler().handleError("Invalid subtab name: " + subtabName);
// TODO: Should we fire a history event here to redirect to a valid bookmark?
return;
+ } else {
+ Canvas subView = tab.getLayout().getCurrentCanvas();
+ if (subView instanceof BookmarkableView) {
+ ((BookmarkableView) subView).renderView(viewPath);
+ }
}
- tab.getLayout().selectTab(subtabName);
}
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
index 27cfc12..7f33fda 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
@@ -118,7 +118,10 @@ public class ResourceGroupTitleBar extends LocatableHLayout {
private void loadTags(final TagEditorView tagEditorView) {
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.addFilterId(group.getId());
+ criteria.addFilterVisible(null); // default is only visible groups, null to support auto-cluster-groups
criteria.fetchTags(true);
+
+
GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
new AsyncCallback<PageList<ResourceGroup>>() {
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
index f313480..af29e89 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
@@ -22,20 +22,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
-import org.rhq.core.domain.criteria.ResourceGroupCriteria;
-import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.util.PageList;
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.ResourceGroupGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
@@ -45,7 +38,6 @@ public class ResourceGroupTopView extends LocatableHLayout implements Bookmarkab
private Canvas contentCanvas;
- private ResourceGroupComposite currentGroup;
private ResourceGroupTreeView treeView;
private ResourceGroupDetailView detailView;
@@ -76,44 +68,7 @@ public class ResourceGroupTopView extends LocatableHLayout implements Bookmarkab
setContent(detailView);
}
- public void setSelectedGroup(final int groupId, final ViewPath view) {
- // check if requested group is already the current group
- if (null != currentGroup && currentGroup.getResourceGroup().getId() == groupId) {
- return;
- }
-
- ResourceGroupCriteria criteria = new ResourceGroupCriteria();
- criteria.addFilterId(groupId);
- //criteria.fetchTags(true);
- groupService.findResourceGroupCompositesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceGroupComposite>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(
- new Message("Group with id [" + groupId + "] does not exist or is not accessible.",
- Message.Severity.Warning));
- caught.printStackTrace();
- CoreGUI.goTo(InventoryView.VIEW_PATH);
- }
-
- public void onSuccess(PageList<ResourceGroupComposite> result) {
- if (result.isEmpty()) {
- //noinspection ThrowableInstanceNeverThrown
- onFailure(new Exception("Group with id [" + groupId + "] does not exist."));
- } else {
- // check if requested group is already the current group. This can happen if
- // renderView (or any callers) execute in quick succession on the same resource group,
- // because of the (async) delay in this call path
- if (null != currentGroup && currentGroup.getResourceGroup().getId() == groupId) {
- return;
- }
-
- currentGroup = result.get(0);
- treeView.setSelectedGroup(currentGroup.getResourceGroup().getId());
- detailView.onGroupSelected(currentGroup);
- }
- }
- });
- }
+
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
@@ -129,10 +84,9 @@ public class ResourceGroupTopView extends LocatableHLayout implements Bookmarkab
viewPath.getViewPath().add(new ViewId("Overview"));
}
- Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
- setSelectedGroup(groupId, viewPath);
- viewPath.next();
+ this.treeView.renderView(viewPath);
+
this.detailView.renderView(viewPath);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java
new file mode 100644
index 0000000..8e1e178
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java
@@ -0,0 +1,349 @@
+/*
+ * 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.inventory.groups.detail;
+
+import java.util.EnumSet;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.MenuItemSeparator;
+import com.smartgwt.client.widgets.menu.events.ClickHandler;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.criteria.ResourceTypeCriteria;
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.ClusterKey;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.graph.GraphPortlet;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceGroupTreeContextMenu extends Menu {
+
+ private ResourceType currentType;
+ private ResourceGroup group;
+ private ResourceGroup currentGroup;
+
+ public void showContextMenu(TreeNode node) {
+
+ currentType = (ResourceType) node.getAttributeAsObject("resourceType");
+
+
+ final ClusterKey clusterKey = (ClusterKey) node.getAttributeAsObject("key");
+ if (clusterKey != null) {
+ GWTServiceLookup.getClusterService().createAutoClusterBackingGroup(clusterKey, true,
+ new AsyncCallback<ResourceGroup>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to create or update auto-cluster group: " + clusterKey, caught);
+ }
+
+ @Override
+ public void onSuccess(ResourceGroup result) {
+ showContextMenu(result);
+ }
+ });
+ } else {
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(Integer.parseInt(node.getAttribute("id")));
+ GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroup>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load group for context menu", caught);
+ }
+
+ @Override
+ public void onSuccess(PageList<ResourceGroup> result) {
+ showContextMenu(result.get(0));
+ }
+ });
+ }
+
+
+ }
+
+ private void showContextMenu(ResourceGroup group) {
+ this.currentGroup = group;
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ currentType.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) {
+
+ currentType = type;
+
+
+ buildResourceGroupContextMenu(currentGroup, type);
+ showContextMenu();
+ }
+ });
+
+ }
+
+
+ private void buildResourceGroupContextMenu(final ResourceGroup group, final ResourceType resourceType) {
+ setItems(new MenuItem(group.getName()));
+
+ addItem(new MenuItem("Type: " + resourceType.getName()));
+
+ MenuItem editPluginConfiguration = new MenuItem("Plugin Configuration");
+ editPluginConfiguration.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ int groupId = group.getId();
+ int resourceTypeId = resourceType.getId();
+
+ Window configEditor = new Window();
+// configEditor.setTitle("Edit " + group.getName() + " plugin configuration");
+ configEditor.setWidth(800);
+ configEditor.setHeight(800);
+ configEditor.setIsModal(true);
+ configEditor.setShowModalMask(true);
+ configEditor.setCanDragResize(true);
+ configEditor.centerInPage();
+ // TODO Group config editor
+// configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
+// ConfigurationEditor.ConfigType.plugin));
+ configEditor.show();
+
+ }
+ });
+ editPluginConfiguration.setEnabled(resourceType.getPluginConfigurationDefinition() != null);
+ addItem(editPluginConfiguration);
+
+ MenuItem editResourceConfiguration = new MenuItem("Resource Configuration");
+ editResourceConfiguration.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ int groupId = group.getId();
+ int resourceTypeId = resourceType.getId();
+
+ final Window configEditor = new Window();
+ configEditor.setTitle("Edit " + group.getName() + " resource configuration");
+ configEditor.setWidth(800);
+ configEditor.setHeight(800);
+ configEditor.setIsModal(true);
+ configEditor.setShowModalMask(true);
+ configEditor.setCanDragResize(true);
+ configEditor.setShowResizer(true);
+ configEditor.centerInPage();
+ configEditor.addCloseClickHandler(new CloseClickHandler() {
+ public void onCloseClick(CloseClientEvent closeClientEvent) {
+ configEditor.destroy();
+ }
+ });
+ // TODO group config editor
+// configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
+// ConfigurationEditor.ConfigType.resource));
+ configEditor.show();
+
+ }
+ });
+ editResourceConfiguration.setEnabled(resourceType.getResourceConfigurationDefinition() != null);
+ addItem(editResourceConfiguration);
+
+ addItem(new MenuItemSeparator());
+
+ // Operations Menu
+ MenuItem operations = new MenuItem("Operations");
+ Menu opSubMenu = new Menu();
+ if (resourceType.getOperationDefinitions() != null) {
+ for (final OperationDefinition operationDefinition : resourceType.getOperationDefinitions()) {
+ MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
+ operationItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+
+ // TODO Group version
+// ResourceCriteria criteria = new ResourceCriteria();
+// criteria.addFilterId(selectedResourceId);
+//
+// GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+// new AsyncCallback<PageList<Resource>>() {
+// public void onFailure(Throwable caught) {
+// CoreGUI.getErrorHandler()
+// .handleError("Failed to get resource to run operation", caught);
+// }
+//
+// public void onSuccess(PageList<Resource> result) {
+// new OperationCreateWizard(result.get(0), operationDefinition).startOperationWizard();
+// }
+// });
+
+ }
+ });
+ opSubMenu.addItem(operationItem);
+ }
+ }
+ operations.setEnabled(resourceType.getOperationDefinitions() != null && !resourceType.getOperationDefinitions().isEmpty());
+ operations.setSubmenu(opSubMenu);
+ addItem(operations);
+
+ addItem(buildMetricsMenu(resourceType));
+
+ /* TODO: We don't support group factory create
+ // Create Menu
+ MenuItem createChildMenu = new MenuItem("Create Child");
+ Menu createChildSubMenu = new Menu();
+ 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(resource, childType);
+ }
+ });
+
+ }
+ }
+ createChildMenu.setSubmenu(createChildSubMenu);
+ createChildMenu.setEnabled(createChildSubMenu.getItems().length > 0);
+ contextMenu.addItem(createChildMenu);*/
+
+ /*
+ // TODO We don't group manual import
+ // Manually Add Menu
+ MenuItem importChildMenu = new MenuItem("Import");
+ Menu importChildSubMenu = new Menu();
+ for (ResourceType childType : resourceType.getChildResourceTypes()) {
+ if (childType.isSupportsManualAdd()) {
+ importChildSubMenu.addItem(new MenuItem(childType.getName()));
+ }
+ }
+ if (resourceType.getCategory() == ResourceCategory.PLATFORM) {
+ loadManuallyAddServersToPlatforms(importChildSubMenu);
+ }
+ importChildMenu.setSubmenu(importChildSubMenu);
+ importChildMenu.setEnabled(importChildSubMenu.getItems().length > 0);
+ addItem(importChildMenu);
+ */
+ }
+
+ private void loadManuallyAddServersToPlatforms(final Menu manuallyAddMenu) {
+ ResourceTypeGWTServiceAsync rts = GWTServiceLookup.getResourceTypeGWTService();
+
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterSupportsManualAdd(true);
+ criteria.fetchParentResourceTypes(true);
+ rts.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load platform manual add children", caught);
+ }
+
+ public void onSuccess(PageList<ResourceType> result) {
+ for (ResourceType type : result) {
+ if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
+ MenuItem item = new MenuItem(type.getName());
+ manuallyAddMenu.addItem(item);
+ }
+ }
+ }
+ });
+ }
+
+ private MenuItem buildMetricsMenu(final ResourceType type) {
+ MenuItem measurements = new MenuItem("Measurements");
+ final Menu measurementsSubMenu = new Menu();
+
+ GWTServiceLookup.getDashboardService().findDashboardsForSubject(new AsyncCallback<List<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load user dashboards", caught);
+ }
+
+ public void onSuccess(List<Dashboard> result) {
+
+ if (type.getMetricDefinitions() != null) {
+ for (final MeasurementDefinition def : type.getMetricDefinitions()) {
+
+ MenuItem defItem = new MenuItem(def.getDisplayName());
+ measurementsSubMenu.addItem(defItem);
+ Menu defSubItem = new Menu();
+ defItem.setSubmenu(defSubItem);
+
+ for (final Dashboard d : result) {
+ MenuItem addToDBItem = new MenuItem("Add chart to Dashboard: " + d.getName());
+ defSubItem.addItem(addToDBItem);
+
+ addToDBItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+
+ DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " Chart",
+ GraphPortlet.KEY, 250);
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_RESOURCE_GROUP_ID, group.getId()));
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
+
+ d.addPortlet(p, 0, 0);
+
+ GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to save dashboard to server",
+ caught);
+ }
+
+ public void onSuccess(Dashboard result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Saved dashboard " + result.getName() + " to server",
+ Message.Severity.Info));
+ }
+ });
+
+ }
+ });
+
+ }
+
+ }
+ }
+
+ }
+ });
+ measurements.setSubmenu(measurementsSubMenu);
+ return measurements;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
index 1730ac3..eae4e0b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -24,27 +24,51 @@ package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
+import com.smartgwt.client.widgets.tree.events.NodeContextClickEvent;
+import com.smartgwt.client.widgets.tree.events.NodeContextClickHandler;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ClusterFlyweight;
+import org.rhq.core.domain.resource.group.composite.ClusterKeyFlyweight;
import org.rhq.core.domain.util.PageList;
+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.inventory.resource.type.ResourceTypeRepository;
/**
* @author Greg Hinkle
*/
-public class ResourceGroupTreeView extends VLayout {
+public class ResourceGroupTreeView extends VLayout implements BookmarkableView {
private TreeGrid treeGrid;
+ private ViewId currentViewId;
+ private int rootGroupId;
+ private int selectedGroupId;
+
+ private ResourceGroupTreeContextMenu contextMenu;
+
+ private ResourceGroup rootResourceGroup;
+ private HashMap<Integer, ResourceType> typeMap;
+ private ResourceGroup selectedGroup;
+
public ResourceGroupTreeView() {
setWidth(250);
setHeight100();
@@ -55,57 +79,221 @@ public class ResourceGroupTreeView extends VLayout {
super.onInit();
this.treeGrid = new TreeGrid();
+ treeGrid.setShowRoot(true);
this.treeGrid.setWidth100();
this.treeGrid.setHeight100();
- treeGrid.setShowRoot(true);
addMember(this.treeGrid);
+
+
+ contextMenu = new ResourceGroupTreeContextMenu();
+ treeGrid.setContextMenu(contextMenu);
+
+
+ treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ @Override
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ if (selectionEvent.getState()) {
+ ClusterKey key = (ClusterKey) selectionEvent.getRecord().getAttributeAsObject("key");
+ if (key == null) {
+ // selected the root group
+ setSelectedGroup(Integer.parseInt(selectionEvent.getRecord().getAttribute("id")));
+ } else {
+ System.out.println("Select group: " + key);
+
+ selectClusterGroup(key);
+ }
+ }
+ }
+ });
+
+ treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
+ public void onNodeContextClick(final NodeContextClickEvent event) {
+ event.getNode();
+ event.cancel();
+
+ contextMenu.showContextMenu(event.getNode());
+ }
+ });
+
}
- public void setSelectedGroup(int groupId) {
- GWTServiceLookup.getClusterService().getClusterTree(groupId,
- new AsyncCallback<ClusterFlyweight>() {
+ public void setSelectedGroup(final int groupId) {
+ this.selectedGroupId = groupId;
+
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(groupId);
+ criteria.addFilterVisible(null);
+ criteria.fetchResourceType(true);
+
+ GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroup>>() {
+ @Override
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load tree", caught);
+ CoreGUI.getErrorHandler().handleError("Failed to load group", caught);
}
- public void onSuccess(ClusterFlyweight result) {
- loadTree(result);
+ @Override
+ public void onSuccess(PageList<ResourceGroup> result) {
+ ResourceGroup group = result.get(0);
+ ResourceGroupTreeView.this.selectedGroup = group;
+
+ if (group.getClusterResourceGroup() == null) {
+ ResourceGroupTreeView.this.rootResourceGroup = group;
+ // This is a straight up group
+ loadGroup(groupId);
+ } else {
+ // Someone select a cluster group beneath a real recursive compatible group
+
+ ResourceGroup rootGroup = group.getClusterResourceGroup();
+ ResourceGroupTreeView.this.rootResourceGroup = rootGroup;
+
+ loadGroup(rootGroup.getId());
+ }
+
}
});
+
+
+ }
+
+
+ private void loadGroup(int groupId) {
+
+ if (groupId == this.rootGroupId) {
+ // Still looking at the same compat-recursive tree
+
+ // TODO reselect tree to selected node
+ if (this.selectedGroup.getClusterKey() != null) {
+ TreeNode selectedNode = treeGrid.getTree().findById(this.selectedGroup.getClusterKey());
+ TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
+ treeGrid.getTree().openFolders(parents);
+ treeGrid.getTree().openFolder(selectedNode);
+
+ treeGrid.selectRecord(selectedNode);
+ }
+
+
+ } else {
+ this.rootGroupId = groupId;
+ GWTServiceLookup.getClusterService().getClusterTree(groupId,
+ new AsyncCallback<ClusterFlyweight>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load tree", caught);
+ }
+
+ public void onSuccess(ClusterFlyweight result) {
+ loadTreeTypes(result);
+ }
+ });
+ }
+
+ }
+
+ private void loadTreeTypes(final ClusterFlyweight root) {
+ HashSet<Integer> typeIds = new HashSet<Integer>();
+ typeIds.add(this.rootResourceGroup.getResourceType().getId());
+ getTreeTypes(root, typeIds);
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ typeIds.toArray(new Integer[typeIds.size()]),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ @Override
+ public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
+ ResourceGroupTreeView.this.typeMap = types;
+ loadTree(root);
+ }
+ }
+ );
+ }
+
+
+ private void selectClusterGroup(ClusterKey key) {
+
+ GWTServiceLookup.getClusterService().createAutoClusterBackingGroup(key, true,
+ new AsyncCallback<ResourceGroup>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to create or update auto cluster group", caught);
+ }
+
+ @Override
+ public void onSuccess(ResourceGroup result) {
+ History.newItem("ResourceGroup/" + result.getId());
+ }
+ });
+
}
private void loadTree(ClusterFlyweight root) {
- TreeNode rootNode = new TreeNode(root.getName());
+ TreeNode rootNode = new TreeNode(rootResourceGroup.getName());
+ rootNode.setID(String.valueOf(root.getGroupId())); //getClusterKey().toString());
+ rootNode.setAttribute("resourceType", typeMap.get(rootResourceGroup.getResourceType().getId()));
- loadTree(rootNode, root);
+ ClusterKey rootKey = new ClusterKey(root.getGroupId());
+ loadTree(rootNode, root, rootKey);
Tree tree = new Tree();
+
tree.setRoot(rootNode);
+
treeGrid.setData(tree);
- markForRedraw();
+ treeGrid.markForRedraw();
}
- public void loadTree(TreeNode parent, ClusterFlyweight parentNode) {
+ public void loadTree(TreeNode parent, ClusterFlyweight parentNode, ClusterKey parentKey) {
if (!parentNode.getChildren().isEmpty()) {
+ // TODO Introduce type groups (Do we still like this model for recursive compatibles?)
+
ArrayList<TreeNode> childNodes = new ArrayList<TreeNode>();
- HashMap<Integer,TreeNode> typeNodes = new HashMap<Integer, TreeNode>();
+ HashMap<Integer, TreeNode> typeNodes = new HashMap<Integer, TreeNode>();
for (ClusterFlyweight child : parentNode.getChildren()) {
TreeNode node = new TreeNode(child.getName());
+
+ ClusterKeyFlyweight keyFlyweight = child.getClusterKey();
+ ClusterKey key = new ClusterKey(parentKey, keyFlyweight.getResourceTypeId(), keyFlyweight.getResourceKey());
+
+ ResourceType type = this.typeMap.get(keyFlyweight.getResourceTypeId());
+
+ String icon = "types/" + type.getCategory().getDisplayName() + "_up_16.png";
+
+ node.setIcon(icon);
+
+
+ node.setID(key.getKey());
+ node.setAttribute("key", key);
+ node.setAttribute("resourceType", type);
childNodes.add(node);
if (child.getChildren().isEmpty()) {
node.setIsFolder(false);
} else {
node.setIsFolder(true);
- loadTree(node, child);
+ loadTree(node, child, key);
}
}
parent.setChildren(childNodes.toArray(new TreeNode[childNodes.size()]));
}
}
+
+ public void renderView(ViewPath viewPath) {
+ currentViewId = viewPath.getCurrent();
+ int groupId = Integer.parseInt(currentViewId.getPath());
+ setSelectedGroup(groupId);
+ }
+
+
+ private void getTreeTypes(ClusterFlyweight clusterFlyweight, Set<Integer> typeIds) {
+ if (clusterFlyweight.getClusterKey() != null) {
+ typeIds.add(clusterFlyweight.getClusterKey().getResourceTypeId());
+ }
+
+ for (ClusterFlyweight child : clusterFlyweight.getChildren()) {
+ getTreeTypes(child, typeIds);
+ }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
index 6f721b2..32e676a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -18,14 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
-import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import java.util.Date;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
@@ -35,7 +28,13 @@ import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.FieldType;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import java.util.Date;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
* @author Greg Hinkle
@@ -108,6 +107,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
ListGridRecord record = new ListGridRecord();
record.setAttribute("id", from.getId());
record.setAttribute("resource", from.getResource());
+ record.setAttribute("resourceTypeId", from.getResource().getResourceType().getId());
record.setAttribute("subject", from.getSubjectName());
record.setAttribute("configuration", from.getConfiguration());
record.setAttribute("createdTime", new Date(from.getCreatedTime()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
index b033a40..8c2b42b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
@@ -20,47 +20,58 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configur
import java.util.EnumSet;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.layout.Layout;
+import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+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.inventory.resource.type.ResourceTypeRepository;
/**
* @author Greg Hinkle
*/
-public class ConfigurationHistoryDetailView extends Layout {
+public class ConfigurationHistoryDetailView extends VLayout implements BookmarkableView {
- private ConfigurationDefinition definition;
- private Configuration configuration;
+ private int configurationUpdateId;
+
+ public ConfigurationHistoryDetailView() {
+ setWidth100();
+ setHeight100();
+ }
@Override
protected void onDraw() {
super.onDraw();
- if (definition != null && configuration != null) {
- setup();
- }
- }
- public void setConfiguration(ConfigurationDefinition definition, Configuration configuration) {
- this.definition = definition;
- this.configuration = configuration;
- setup();
}
- private void setup() {
- if (getChildren().length > 0)
- getChildren()[0].destroy();
+ private void displayHistory(final ResourceConfigurationUpdate update) {
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(update.getResource().getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
- ConfigurationEditor editor = new ConfigurationEditor(definition, configuration);
- editor.setReadOnly(true);
- addMember(editor);
- markForRedraw();
+ ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
+
+ ConfigurationEditor editor = new ConfigurationEditor(definition, update.getConfiguration());
+ editor.setReadOnly(true);
+ addMember(editor);
+ markForRedraw();
+ }
+ });
}
public void displayInDialog() {
@@ -76,4 +87,31 @@ public class ConfigurationHistoryDetailView extends Layout {
window.addItem(this);
window.show();
}
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+
+ int updateId = viewPath.getCurrentAsInt();
+
+ ResourceConfigurationUpdateCriteria criteria = new ResourceConfigurationUpdateCriteria();
+ criteria.fetchConfiguration(true);
+ criteria.fetchResource(true);
+ criteria.addFilterId(updateId);
+
+
+ GWTServiceLookup.getConfigurationService().findResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Unable to load configuration history", caught);
+ }
+
+ public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
+
+ ResourceConfigurationUpdate update = result.get(0);
+ displayHistory(update);
+ }
+ });
+
+
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 472ee86..1053e79 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -19,64 +19,52 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
import java.util.ArrayList;
-import java.util.EnumSet;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent;
-import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
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.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
/**
* @author Greg Hinkle
*/
-public class ConfigurationHistoryView extends LocatableVLayout {
+public class ConfigurationHistoryView extends TableSection {
private Integer resourceId;
public ConfigurationHistoryView(String locatorId) {
- super(locatorId);
- setWidth100();
- setHeight100();
- setAnimateMembers(true);
-
+ super("ConfigurationHistory", "Configuration History");
+ final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
+ setDataSource(datasource);
}
public ConfigurationHistoryView(String locatorId, final int resourceId) {
- this(locatorId);
+ super("ConfigurationHistory", "Configuration History", new Criteria("resourceId", String.valueOf(resourceId)));
this.resourceId = resourceId;
+
+ final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
+ setDataSource(datasource);
+
+
}
@Override
- protected void onDraw() {
- super.onDraw();
+ protected void configureTable() {
+ super.configureTable();
- Criteria criteria = new Criteria();
- if (resourceId != null) {
- criteria.addCriteria("resourceId", (int) resourceId);
- }
- final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
- Table table = new Table(getLocatorId(), "Configuration History", criteria);
- table.setDataSource(datasource);
- table.getListGrid().setUseAllDataSourceFields(true);
-
- ListGrid grid = table.getListGrid();
+ ListGrid grid = getListGrid();
grid.getField("id").setWidth(60);
grid.getField("createdTime").setWidth(200);
@@ -116,7 +104,7 @@ public class ConfigurationHistoryView extends LocatableVLayout {
grid.getField("subject").setWidth(150);
- table.addTableAction(extendLocatorId("Remove"), "Remove", Table.SelectionEnablement.ANY,
+ addTableAction(extendLocatorId("Remove"), "Remove", Table.SelectionEnablement.ANY,
"Are you sure you want to delete # configurations?", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
// TODO: Implement this method.
@@ -124,7 +112,7 @@ public class ConfigurationHistoryView extends LocatableVLayout {
}
});
- table.addTableAction(extendLocatorId("Compare"), "Compare", Table.SelectionEnablement.MULTIPLE, null,
+ addTableAction(extendLocatorId("Compare"), "Compare", Table.SelectionEnablement.MULTIPLE, null,
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
@@ -137,14 +125,8 @@ public class ConfigurationHistoryView extends LocatableVLayout {
}
});
- table.getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
- public void onCellDoubleClick(CellDoubleClickEvent cellDoubleClickEvent) {
- ListGridRecord record = cellDoubleClickEvent.getRecord();
- showDetails(record);
- }
- });
- table.addTableAction(extendLocatorId("ShowDetail"), "Show Details", Table.SelectionEnablement.SINGLE, null,
+ addTableAction(extendLocatorId("ShowDetail"), "Show Details", Table.SelectionEnablement.SINGLE, null,
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
@@ -154,30 +136,17 @@ public class ConfigurationHistoryView extends LocatableVLayout {
}
});
- addMember(table);
}
- public static void showDetails(ListGridRecord record) {
- final ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record.getAttributeAsObject("entity");
-
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(update.getResource().getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
-
- public void onTypesLoaded(ResourceType type) {
-
- ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
-
- ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView();
+ @Override
+ public Canvas getDetailsView(int id) {
+ ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView();
- detailView.setConfiguration(definition, update.getConfiguration());
+ return detailView;
- detailView.displayInDialog();
+ }
- }
- });
- }
// -------- Static Utility loaders ------------
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index 24fc0e0..f8ebe39 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -18,7 +18,15 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.type;
-import org.rhq.core.domain.configuration.RawConfiguration;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
@@ -28,15 +36,6 @@ 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.ResourceTypeGWTServiceAsync;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
@@ -130,7 +129,7 @@ public class ResourceTypeRepository {
} else {
for (Integer typeId : resourceTypeIds) {
- if (!typeCache.containsKey(typeId) || (metadataTypes != null && !typeCacheLevel.get(typeId).containsAll(metadataTypes))) {
+ if (!typeCache.containsKey(typeId) || (metadataTypes != null && (typeCacheLevel.containsKey(typeId)) && !typeCacheLevel.get(typeId).containsAll(metadataTypes))) {
typesNeeded.add(typeId);
} else {
cachedTypes.put(typeId, typeCache.get(typeId));
@@ -186,7 +185,7 @@ public class ResourceTypeRepository {
criteria.setPageControl(PageControl.getUnlimitedInstance());
- System.out.println("Loading " + typesNeeded.size() + " types: " + metadataTypes.toString());
+ System.out.println("Loading " + typesNeeded.size() + ((metadataTypes != null) ? (" types: " + metadataTypes.toString()) : ""));
resourceTypeService.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
public void onFailure(Throwable caught) {
commit 2ffab8117be3ea68c8e77aec7413dbee0e14e673
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 30 14:35:52 2010 -0400
ClusterKey serialization fix (not sure how this got lost in the merge)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
index e6d5369..f57608d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
@@ -44,6 +44,10 @@ import java.util.List;
*
*/
public class ClusterKey implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+
static final String DELIM = ":";
static final String DELIM_NODE = "::";
@@ -202,9 +206,14 @@ public class ClusterKey implements Serializable {
* and so typically this class is for use within a ClusterKey, which qualifies the node with
* the root group and constraining node ancestry.. */
public static class Node implements Serializable {
+ private static final long serialVersionUID = 1L;
+
int resourceTypeId;
String resourceKey;
+ public Node() {
+ }
+
public Node(int resourceTypeId, String resourceKey) {
super();
this.resourceTypeId = resourceTypeId;
commit 779937bf4fcef98bd174eecb50ae820e09a16f94
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Aug 29 20:43:38 2010 -0400
Fix show/hide animation ordering
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index a25d7e6..01a19f3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -99,13 +99,13 @@ public abstract class TableSection extends Table implements BookmarkableView {
/**
* Shows the details view for the given record of the table.
- *
+ *
* The default implementation of this method assumes there is an
* id attribute on the record and passes it to {@link #showDetails(int)}.
* Subclasses are free to override this behavior. Subclasses usually
* will need to set the {@link #setDetailsView(Canvas) details view}
* explicitly.
- *
+ *
* @param record the record whose details are to be shown
*/
public void showDetails(ListGridRecord record) {
@@ -127,7 +127,7 @@ public abstract class TableSection extends Table implements BookmarkableView {
* Subclasses are free to override this - which you usually want to do
* if you know the full details of the item are stored in the record attributes
* and thus help avoid making a round trip to the DB.
- *
+ *
* @param record the record of the item whose details to be shown; ; null if empty details view should be shown.
*/
public Canvas getDetailsView(ListGridRecord record) {
@@ -150,9 +150,9 @@ public abstract class TableSection extends Table implements BookmarkableView {
* details view will be shown if the id passed in is 0.
* This method is usually called when a user goes to the details
* page via a bookmark or direct link.
- *
+ *
* @param id the id of the row whose details are to be shown; pass in 0 to show empty details
- *
+ *
* @see #showDetails(ListGridRecord)
*/
public void showDetails(int id) {
@@ -163,7 +163,7 @@ public abstract class TableSection extends Table implements BookmarkableView {
* Returns the details canvas with information on the item that has the given ID.
* Note that an empty details view should be returned if the id passed in is 0 (as would
* be the case if a new item is to be created using the details view).
- *
+ *
* @param id the id of the details to be shown; will be 0 if an empty details view should be shown.
*/
public abstract Canvas getDetailsView(int id);
@@ -192,7 +192,7 @@ public abstract class TableSection extends Table implements BookmarkableView {
/**
* For use by subclasses that want to define their own details view.
- *
+ *
* @param detailsView the new details view
*/
protected void setDetailsView(Canvas detailsView) {
@@ -225,20 +225,24 @@ public abstract class TableSection extends Table implements BookmarkableView {
* Switches to viewing the table, hiding the details canvas.
*/
protected void switchToTableView() {
- Canvas contents = getTableContents();
+ final Canvas contents = getTableContents();
if (contents != null) {
- contents.animateShow(AnimationEffect.FADE, new AnimationCallback() {
- @Override
- public void execute(boolean b) {
- if (detailsHolder != null && detailsHolder.isVisible()) {
- detailsHolder.animateHide(AnimationEffect.FADE);
+ if (detailsHolder != null && detailsHolder.isVisible()) {
+ detailsHolder.animateHide(AnimationEffect.FADE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ // TODO: Implement this method.
for (Canvas child : detailsHolder.getMembers()) {
detailsHolder.removeMember(child);
}
+
+ contents.animateShow(AnimationEffect.FADE);
}
- }
- });
+ });
+ } else {
+ contents.animateShow(AnimationEffect.FADE);
+ }
}
}
}
13 years, 3 months
[rhq] 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java | 161 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java | 25 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 138 +++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java | 7
12 files changed, 225 insertions(+), 154 deletions(-)
New commits:
commit 033c156cbba2e6799271dc4688e52c023d2c709f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Aug 27 18:26:35 2010 -0400
refactor TableSection to allow for records to be used to build detail views
refactor the alert def code to use the new TableSection
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
index 21565e1..4c7b047 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
@@ -18,17 +18,22 @@
*/
package org.rhq.enterprise.gui.coregui.client.alert.definitions;
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.alert.BooleanExpression;
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
+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.components.table.Table.SelectionEnablement;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
* Superclass to the different alert definition views. This should be subclassed
@@ -36,49 +41,31 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*
* @author John Mazzitelli
*/
-public abstract class AbstractAlertDefinitionsView extends LocatableVLayout {
+public abstract class AbstractAlertDefinitionsView extends TableSection {
- private SingleAlertDefinitionView singleAlertDefinitionView;
- private Table alertDefinitionsTable;
-
- public AbstractAlertDefinitionsView(String locatorId) {
- super(locatorId);
- setWidth100();
- setHeight100();
- setMembersMargin(10);
+ public AbstractAlertDefinitionsView(String locatorId, String tableTitle) {
+ super(locatorId, tableTitle);
}
@Override
- protected void onDraw() {
- super.onDraw();
+ protected void configureTable() {
+
+ ListGrid listGrid = getListGrid();
+
+ AbstractAlertDefinitionsDataSource ds = getAlertDefinitionDataSource();
+ setDataSource(ds);
+ listGrid.setDataSource(ds);
Criteria criteria = getCriteria();
- alertDefinitionsTable = new Table(extendLocatorId("AlertDef"), getTableTitle(), criteria);
- alertDefinitionsTable.setDataSource(getAlertDefinitionDataSource());
- alertDefinitionsTable.getListGrid().setUseAllDataSourceFields(true);
-
- alertDefinitionsTable.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- AlertDefinition alertDef = null;
- ListGridRecord selectedRecord = null;
- ListGridRecord[] allSelections = selectionEvent.getSelection();
- if (allSelections != null && allSelections.length == 1) {
- selectedRecord = allSelections[0];
- }
- if (selectedRecord != null) {
- alertDef = ((AbstractAlertDefinitionsDataSource) alertDefinitionsTable.getDataSource())
- .copyValues(selectedRecord);
- showSingleAlertDefinitionView(alertDef);
- } else {
- hideSingleAlertDefinitionView();
- }
- markForRedraw();
- }
- });
+ listGrid.setCriteria(criteria);
+ listGrid.setUseAllDataSourceFields(true);
+ listGrid.setWrapCells(true);
+ listGrid.setFixedRecordHeights(false);
+ //listGrid.getField("id").setWidth(55);
- boolean permitted = isAllowedToModifyAlerts();
+ boolean permitted = isAllowedToModifyAlertDefinitions();
- alertDefinitionsTable.addTableAction(extendLocatorId("New"), "New", (permitted) ? SelectionEnablement.ALWAYS
+ addTableAction(extendLocatorId("New"), "New", (permitted) ? SelectionEnablement.ALWAYS
: SelectionEnablement.NEVER, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
newButtonPressed(selection);
@@ -86,7 +73,7 @@ public abstract class AbstractAlertDefinitionsView extends LocatableVLayout {
}
});
- alertDefinitionsTable.addTableAction(extendLocatorId("Enable"), "Enable", (permitted) ? SelectionEnablement.ANY
+ addTableAction(extendLocatorId("Enable"), "Enable", (permitted) ? SelectionEnablement.ANY
: SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
enableButtonPressed(selection);
@@ -94,62 +81,86 @@ public abstract class AbstractAlertDefinitionsView extends LocatableVLayout {
}
});
- alertDefinitionsTable.addTableAction(extendLocatorId("Disable"), "Disable",
- (permitted) ? SelectionEnablement.ANY : SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- disableButtonPressed(selection);
- CoreGUI.refresh();
- }
- });
+ addTableAction(extendLocatorId("Disable"), "Disable", (permitted) ? SelectionEnablement.ANY
+ : SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ disableButtonPressed(selection);
+ CoreGUI.refresh();
+ }
+ });
- alertDefinitionsTable.addTableAction(extendLocatorId("Delete"), "Delete", (permitted) ? SelectionEnablement.ANY
+ addTableAction(extendLocatorId("Delete"), "Delete", (permitted) ? SelectionEnablement.ANY
: SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
deleteButtonPressed(selection);
CoreGUI.refresh();
}
});
+ }
- addMember(alertDefinitionsTable);
+ @Override
+ public void showDetails(ListGridRecord record) {
+ Canvas canvas = getDetailsView(record);
+ setDetailsView(canvas);
- singleAlertDefinitionView = buildSingleAlertDefinitionView();
- singleAlertDefinitionView.hide();
- singleAlertDefinitionView.setWidth100();
- singleAlertDefinitionView.setHeight100();
- singleAlertDefinitionView.setMargin(10);
- addMember(singleAlertDefinitionView);
- }
+ Integer id = record.getAttributeAsInt("id");
+ History.newItem(getBasePath() + "/" + id.intValue(), false);
- protected SingleAlertDefinitionView getSingleAlertDefinitionView() {
- return singleAlertDefinitionView;
+ switchToDetailsView();
}
- protected void showSingleAlertDefinitionView(AlertDefinition alertDef) {
- alertDefinitionsTable.setHeight("33%");
- alertDefinitionsTable.setShowResizeBar(true);
- singleAlertDefinitionView.setHeight("67%");
- singleAlertDefinitionView.show();
- singleAlertDefinitionView.setAlertDefinition(alertDef);
- }
+ @Override
+ public Canvas getDetailsView(ListGridRecord record) {
+ if (record == null) {
+ return getDetailsView(0);
+ }
- protected void hideSingleAlertDefinitionView() {
- alertDefinitionsTable.setHeight100();
- alertDefinitionsTable.setShowResizeBar(false);
- singleAlertDefinitionView.hide();
+ AlertDefinition alertDef = getAlertDefinitionDataSource().copyValues(record);
+ SingleAlertDefinitionView singleAlertDefinitionView = new SingleAlertDefinitionView(alertDef);
+ return singleAlertDefinitionView;
}
- protected SingleAlertDefinitionView buildSingleAlertDefinitionView() {
- SingleAlertDefinitionView singleAlertDefinitionView = new SingleAlertDefinitionView();
+ @Override
+ public SingleAlertDefinitionView getDetailsView(int id) {
+ final SingleAlertDefinitionView singleAlertDefinitionView = new SingleAlertDefinitionView();
+
+ if (id == 0) {
+ // create an empty one with all defaults
+ AlertDefinition newAlertDef = new AlertDefinition();
+ newAlertDef.setDeleted(false);
+ newAlertDef.setEnabled(true);
+ newAlertDef.setNotifyFiltered(false);
+ newAlertDef.setParentId(Integer.valueOf(0));
+ newAlertDef.setConditionExpression(BooleanExpression.ALL);
+ newAlertDef.setPriority(AlertPriority.MEDIUM);
+ newAlertDef.setWillRecover(false);
+ singleAlertDefinitionView.makeEditable();
+ } else {
+ final AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
+ criteria.addFilterId(id);
+ criteria.fetchGroupAlertDefinition(true);
+ GWTServiceLookup.getAlertService().findAlertDefinitionsByCriteria(criteria,
+ new AsyncCallback<PageList<AlertDefinition>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load alert definition data", caught);
+ }
+
+ public void onSuccess(PageList<AlertDefinition> result) {
+ if (result.size() > 0) {
+ singleAlertDefinitionView.setAlertDefinition(result.get(0));
+ }
+ }
+ });
+ }
+
return singleAlertDefinitionView;
}
- protected abstract String getTableTitle();
-
protected abstract Criteria getCriteria();
protected abstract AbstractAlertDefinitionsDataSource getAlertDefinitionDataSource();
- protected abstract boolean isAllowedToModifyAlerts();
+ protected abstract boolean isAllowedToModifyAlertDefinitions();
protected abstract void newButtonPressed(ListGridRecord[] selection);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
index 8be60bb..477dc0d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
@@ -54,8 +54,8 @@ public class ConditionsAlertDefinitionForm extends DynamicForm implements EditAl
}
@Override
- protected void onDraw() {
- super.onDraw();
+ protected void onInit() {
+ super.onInit();
if (!formBuilt) {
buildForm();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
index 1da8f49..4dc7356 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
@@ -45,8 +45,8 @@ public class DampeningAlertDefinitionForm extends DynamicForm implements EditAle
}
@Override
- protected void onDraw() {
- super.onDraw();
+ protected void onInit() {
+ super.onInit();
if (!formBuilt) {
buildForm();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
index 3b46437..e7d8d0a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
@@ -65,8 +65,8 @@ public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements
}
@Override
- protected void onDraw() {
- super.onDraw();
+ protected void onInit() {
+ super.onInit();
if (!formBuilt) {
buildForm();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
index 491baee..c0b37ca 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
@@ -39,7 +39,7 @@ public class GroupAlertDefinitionsView extends AbstractAlertDefinitionsView {
private ResourceGroup group;
public GroupAlertDefinitionsView(String locatorId, ResourceGroup group) {
- super(locatorId);
+ super(locatorId, "Group Alert Definitions");
this.group = group;
}
@@ -56,12 +56,7 @@ public class GroupAlertDefinitionsView extends AbstractAlertDefinitionsView {
}
@Override
- protected String getTableTitle() {
- return "Group Alert Definitions";
- }
-
- @Override
- protected boolean isAllowedToModifyAlerts() {
+ protected boolean isAllowedToModifyAlertDefinitions() {
// TODO: see if user can modify group alerts on this group
return true;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
index d0fddc6..644ba4c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
@@ -45,8 +45,8 @@ public class NotificationsAlertDefinitionForm extends DynamicForm implements Edi
}
@Override
- protected void onDraw() {
- super.onDraw();
+ protected void onInit() {
+ super.onInit();
if (!formBuilt) {
buildForm();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
index 637c2cc..e3d6bcc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
@@ -50,8 +50,8 @@ public class RecoveryAlertDefinitionForm extends DynamicForm implements EditAler
}
@Override
- protected void onDraw() {
- super.onDraw();
+ protected void onInit() {
+ super.onInit();
if (!formBuilt) {
buildForm();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
index acc88c2..126c672 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
@@ -27,9 +27,6 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.alert.AlertPriority;
-import org.rhq.core.domain.alert.BooleanExpression;
import org.rhq.core.domain.resource.Resource;
/**
@@ -42,7 +39,7 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
private Resource resource;
public ResourceAlertDefinitionsView(String locatorId, Resource resource) {
- super(locatorId);
+ super(locatorId, "Alert Definitions");
this.resource = resource;
}
@@ -59,30 +56,14 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
}
@Override
- protected String getTableTitle() {
- return "Alert Definitions";
- }
-
- @Override
- protected boolean isAllowedToModifyAlerts() {
+ protected boolean isAllowedToModifyAlertDefinitions() {
// TODO: see if user can modify alerts on this resource
return true;
}
@Override
protected void newButtonPressed(ListGridRecord[] selection) {
- // create an empty one with all defaults
- AlertDefinition newAlertDef = new AlertDefinition();
- newAlertDef.setDeleted(false);
- newAlertDef.setEnabled(true);
- newAlertDef.setNotifyFiltered(false);
- newAlertDef.setParentId(Integer.valueOf(0));
- newAlertDef.setConditionExpression(BooleanExpression.ALL);
- newAlertDef.setPriority(AlertPriority.MEDIUM);
- newAlertDef.setWillRecover(false);
-
- showSingleAlertDefinitionView(newAlertDef);
- getSingleAlertDefinitionView().makeEditable();
+ showDetails(0);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
index 4e0ca75..d2f44f6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
@@ -39,7 +39,7 @@ public class TemplateAlertDefinitionsView extends AbstractAlertDefinitionsView {
private ResourceType resourceType;
public TemplateAlertDefinitionsView(String locatorId, ResourceType resourceType) {
- super(locatorId);
+ super(locatorId, "Alert Templates");
this.resourceType = resourceType;
}
@@ -56,12 +56,7 @@ public class TemplateAlertDefinitionsView extends AbstractAlertDefinitionsView {
}
@Override
- protected String getTableTitle() {
- return "Alert Templates";
- }
-
- @Override
- protected boolean isAllowedToModifyAlerts() {
+ protected boolean isAllowedToModifyAlertDefinitions() {
// TODO: see if user can modify template alerts
return true;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index b167872..8404cd5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -58,7 +58,7 @@ public class Table extends LocatableHLayout {
private static final SelectionEnablement DEFAULT_SELECTION_ENABLEMENT = SelectionEnablement.ALWAYS;
- protected VLayout contents;
+ private VLayout contents;
private HTMLFlow title;
@@ -329,6 +329,14 @@ public class Table extends LocatableHLayout {
}
+ /**
+ * Returns the encompassing canvas that contains all content for this table component.
+ * This content includes the list grid, the buttons, etc.
+ */
+ public Canvas getTableContents() {
+ return this.contents;
+ }
+
public boolean isShowHeader() {
return showHeader;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index 78988c5..a25d7e6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -28,23 +28,24 @@ import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.AnimationEffect;
import com.smartgwt.client.widgets.AnimationCallback;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent;
import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
/**
* @author Greg Hinkle
+ * @author John Mazzitelli
*/
public abstract class TableSection extends Table implements BookmarkableView {
private VLayout detailsHolder;
-
private Canvas detailsView;
-
private String basePath;
protected TableSection(String locatorId, String tableTitle) {
@@ -83,29 +84,88 @@ public abstract class TableSection extends Table implements BookmarkableView {
detailsHolder.hide();
addMember(detailsHolder);
-
}
@Override
protected void onDraw() {
super.onDraw();
-
getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
@Override
public void onCellDoubleClick(CellDoubleClickEvent event) {
-
- int id = event.getRecord().getAttributeAsInt("id");
-
- showDetails(id);
+ showDetails(event.getRecord());
}
});
+ }
+
+ /**
+ * Shows the details view for the given record of the table.
+ *
+ * The default implementation of this method assumes there is an
+ * id attribute on the record and passes it to {@link #showDetails(int)}.
+ * Subclasses are free to override this behavior. Subclasses usually
+ * will need to set the {@link #setDetailsView(Canvas) details view}
+ * explicitly.
+ *
+ * @param record the record whose details are to be shown
+ */
+ public void showDetails(ListGridRecord record) {
+ Integer id = record.getAttributeAsInt("id");
+ if (id != null) {
+ showDetails(id.intValue());
+ } else {
+ String msg = "table [" + this.getClass() + "] is missing 'id' attrib! please report this bug";
+ CoreGUI.getErrorHandler().handleError(msg);
+ throw new IllegalArgumentException(msg);
+ }
+ }
+ /**
+ * Returns the details canvas with information on the item given its list grid record.
+ *
+ * The default implementation of this method is to assume there is an
+ * id attribute on the record and pass that ID to {@link #getDetailsView(int)}.
+ * Subclasses are free to override this - which you usually want to do
+ * if you know the full details of the item are stored in the record attributes
+ * and thus help avoid making a round trip to the DB.
+ *
+ * @param record the record of the item whose details to be shown; ; null if empty details view should be shown.
+ */
+ public Canvas getDetailsView(ListGridRecord record) {
+ if (record == null) {
+ return getDetailsView(0);
+ }
+
+ Integer id = record.getAttributeAsInt("id");
+ if (id != null) {
+ return getDetailsView(id.intValue());
+ } else {
+ String msg = "table [" + this.getClass() + "] is missing 'id' attrib. please report this bug";
+ CoreGUI.getErrorHandler().handleError(msg);
+ throw new IllegalArgumentException(msg);
+ }
}
+ /**
+ * Shows the details for an item has the given ID. Note that an empty
+ * details view will be shown if the id passed in is 0.
+ * This method is usually called when a user goes to the details
+ * page via a bookmark or direct link.
+ *
+ * @param id the id of the row whose details are to be shown; pass in 0 to show empty details
+ *
+ * @see #showDetails(ListGridRecord)
+ */
public void showDetails(int id) {
History.newItem(basePath + "/" + id);
}
+ /**
+ * Returns the details canvas with information on the item that has the given ID.
+ * Note that an empty details view should be returned if the id passed in is 0 (as would
+ * be the case if a new item is to be created using the details view).
+ *
+ * @param id the id of the details to be shown; will be 0 if an empty details view should be shown.
+ */
public abstract Canvas getDetailsView(int id);
@Override
@@ -114,16 +174,39 @@ public abstract class TableSection extends Table implements BookmarkableView {
basePath = viewPath.getPathToCurrent();
if (!viewPath.isEnd()) {
-
int id = Integer.parseInt(viewPath.getCurrent().getPath());
-
detailsView = getDetailsView(id);
-
if (detailsView instanceof BookmarkableView) {
-
((BookmarkableView) detailsView).renderView(viewPath);
}
+ switchToDetailsView();
+ } else {
+ switchToTableView();
+ }
+ }
+
+ protected String getBasePath() {
+ return this.basePath;
+ }
+
+ /**
+ * For use by subclasses that want to define their own details view.
+ *
+ * @param detailsView the new details view
+ */
+ protected void setDetailsView(Canvas detailsView) {
+ this.detailsView = detailsView;
+ }
+
+ /**
+ * Switches to viewing the details canvas, hiding the table. This does not
+ * do anything with reloading data or switching to the selected row in the table;
+ * this only changes the visibility of canvases.
+ */
+ protected void switchToDetailsView() {
+ Canvas contents = getTableContents();
+ if (contents != null) {
contents.animateHide(AnimationEffect.FADE, new AnimationCallback() {
@Override
public void execute(boolean b) {
@@ -135,22 +218,27 @@ public abstract class TableSection extends Table implements BookmarkableView {
detailsHolder.animateShow(AnimationEffect.FADE);
}
});
+ }
+ }
- } else {
- if (contents != null) {
- contents.animateShow(AnimationEffect.FADE, new AnimationCallback() {
- @Override
- public void execute(boolean b) {
- if (detailsHolder != null && detailsHolder.isVisible()) {
- detailsHolder.animateHide(AnimationEffect.FADE);
-
- for (Canvas child : detailsHolder.getMembers()) {
- detailsHolder.removeMember(child);
- }
+ /**
+ * Switches to viewing the table, hiding the details canvas.
+ */
+ protected void switchToTableView() {
+ Canvas contents = getTableContents();
+ if (contents != null) {
+ contents.animateShow(AnimationEffect.FADE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ if (detailsHolder != null && detailsHolder.isVisible()) {
+ detailsHolder.animateHide(AnimationEffect.FADE);
+
+ for (Canvas child : detailsHolder.getMembers()) {
+ detailsHolder.removeMember(child);
}
}
- });
- }
+ }
+ });
}
}
}
commit 8923b7f0c47e91528507b90198e3e6d926dc46a3
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Aug 27 18:16:08 2010 -0400
error handler should not store errors in an unbounded list - they aren't even used
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
index 9491b8f..d410c54 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
@@ -18,8 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.util;
-import java.util.ArrayList;
-
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -28,8 +26,6 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
*/
public class ErrorHandler {
- private ArrayList<String> errors = new ArrayList<String>();
-
public void handleError(String message) {
handleError(message, null);
}
@@ -41,8 +37,5 @@ public class ErrorHandler {
if (t != null) {
t.printStackTrace();
}
-
- this.errors.add(message);
}
-
}
13 years, 3 months
[rhq] Branch 'release-3.0.0' - 3 commits - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 2f962ce204d8f3fb75461c820398a26ee55401df
Merge: db52fd9... ff67750...
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Aug 26 08:40:54 2010 -0400
Merge branch 'release-3.0.0-patch1' into release-3.0.0
commit ff677500c349d4c6e3908e27fa728251bd55a674
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 25 16:05:31 2010 -0400
[BZ 627391] There was a 2nd method with the query param name wrong
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
index c1f8d50..b547898 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
@@ -209,10 +209,10 @@ public class AuthorizationManagerBean implements AuthorizationManagerLocal {
query.setParameter("parentResourceId", parentResourceId);
query.setParameter("resourceTypeId", resourceTypeId);
- query.setParameter("subject", -1);
+ query.setParameter("subjectId", -1);
long baseCount = (Long) query.getSingleResult();
- query.setParameter("subject", subject);
+ query.setParameter("subjectId", subject.getId());
long subjectCount = (Long) query.getSingleResult();
/*
commit da4c70da6d11ec2a8f1a18dba5bdecd4e31337ee
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 25 13:53:10 2010 -0400
[BZ 627391] Fixing JPAQL query that checks autogroup access
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
index d675177..c1f8d50 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
@@ -149,10 +149,10 @@ public class AuthorizationManagerBean implements AuthorizationManagerLocal {
query.setParameter("parentResourceId", parentResourceId);
query.setParameter("resourceTypeId", resourceTypeId);
- query.setParameter("subject", -1);
+ query.setParameter("subjectId", -1);
long baseCount = (Long) query.getSingleResult();
- query.setParameter("subject", subject);
+ query.setParameter("subjectId", subject.getId());
long subjectCount = (Long) query.getSingleResult();
/*
13 years, 3 months
[rhq] Branch 'release-3.0.0-patch1' - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit ff677500c349d4c6e3908e27fa728251bd55a674
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 25 16:05:31 2010 -0400
[BZ 627391] There was a 2nd method with the query param name wrong
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
index c1f8d50..b547898 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
@@ -209,10 +209,10 @@ public class AuthorizationManagerBean implements AuthorizationManagerLocal {
query.setParameter("parentResourceId", parentResourceId);
query.setParameter("resourceTypeId", resourceTypeId);
- query.setParameter("subject", -1);
+ query.setParameter("subjectId", -1);
long baseCount = (Long) query.getSingleResult();
- query.setParameter("subject", subject);
+ query.setParameter("subjectId", subject.getId());
long subjectCount = (Long) query.getSingleResult();
/*
13 years, 3 months
[rhq] Changes to 'release-3.0.0-patch1'
by John Sanda
New branch 'release-3.0.0-patch1' available with the following commits:
commit da4c70da6d11ec2a8f1a18dba5bdecd4e31337ee
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 25 13:53:10 2010 -0400
[BZ 627391] Fixing JPAQL query that checks autogroup access
13 years, 3 months
[rhq] 2 commits - modules/enterprise
by Greg Hinkle
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java | 4 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 10 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 5 -----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java | 6 +-----
4 files changed, 10 insertions(+), 15 deletions(-)
New commits:
commit 6415d67bc516e445ef5bbd3d77b6cc07e9e3a706
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Aug 26 13:22:16 2010 -0400
removed erroneous subtab destroy before display...
fixed detail view freezes
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 0b2037d..6c579ce 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -145,11 +145,13 @@ public class SubTabLayout extends LocatableVLayout {
}
public void updateSubTab(SubTab subTab) {
+
// Destroy old views so they don't leak
- Canvas oldCanvas = subTab.getCanvas();
- if (oldCanvas != null) {
- oldCanvas.destroy();
- }
+ // TODO: You've already leaked because the subtab has already had its canvas replaced.
+// Canvas oldCanvas = subTab.getCanvas();
+// if (oldCanvas != null) {
+// oldCanvas.destroy();
+// }
String locatorId = subTab.getLocatorId();
subtabs.put(locatorId, subTab);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index f6554ff..75c8f9a 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
@@ -113,11 +113,6 @@ public class ResourceDetailView extends LocatableVLayout implements Bookmarkable
public ResourceDetailView(String locatorId) {
super(locatorId);
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
setWidth100();
setHeight100();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
index 7882473..0476dd1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
@@ -41,15 +41,11 @@ public class ResourceTopView extends LocatableHLayout implements BookmarkableVie
public ResourceTopView(String locatorId) {
super(locatorId);
- }
-
- @Override
- protected void onInit() {
- super.onInit();
setWidth100();
setHeight100();
+
treeView = new ResourceTreeView(getLocatorId());
addMember(treeView);
commit 400668a5071d680d37d6161fead802a139bc2147
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Aug 25 10:57:55 2010 -0400
Fixed NPE in selector destory
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
index 0a46217..1617a2d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
@@ -271,7 +271,9 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
removeButton.destroy();
addAllButton.destroy();
removeAllButton.destroy();
- availableFilterForm.destroy();
+ if (availableFilterForm != null) {
+ availableFilterForm.destroy();
+ }
}
protected void updateButtons() {
13 years, 3 months
[rhq] 7 commits - modules/core modules/enterprise
by Simeon Pinder
modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationLastCompletedComposite.java | 64 +--
modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationScheduleComposite.java | 57 +-
modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationLastCompletedComposite.java | 58 +-
modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationScheduleComposite.java | 58 +-
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java | 35 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java | 21 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java | 122 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java | 97 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java | 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java | 208 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java | 175 ++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java | 183 ++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java | 97 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java | 87 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java | 50 ++
18 files changed, 1195 insertions(+), 147 deletions(-)
New commits:
commit 4472eb027f3bc43d08b8e061f4091dacf5c9711d
Merge: 98280b9... dd2948a...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Aug 26 12:08:55 2010 -0400
Operations and Problem Resources portlets. Needed to add default constructors of a few base classes for gwt serialization
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
index 76babb0,83af987..d9cefe5
--- 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
@@@ -289,15 -291,16 +291,17 @@@ public class DashboardsView extends Loc
public void renderView(ViewPath viewPath) {
if (!viewPath.isEnd()) {
selectedTab = viewPath.getCurrent().getPath();
- System.out.println("#################:" + selectedTab + ":tabset:" + tabSet);
- // if (tabSet != null) {
- for (Tab tab : tabSet.getTabs()) {
- // if (selectedTab.equals(tab.getTitle())) {
- if (tab.getTitle().equals(selectedTab)) {
- tabSet.selectTab(tab);
++
+ //added to avoid NPE in gwt debug window.
+ if (tabSet != null) {
+ for (Tab tab : tabSet.getTabs()) {
+ if (tab.getTitle().equals(selectedTab)) {
+ tabSet.selectTab(tab);
+ }
}
+ } else {
+ System.out.println("WARN: While rendering DashboardsView tabSet is null.");
}
- // }
}
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
index 0000000,502189a..438f870
mode 000000,100644..100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
@@@ -1,0 -1,112 +1,122 @@@
+ package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.operations;
+
+ /*
+ * 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.
+ */
+
+ import com.google.gwt.core.client.GWT;
+ import com.smartgwt.client.widgets.Canvas;
+ import com.smartgwt.client.widgets.HTMLFlow;
+ import com.smartgwt.client.widgets.form.DynamicForm;
+ import com.smartgwt.client.widgets.grid.HeaderSpan;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.layout.VLayout;
+
+ import org.rhq.core.domain.dashboard.DashboardPortlet;
+ import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+ import org.rhq.enterprise.gui.coregui.client.operation.RecentOperationsDataSource;
+ import org.rhq.enterprise.gui.coregui.client.operation.ScheduledOperationsDataSource;
++import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
++import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+ /**
+ * A view that displays a live table of completed Operations and scheduled operations.
+ *
+ * @author Simeon Pinder
+ */
-public class OperationsPortlet extends VLayout implements Portlet {
++public class OperationsPortlet extends LocatableVLayout implements Portlet {
+
+ public static final String KEY = "Operations";
+ private static final String TITLE = KEY;
+ private static String recentOperations = "Recent Operations";
+ private static String scheduledOperations = "Scheduled Operations";
+
- public OperationsPortlet() {
++ //no args for serialization
++ private OperationsPortlet() {
++ }
++
++ public OperationsPortlet(String locatorId) {
++ super(locatorId);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ //set title for larger container
+ setTitle(TITLE);
+
+ // Add the list table as the top half of the view.
- ListGrid recentOperationsGrid = new ListGrid();
++ LocatableListGrid recentOperationsGrid = new LocatableListGrid(recentOperations);
+ recentOperationsGrid.setDataSource(new RecentOperationsDataSource());
+ recentOperationsGrid.setAutoFetchData(true);
+ String[] allRows = new String[] { RecentOperationsDataSource.location, RecentOperationsDataSource.operation,
+ RecentOperationsDataSource.resource, RecentOperationsDataSource.status, RecentOperationsDataSource.time };
+ recentOperationsGrid.setHeaderSpans(new HeaderSpan(recentOperations, allRows));
+ recentOperationsGrid.setHeaderSpanHeight(new Integer(20));
+ recentOperationsGrid.setHeaderHeight(40);
+ recentOperationsGrid.setResizeFieldsInRealTime(true);
+ addMember(recentOperationsGrid);
+
+ // Add the list table as the top half of the view.
- ListGrid scheduledOperationsGrid = new ListGrid();
++ LocatableListGrid scheduledOperationsGrid = new LocatableListGrid(scheduledOperations);
+ scheduledOperationsGrid.setDataSource(new ScheduledOperationsDataSource());
+ scheduledOperationsGrid.setAutoFetchData(true);
+ String[] allRows2 = new String[] { ScheduledOperationsDataSource.location,
+ ScheduledOperationsDataSource.operation, ScheduledOperationsDataSource.resource,
+ ScheduledOperationsDataSource.time };
+ scheduledOperationsGrid.setHeaderSpans(new HeaderSpan(scheduledOperations, allRows2));
+ scheduledOperationsGrid.setHeaderSpanHeight(new Integer(20));
+ scheduledOperationsGrid.setHeaderHeight(40);
+
+ scheduledOperationsGrid.setTitle(scheduledOperations);
+ scheduledOperationsGrid.setResizeFieldsInRealTime(true);
+
+ addMember(scheduledOperationsGrid);
+
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ // TODO implement this.
+
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new HTMLFlow("This portlet displays both operations that have occurred and are scheduled to occur.");
+ }
+
+ public DynamicForm getCustomSettingsForm() {
+ return null;
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ public final Portlet getInstance() {
+ return GWT.create(OperationsPortlet.class);
+ }
++
++ public final Portlet getInstance(String locatorId) {
++ return new OperationsPortlet(locatorId);
++ }
++
+ }
+
+ }
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
index 0000000,ca5ce12..b2c9524
mode 000000,100644..100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
@@@ -1,0 -1,88 +1,97 @@@
+ package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.problems;
+
+ /*
+ * 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.
+ */
+
+ import com.google.gwt.core.client.GWT;
+ import com.smartgwt.client.types.Autofit;
+ import com.smartgwt.client.widgets.Canvas;
+ import com.smartgwt.client.widgets.HTMLFlow;
+ import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.layout.VLayout;
+
+ import org.rhq.core.domain.dashboard.DashboardPortlet;
+ import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+ import org.rhq.enterprise.gui.coregui.client.resource.ProblemResourcesDataSource;
++import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
++import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+ /**
+ * A view that displays a paginated table of Resoruces with alerts,
+ * and/or Resources reported unavailable.
+ *
+ * @author Simeon Pinder
+ */
-public class ProblemResourcesPortlet extends VLayout implements Portlet {
++public class ProblemResourcesPortlet extends LocatableVLayout implements Portlet {
+
+ public static final String KEY = "Has Alerts or Currently Unavailable";
+ private static final String TITLE = KEY;
+
- public ProblemResourcesPortlet() {
++ //no args constructor for serialization
++ private ProblemResourcesPortlet() {
++ }
++
++ public ProblemResourcesPortlet(String locatorId) {
++ super(locatorId);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ // Add the list table as the top half of the view.
- ListGrid listGrid = new ListGrid();
++ LocatableListGrid listGrid = new LocatableListGrid("Problem Resources");
+ listGrid.setDataSource(new ProblemResourcesDataSource());
+ listGrid.setAutoFetchData(true);
+ listGrid.setTitle(TITLE);
+ listGrid.setResizeFieldsInRealTime(true);
+ listGrid.setCellHeight(40);
+ listGrid.setAutoFitData(Autofit.BOTH);
+ addMember(listGrid);
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ // TODO implement this.
+
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new HTMLFlow("This portlet displays resources that have reported alerts or Down availability.");
+ }
+
+ public DynamicForm getCustomSettingsForm() {
+ return null;
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ public final Portlet getInstance() {
+ return GWT.create(ProblemResourcesPortlet.class);
+ }
++
++ public Portlet getInstance(String locatorId) {
++ return new ProblemResourcesPortlet(locatorId);
++ }
+ }
+
+ }
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
index 0000000,7995f46..b48b4c3
mode 000000,100644..100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
@@@ -1,0 -1,177 +1,208 @@@
+ package org.rhq.enterprise.gui.coregui.client.operation;
+
+ /*
+ * 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.
+ */
+ import java.util.Date;
+ import java.util.List;
+
+ import com.google.gwt.user.client.rpc.AsyncCallback;
+ import com.smartgwt.client.data.DSRequest;
+ import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.DataSource;
+ import com.smartgwt.client.data.Record;
+ import com.smartgwt.client.data.fields.DataSourceDateTimeField;
+ import com.smartgwt.client.data.fields.DataSourceTextField;
+ import com.smartgwt.client.types.DSDataFormat;
+ import com.smartgwt.client.types.DSProtocol;
+ import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+ import org.rhq.core.domain.criteria.ResourceCriteria;
+ import org.rhq.core.domain.operation.OperationRequestStatus;
+ import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
+ import org.rhq.core.domain.resource.composite.DisambiguationReport;
+ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+ import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
++import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+ /** Responsible for defining and populating the Smart GWT datasource details and
+ * translating the deserialized content into specific record entries for display
+ *
- * @author spinder
++ * @author Simeon Pinder
+ */
-public class RecentOperationsDataSource extends DataSource {
++public class RecentOperationsDataSource extends
++ RPCDataSource<DisambiguationReport<ResourceOperationLastCompletedComposite>> {
+ public static final String resource = "resource";
+ public static final String location = "location";
+ public static final String operation = "operation";
+ public static final String time = "time";
+ public static final String status = "status";
+
+ /** Build list of fields for the datasource and then adds them to it.
+ */
+ public RecentOperationsDataSource() {
+ setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ setDataFormat(DSDataFormat.CUSTOM);
+
+ DataSourceTextField resourceField = new DataSourceTextField(resource, "Resource");
+ resourceField.setPrimaryKey(true);
+
+ DataSourceTextField locationField = new DataSourceTextField(location, "Location", 200);
+
+ DataSourceTextField operationField = new DataSourceTextField(operation, "Operation");
+
+ DataSourceDateTimeField timeField = new DataSourceDateTimeField(time, "Date/Time");
+
+ // DataSourceImageField statusField = new DataSourceImageField(status, "Status");
+ DataSourceTextField statusField = new DataSourceTextField(status, "Status");
+
+ setFields(resourceField, locationField, operationField, timeField, statusField);
+ }
+
+ /* Intercept DSRequest object to pipe into custom fetch request.
+ * (non-Javadoc)
+ * @see com.smartgwt.client.data.DataSource#transformRequest(com.smartgwt.client.data.DSRequest)
+ */
+ protected Object transformRequest(DSRequest request) {
+ DSResponse response = new DSResponse();
+ response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
+ // Assume success
+ response.setStatus(0);
+ switch (request.getOperationType()) {
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
+ }
+
+ return request.getData();
+ }
+
+ /** Fetch the ProblemResource data, and populate the response object appropriately.
+ *
+ * @param request incoming request
+ * @param response outgoing response
+ */
+ public void executeFetch(final DSRequest request, final DSResponse response) {
+
+ ResourceCriteria c = new ResourceCriteria();
+ GWTServiceLookup.getOperationService().findRecentCompletedOperations(c,
+ new AsyncCallback<List<DisambiguationReport<ResourceOperationLastCompletedComposite>>>() {
+
+ public void onFailure(Throwable throwable) {
+ CoreGUI.getErrorHandler().handleError("Failed to load recently completed operations.", throwable);
+ }
+
+ public void onSuccess(
+ List<DisambiguationReport<ResourceOperationLastCompletedComposite>> recentOperationsList) {
+
+ //translate DisambiguationReport into dataset entries
+ response.setData(buildList(recentOperationsList));
+ //entry count
+ if (null != recentOperationsList) {
+ response.setTotalRows(recentOperationsList.size());
+ } else {
+ response.setTotalRows(0);
+ }
+ //pass off for processing
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ /** Translates the DisambiguationReport of ResourceOperationLastCompletedComposites into specific
+ * and ordered record values.
+ *
+ * @param list DisambiguationReport of entries.
+ * @return Record[] ordered record entries.
+ */
+ protected Record[] buildList(List<DisambiguationReport<ResourceOperationLastCompletedComposite>> list) {
+
+ ListGridRecord[] dataValues = null;
+ if (list != null) {
+ dataValues = new ListGridRecord[list.size()];
+ int indx = 0;
+
+ for (DisambiguationReport<ResourceOperationLastCompletedComposite> report : list) {
+ ListGridRecord record = new ListGridRecord();
+ //disambiguated Resource name, decorated with html anchors to problem resources
+ record.setAttribute(resource, ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
+ report.getResourceType(), report.getOriginal().getResourceName(), report.getOriginal()
+ .getResourceId()));
+ //disambiguated resource lineage, decorated with html anchors
+ record.setAttribute(location, ReportDecorator.decorateResourceLineage(report.getParents()));
+ //operation name.
+ record.setAttribute(operation, report.getOriginal().getOperationName());
+ //timestamp.
+ record.setAttribute(time, new Date(report.getOriginal().getOperationStartTime()));
- //populate status icon . /rhq/resource/operation/resourceOperationHistoryDetails-plain.xhtml?id=10001&opId=10001
- // String link = "<a href='" + ReportDecorator.GWT_RECENT_OPERATION_URL
- String link = "<a href='" + "/rhq/resource/operation/resourceOperationHistoryDetails-plain.xhtml?id="
- + report.getOriginal().getResourceId() + "&opId=" + report.getOriginal().getResourceId() + "'>";
- String img = "<img alt='" + report.getOriginal().getOperationStatus() + "' title='"
- + report.getOriginal().getOperationStatus() + "' src='/images/icons/";
- if (report.getOriginal().getOperationStatus().compareTo(OperationRequestStatus.SUCCESS) == 0) {
- img += "availability_green_16.png'";
- } else if (report.getOriginal().getOperationStatus().compareTo(OperationRequestStatus.FAILURE) == 0) {
- img += "availability_red_16.png";
- } else if (report.getOriginal().getOperationStatus().compareTo(OperationRequestStatus.CANCELED) == 0) {
- img += "availability_yellow_16.png";
- } else {
- img += "availability_grey_16.png";
- }
- link = link + img + "'></img></a>";
++ String link = generateResourceOperationStatusLink(report);
+ record.setAttribute(status, link);
+
+ dataValues[indx++] = record;
+ }
+ }
+ return dataValues;
+ }
++
++ /** Generates the ResourceOperationHistory status link from DisambiguationReport passed in.
++ *
++ * @param report
++ * @return html string for display in table.
++ */
++ private String generateResourceOperationStatusLink(
++ DisambiguationReport<ResourceOperationLastCompletedComposite> report) {
++ //TODO: refactor this out for more general case
++ String link = "<a href='" + "/rhq/resource/operation/resourceOperationHistoryDetails-plain.xhtml?id="
++ + report.getOriginal().getResourceId() + "&opId=" + report.getOriginal().getResourceId() + "'>";
++ String img = "<img alt='" + report.getOriginal().getOperationStatus() + "' title='"
++ + report.getOriginal().getOperationStatus() + "' src='/images/icons/";
++ if (report.getOriginal().getOperationStatus().compareTo(OperationRequestStatus.SUCCESS) == 0) {
++ img += "availability_green_16.png'";
++ } else if (report.getOriginal().getOperationStatus().compareTo(OperationRequestStatus.FAILURE) == 0) {
++ img += "availability_red_16.png";
++ } else if (report.getOriginal().getOperationStatus().compareTo(OperationRequestStatus.CANCELED) == 0) {
++ img += "availability_yellow_16.png";
++ } else {
++ img += "availability_grey_16.png";
++ }
++ link = link + img + "'></img></a>";
++ return link;
++ }
++
++ @Override
++ public DisambiguationReport<ResourceOperationLastCompletedComposite> copyValues(ListGridRecord from) {
++ throw new UnsupportedOperationException("ResourceOperations data is read only");
++ }
++
++ @Override
++ public ListGridRecord copyValues(DisambiguationReport<ResourceOperationLastCompletedComposite> from) {
++ ListGridRecord record = new ListGridRecord();
++ record.setAttribute(resource, ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL, from
++ .getResourceType(), from.getOriginal().getResourceName(), from.getOriginal().getResourceId()));
++ record.setAttribute(location, ReportDecorator.decorateResourceLineage(from.getParents()));
++ record.setAttribute(operation, from.getOriginal().getOperationName());
++ record.setAttribute(time, from.getOriginal().getOperationStartTime());
++ record.setAttribute(status, generateResourceOperationStatusLink(from));
++
++ record.setAttribute("entity", from);
++
++ return record;
++ }
+ }
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
index 0000000,a1fa3f4..22ec638
mode 000000,100644..100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
@@@ -1,0 -1,154 +1,175 @@@
+ package org.rhq.enterprise.gui.coregui.client.operation;
+
+ /*
+ * 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.
+ */
+ import java.util.Date;
+ import java.util.List;
+
+ import com.google.gwt.user.client.rpc.AsyncCallback;
+ import com.smartgwt.client.data.DSRequest;
+ import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.DataSource;
+ import com.smartgwt.client.data.Record;
+ import com.smartgwt.client.data.fields.DataSourceTextField;
+ import com.smartgwt.client.types.DSDataFormat;
+ import com.smartgwt.client.types.DSProtocol;
+ import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+ import org.rhq.core.domain.criteria.ResourceCriteria;
+ import org.rhq.core.domain.operation.composite.ResourceOperationScheduleComposite;
+ import org.rhq.core.domain.resource.composite.DisambiguationReport;
+ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+ import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
++import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+ /** Responsible for defining and populating the Smart GWT datasource details and
+ * translating the deserialized content into specific record entries for display
+ *
- * @author spinder
++ * @author Simeon Pinder
+ */
-public class ScheduledOperationsDataSource extends DataSource {
++public class ScheduledOperationsDataSource extends
++ RPCDataSource<DisambiguationReport<ResourceOperationScheduleComposite>> {
+ public static final String resource = "resource";
+ public static final String location = "location";
+ public static final String operation = "operation";
+ public static final String time = "time";
+
+ /** Build list of fields for the datasource and then adds them to it.
+ */
+ public ScheduledOperationsDataSource() {
+ setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ setDataFormat(DSDataFormat.CUSTOM);
+
+ DataSourceTextField resourceField = new DataSourceTextField(resource, "Resource");
+ resourceField.setPrimaryKey(true);
+
+ DataSourceTextField locationField = new DataSourceTextField(location, "Location");
+
+ DataSourceTextField operationField = new DataSourceTextField(operation, "Operation");
+
+ DataSourceTextField timeField = new DataSourceTextField(operation, "Date/Time");
+
+ setFields(resourceField, locationField, operationField, timeField);
+ }
+
+ /* Intercept DSRequest object to pipe into custom fetch request.
+ * (non-Javadoc)
+ * @see com.smartgwt.client.data.DataSource#transformRequest(com.smartgwt.client.data.DSRequest)
+ */
+ protected Object transformRequest(DSRequest request) {
+ DSResponse response = new DSResponse();
+ response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
+ // Assume success
+ response.setStatus(0);
+ switch (request.getOperationType()) {
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
+ }
+
+ return request.getData();
+ }
+
+ /** Fetch the ProblemResource data, and populate the response object appropriately.
+ *
+ * @param request incoming request
+ * @param response outgoing response
+ */
+ public void executeFetch(final DSRequest request, final DSResponse response) {
+
+ ResourceCriteria c = new ResourceCriteria();
+ GWTServiceLookup.getOperationService().findScheduledOperations(c,
+ new AsyncCallback<List<DisambiguationReport<ResourceOperationScheduleComposite>>>() {
+
+ public void onFailure(Throwable throwable) {
+ CoreGUI.getErrorHandler().handleError("Failed to load scheduled operations.", throwable);
+ }
+
+ public void onSuccess(List<DisambiguationReport<ResourceOperationScheduleComposite>> scheduledOpsList) {
+
+ //translate DisambiguationReport into dataset entries
+ response.setData(buildList(scheduledOpsList));
+ //entry count
+ if (null != scheduledOpsList) {
+ response.setTotalRows(scheduledOpsList.size());
+ } else {
+ response.setTotalRows(0);
+ }
+ //pass off for processing
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ /** Translates the DisambiguationReport of ProblemResourceComposites into specific
+ * and ordered record values.
+ *
+ * @param list DisambiguationReport of entries.
+ * @return Record[] ordered record entries.
+ */
+ protected Record[] buildList(List<DisambiguationReport<ResourceOperationScheduleComposite>> list) {
+
+ ListGridRecord[] dataValues = null;
+ if (list != null) {
+ dataValues = new ListGridRecord[list.size()];
+ int indx = 0;
+
+ for (DisambiguationReport<ResourceOperationScheduleComposite> report : list) {
+ ListGridRecord record = new ListGridRecord();
+
+ //disambiguated Resource name, decorated with html anchors to problem resources
+ record.setAttribute(resource, ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
+ report.getResourceType(), report.getOriginal().getResourceName(), report.getOriginal()
+ .getResourceId()));
+ //disambiguated resource lineage, decorated with html anchors
+ record.setAttribute(location, ReportDecorator.decorateResourceLineage(report.getParents()));
+ //operation name.
+ record.setAttribute(operation, report.getOriginal().getOperationName());
+ //timestamp.
+ record.setAttribute(time, new Date(report.getOriginal().getOperationNextFireTime()));
+
+ dataValues[indx++] = record;
+ }
+ }
+ return dataValues;
+ }
++
++ @Override
++ public DisambiguationReport<ResourceOperationScheduleComposite> copyValues(ListGridRecord from) {
++ throw new UnsupportedOperationException("ResourceOperations data is read only");
++ }
++
++ @Override
++ public ListGridRecord copyValues(DisambiguationReport<ResourceOperationScheduleComposite> from) {
++ ListGridRecord record = new ListGridRecord();
++ record.setAttribute(resource, ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL, from
++ .getResourceType(), from.getOriginal().getResourceName(), from.getOriginal().getResourceId()));
++ record.setAttribute(location, ReportDecorator.decorateResourceLineage(from.getParents()));
++ record.setAttribute(operation, from.getOriginal().getOperationName());
++ record.setAttribute(time, from.getOriginal().getOperationNextFireTime());
++
++ record.setAttribute("entity", from);
++
++ return record;
++
++ }
+ }
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
index 1d5c079,387314a..5f2b5ee
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
@@@ -1,13 -1,31 +1,31 @@@
package org.rhq.enterprise.gui.coregui.client.resource;
- import java.util.ArrayList;
+ /*
+ * 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.
+ */
++
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
--import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.Record;
+ import com.smartgwt.client.data.fields.DataSourceImageField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
@@@ -18,12 -37,18 +37,19 @@@ import org.rhq.core.domain.resource.com
import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-
- public class ProblemResourcesDataSource extends DataSource {
- public final String resource = "resource";
- public final String location = "location";
- public final String alerts = "alerts";
- public final String available = "available";
+ import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
++import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+ /** Responsible for defining and populating the Smart GWT datasource details and
+ * translating the deserialized content into specific record entries for display
+ *
- * @author spinder
++ * @author Simeon Pinder
+ */
-public class ProblemResourcesDataSource extends DataSource {
++public class ProblemResourcesDataSource extends RPCDataSource<DisambiguationReport<ProblemResourceComposite>> {
+ public static final String resource = "resource";
+ public static final String location = "location";
+ public static final String alerts = "alerts";
+ public static final String available = "available";
/** Build list of fields for the datasource and then adds them to it.
*/
@@@ -72,30 -97,25 +98,26 @@@
public void executeFetch(final DSRequest request, final DSResponse response) {
ResourceCriteria c = new ResourceCriteria();
- c.addFilterCurrentAvailability(AvailabilityType.DOWN);
+
- // GWTServiceLookup.getResourceService().findRecentlyAddedResources(0, 100,
GWTServiceLookup.getResourceService().findProblemResources(c,
- // new AsyncCallback<List<RecentlyAddedResourceComposite>>() {
- new AsyncCallback<List<ProblemResourceComposite>>() {
+ new AsyncCallback<List<DisambiguationReport<ProblemResourceComposite>>>() {
+
public void onFailure(Throwable throwable) {
- CoreGUI.getErrorHandler().handleError("Failed to load unavailable resources", throwable);
+ CoreGUI.getErrorHandler().handleError("Failed to load resources with alerts/unavailability.",
+ throwable);
}
- // public void onSuccess(List<RecentlyAddedResourceComposite> recentlyAddedList) {
- public void onSuccess(List<ProblemResourceComposite> problemResourcesList) {
- // List<RecentlyAddedResourceComposite> list = new ArrayList<RecentlyAddedResourceComposite>();
- List<ProblemResourceComposite> list = new ArrayList<ProblemResourceComposite>();
+ public void onSuccess(List<DisambiguationReport<ProblemResourceComposite>> problemResourcesList) {
- // for (RecentlyAddedResourceComposite recentlyAdded : problemResourcesList) {
- for (ProblemResourceComposite problemResource : problemResourcesList) {
- list.add(problemResource);
- // list.addAll(problemResource.getChildren());
+ //translate DisambiguationReport into dataset entries
+ response.setData(buildList(problemResourcesList));
+ //entry count
+ if (null != problemResourcesList) {
+ response.setTotalRows(problemResourcesList.size());
+ } else {
+ response.setTotalRows(0);
}
-
- // response.setData(buildNodes(list));
- response.setData(buildList(list));
- response.setTotalRows(list.size());
+ //pass off for processing
processResponse(request.getRequestId(), response);
}
});
@@@ -141,5 -156,4 +158,26 @@@
}
return dataValues;
}
+
++ @Override
++ public ListGridRecord copyValues(DisambiguationReport<ProblemResourceComposite> from) {
++ ListGridRecord record = new ListGridRecord();
++ record.setAttribute(resource, ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL, from
++ .getResourceType(), from.getOriginal().getResourceName(), from.getOriginal().getResourceId()));
++ record.setAttribute(location, ReportDecorator.decorateResourceLineage(from.getParents()));
++ record.setAttribute(alerts, from.getOriginal().getNumAlerts());
++ if (from.getOriginal().getAvailabilityType().compareTo(AvailabilityType.DOWN) == 0) {
++ record.setAttribute(available, "/images/icons/availability_red_16.png");
++ } else {
++ record.setAttribute(available, "/images/icons/availability_green_16.png");
++ }
++
++ record.setAttribute("entity", from);
++ return record;
++ }
++
++ @Override
++ public DisambiguationReport<ProblemResourceComposite> copyValues(ListGridRecord from) {
++ throw new UnsupportedOperationException("ProblemResource data is read only");
++ }
}
commit 98280b9a2d8be10061d9a0f00c70c8b9f745f4bf
Merge: 94f59f5... 2817b52...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Aug 26 08:41:06 2010 -0400
Merge branch 'master' of ssh://spinder@git.fedorahosted.org/git/rhq/rhq
commit dd2948a07d2b5674159eb6bfc42dff009a4cac85
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Aug 26 08:36:35 2010 -0400
added OpererationsPortlet and modified composites for serialization.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationLastCompletedComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationLastCompletedComposite.java
index f6fb61e..4722f6a 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationLastCompletedComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationLastCompletedComposite.java
@@ -1,40 +1,48 @@
- /*
- * 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, 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.
- */
+/*
+ * 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, 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.operation.composite;
+import java.io.Serializable;
+
import org.rhq.core.domain.operation.OperationHistory;
import org.rhq.core.domain.operation.OperationRequestStatus;
-import java.io.Serializable;
-
public abstract class OperationLastCompletedComposite implements Serializable {
private static final long serialVersionUID = 1L;
- private final int operationHistoryId;
- private final String operationName;
- private final long operationStartTime;
- private final OperationRequestStatus operationStatus;
+ private int operationHistoryId;
+ private String operationName;
+ private long operationStartTime;
+ private OperationRequestStatus operationStatus;
+
+ //default no args constructor for java bean/serialization. Not to be used.
+ protected OperationLastCompletedComposite() {
+ this.operationHistoryId = 0;
+ this.operationName = "(unitialized)";
+ this.operationStartTime = -1;
+ this.operationStatus = OperationRequestStatus.FAILURE;
+ }
public OperationLastCompletedComposite(int operationHistoryId, String operationName, long operationStartTime,
OperationRequestStatus operationStatus) {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationScheduleComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationScheduleComposite.java
index 708ed11..dc99113 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationScheduleComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/OperationScheduleComposite.java
@@ -1,29 +1,29 @@
- /*
- * 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, 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.
- */
+/*
+ * 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, 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.operation.composite;
-import java.util.Date;
import java.io.Serializable;
+import java.util.Date;
import org.rhq.core.domain.operation.ScheduleJobId;
@@ -31,9 +31,16 @@ public abstract class OperationScheduleComposite implements Serializable {
private static final long serialVersionUID = 1L;
- private final ScheduleJobId operationJobId;
+ private ScheduleJobId operationJobId;
private String operationName;
- private final long operationNextFireTime;
+ private long operationNextFireTime;
+
+ //no args constructor for serialization purposes not to be used.
+ protected OperationScheduleComposite() {
+ this.operationNextFireTime = -1;
+ this.operationJobId = null;
+ this.operationName = "(uninitialized)";
+ }
public OperationScheduleComposite(ScheduleJobId operationJobId, String operationName, long operationNextFireTime) {
this.operationJobId = operationJobId;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationLastCompletedComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationLastCompletedComposite.java
index 95d13cf..5add81b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationLastCompletedComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationLastCompletedComposite.java
@@ -1,33 +1,41 @@
- /*
- * 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, 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.
- */
+/*
+ * 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, 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.operation.composite;
import org.rhq.core.domain.operation.OperationRequestStatus;
public class ResourceOperationLastCompletedComposite extends OperationLastCompletedComposite {
- private final int resourceId;
- private final String resourceName;
- private final String resourceTypeName;
+ private int resourceId;
+ private String resourceName;
+ private String resourceTypeName;
+
+ //no args constructor. Not to be used. java bean/serialization requirement
+ private ResourceOperationLastCompletedComposite() {
+ super();
+ this.resourceTypeName = "(unitialized type)";
+ this.resourceName = "(unitialized)";
+ this.resourceId = 0;
+ }
public ResourceOperationLastCompletedComposite(int operationId, String operationName, long operationStartTime,
OperationRequestStatus operationStatus, int resourceId, String resourceName, String resourceTypeName) {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationScheduleComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationScheduleComposite.java
index 99e45b6..4185035 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationScheduleComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/composite/ResourceOperationScheduleComposite.java
@@ -1,33 +1,41 @@
- /*
- * 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, 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.
- */
+/*
+ * 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, 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.operation.composite;
import org.rhq.core.domain.operation.ScheduleJobId;
public class ResourceOperationScheduleComposite extends OperationScheduleComposite {
- private final int resourceId;
- private final String resourceName;
- private final String resourceTypeName;
+ private int resourceId;
+ private String resourceName;
+ private String resourceTypeName;
+
+ //private no args constructor for serialization. Not to be used.
+ private ResourceOperationScheduleComposite() {
+ super();
+ this.resourceTypeName = "(unitialized type)";
+ this.resourceName = "(uninitialized)";
+ this.resourceId = 0;
+ }
public ResourceOperationScheduleComposite(String jobName, String jobGroup, String operationName,
long operationNextFireTime, int resourceId, String resourceName, String resourceTypeName) {
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 d4deaca..83af987 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
@@ -48,9 +48,10 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.ProblemResourcesPortlet;
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.recent.operations.OperationsPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.problems.ProblemResourcesPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.InventorySummaryView;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.TagCloudPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MashupPortlet;
@@ -225,12 +226,12 @@ public class DashboardsView extends VLayout implements BookmarkableView {
DashboardPortlet recentlyAdded = new DashboardPortlet("Recently Added Resources", RecentlyAddedView.KEY, 250);
dashboard.addPortlet(recentlyAdded, 1, 4);
- // DashboardPortlet operations = new DashboardPortlet("Operations", RecentlyAddedView.KEY, 250);
- // dashboard.addPortlet(operations, 1, 5);
+ DashboardPortlet operations = new DashboardPortlet("Operations", OperationsPortlet.KEY, 250);
+ dashboard.addPortlet(operations, 1, 5);
DashboardPortlet hasAlertsCurrentlyUnavailable = new DashboardPortlet("Has Alerts or Currently Unavailable",
ProblemResourcesPortlet.KEY, 250);
- dashboard.addPortlet(hasAlertsCurrentlyUnavailable, 1, 5);
+ dashboard.addPortlet(hasAlertsCurrentlyUnavailable, 1, 6);
return dashboard;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
index a676bae..cb87235 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
@@ -32,8 +32,9 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resour
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.alerts.ProblemResourcesPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.imported.RecentlyAddedView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.operations.OperationsPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.problems.ProblemResourcesPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.InventorySummaryView;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.TagCloudPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MashupPortlet;
@@ -66,6 +67,7 @@ public class PortletFactory {
registeredPortlets.put(MashupPortlet.KEY, MashupPortlet.Factory.INSTANCE);
registeredPortlets.put(MessagePortlet.KEY, MessagePortlet.Factory.INSTANCE);
registeredPortlets.put(ProblemResourcesPortlet.KEY, ProblemResourcesPortlet.Factory.INSTANCE);
+ registeredPortlets.put(OperationsPortlet.KEY, OperationsPortlet.Factory.INSTANCE);
}
public static Portlet buildPortlet(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/ProblemResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/ProblemResourcesPortlet.java
deleted file mode 100644
index 2d7ad0e..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/ProblemResourcesPortlet.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts;
-
-/*
- * 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.
- */
-
-import com.google.gwt.core.client.GWT;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import org.rhq.core.domain.dashboard.DashboardPortlet;
-import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
-import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
-import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
-import org.rhq.enterprise.gui.coregui.client.resource.ProblemResourcesDataSource;
-
-/**
- * A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s,
- * and Resources reported unavailable.
- *
- * @author Simeon Pinder
- */
-public class ProblemResourcesPortlet extends VLayout implements Portlet {
-
- public static final String KEY = "Has Alerts or Currently Unavailable";
- private static final String TITLE = KEY;
-
- public ProblemResourcesPortlet() {
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- // Add the list table as the top half of the view.
- ListGrid listGrid = new ListGrid();
- listGrid.setDataSource(new ProblemResourcesDataSource());
- listGrid.setAutoFetchData(true);
- listGrid.setTitle(TITLE);
- listGrid.setResizeFieldsInRealTime(true);
- addMember(listGrid);
- }
-
- @Override
- public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- // TODO implement this.
-
- }
-
- @Override
- public Canvas getHelpCanvas() {
- return new HTMLFlow("This portlet displays resources that have reported alerts or Down availability.");
- }
-
- public DynamicForm getCustomSettingsForm() {
- return null;
- }
-
- public static final class Factory implements PortletViewFactory {
- public static PortletViewFactory INSTANCE = new Factory();
-
- public final Portlet getInstance() {
- return GWT.create(ProblemResourcesPortlet.class);
- }
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
new file mode 100644
index 0000000..502189a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
@@ -0,0 +1,112 @@
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.operations;
+
+/*
+ * 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.
+ */
+
+import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.grid.HeaderSpan;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.operation.RecentOperationsDataSource;
+import org.rhq.enterprise.gui.coregui.client.operation.ScheduledOperationsDataSource;
+
+/**
+ * A view that displays a live table of completed Operations and scheduled operations.
+ *
+ * @author Simeon Pinder
+ */
+public class OperationsPortlet extends VLayout implements Portlet {
+
+ public static final String KEY = "Operations";
+ private static final String TITLE = KEY;
+ private static String recentOperations = "Recent Operations";
+ private static String scheduledOperations = "Scheduled Operations";
+
+ public OperationsPortlet() {
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ //set title for larger container
+ setTitle(TITLE);
+
+ // Add the list table as the top half of the view.
+ ListGrid recentOperationsGrid = new ListGrid();
+ recentOperationsGrid.setDataSource(new RecentOperationsDataSource());
+ recentOperationsGrid.setAutoFetchData(true);
+ String[] allRows = new String[] { RecentOperationsDataSource.location, RecentOperationsDataSource.operation,
+ RecentOperationsDataSource.resource, RecentOperationsDataSource.status, RecentOperationsDataSource.time };
+ recentOperationsGrid.setHeaderSpans(new HeaderSpan(recentOperations, allRows));
+ recentOperationsGrid.setHeaderSpanHeight(new Integer(20));
+ recentOperationsGrid.setHeaderHeight(40);
+ recentOperationsGrid.setResizeFieldsInRealTime(true);
+ addMember(recentOperationsGrid);
+
+ // Add the list table as the top half of the view.
+ ListGrid scheduledOperationsGrid = new ListGrid();
+ scheduledOperationsGrid.setDataSource(new ScheduledOperationsDataSource());
+ scheduledOperationsGrid.setAutoFetchData(true);
+ String[] allRows2 = new String[] { ScheduledOperationsDataSource.location,
+ ScheduledOperationsDataSource.operation, ScheduledOperationsDataSource.resource,
+ ScheduledOperationsDataSource.time };
+ scheduledOperationsGrid.setHeaderSpans(new HeaderSpan(scheduledOperations, allRows2));
+ scheduledOperationsGrid.setHeaderSpanHeight(new Integer(20));
+ scheduledOperationsGrid.setHeaderHeight(40);
+
+ scheduledOperationsGrid.setTitle(scheduledOperations);
+ scheduledOperationsGrid.setResizeFieldsInRealTime(true);
+
+ addMember(scheduledOperationsGrid);
+
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ // TODO implement this.
+
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new HTMLFlow("This portlet displays both operations that have occurred and are scheduled to occur.");
+ }
+
+ public DynamicForm getCustomSettingsForm() {
+ return null;
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ public final Portlet getInstance() {
+ return GWT.create(OperationsPortlet.class);
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/ScheduledOperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/ScheduledOperationsPortlet.java
new file mode 100644
index 0000000..ab24763
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/ScheduledOperationsPortlet.java
@@ -0,0 +1,87 @@
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.operations;
+
+/*
+ * 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.
+ */
+
+import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.types.GroupStartOpen;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.operation.RecentOperationsDataSource;
+
+/**
+ * A view that displays a live table of completed Operations and scheduled operations.
+ *
+ * @author Simeon Pinder
+ */
+public class ScheduledOperationsPortlet extends VLayout implements Portlet {
+
+ public static final String KEY = "Operations";
+ private static final String TITLE = KEY;
+
+ public ScheduledOperationsPortlet() {
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ // Add the list table as the top half of the view.
+ ListGrid listGrid = new ListGrid();
+ listGrid.setDataSource(new RecentOperationsDataSource());
+ listGrid.setGroupStartOpen(GroupStartOpen.ALL);
+ listGrid.setGroupByField("continent");
+ listGrid.setAutoFetchData(true);
+ listGrid.setTitle(TITLE);
+ listGrid.setResizeFieldsInRealTime(true);
+ addMember(listGrid);
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ // TODO implement this.
+
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new HTMLFlow("This portlet displays both operations that have occurred and are scheduled to occur.");
+ }
+
+ public DynamicForm getCustomSettingsForm() {
+ return null;
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ public final Portlet getInstance() {
+ return GWT.create(ScheduledOperationsPortlet.class);
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
new file mode 100644
index 0000000..ca5ce12
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
@@ -0,0 +1,88 @@
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.problems;
+
+/*
+ * 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.
+ */
+
+import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.types.Autofit;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.resource.ProblemResourcesDataSource;
+
+/**
+ * A view that displays a paginated table of Resoruces with alerts,
+ * and/or Resources reported unavailable.
+ *
+ * @author Simeon Pinder
+ */
+public class ProblemResourcesPortlet extends VLayout implements Portlet {
+
+ public static final String KEY = "Has Alerts or Currently Unavailable";
+ private static final String TITLE = KEY;
+
+ public ProblemResourcesPortlet() {
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ // Add the list table as the top half of the view.
+ ListGrid listGrid = new ListGrid();
+ listGrid.setDataSource(new ProblemResourcesDataSource());
+ listGrid.setAutoFetchData(true);
+ listGrid.setTitle(TITLE);
+ listGrid.setResizeFieldsInRealTime(true);
+ listGrid.setCellHeight(40);
+ listGrid.setAutoFitData(Autofit.BOTH);
+ addMember(listGrid);
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ // TODO implement this.
+
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new HTMLFlow("This portlet displays resources that have reported alerts or Down availability.");
+ }
+
+ public DynamicForm getCustomSettingsForm() {
+ return null;
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ public final Portlet getInstance() {
+ return GWT.create(ProblemResourcesPortlet.class);
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
index 2ba537f..72f2fb9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
@@ -18,13 +18,19 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
+import java.util.List;
+
import com.google.gwt.user.client.rpc.RemoteService;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
+import org.rhq.core.domain.operation.composite.ResourceOperationScheduleComposite;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.ExecutionSchedule;
@@ -33,13 +39,17 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation
*/
public interface OperationGWTService extends RemoteService {
-
- PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(ResourceOperationHistoryCriteria criteria);
+ PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(
+ ResourceOperationHistoryCriteria criteria);
PageList<GroupOperationHistory> findGroupOperationHistoriesByCriteria(GroupOperationHistoryCriteria criteria);
- void scheduleResourceOperation(
- int resourceId, String operationName, Configuration parameters, ExecutionSchedule schedule, String description, int timeout)
- throws RuntimeException;
+ List<DisambiguationReport<ResourceOperationLastCompletedComposite>> findRecentCompletedOperations(
+ ResourceCriteria criteria);
+
+ List<DisambiguationReport<ResourceOperationScheduleComposite>> findScheduledOperations(ResourceCriteria criteria);
+
+ void scheduleResourceOperation(int resourceId, String operationName, Configuration parameters,
+ ExecutionSchedule schedule, String description, int timeout) throws RuntimeException;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
new file mode 100644
index 0000000..7995f46
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
@@ -0,0 +1,177 @@
+package org.rhq.enterprise.gui.coregui.client.operation;
+
+/*
+ * 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.
+ */
+import java.util.Date;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.fields.DataSourceDateTimeField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.DSDataFormat;
+import com.smartgwt.client.types.DSProtocol;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.operation.OperationRequestStatus;
+import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+
+/** Responsible for defining and populating the Smart GWT datasource details and
+ * translating the deserialized content into specific record entries for display
+ *
+ * @author spinder
+ */
+public class RecentOperationsDataSource extends DataSource {
+ public static final String resource = "resource";
+ public static final String location = "location";
+ public static final String operation = "operation";
+ public static final String time = "time";
+ public static final String status = "status";
+
+ /** Build list of fields for the datasource and then adds them to it.
+ */
+ public RecentOperationsDataSource() {
+ setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ setDataFormat(DSDataFormat.CUSTOM);
+
+ DataSourceTextField resourceField = new DataSourceTextField(resource, "Resource");
+ resourceField.setPrimaryKey(true);
+
+ DataSourceTextField locationField = new DataSourceTextField(location, "Location", 200);
+
+ DataSourceTextField operationField = new DataSourceTextField(operation, "Operation");
+
+ DataSourceDateTimeField timeField = new DataSourceDateTimeField(time, "Date/Time");
+
+ // DataSourceImageField statusField = new DataSourceImageField(status, "Status");
+ DataSourceTextField statusField = new DataSourceTextField(status, "Status");
+
+ setFields(resourceField, locationField, operationField, timeField, statusField);
+ }
+
+ /* Intercept DSRequest object to pipe into custom fetch request.
+ * (non-Javadoc)
+ * @see com.smartgwt.client.data.DataSource#transformRequest(com.smartgwt.client.data.DSRequest)
+ */
+ protected Object transformRequest(DSRequest request) {
+ DSResponse response = new DSResponse();
+ response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
+ // Assume success
+ response.setStatus(0);
+ switch (request.getOperationType()) {
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
+ }
+
+ return request.getData();
+ }
+
+ /** Fetch the ProblemResource data, and populate the response object appropriately.
+ *
+ * @param request incoming request
+ * @param response outgoing response
+ */
+ public void executeFetch(final DSRequest request, final DSResponse response) {
+
+ ResourceCriteria c = new ResourceCriteria();
+ GWTServiceLookup.getOperationService().findRecentCompletedOperations(c,
+ new AsyncCallback<List<DisambiguationReport<ResourceOperationLastCompletedComposite>>>() {
+
+ public void onFailure(Throwable throwable) {
+ CoreGUI.getErrorHandler().handleError("Failed to load recently completed operations.", throwable);
+ }
+
+ public void onSuccess(
+ List<DisambiguationReport<ResourceOperationLastCompletedComposite>> recentOperationsList) {
+
+ //translate DisambiguationReport into dataset entries
+ response.setData(buildList(recentOperationsList));
+ //entry count
+ if (null != recentOperationsList) {
+ response.setTotalRows(recentOperationsList.size());
+ } else {
+ response.setTotalRows(0);
+ }
+ //pass off for processing
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ /** Translates the DisambiguationReport of ResourceOperationLastCompletedComposites into specific
+ * and ordered record values.
+ *
+ * @param list DisambiguationReport of entries.
+ * @return Record[] ordered record entries.
+ */
+ protected Record[] buildList(List<DisambiguationReport<ResourceOperationLastCompletedComposite>> list) {
+
+ ListGridRecord[] dataValues = null;
+ if (list != null) {
+ dataValues = new ListGridRecord[list.size()];
+ int indx = 0;
+
+ for (DisambiguationReport<ResourceOperationLastCompletedComposite> report : list) {
+ ListGridRecord record = new ListGridRecord();
+ //disambiguated Resource name, decorated with html anchors to problem resources
+ record.setAttribute(resource, ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
+ report.getResourceType(), report.getOriginal().getResourceName(), report.getOriginal()
+ .getResourceId()));
+ //disambiguated resource lineage, decorated with html anchors
+ record.setAttribute(location, ReportDecorator.decorateResourceLineage(report.getParents()));
+ //operation name.
+ record.setAttribute(operation, report.getOriginal().getOperationName());
+ //timestamp.
+ record.setAttribute(time, new Date(report.getOriginal().getOperationStartTime()));
+ //populate status icon . /rhq/resource/operation/resourceOperationHistoryDetails-plain.xhtml?id=10001&opId=10001
+ // String link = "<a href='" + ReportDecorator.GWT_RECENT_OPERATION_URL
+ String link = "<a href='" + "/rhq/resource/operation/resourceOperationHistoryDetails-plain.xhtml?id="
+ + report.getOriginal().getResourceId() + "&opId=" + report.getOriginal().getResourceId() + "'>";
+ String img = "<img alt='" + report.getOriginal().getOperationStatus() + "' title='"
+ + report.getOriginal().getOperationStatus() + "' src='/images/icons/";
+ if (report.getOriginal().getOperationStatus().compareTo(OperationRequestStatus.SUCCESS) == 0) {
+ img += "availability_green_16.png'";
+ } else if (report.getOriginal().getOperationStatus().compareTo(OperationRequestStatus.FAILURE) == 0) {
+ img += "availability_red_16.png";
+ } else if (report.getOriginal().getOperationStatus().compareTo(OperationRequestStatus.CANCELED) == 0) {
+ img += "availability_yellow_16.png";
+ } else {
+ img += "availability_grey_16.png";
+ }
+ link = link + img + "'></img></a>";
+ record.setAttribute(status, link);
+
+ dataValues[indx++] = record;
+ }
+ }
+ return dataValues;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
new file mode 100644
index 0000000..a1fa3f4
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
@@ -0,0 +1,154 @@
+package org.rhq.enterprise.gui.coregui.client.operation;
+
+/*
+ * 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.
+ */
+import java.util.Date;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.DSDataFormat;
+import com.smartgwt.client.types.DSProtocol;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.operation.composite.ResourceOperationScheduleComposite;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+
+/** Responsible for defining and populating the Smart GWT datasource details and
+ * translating the deserialized content into specific record entries for display
+ *
+ * @author spinder
+ */
+public class ScheduledOperationsDataSource extends DataSource {
+ public static final String resource = "resource";
+ public static final String location = "location";
+ public static final String operation = "operation";
+ public static final String time = "time";
+
+ /** Build list of fields for the datasource and then adds them to it.
+ */
+ public ScheduledOperationsDataSource() {
+ setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ setDataFormat(DSDataFormat.CUSTOM);
+
+ DataSourceTextField resourceField = new DataSourceTextField(resource, "Resource");
+ resourceField.setPrimaryKey(true);
+
+ DataSourceTextField locationField = new DataSourceTextField(location, "Location");
+
+ DataSourceTextField operationField = new DataSourceTextField(operation, "Operation");
+
+ DataSourceTextField timeField = new DataSourceTextField(operation, "Date/Time");
+
+ setFields(resourceField, locationField, operationField, timeField);
+ }
+
+ /* Intercept DSRequest object to pipe into custom fetch request.
+ * (non-Javadoc)
+ * @see com.smartgwt.client.data.DataSource#transformRequest(com.smartgwt.client.data.DSRequest)
+ */
+ protected Object transformRequest(DSRequest request) {
+ DSResponse response = new DSResponse();
+ response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
+ // Assume success
+ response.setStatus(0);
+ switch (request.getOperationType()) {
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
+ }
+
+ return request.getData();
+ }
+
+ /** Fetch the ProblemResource data, and populate the response object appropriately.
+ *
+ * @param request incoming request
+ * @param response outgoing response
+ */
+ public void executeFetch(final DSRequest request, final DSResponse response) {
+
+ ResourceCriteria c = new ResourceCriteria();
+ GWTServiceLookup.getOperationService().findScheduledOperations(c,
+ new AsyncCallback<List<DisambiguationReport<ResourceOperationScheduleComposite>>>() {
+
+ public void onFailure(Throwable throwable) {
+ CoreGUI.getErrorHandler().handleError("Failed to load scheduled operations.", throwable);
+ }
+
+ public void onSuccess(List<DisambiguationReport<ResourceOperationScheduleComposite>> scheduledOpsList) {
+
+ //translate DisambiguationReport into dataset entries
+ response.setData(buildList(scheduledOpsList));
+ //entry count
+ if (null != scheduledOpsList) {
+ response.setTotalRows(scheduledOpsList.size());
+ } else {
+ response.setTotalRows(0);
+ }
+ //pass off for processing
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ /** Translates the DisambiguationReport of ProblemResourceComposites into specific
+ * and ordered record values.
+ *
+ * @param list DisambiguationReport of entries.
+ * @return Record[] ordered record entries.
+ */
+ protected Record[] buildList(List<DisambiguationReport<ResourceOperationScheduleComposite>> list) {
+
+ ListGridRecord[] dataValues = null;
+ if (list != null) {
+ dataValues = new ListGridRecord[list.size()];
+ int indx = 0;
+
+ for (DisambiguationReport<ResourceOperationScheduleComposite> report : list) {
+ ListGridRecord record = new ListGridRecord();
+
+ //disambiguated Resource name, decorated with html anchors to problem resources
+ record.setAttribute(resource, ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
+ report.getResourceType(), report.getOriginal().getResourceName(), report.getOriginal()
+ .getResourceId()));
+ //disambiguated resource lineage, decorated with html anchors
+ record.setAttribute(location, ReportDecorator.decorateResourceLineage(report.getParents()));
+ //operation name.
+ record.setAttribute(operation, report.getOriginal().getOperationName());
+ //timestamp.
+ record.setAttribute(time, new Date(report.getOriginal().getOperationNextFireTime()));
+
+ dataValues[indx++] = record;
+ }
+ }
+ return dataValues;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
index ccc620a..387314a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
@@ -137,8 +137,9 @@ public class ProblemResourcesDataSource extends DataSource {
for (DisambiguationReport<ProblemResourceComposite> report : list) {
ListGridRecord record = new ListGridRecord();
//disambiguated Resource name, decorated with html anchors to problem resources
- record.setAttribute(resource, ReportDecorator.decorateResourceName(report.getResourceType(), report
- .getOriginal().getResourceName(), report.getOriginal().getResourceId()));
+ record.setAttribute(resource, ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
+ report.getResourceType(), report.getOriginal().getResourceName(), report.getOriginal()
+ .getResourceId()));
//disambiguated resource lineage, decorated with html anchors
record.setAttribute(location, ReportDecorator.decorateResourceLineage(report.getParents()));
//alert cnt.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
index ff50f1f..d2c7a4a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
@@ -19,6 +19,7 @@ public class ReportDecorator {
//TODO: pull value from more bookmarking/history definition
public final static String GWT_RESOURCE_URL = "/coregui/CoreGUI.html#Resource/";
+ public final static String GWT_RECENT_OPERATION_URL = "/coregui/CoreGUI.html#Operation/";
public static final String DEFAULT_SEPARATOR = " > ";
/** Generates HTML label from DisambiguationReport data.
@@ -28,12 +29,13 @@ public class ReportDecorator {
* @param resourceId Id for resource
* @return String of generated html for a ResourceName.
*/
- public static String decorateResourceName(ResourceType type, String resourceName, int resourceId) {
+ public static String decorateResourceName(String specificUrl, ResourceType type, String resourceName, int resourceId) {
String decorated = "";
if (type != null) {
decorated += type.getName();
}
- decorated += " <a href=\"" + GWT_RESOURCE_URL + resourceId + "\">" + resourceName + "</a>";
+ // decorated += " <a href=\"" + GWT_RESOURCE_URL + resourceId + "\">" + resourceName + "</a>";
+ decorated += " <a href=\"" + specificUrl + resourceId + "\">" + resourceName + "</a>";
return decorated;
}
@@ -49,13 +51,14 @@ public class ReportDecorator {
Iterator<DisambiguationReport.Resource> it = parents.iterator();
DisambiguationReport.Resource parent = it.next();
//generate first link
- String parentUrl = ReportDecorator.decorateResourceName(null, parent.getName(), parent.getId());
+ String parentUrl = ReportDecorator.decorateResourceName(GWT_RESOURCE_URL, null, parent.getName(), parent
+ .getId());
decorated = writeResource(decorated, parentUrl, parent.getName(), parent.getType());
while (it.hasNext()) {
decorated.append(DEFAULT_SEPARATOR);
parent = it.next();
- decorated = writeResource(decorated, ReportDecorator.decorateResourceName(null, parent.getName(),
- parent.getId()), parent.getName(), parent.getType());
+ decorated = writeResource(decorated, ReportDecorator.decorateResourceName(GWT_RESOURCE_URL, null,
+ parent.getName(), parent.getId()), parent.getName(), parent.getType());
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
index 0519a0b..e44c086 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
@@ -18,19 +18,29 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.util.List;
+
import org.quartz.CronTrigger;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
+import org.rhq.core.domain.operation.composite.ResourceOperationScheduleComposite;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTService;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.ExecutionSchedule;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
import org.rhq.enterprise.server.operation.ResourceOperationSchedule;
+import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.resource.disambiguation.DefaultDisambiguationUpdateStrategies;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -39,40 +49,87 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class OperationGWTServiceImpl extends AbstractGWTServiceImpl implements OperationGWTService {
private OperationManagerLocal operationManager = LookupUtil.getOperationManager();
+ private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
- public PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(ResourceOperationHistoryCriteria criteria) {
- return SerialUtility.prepare(operationManager.findResourceOperationHistoriesByCriteria(getSessionSubject(), criteria),
- "OperationService.findResourceOperationHistoriesByCriteria");
+ public PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(
+ ResourceOperationHistoryCriteria criteria) {
+ return SerialUtility.prepare(operationManager.findResourceOperationHistoriesByCriteria(getSessionSubject(),
+ criteria), "OperationService.findResourceOperationHistoriesByCriteria");
}
public PageList<GroupOperationHistory> findGroupOperationHistoriesByCriteria(GroupOperationHistoryCriteria criteria) {
- return SerialUtility.prepare(operationManager.findGroupOperationHistoriesByCriteria(getSessionSubject(), criteria),
- "OperationService.findGroupOperationHistoriesByCriteria");
+ return SerialUtility.prepare(operationManager.findGroupOperationHistoriesByCriteria(getSessionSubject(),
+ criteria), "OperationService.findGroupOperationHistoriesByCriteria");
}
-
- public void scheduleResourceOperation(
- int resourceId, String operationName, Configuration parameters, ExecutionSchedule schedule, String description, int timeout)
- throws RuntimeException {
+ public void scheduleResourceOperation(int resourceId, String operationName, Configuration parameters,
+ ExecutionSchedule schedule, String description, int timeout) throws RuntimeException {
ResourceOperationSchedule opSchedule;
try {
if (schedule.getStart() == ExecutionSchedule.Start.Immediately) {
- opSchedule = operationManager.scheduleResourceOperation(getSessionSubject(), resourceId, operationName, 0, 0, 0, 0, parameters, description);
+ opSchedule = operationManager.scheduleResourceOperation(getSessionSubject(), resourceId, operationName,
+ 0, 0, 0, 0, parameters, description);
} else {
- CronTrigger ct = new CronTrigger(
- "resource " + resourceId + "_" + operationName,
- "group",
- schedule.getCronString());
+ CronTrigger ct = new CronTrigger("resource " + resourceId + "_" + operationName, "group", schedule
+ .getCronString());
- opSchedule = operationManager.scheduleResourceOperation(getSessionSubject(), resourceId, operationName, parameters, ct, description);
+ opSchedule = operationManager.scheduleResourceOperation(getSessionSubject(), resourceId, operationName,
+ parameters, ct, description);
}
} catch (Exception e) {
throw new RuntimeException("Unabled to schedule operation execution" + e.getMessage());
}
}
+ /** Find recently completed operations, disambiguate them and return that list.
+ *
+ */
+ public List<DisambiguationReport<ResourceOperationLastCompletedComposite>> findRecentCompletedOperations(
+ ResourceCriteria criteria) {
+
+ PageControl pageControl = new PageControl(0, -1);
+ PageList<ResourceOperationLastCompletedComposite> lastCompletedResourceOps = operationManager
+ .findRecentlyCompletedResourceOperations(getSessionSubject(), null, pageControl);
+
+ //translate the returned problem resources to disambiguated links
+ List<DisambiguationReport<ResourceOperationLastCompletedComposite>> disambiguatedLastCompletedResourceOps = resourceManager
+ .disambiguate(lastCompletedResourceOps, RESOURCE_OPERATION_RESOURCE_ID_EXTRACTOR,
+ DefaultDisambiguationUpdateStrategies.getDefault());
+
+ return disambiguatedLastCompletedResourceOps;
+ }
+
+ /** Find scheduled operations, disambiguate them and return that list.
+ *
+ */
+ public List<DisambiguationReport<ResourceOperationScheduleComposite>> findScheduledOperations(
+ ResourceCriteria criteria) {
+
+ PageControl pageControl = new PageControl(0, -1);
+ PageList<ResourceOperationScheduleComposite> scheduledResourceOps = operationManager
+ .findCurrentlyScheduledResourceOperations(getSessionSubject(), pageControl);
+
+ //translate the returned problem resources to disambiguated links
+ List<DisambiguationReport<ResourceOperationScheduleComposite>> disambiguatedNextScheduledResourceOps = resourceManager
+ .disambiguate(scheduledResourceOps, RESOURCE_OPERATION_SCHEDULE_RESOURCE_ID_EXTRACTOR,
+ DefaultDisambiguationUpdateStrategies.getDefault());
+
+ return disambiguatedNextScheduledResourceOps;
+ }
+
+ private static final IntExtractor<ResourceOperationLastCompletedComposite> RESOURCE_OPERATION_RESOURCE_ID_EXTRACTOR = new IntExtractor<ResourceOperationLastCompletedComposite>() {
+ public int extract(ResourceOperationLastCompletedComposite object) {
+ return object.getResourceId();
+ }
+ };
+
+ private static final IntExtractor<ResourceOperationScheduleComposite> RESOURCE_OPERATION_SCHEDULE_RESOURCE_ID_EXTRACTOR = new IntExtractor<ResourceOperationScheduleComposite>() {
+ public int extract(ResourceOperationScheduleComposite object) {
+ return object.getResourceId();
+ }
+ };
}
commit 94f59f5b446b8440a138ebeea39785727991dc2f
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Aug 19 15:57:09 2010 -0400
UnavailibilityPortlet start
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 90b795e..33d32b3 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
@@ -60,7 +60,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
public class AlertDataSource extends RPCDataSource<Alert> {
private AlertGWTServiceAsync alertService = GWTServiceLookup.getAlertService();
- protected AlertDataSource() {
+ public AlertDataSource() {
super();
setCanMultiSort(true);
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 a82393c..30811cd 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
@@ -75,7 +75,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
-
private String selectedTab;
public DashboardsView() {
@@ -108,7 +107,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
removeMembers(getMembers());
this.dashboards = dashboards;
-
tabSet = new TabSet();
tabSet.setWidth100();
@@ -116,7 +114,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tabSet.setCanCloseTabs(true);
-
editButton = new IButton(editMode ? "View Mode" : "Edit Mode");
editButton.setAutoFit(true);
editButton.addClickHandler(new ClickHandler() {
@@ -127,7 +124,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
});
-
final IButton newDashboardButton = new IButton("New Dashboard");
newDashboardButton.setAutoFit(true);
newDashboardButton.addClickHandler(new ClickHandler() {
@@ -142,7 +138,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tabSet.setTabBarControls(buttons);
-
tabSet.addTabSelectedHandler(new TabSelectedHandler() {
public void onTabSelected(TabSelectedEvent tabSelectedEvent) {
History.newItem("Dashboard/" + tabSelectedEvent.getTab().getTitle(), false);
@@ -159,7 +154,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tab.setPane(dashboardView);
tab.setCanClose(true);
-
tabSet.addTab(tab);
if (dashboard.getName().equals(selectedTab)) {
tabSet.selectTab(tab);
@@ -169,15 +163,16 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tabSet.addCloseClickHandler(new CloseClickHandler() {
public void onCloseClick(final TabCloseClickEvent tabCloseClickEvent) {
final DashboardView dashboardView = (DashboardView) tabCloseClickEvent.getTab().getPane();
- SC.ask("Are you sure you want to delete [" + tabCloseClickEvent.getTab().getTitle() + "]?", new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- if (aBoolean) {
- dashboardView.delete();
- } else {
- tabCloseClickEvent.cancel();
+ SC.ask("Are you sure you want to delete [" + tabCloseClickEvent.getTab().getTitle() + "]?",
+ new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+ if (aBoolean) {
+ dashboardView.delete();
+ } else {
+ tabCloseClickEvent.cancel();
+ }
}
- }
- });
+ });
}
});
@@ -185,7 +180,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
-
protected Dashboard getDefaultDashboard() {
Dashboard dashboard = new Dashboard();
@@ -194,7 +188,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
dashboard.setColumnWidths("32%", "68%");
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
-
DashboardPortlet summary = new DashboardPortlet("Inventory Summary", InventorySummaryView.KEY, 230);
dashboard.addPortlet(summary, 0, 0);
@@ -202,40 +195,46 @@ public class DashboardsView extends VLayout implements BookmarkableView {
dashboard.addPortlet(tagCloud, 0, 1);
// Experimental
-// StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
-// col2.add(platformSummary);
-
+ // StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
+ // col2.add(platformSummary);
DashboardPortlet welcome = new DashboardPortlet("Welcome To RHQ", MessagePortlet.KEY, 180);
- welcome.getConfiguration().put(new PropertySimple("message", "<h1>Welcome to RHQ</h1>\n" +
- "<p>The RHQ project is an abstraction and plug-in based systems management suite that provides " +
- "extensible and integrated systems management for multiple products and platforms across a set " +
- "of core features. The project is designed with layered modules that provide a flexible " +
- "architecture for deployment. It delivers a core user interface that delivers audited and " +
- "historical management across an entire enterprise. A Server/Agent architecture provides " +
- "remote management and plugins implement all specific support for managed products.</p>\n" +
- "<p>This default dashboard can be edited by clicking the \"edit mode\" button above.</p>"));
+ welcome.getConfiguration().put(
+ new PropertySimple("message", "<h1>Welcome to RHQ</h1>\n"
+ + "<p>The RHQ project is an abstraction and plug-in based systems management suite that provides "
+ + "extensible and integrated systems management for multiple products and platforms across a set "
+ + "of core features. The project is designed with layered modules that provide a flexible "
+ + "architecture for deployment. It delivers a core user interface that delivers audited and "
+ + "historical management across an entire enterprise. A Server/Agent architecture provides "
+ + "remote management and plugins implement all specific support for managed products.</p>\n"
+ + "<p>This default dashboard can be edited by clicking the \"edit mode\" button above.</p>"));
dashboard.addPortlet(welcome, 1, 0);
DashboardPortlet news = new DashboardPortlet("RHQ News", MashupPortlet.KEY, 320);
- news.getConfiguration().put(new PropertySimple("address", "http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
+ news.getConfiguration().put(
+ new PropertySimple("address", "http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
dashboard.addPortlet(news, 1, 1);
-//
+ //
DashboardPortlet discoveryQueue = new DashboardPortlet("Discovery Queue", AutodiscoveryPortlet.KEY, 250);
dashboard.addPortlet(discoveryQueue, 1, 2);
-
DashboardPortlet recentAlerts = new DashboardPortlet("Recent Alerts", RecentAlertsPortlet.KEY, 250);
dashboard.addPortlet(recentAlerts, 1, 3);
DashboardPortlet recentlyAdded = new DashboardPortlet("Recently Added Resources", RecentlyAddedView.KEY, 250);
dashboard.addPortlet(recentlyAdded, 1, 4);
+ // DashboardPortlet operations = new DashboardPortlet("Operations", RecentlyAddedView.KEY, 250);
+ // dashboard.addPortlet(operations, 1, 5);
+
+ // DashboardPortlet hasAlertsCurrentlyUnavailable = new DashboardPortlet("Has Alerts or Currently Unavailable",
+ // UnavailabilityPortlet.KEY, 250);
+ // dashboard.addPortlet(hasAlertsCurrentlyUnavailable, 1, 5);
+
return dashboard;
}
-
public void addNewDashboard() {
Dashboard dashboard = new Dashboard();
@@ -276,7 +275,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
editButton.setTitle(editMode ? "View Mode" : "Edit Mode");
dashboardView.setEditMode(editMode);
-
}
});
}
@@ -288,15 +286,18 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
}
-
public void renderView(ViewPath viewPath) {
if (!viewPath.isEnd()) {
selectedTab = viewPath.getCurrent().getPath();
+ System.out.println("#################:" + selectedTab + ":tabset:" + tabSet);
+ // if (tabSet != null) {
for (Tab tab : tabSet.getTabs()) {
- if (selectedTab.equals(tab.getTitle())) {
+ // if (selectedTab.equals(tab.getTitle())) {
+ if (tab.getTitle().equals(selectedTab)) {
tabSet.selectTab(tab);
}
}
+ // }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/UnavailabilityPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/UnavailabilityPortlet.java
new file mode 100644
index 0000000..e694c5c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/UnavailabilityPortlet.java
@@ -0,0 +1,91 @@
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts;
+
+/*
+ * 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.
+ */
+
+import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.resource.ProblemResourcesDataSource;
+
+/**
+ * A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s,
+ * and Resources reported unavailable.
+ *
+ * @author Simeon Pinder
+ */
+public class UnavailabilityPortlet extends VLayout implements Portlet {
+
+ public static final String KEY = "Currently Unavailable";
+ private static final String TITLE = KEY;
+
+ public UnavailabilityPortlet() {
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ // Add the list table as the top half of the view.
+ ListGrid listGrid = new ListGrid();
+ listGrid.setDataSource(new ProblemResourcesDataSource());
+ listGrid.setAutoFetchData(true);
+ listGrid.setTitle(TITLE);
+ listGrid.setResizeFieldsInRealTime(true);
+ // 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>";
+ // }
+ // });
+ addMember(listGrid);
+
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ // TODO implement this.
+
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new HTMLFlow("This portlet displays resources that have reported Down availability.");
+ }
+
+ public DynamicForm getCustomSettingsForm() {
+ return null;
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ public final Portlet getInstance() {
+ return GWT.create(UnavailabilityPortlet.class);
+ }
+ }
+
+}
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 f92e7d5..4c7fce5 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
@@ -28,6 +28,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageControl;
@@ -48,6 +49,8 @@ public interface ResourceGWTService extends RemoteService {
List<RecentlyAddedResourceComposite> findRecentlyAddedResources(long ctime, int maxItems);
+ List<ProblemResourceComposite> findProblemResources(ResourceCriteria criteria);
+
Resource getPlatformForResource(int resourceId);
List<Integer> uninventoryResources(int[] resourceIds);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
new file mode 100644
index 0000000..1d5c079
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
@@ -0,0 +1,145 @@
+package org.rhq.enterprise.gui.coregui.client.resource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.DSDataFormat;
+import com.smartgwt.client.types.DSProtocol;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+public class ProblemResourcesDataSource extends DataSource {
+ public final String resource = "resource";
+ public final String location = "location";
+ public final String alerts = "alerts";
+ public final String available = "available";
+
+ /** Build list of fields for the datasource and then adds them to it.
+ */
+ public ProblemResourcesDataSource() {
+ setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ setDataFormat(DSDataFormat.CUSTOM);
+
+ DataSourceTextField resourceField = new DataSourceTextField(resource, "Resource");
+ resourceField.setPrimaryKey(true);
+
+ DataSourceTextField locationField = new DataSourceTextField(location, "Location");
+
+ DataSourceTextField alertsField = new DataSourceTextField(alerts, "Alerts");
+
+ DataSourceTextField availablilityField = new DataSourceTextField(available, "Current Availability");
+
+ setFields(resourceField, locationField, alertsField, availablilityField);
+ }
+
+ /* Intercept DSRequest object to pipe into custom fetch request.
+ * (non-Javadoc)
+ * @see com.smartgwt.client.data.DataSource#transformRequest(com.smartgwt.client.data.DSRequest)
+ */
+ protected Object transformRequest(DSRequest request) {
+ DSResponse response = new DSResponse();
+ response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
+ // Assume success
+ response.setStatus(0);
+ switch (request.getOperationType()) {
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
+ }
+
+ return request.getData();
+ }
+
+ /** Fetch the ProblemResource data, and populate the response object appropriately.
+ *
+ * @param request incoming request
+ * @param response outgoing response
+ */
+ public void executeFetch(final DSRequest request, final DSResponse response) {
+
+ ResourceCriteria c = new ResourceCriteria();
+ c.addFilterCurrentAvailability(AvailabilityType.DOWN);
+
+ // GWTServiceLookup.getResourceService().findRecentlyAddedResources(0, 100,
+ GWTServiceLookup.getResourceService().findProblemResources(c,
+ // new AsyncCallback<List<RecentlyAddedResourceComposite>>() {
+ new AsyncCallback<List<ProblemResourceComposite>>() {
+ public void onFailure(Throwable throwable) {
+ CoreGUI.getErrorHandler().handleError("Failed to load unavailable resources", throwable);
+ }
+
+ // public void onSuccess(List<RecentlyAddedResourceComposite> recentlyAddedList) {
+ public void onSuccess(List<ProblemResourceComposite> problemResourcesList) {
+ // List<RecentlyAddedResourceComposite> list = new ArrayList<RecentlyAddedResourceComposite>();
+ List<ProblemResourceComposite> list = new ArrayList<ProblemResourceComposite>();
+
+ // for (RecentlyAddedResourceComposite recentlyAdded : problemResourcesList) {
+ for (ProblemResourceComposite problemResource : problemResourcesList) {
+ list.add(problemResource);
+ // list.addAll(problemResource.getChildren());
+ }
+
+ // response.setData(buildNodes(list));
+ response.setData(buildList(list));
+ response.setTotalRows(list.size());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ //
+ // GWTServiceLookup.getResourceService().findResourcesByCriteria(c, new AsyncCallback<PageList<Resource>>() {
+ // public void onFailure(Throwable caught) {
+ // CoreGUI.getErrorHandler().handleError("Failed to load recently added resources data",caught);
+ // response.setStatus(DSResponse.STATUS_FAILURE);
+ // processResponse(request.getRequestId(), response);
+ // }
+ //
+ // public void onSuccess(PageList<Resource> result) {
+ // PageList<Resource> all = new PageList<Resource>();
+ //
+ // for (Resource root : result) {
+ // all.add(root);
+ // if (root.getChildResources() != null)
+ // all.addAll(root.getChildResources());
+ // }
+ //
+ //
+ // response.setData(buildNodes(all));
+ // response.setTotalRows(all.getTotalSize());
+ // processResponse(request.getRequestId(), response);
+ // }
+ // });
+ }
+
+ protected Record[] buildList(List<ProblemResourceComposite> list) {
+ ListGridRecord[] dataValues = null;
+ if (list != null) {
+ dataValues = new ListGridRecord[list.size()];
+ int indx = 0;
+ for (ProblemResourceComposite prc : list) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute(resource, prc.getResourceId());
+ record.setAttribute(location, prc.getResourceName());
+ record.setAttribute(alerts, prc.getNumAlerts());
+ // record.setAttribute(available, DateTimeFormat.getMediumDateTimeFormat().format(dateAdded));
+ record.setAttribute(available, prc.getAvailabilityType().getName());
+ dataValues[indx++] = record;
+ }
+ }
+ return dataValues;
+ }
+
+}
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 c10254e..07388ea 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
@@ -35,6 +35,7 @@ import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageControl;
@@ -124,7 +125,7 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
public PageList<ResourceComposite> findResourceCompositesByCriteria(ResourceCriteria criteria) {
try {
PageList<ResourceComposite> result = resourceManager.findResourceCompositesByCriteria(getSessionSubject(),
- criteria);
+ criteria);
List<Resource> resources = new ArrayList<Resource>(result.size());
if (resources.size() > 1) {
@@ -138,6 +139,19 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
}
}
+ public List<ProblemResourceComposite> findProblemResources(ResourceCriteria criteria) {
+ List<ProblemResourceComposite> located = new ArrayList<ProblemResourceComposite>();
+ PageList<ResourceComposite> pageList = findResourceCompositesByCriteria(criteria);
+ if (!pageList.isEmpty()) {
+ for (ResourceComposite rc : pageList) {
+ ProblemResourceComposite prc = new ProblemResourceComposite(rc.getResource().getId(), rc.getResource()
+ .getName(), rc.getAvailability(), 0);
+ //TODO: spinder: replace last argument with alert count for this resource.
+ }
+ }
+ return located;
+ }
+
public List<Resource> getResourceLineage(int resourceId) {
return SerialUtility.prepare(resourceManager.getResourceLineage(resourceId),
"ResourceService.getResourceLineage");
@@ -166,6 +180,15 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
return platforms;
}
+ // @Override
+ // public List<ProblemResourceComposite> findProblemResources(long ctime, int maxItems) {
+ // List<ProblemResourceComposite> problems =
+ // resourceManager.findResourceCompositesByCriteria(getSessionSubject(), criteria)(
+ // getSessionSubject(), ctime, maxItems);
+ //
+ // return problems;
+ // }
+
public List<Integer> uninventoryResources(int[] resourceIds) {
return SerialUtility.prepare(resourceManager.uninventoryResources(getSessionSubject(), resourceIds),
"ResourceService.uninventoryResources");
@@ -195,12 +218,8 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
}
public Map<Resource, List<Resource>> getQueuedPlatformsAndServers(HashSet<InventoryStatus> statuses, PageControl pc) {
- return SerialUtility.prepare(
- discoveryBoss.getQueuedPlatformsAndServers(
- getSessionSubject(),
- EnumSet.copyOf(statuses),
- pc),
- "ResourceService.getQueuedPlatformsAndServers");
+ return SerialUtility.prepare(discoveryBoss.getQueuedPlatformsAndServers(getSessionSubject(), EnumSet
+ .copyOf(statuses), pc), "ResourceService.getQueuedPlatformsAndServers");
}
public void importResources(Integer[] resourceIds) {
@@ -214,5 +233,5 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
public void unignoreResources(Integer[] resourceIds) {
discoveryBoss.unignoreResources(getSessionSubject(), resourceIds);
}
-
+
}
\ No newline at end of file
commit 3affb98c0a1620a0b4dc68db31208fb8a8d0cfdb
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Aug 24 13:13:43 2010 -0400
Unavailability portlet with Datasource and including Disambiguation.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
index 197378d..a83d1f8 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
@@ -24,7 +24,6 @@
package org.rhq.core.domain.resource.composite;
import java.io.Serializable;
-import java.util.Collections;
import java.util.List;
/**
@@ -34,7 +33,7 @@ import java.util.List;
*/
public class DisambiguationReport<T> implements Serializable {
private static final long serialVersionUID = 1L;
-
+
private T original;
private List<Resource> parents;
private ResourceType resourceType;
@@ -45,7 +44,11 @@ public class DisambiguationReport<T> implements Serializable {
private String name;
private String plugin;
private boolean singleton;
-
+
+ //no args
+ public ResourceType() {
+ }
+
/**
* @param name
* @param plugin
@@ -57,11 +60,11 @@ public class DisambiguationReport<T> implements Serializable {
this.plugin = plugin;
this.singleton = singleton;
}
-
+
public String getName() {
return name;
}
-
+
/**
* @return the plugin that defines this type or null if such information
* isn't needed to disambiguate this type.
@@ -73,19 +76,22 @@ public class DisambiguationReport<T> implements Serializable {
public boolean isSingleton() {
return singleton;
}
-
+
public String toString() {
return "ResourceType[name='" + name + "', plugin='" + plugin + "'" + "]";
}
}
public static class Resource implements Serializable {
+ //no args
+ public Resource() {
+ }
private static final long serialVersionUID = 1L;
private int id;
private String name;
private ResourceType type;
-
+
/**
* @param id
* @param name
@@ -112,22 +118,27 @@ public class DisambiguationReport<T> implements Serializable {
public ResourceType getType() {
return type;
}
-
+
public String toString() {
return "Resource[id=" + id + ", name='" + name + "', type=" + type + "]";
}
}
-
+
+ public DisambiguationReport() {
+ }
+
public DisambiguationReport(T original, List<Resource> parents, ResourceType resourceType) {
this.original = original;
- this.parents = Collections.unmodifiableList(parents);
+ // this.parents = Collections.unmodifiableList(parents);
+ //spinder: the returned type is not Serializable and causes GWT serialization errors.
+ this.parents = parents;
this.resourceType = resourceType;
}
public T getOriginal() {
return original;
}
-
+
/**
* @return the list of parents to disambiguate the original. Empty if no disambiguation using
* parents is needed.
@@ -143,7 +154,7 @@ public class DisambiguationReport<T> implements Serializable {
public ResourceType getResourceType() {
return resourceType;
}
-
+
public String toString() {
return "DisambiguationReport(type=" + resourceType + ", parents=" + parents + ", original=" + original + ")";
}
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 30811cd..d4deaca 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
@@ -48,6 +48,7 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.ProblemResourcesPortlet;
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;
@@ -227,9 +228,9 @@ public class DashboardsView extends VLayout implements BookmarkableView {
// DashboardPortlet operations = new DashboardPortlet("Operations", RecentlyAddedView.KEY, 250);
// dashboard.addPortlet(operations, 1, 5);
- // DashboardPortlet hasAlertsCurrentlyUnavailable = new DashboardPortlet("Has Alerts or Currently Unavailable",
- // UnavailabilityPortlet.KEY, 250);
- // dashboard.addPortlet(hasAlertsCurrentlyUnavailable, 1, 5);
+ DashboardPortlet hasAlertsCurrentlyUnavailable = new DashboardPortlet("Has Alerts or Currently Unavailable",
+ ProblemResourcesPortlet.KEY, 250);
+ dashboard.addPortlet(hasAlertsCurrentlyUnavailable, 1, 5);
return dashboard;
@@ -289,15 +290,16 @@ public class DashboardsView extends VLayout implements BookmarkableView {
public void renderView(ViewPath viewPath) {
if (!viewPath.isEnd()) {
selectedTab = viewPath.getCurrent().getPath();
- System.out.println("#################:" + selectedTab + ":tabset:" + tabSet);
- // if (tabSet != null) {
- for (Tab tab : tabSet.getTabs()) {
- // if (selectedTab.equals(tab.getTitle())) {
- if (tab.getTitle().equals(selectedTab)) {
- tabSet.selectTab(tab);
+ //added to avoid NPE in gwt debug window.
+ if (tabSet != null) {
+ for (Tab tab : tabSet.getTabs()) {
+ if (tab.getTitle().equals(selectedTab)) {
+ tabSet.selectTab(tab);
+ }
}
+ } else {
+ System.out.println("WARN: While rendering DashboardsView tabSet is null.");
}
- // }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
index 7d208f1..a676bae 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
@@ -30,9 +30,10 @@ import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.FavoriteResourcesPortlet;
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.alerts.ProblemResourcesPortlet;
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.dashboard.portlets.summary.TagCloudPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MashupPortlet;
@@ -43,13 +44,11 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePort
*/
public class PortletFactory {
-
private static Map<String, PortletViewFactory> registeredPortlets;
static {
registeredPortlets = new HashMap<String, PortletViewFactory>();
-
registeredPortlets.put(InventorySummaryView.KEY, InventorySummaryView.Factory.INSTANCE);
registeredPortlets.put(RecentlyAddedView.KEY, RecentlyAddedView.Factory.INSTANCE);
registeredPortlets.put(PlatformPortletView.KEY, PlatformPortletView.Factory.INSTANCE);
@@ -66,11 +65,11 @@ public class PortletFactory {
registeredPortlets.put(MashupPortlet.KEY, MashupPortlet.Factory.INSTANCE);
registeredPortlets.put(MessagePortlet.KEY, MessagePortlet.Factory.INSTANCE);
+ registeredPortlets.put(ProblemResourcesPortlet.KEY, ProblemResourcesPortlet.Factory.INSTANCE);
}
public static Portlet buildPortlet(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
-
PortletViewFactory viewFactory = registeredPortlets.get(storedPortlet.getPortletKey());
Canvas canvas = null;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/ProblemResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/ProblemResourcesPortlet.java
new file mode 100644
index 0000000..2d7ad0e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/ProblemResourcesPortlet.java
@@ -0,0 +1,85 @@
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts;
+
+/*
+ * 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.
+ */
+
+import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.resource.ProblemResourcesDataSource;
+
+/**
+ * A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s,
+ * and Resources reported unavailable.
+ *
+ * @author Simeon Pinder
+ */
+public class ProblemResourcesPortlet extends VLayout implements Portlet {
+
+ public static final String KEY = "Has Alerts or Currently Unavailable";
+ private static final String TITLE = KEY;
+
+ public ProblemResourcesPortlet() {
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ // Add the list table as the top half of the view.
+ ListGrid listGrid = new ListGrid();
+ listGrid.setDataSource(new ProblemResourcesDataSource());
+ listGrid.setAutoFetchData(true);
+ listGrid.setTitle(TITLE);
+ listGrid.setResizeFieldsInRealTime(true);
+ addMember(listGrid);
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ // TODO implement this.
+
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new HTMLFlow("This portlet displays resources that have reported alerts or Down availability.");
+ }
+
+ public DynamicForm getCustomSettingsForm() {
+ return null;
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ public final Portlet getInstance() {
+ return GWT.create(ProblemResourcesPortlet.class);
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/UnavailabilityPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/UnavailabilityPortlet.java
deleted file mode 100644
index 12cd480..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/UnavailabilityPortlet.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts;
-
-/*
- * 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.
- */
-
-import com.google.gwt.core.client.GWT;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import org.rhq.core.domain.dashboard.DashboardPortlet;
-import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
-import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
-import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
-import org.rhq.enterprise.gui.coregui.client.resource.ProblemResourcesDataSource;
-
-/**
- * A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s,
- * and Resources reported unavailable.
- *
- * @author Simeon Pinder
- */
-public class UnavailabilityPortlet extends VLayout implements Portlet {
-
- public static final String KEY = "Currently Unavailable";
- private static final String TITLE = KEY;
-
- public UnavailabilityPortlet() {
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- // Add the list table as the top half of the view.
- ListGrid listGrid = new ListGrid();
- listGrid.setDataSource(new ProblemResourcesDataSource());
- listGrid.setAutoFetchData(true);
- listGrid.setTitle(TITLE);
- listGrid.setResizeFieldsInRealTime(true);
- // 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>";
- // }
- // });
- addMember(listGrid);
-
- }
-
- @Override
- public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- // TODO implement this.
-
- }
-
- @Override
- public Canvas getHelpCanvas() {
- return new HTMLFlow("This portlet displays resources that have reported Down availability.");
- }
-
- public DynamicForm getCustomSettingsForm() {
- return null;
- }
-
- public static final class Factory implements PortletViewFactory {
- public static PortletViewFactory INSTANCE = new Factory();
-
- public final Portlet getInstance() {
- return GWT.create(UnavailabilityPortlet.class);
- }
- }
-
-}
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 4c7fce5..fefa85f 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
@@ -28,6 +28,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -49,7 +50,7 @@ public interface ResourceGWTService extends RemoteService {
List<RecentlyAddedResourceComposite> findRecentlyAddedResources(long ctime, int maxItems);
- List<ProblemResourceComposite> findProblemResources(ResourceCriteria criteria);
+ List<DisambiguationReport<ProblemResourceComposite>> findProblemResources(ResourceCriteria criteria);
Resource getPlatformForResource(int resourceId);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
index 470faf1..ccc620a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
@@ -1,6 +1,23 @@
package org.rhq.enterprise.gui.coregui.client.resource;
-import java.util.ArrayList;
+/*
+ * 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.
+ */
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -8,6 +25,7 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.fields.DataSourceImageField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
@@ -15,15 +33,22 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+/** Responsible for defining and populating the Smart GWT datasource details and
+ * translating the deserialized content into specific record entries for display
+ *
+ * @author spinder
+ */
public class ProblemResourcesDataSource extends DataSource {
- public final String resource = "resource";
- public final String location = "location";
- public final String alerts = "alerts";
- public final String available = "available";
+ public static final String resource = "resource";
+ public static final String location = "location";
+ public static final String alerts = "alerts";
+ public static final String available = "available";
/** Build list of fields for the datasource and then adds them to it.
*/
@@ -39,7 +64,7 @@ public class ProblemResourcesDataSource extends DataSource {
DataSourceTextField alertsField = new DataSourceTextField(alerts, "Alerts");
- DataSourceTextField availablilityField = new DataSourceTextField(available, "Current Availability");
+ DataSourceImageField availablilityField = new DataSourceImageField(available, "Current Availability");
setFields(resourceField, locationField, alertsField, availablilityField);
}
@@ -72,74 +97,62 @@ public class ProblemResourcesDataSource extends DataSource {
public void executeFetch(final DSRequest request, final DSResponse response) {
ResourceCriteria c = new ResourceCriteria();
- c.addFilterCurrentAvailability(AvailabilityType.DOWN);
-
- // GWTServiceLookup.getResourceService().findRecentlyAddedResources(0, 100,
GWTServiceLookup.getResourceService().findProblemResources(c,
- // new AsyncCallback<List<RecentlyAddedResourceComposite>>() {
- new AsyncCallback<List<ProblemResourceComposite>>() {
+ new AsyncCallback<List<DisambiguationReport<ProblemResourceComposite>>>() {
+
public void onFailure(Throwable throwable) {
- CoreGUI.getErrorHandler().handleError("Failed to load unavailable resources", throwable);
+ CoreGUI.getErrorHandler().handleError("Failed to load resources with alerts/unavailability.",
+ throwable);
}
- // public void onSuccess(List<RecentlyAddedResourceComposite> recentlyAddedList) {
- public void onSuccess(List<ProblemResourceComposite> problemResourcesList) {
- // List<RecentlyAddedResourceComposite> list = new ArrayList<RecentlyAddedResourceComposite>();
- List<ProblemResourceComposite> list = new ArrayList<ProblemResourceComposite>();
+ public void onSuccess(List<DisambiguationReport<ProblemResourceComposite>> problemResourcesList) {
- // for (RecentlyAddedResourceComposite recentlyAdded : problemResourcesList) {
- for (ProblemResourceComposite problemResource : problemResourcesList) {
- list.add(problemResource);
- // list.addAll(problemResource.getChildren());
+ //translate DisambiguationReport into dataset entries
+ response.setData(buildList(problemResourcesList));
+ //entry count
+ if (null != problemResourcesList) {
+ response.setTotalRows(problemResourcesList.size());
+ } else {
+ response.setTotalRows(0);
}
-
- // response.setData(buildNodes(list));
- response.setData(buildList(list));
- response.setTotalRows(list.size());
+ //pass off for processing
processResponse(request.getRequestId(), response);
}
});
- //
- // GWTServiceLookup.getResourceService().findResourcesByCriteria(c, new AsyncCallback<PageList<Resource>>() {
- // public void onFailure(Throwable caught) {
- // CoreGUI.getErrorHandler().handleError("Failed to load recently added resources data",caught);
- // response.setStatus(DSResponse.STATUS_FAILURE);
- // processResponse(request.getRequestId(), response);
- // }
- //
- // public void onSuccess(PageList<Resource> result) {
- // PageList<Resource> all = new PageList<Resource>();
- //
- // for (Resource root : result) {
- // all.add(root);
- // if (root.getChildResources() != null)
- // all.addAll(root.getChildResources());
- // }
- //
- //
- // response.setData(buildNodes(all));
- // response.setTotalRows(all.getTotalSize());
- // processResponse(request.getRequestId(), response);
- // }
- // });
}
- protected Record[] buildList(List<ProblemResourceComposite> list) {
+ /** Translates the DisambiguationReport of ProblemResourceComposites into specific
+ * and ordered record values.
+ *
+ * @param list DisambiguationReport of entries.
+ * @return Record[] ordered record entries.
+ */
+ protected Record[] buildList(List<DisambiguationReport<ProblemResourceComposite>> list) {
+
ListGridRecord[] dataValues = null;
if (list != null) {
dataValues = new ListGridRecord[list.size()];
int indx = 0;
- for (ProblemResourceComposite prc : list) {
+
+ for (DisambiguationReport<ProblemResourceComposite> report : list) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute(resource, prc.getResourceId());
- record.setAttribute(location, prc.getResourceName());
- record.setAttribute(alerts, prc.getNumAlerts());
- // record.setAttribute(available, DateTimeFormat.getMediumDateTimeFormat().format(dateAdded));
- record.setAttribute(available, prc.getAvailabilityType().getName());
+ //disambiguated Resource name, decorated with html anchors to problem resources
+ record.setAttribute(resource, ReportDecorator.decorateResourceName(report.getResourceType(), report
+ .getOriginal().getResourceName(), report.getOriginal().getResourceId()));
+ //disambiguated resource lineage, decorated with html anchors
+ record.setAttribute(location, ReportDecorator.decorateResourceLineage(report.getParents()));
+ //alert cnt.
+ record.setAttribute(alerts, report.getOriginal().getNumAlerts());
+ //populate availability icon
+ if (report.getOriginal().getAvailabilityType().compareTo(AvailabilityType.DOWN) == 0) {
+ record.setAttribute(available, "/images/icons/availability_red_16.png");
+ } else {
+ record.setAttribute(available, "/images/icons/availability_green_16.png");
+ }
+
dataValues[indx++] = record;
}
}
return dataValues;
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
new file mode 100644
index 0000000..ff50f1f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
@@ -0,0 +1,94 @@
+package org.rhq.enterprise.gui.coregui.client.resource.disambiguation;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.composite.DisambiguationReport.Resource;
+import org.rhq.core.domain.resource.composite.DisambiguationReport.ResourceType;
+
+/**
+ * Class handles some of the data decoration that used to be done for legacy struts
+ * tags. See org.rhq.enterprise.gui.legacy.taglib.display.DisambiguatedResourceLineageDecorator and
+ * org.rhq.enterprise.gui.legacy.taglib.display.DisambiguatedResourceLineageTag
+ * for original functionality.
+ *
+ * @author Simeon Pinder
+ */
+public class ReportDecorator {
+
+ //TODO: pull value from more bookmarking/history definition
+ public final static String GWT_RESOURCE_URL = "/coregui/CoreGUI.html#Resource/";
+ public static final String DEFAULT_SEPARATOR = " > ";
+
+ /** Generates HTML label from DisambiguationReport data.
+ *
+ * @param ResourceType type. If !null, the ResourceType name is prepended to result.
+ * @param resourceName Name of the element from report
+ * @param resourceId Id for resource
+ * @return String of generated html for a ResourceName.
+ */
+ public static String decorateResourceName(ResourceType type, String resourceName, int resourceId) {
+ String decorated = "";
+ if (type != null) {
+ decorated += type.getName();
+ }
+ decorated += " <a href=\"" + GWT_RESOURCE_URL + resourceId + "\">" + resourceName + "</a>";
+ return decorated;
+ }
+
+ /** Generates Html label of Resource Lineage for disambiguation.
+ *
+ * @param parents ResourceLineage provided by DisambiguationReport.
+ * @return String of generated html for ResourceLineage.
+ */
+ public static String decorateResourceLineage(List<Resource> parents) {
+ StringBuffer decorated = new StringBuffer();
+ if (parents != null && parents.size() > 0) {
+
+ Iterator<DisambiguationReport.Resource> it = parents.iterator();
+ DisambiguationReport.Resource parent = it.next();
+ //generate first link
+ String parentUrl = ReportDecorator.decorateResourceName(null, parent.getName(), parent.getId());
+ decorated = writeResource(decorated, parentUrl, parent.getName(), parent.getType());
+ while (it.hasNext()) {
+ decorated.append(DEFAULT_SEPARATOR);
+ parent = it.next();
+ decorated = writeResource(decorated, ReportDecorator.decorateResourceName(null, parent.getName(),
+ parent.getId()), parent.getName(), parent.getType());
+
+ }
+ }
+ return decorated.toString();
+ }
+
+ /** Appends resource lineage details with html anchors.
+ *
+ * @param existing
+ * @param url
+ * @param resourceName
+ * @param resourceType
+ * @return
+ */
+ private static StringBuffer writeResource(StringBuffer existing, String url, String resourceName,
+ DisambiguationReport.ResourceType resourceType) {
+ if (!resourceType.isSingleton()) {
+
+ existing.append(resourceType.getName()).append(" ");
+
+ if (resourceType.getPlugin() != null) {
+ existing.append("(").append(resourceType.getPlugin()).append(" plugin) ");
+ }
+ }
+
+ if (url != null) {
+ existing.append(url);
+ }
+
+ if (resourceType.isSingleton() && resourceType.getPlugin() != null) {
+ existing.append(" (").append(resourceType.getPlugin()).append(" plugin)");
+ }
+ return existing;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java
index aa2c7dd..cc144f8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java
@@ -18,7 +18,7 @@ public class LocatableVLayout extends VLayout {
public LocatableVLayout(String id) {
super();
String locatorId = this.getScClassName() + "-" + id;
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ // setID(SeleniumUtility.getSafeId(locatorId, locatorId));
}
}
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 c9196db..240e523 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
@@ -35,16 +35,20 @@ import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.discovery.DiscoveryBossLocal;
+import org.rhq.enterprise.server.measurement.MeasurementProblemManagerLocal;
import org.rhq.enterprise.server.resource.ResourceFactoryManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.resource.disambiguation.DefaultDisambiguationUpdateStrategies;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -139,19 +143,30 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
}
}
- public List<ProblemResourceComposite> findProblemResources(ResourceCriteria criteria) {
+ /** Locate ProblemResourcesComposites and generate the disambiguation reports for them.
+ * Criteria passed in not currently used.
+ */
+ public List<DisambiguationReport<ProblemResourceComposite>> findProblemResources(ResourceCriteria criteria) {
+
List<ProblemResourceComposite> located = new ArrayList<ProblemResourceComposite>();
- PageList<ResourceComposite> pageList = findResourceCompositesByCriteria(criteria);
- if (!pageList.isEmpty()) {
- for (ResourceComposite rc : pageList) {
- ProblemResourceComposite prc = new ProblemResourceComposite(rc.getResource().getId(), rc.getResource()
- .getName(), rc.getAvailability(), 0);
- //TODO: spinder: replace last argument with alert count for this resource.
- }
- }
- return located;
+ MeasurementProblemManagerLocal problemManager = LookupUtil.getMeasurementProblemManager();
+ ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+
+ //retrieve list of discovered problem resources. Grab all, live scrolling data
+ located = problemManager.findProblemResources(getSessionSubject(), 0, new PageControl(0, -1));
+
+ //translate the returned problem resources to disambiguated links
+ List<DisambiguationReport<ProblemResourceComposite>> translated = resourceManager.disambiguate(located,
+ RESOURCE_ID_EXTRACTOR, DefaultDisambiguationUpdateStrategies.getDefault());
+ return translated;
}
+ private static final IntExtractor<ProblemResourceComposite> RESOURCE_ID_EXTRACTOR = new IntExtractor<ProblemResourceComposite>() {
+ public int extract(ProblemResourceComposite object) {
+ return object.getResourceId();
+ }
+ };
+
public List<Resource> getResourceLineage(int resourceId) {
return SerialUtility.prepare(resourceManager.getResourceLineage(resourceId),
"ResourceService.getResourceLineage");
@@ -180,15 +195,6 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
return platforms;
}
- // @Override
- // public List<ProblemResourceComposite> findProblemResources(long ctime, int maxItems) {
- // List<ProblemResourceComposite> problems =
- // resourceManager.findResourceCompositesByCriteria(getSessionSubject(), criteria)(
- // getSessionSubject(), ctime, maxItems);
- //
- // return problems;
- // }
-
public List<Integer> uninventoryResources(int[] resourceIds) {
return SerialUtility.prepare(resourceManager.uninventoryResources(getSessionSubject(), resourceIds),
"ResourceService.uninventoryResources");
commit 3aa4bd2d096eb3195d846646cae3f2b292c814d2
Merge: 4bd7b73... 66234db...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Aug 24 05:23:19 2010 -0400
Merge branch 'master' of ssh://spinder@git.fedorahosted.org/git/rhq/rhq into spinder-track
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index c5effa7,90b795e..33d32b3
--- 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
@@@ -60,11 -58,9 +58,9 @@@ import org.rhq.enterprise.gui.coregui.c
* @author Ian Springer
*/
public class AlertDataSource extends RPCDataSource<Alert> {
- private static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getMediumDateTimeFormat();
-
private AlertGWTServiceAsync alertService = GWTServiceLookup.getAlertService();
- protected AlertDataSource() {
+ public AlertDataSource() {
super();
setCanMultiSort(true);
commit 4bd7b730b2362d96f126e36bec397eec987d2c15
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Aug 19 15:57:09 2010 -0400
UnavailibilityPortlet start
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 3369352..c5effa7 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
@@ -64,7 +64,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
private AlertGWTServiceAsync alertService = GWTServiceLookup.getAlertService();
- protected AlertDataSource() {
+ public AlertDataSource() {
super();
setCanMultiSort(true);
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 a82393c..30811cd 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
@@ -75,7 +75,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
-
private String selectedTab;
public DashboardsView() {
@@ -108,7 +107,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
removeMembers(getMembers());
this.dashboards = dashboards;
-
tabSet = new TabSet();
tabSet.setWidth100();
@@ -116,7 +114,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tabSet.setCanCloseTabs(true);
-
editButton = new IButton(editMode ? "View Mode" : "Edit Mode");
editButton.setAutoFit(true);
editButton.addClickHandler(new ClickHandler() {
@@ -127,7 +124,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
});
-
final IButton newDashboardButton = new IButton("New Dashboard");
newDashboardButton.setAutoFit(true);
newDashboardButton.addClickHandler(new ClickHandler() {
@@ -142,7 +138,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tabSet.setTabBarControls(buttons);
-
tabSet.addTabSelectedHandler(new TabSelectedHandler() {
public void onTabSelected(TabSelectedEvent tabSelectedEvent) {
History.newItem("Dashboard/" + tabSelectedEvent.getTab().getTitle(), false);
@@ -159,7 +154,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tab.setPane(dashboardView);
tab.setCanClose(true);
-
tabSet.addTab(tab);
if (dashboard.getName().equals(selectedTab)) {
tabSet.selectTab(tab);
@@ -169,15 +163,16 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tabSet.addCloseClickHandler(new CloseClickHandler() {
public void onCloseClick(final TabCloseClickEvent tabCloseClickEvent) {
final DashboardView dashboardView = (DashboardView) tabCloseClickEvent.getTab().getPane();
- SC.ask("Are you sure you want to delete [" + tabCloseClickEvent.getTab().getTitle() + "]?", new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- if (aBoolean) {
- dashboardView.delete();
- } else {
- tabCloseClickEvent.cancel();
+ SC.ask("Are you sure you want to delete [" + tabCloseClickEvent.getTab().getTitle() + "]?",
+ new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+ if (aBoolean) {
+ dashboardView.delete();
+ } else {
+ tabCloseClickEvent.cancel();
+ }
}
- }
- });
+ });
}
});
@@ -185,7 +180,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
-
protected Dashboard getDefaultDashboard() {
Dashboard dashboard = new Dashboard();
@@ -194,7 +188,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
dashboard.setColumnWidths("32%", "68%");
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
-
DashboardPortlet summary = new DashboardPortlet("Inventory Summary", InventorySummaryView.KEY, 230);
dashboard.addPortlet(summary, 0, 0);
@@ -202,40 +195,46 @@ public class DashboardsView extends VLayout implements BookmarkableView {
dashboard.addPortlet(tagCloud, 0, 1);
// Experimental
-// StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
-// col2.add(platformSummary);
-
+ // StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
+ // col2.add(platformSummary);
DashboardPortlet welcome = new DashboardPortlet("Welcome To RHQ", MessagePortlet.KEY, 180);
- welcome.getConfiguration().put(new PropertySimple("message", "<h1>Welcome to RHQ</h1>\n" +
- "<p>The RHQ project is an abstraction and plug-in based systems management suite that provides " +
- "extensible and integrated systems management for multiple products and platforms across a set " +
- "of core features. The project is designed with layered modules that provide a flexible " +
- "architecture for deployment. It delivers a core user interface that delivers audited and " +
- "historical management across an entire enterprise. A Server/Agent architecture provides " +
- "remote management and plugins implement all specific support for managed products.</p>\n" +
- "<p>This default dashboard can be edited by clicking the \"edit mode\" button above.</p>"));
+ welcome.getConfiguration().put(
+ new PropertySimple("message", "<h1>Welcome to RHQ</h1>\n"
+ + "<p>The RHQ project is an abstraction and plug-in based systems management suite that provides "
+ + "extensible and integrated systems management for multiple products and platforms across a set "
+ + "of core features. The project is designed with layered modules that provide a flexible "
+ + "architecture for deployment. It delivers a core user interface that delivers audited and "
+ + "historical management across an entire enterprise. A Server/Agent architecture provides "
+ + "remote management and plugins implement all specific support for managed products.</p>\n"
+ + "<p>This default dashboard can be edited by clicking the \"edit mode\" button above.</p>"));
dashboard.addPortlet(welcome, 1, 0);
DashboardPortlet news = new DashboardPortlet("RHQ News", MashupPortlet.KEY, 320);
- news.getConfiguration().put(new PropertySimple("address", "http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
+ news.getConfiguration().put(
+ new PropertySimple("address", "http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
dashboard.addPortlet(news, 1, 1);
-//
+ //
DashboardPortlet discoveryQueue = new DashboardPortlet("Discovery Queue", AutodiscoveryPortlet.KEY, 250);
dashboard.addPortlet(discoveryQueue, 1, 2);
-
DashboardPortlet recentAlerts = new DashboardPortlet("Recent Alerts", RecentAlertsPortlet.KEY, 250);
dashboard.addPortlet(recentAlerts, 1, 3);
DashboardPortlet recentlyAdded = new DashboardPortlet("Recently Added Resources", RecentlyAddedView.KEY, 250);
dashboard.addPortlet(recentlyAdded, 1, 4);
+ // DashboardPortlet operations = new DashboardPortlet("Operations", RecentlyAddedView.KEY, 250);
+ // dashboard.addPortlet(operations, 1, 5);
+
+ // DashboardPortlet hasAlertsCurrentlyUnavailable = new DashboardPortlet("Has Alerts or Currently Unavailable",
+ // UnavailabilityPortlet.KEY, 250);
+ // dashboard.addPortlet(hasAlertsCurrentlyUnavailable, 1, 5);
+
return dashboard;
}
-
public void addNewDashboard() {
Dashboard dashboard = new Dashboard();
@@ -276,7 +275,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
editButton.setTitle(editMode ? "View Mode" : "Edit Mode");
dashboardView.setEditMode(editMode);
-
}
});
}
@@ -288,15 +286,18 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
}
-
public void renderView(ViewPath viewPath) {
if (!viewPath.isEnd()) {
selectedTab = viewPath.getCurrent().getPath();
+ System.out.println("#################:" + selectedTab + ":tabset:" + tabSet);
+ // if (tabSet != null) {
for (Tab tab : tabSet.getTabs()) {
- if (selectedTab.equals(tab.getTitle())) {
+ // if (selectedTab.equals(tab.getTitle())) {
+ if (tab.getTitle().equals(selectedTab)) {
tabSet.selectTab(tab);
}
}
+ // }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/UnavailabilityPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/UnavailabilityPortlet.java
new file mode 100644
index 0000000..12cd480
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/UnavailabilityPortlet.java
@@ -0,0 +1,91 @@
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts;
+
+/*
+ * 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.
+ */
+
+import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
+import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.resource.ProblemResourcesDataSource;
+
+/**
+ * A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s,
+ * and Resources reported unavailable.
+ *
+ * @author Simeon Pinder
+ */
+public class UnavailabilityPortlet extends VLayout implements Portlet {
+
+ public static final String KEY = "Currently Unavailable";
+ private static final String TITLE = KEY;
+
+ public UnavailabilityPortlet() {
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ // Add the list table as the top half of the view.
+ ListGrid listGrid = new ListGrid();
+ listGrid.setDataSource(new ProblemResourcesDataSource());
+ listGrid.setAutoFetchData(true);
+ listGrid.setTitle(TITLE);
+ listGrid.setResizeFieldsInRealTime(true);
+ // 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>";
+ // }
+ // });
+ addMember(listGrid);
+
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ // TODO implement this.
+
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new HTMLFlow("This portlet displays resources that have reported Down availability.");
+ }
+
+ public DynamicForm getCustomSettingsForm() {
+ return null;
+ }
+
+ public static final class Factory implements PortletViewFactory {
+ public static PortletViewFactory INSTANCE = new Factory();
+
+ public final Portlet getInstance() {
+ return GWT.create(UnavailabilityPortlet.class);
+ }
+ }
+
+}
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 f92e7d5..4c7fce5 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
@@ -28,6 +28,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageControl;
@@ -48,6 +49,8 @@ public interface ResourceGWTService extends RemoteService {
List<RecentlyAddedResourceComposite> findRecentlyAddedResources(long ctime, int maxItems);
+ List<ProblemResourceComposite> findProblemResources(ResourceCriteria criteria);
+
Resource getPlatformForResource(int resourceId);
List<Integer> uninventoryResources(int[] resourceIds);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
new file mode 100644
index 0000000..470faf1
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
@@ -0,0 +1,145 @@
+package org.rhq.enterprise.gui.coregui.client.resource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.DSDataFormat;
+import com.smartgwt.client.types.DSProtocol;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+public class ProblemResourcesDataSource extends DataSource {
+ public final String resource = "resource";
+ public final String location = "location";
+ public final String alerts = "alerts";
+ public final String available = "available";
+
+ /** Build list of fields for the datasource and then adds them to it.
+ */
+ public ProblemResourcesDataSource() {
+ setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ setDataFormat(DSDataFormat.CUSTOM);
+
+ DataSourceTextField resourceField = new DataSourceTextField(resource, "Resource");
+ resourceField.setPrimaryKey(true);
+
+ DataSourceTextField locationField = new DataSourceTextField(location, "Location");
+
+ DataSourceTextField alertsField = new DataSourceTextField(alerts, "Alerts");
+
+ DataSourceTextField availablilityField = new DataSourceTextField(available, "Current Availability");
+
+ setFields(resourceField, locationField, alertsField, availablilityField);
+ }
+
+ /* Intercept DSRequest object to pipe into custom fetch request.
+ * (non-Javadoc)
+ * @see com.smartgwt.client.data.DataSource#transformRequest(com.smartgwt.client.data.DSRequest)
+ */
+ protected Object transformRequest(DSRequest request) {
+ DSResponse response = new DSResponse();
+ response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
+ // Assume success
+ response.setStatus(0);
+ switch (request.getOperationType()) {
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
+ }
+
+ return request.getData();
+ }
+
+ /** Fetch the ProblemResource data, and populate the response object appropriately.
+ *
+ * @param request incoming request
+ * @param response outgoing response
+ */
+ public void executeFetch(final DSRequest request, final DSResponse response) {
+
+ ResourceCriteria c = new ResourceCriteria();
+ c.addFilterCurrentAvailability(AvailabilityType.DOWN);
+
+ // GWTServiceLookup.getResourceService().findRecentlyAddedResources(0, 100,
+ GWTServiceLookup.getResourceService().findProblemResources(c,
+ // new AsyncCallback<List<RecentlyAddedResourceComposite>>() {
+ new AsyncCallback<List<ProblemResourceComposite>>() {
+ public void onFailure(Throwable throwable) {
+ CoreGUI.getErrorHandler().handleError("Failed to load unavailable resources", throwable);
+ }
+
+ // public void onSuccess(List<RecentlyAddedResourceComposite> recentlyAddedList) {
+ public void onSuccess(List<ProblemResourceComposite> problemResourcesList) {
+ // List<RecentlyAddedResourceComposite> list = new ArrayList<RecentlyAddedResourceComposite>();
+ List<ProblemResourceComposite> list = new ArrayList<ProblemResourceComposite>();
+
+ // for (RecentlyAddedResourceComposite recentlyAdded : problemResourcesList) {
+ for (ProblemResourceComposite problemResource : problemResourcesList) {
+ list.add(problemResource);
+ // list.addAll(problemResource.getChildren());
+ }
+
+ // response.setData(buildNodes(list));
+ response.setData(buildList(list));
+ response.setTotalRows(list.size());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ //
+ // GWTServiceLookup.getResourceService().findResourcesByCriteria(c, new AsyncCallback<PageList<Resource>>() {
+ // public void onFailure(Throwable caught) {
+ // CoreGUI.getErrorHandler().handleError("Failed to load recently added resources data",caught);
+ // response.setStatus(DSResponse.STATUS_FAILURE);
+ // processResponse(request.getRequestId(), response);
+ // }
+ //
+ // public void onSuccess(PageList<Resource> result) {
+ // PageList<Resource> all = new PageList<Resource>();
+ //
+ // for (Resource root : result) {
+ // all.add(root);
+ // if (root.getChildResources() != null)
+ // all.addAll(root.getChildResources());
+ // }
+ //
+ //
+ // response.setData(buildNodes(all));
+ // response.setTotalRows(all.getTotalSize());
+ // processResponse(request.getRequestId(), response);
+ // }
+ // });
+ }
+
+ protected Record[] buildList(List<ProblemResourceComposite> list) {
+ ListGridRecord[] dataValues = null;
+ if (list != null) {
+ dataValues = new ListGridRecord[list.size()];
+ int indx = 0;
+ for (ProblemResourceComposite prc : list) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute(resource, prc.getResourceId());
+ record.setAttribute(location, prc.getResourceName());
+ record.setAttribute(alerts, prc.getNumAlerts());
+ // record.setAttribute(available, DateTimeFormat.getMediumDateTimeFormat().format(dateAdded));
+ record.setAttribute(available, prc.getAvailabilityType().getName());
+ dataValues[indx++] = record;
+ }
+ }
+ return dataValues;
+ }
+
+}
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 c10254e..c9196db 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
@@ -35,6 +35,7 @@ import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.ProblemResourceComposite;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageControl;
@@ -124,7 +125,7 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
public PageList<ResourceComposite> findResourceCompositesByCriteria(ResourceCriteria criteria) {
try {
PageList<ResourceComposite> result = resourceManager.findResourceCompositesByCriteria(getSessionSubject(),
- criteria);
+ criteria);
List<Resource> resources = new ArrayList<Resource>(result.size());
if (resources.size() > 1) {
@@ -138,6 +139,19 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
}
}
+ public List<ProblemResourceComposite> findProblemResources(ResourceCriteria criteria) {
+ List<ProblemResourceComposite> located = new ArrayList<ProblemResourceComposite>();
+ PageList<ResourceComposite> pageList = findResourceCompositesByCriteria(criteria);
+ if (!pageList.isEmpty()) {
+ for (ResourceComposite rc : pageList) {
+ ProblemResourceComposite prc = new ProblemResourceComposite(rc.getResource().getId(), rc.getResource()
+ .getName(), rc.getAvailability(), 0);
+ //TODO: spinder: replace last argument with alert count for this resource.
+ }
+ }
+ return located;
+ }
+
public List<Resource> getResourceLineage(int resourceId) {
return SerialUtility.prepare(resourceManager.getResourceLineage(resourceId),
"ResourceService.getResourceLineage");
@@ -166,6 +180,15 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
return platforms;
}
+ // @Override
+ // public List<ProblemResourceComposite> findProblemResources(long ctime, int maxItems) {
+ // List<ProblemResourceComposite> problems =
+ // resourceManager.findResourceCompositesByCriteria(getSessionSubject(), criteria)(
+ // getSessionSubject(), ctime, maxItems);
+ //
+ // return problems;
+ // }
+
public List<Integer> uninventoryResources(int[] resourceIds) {
return SerialUtility.prepare(resourceManager.uninventoryResources(getSessionSubject(), resourceIds),
"ResourceService.uninventoryResources");
@@ -195,12 +218,8 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
}
public Map<Resource, List<Resource>> getQueuedPlatformsAndServers(HashSet<InventoryStatus> statuses, PageControl pc) {
- return SerialUtility.prepare(
- discoveryBoss.getQueuedPlatformsAndServers(
- getSessionSubject(),
- EnumSet.copyOf(statuses),
- pc),
- "ResourceService.getQueuedPlatformsAndServers");
+ return SerialUtility.prepare(discoveryBoss.getQueuedPlatformsAndServers(getSessionSubject(), EnumSet
+ .copyOf(statuses), pc), "ResourceService.getQueuedPlatformsAndServers");
}
public void importResources(Integer[] resourceIds) {
@@ -214,5 +233,5 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
public void unignoreResources(Integer[] resourceIds) {
discoveryBoss.unignoreResources(getSessionSubject(), resourceIds);
}
-
+
}
\ No newline at end of file
13 years, 3 months
[rhq] 2 commits - modules/enterprise modules/plugins
by fdrabek
modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml | 1
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractManagedDeploymentComponent.java | 6 +++--
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java | 12 ++++++++--
3 files changed, 15 insertions(+), 4 deletions(-)
New commits:
commit 2817b52f6ecf08670242d62f381113969d78c8e9
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Thu Aug 26 09:21:24 2010 +0200
BZ-535208 Removed quartz-ra.rar. Nowhere in our code do we use ResourceAdapter("quartz-ra.rar")
We rely on going directly to the quartz API to setup jobs.
diff --git a/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml
index 477f62f..d45932d 100644
--- a/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml
@@ -647,6 +647,7 @@ rhq.autoinstall.public-endpoint-address=
<!-- Delete 'minimal' and 'all' config dirs... -->
<delete dir="${jboss.home}/server/minimal" />
<delete dir="${jboss.home}/server/all" />
+ <delete file="${jboss.home}/server/default/deploy/quartz-ra.rar" />
</target>
<target name="unzip-jbossws-native" unless="jbossws-native.uptodate">
commit 6475081857301ef290e610a1545c5ab9a7b9aa2d
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Thu Aug 26 09:15:38 2010 +0200
BZ-616071 Additional debug logging to identify state returned from ProfileService for management deployments and components.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractManagedDeploymentComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractManagedDeploymentComponent.java
index e7a1194..bd78958 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractManagedDeploymentComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractManagedDeploymentComponent.java
@@ -112,14 +112,16 @@ public abstract class AbstractManagedDeploymentComponent extends AbstractManaged
+ e.getLocalizedMessage());
return AvailabilityType.DOWN;
} catch (Throwable t) {
- log.debug("Could not get deployment state, cause: ", t);
+ log.debug("Could not get deployment state for " + this.deploymentType + " deployment '"
+ + this.deploymentName + "', cause: ", t);
return AvailabilityType.DOWN;
}
if (deploymentState == DeploymentState.STARTED) {
return AvailabilityType.UP;
} else {
- log.debug("Deployment was not STARTED, state was: " + deploymentState);
+ log.debug(this.deploymentType + " deployment '" + this.deploymentName +
+ "' was not running, state was: " + deploymentState);
return AvailabilityType.DOWN;
}
}
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java
index e4511fd..7c70bc7 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java
@@ -108,10 +108,18 @@ public class ManagedComponentComponent extends AbstractManagedComponent implemen
RunState runState;
try {
runState = getManagedComponent().getRunState();
- } catch (CannotConnectException e) {
+ } catch (Throwable t) {
+ log.debug("Could not get component state for " + this.componentType + " component '"
+ + this.componentName + "', cause: ", t);
+ return AvailabilityType.DOWN;
+ }
+ if (runState == RunState.RUNNING) {
+ return AvailabilityType.UP;
+ } else {
+ log.debug(this.componentType + " component '" + this.componentName + "' was not running, state" +
+ " was: " + runState);
return AvailabilityType.DOWN;
}
- return (runState == RunState.RUNNING) ? AvailabilityType.UP : AvailabilityType.DOWN;
}
public void start(ResourceContext<ProfileServiceComponent> resourceContext) throws Exception {
13 years, 3 months