modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
| 20 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
| 88 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
| 53 +++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
| 8
4 files changed, 106 insertions(+), 63 deletions(-)
New commits:
commit 7f771252b7e95536c474bad025d458d0ed5bd438
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 18 07:32:49 2010 -0500
add a third tree level - under destinations, you can now see all deployments made to
that dest.
if the deployment is live, you'll see a green, bold string "(live)" next
to the name of the deployment
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index f90d8b3..e0bd7e9 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -312,7 +312,11 @@ public class BundleView extends LocatableVLayout implements
BookmarkableView {
}
} else if (viewPath.getCurrent().getPath().equals("deployments"))
{
if (viewPath.isEnd()) {
- // TODO: where to go? I don't think this is a valid url right
now
+ // today we do not have an uber-view showing all deployments for a
bundle.
+ // if we did, it would show all deployments to all destinations for
all bundle versions.
+ // because that would be a very large list with a lot of stuff to
show, it was deemed
+ // too complex to be useful for users. thus, we have no
uber-deployments view. If we did,
+ // we would render it here.
} else {
// a specific deployment
//removeMembers(getMembers());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
index 7dd1e65..4bad6b9 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
@@ -86,10 +86,11 @@ public class BundleTreeDataSource extends RPCDataSource {
protected void executeFetch(final DSRequest request, final DSResponse response) {
String p = request.getCriteria().getAttribute("parentId");
- // load the bundles
if (p == null) {
+ // there is no parent - we are at the root of the tree
+ // get the top nodes (the bundles)
BundleCriteria criteria = new BundleCriteria();
criteria.fetchDestinations(true);
criteria.setPageControl(getPageControl(request));
@@ -107,7 +108,10 @@ public class BundleTreeDataSource extends RPCDataSource {
processResponse(request.getRequestId(), response);
}
});
+
} else {
+
+ // we are at an inner node, being asked to get the children of it
if (p.endsWith("_versions")) {
int bundleId = Integer.parseInt(p.substring(0,
p.indexOf("_")));
BundleVersionCriteria criteria = new BundleVersionCriteria();
@@ -125,6 +129,7 @@ public class BundleTreeDataSource extends RPCDataSource {
processResponse(request.getRequestId(), response);
}
});
+
} else if (p.endsWith("_deployments")) {
int bundleId = Integer.parseInt(p.substring(0,
p.indexOf("_")));
BundleDeploymentCriteria criteria = new BundleDeploymentCriteria();
@@ -141,10 +146,12 @@ public class BundleTreeDataSource extends RPCDataSource {
processResponse(request.getRequestId(), response);
}
});
+
} else if (p.endsWith("_destinations")) {
- int bundleId = Integer.parseInt(p.substring(0,
p.indexOf("_")));
+ final int bundleId = Integer.parseInt(p.substring(0,
p.indexOf("_")));
BundleDestinationCriteria criteria = new BundleDestinationCriteria();
criteria.addFilterBundleId(bundleId);
+ criteria.fetchDeployments(true);
bundleService.findBundleDestinationsByCriteria(criteria,
new AsyncCallback<PageList<BundleDestination>>() {
public void onFailure(Throwable caught) {
@@ -152,7 +159,7 @@ public class BundleTreeDataSource extends RPCDataSource {
}
public void onSuccess(PageList<BundleDestination> result)
{
- response.setData(buildRecords(result));
+ response.setData(buildRecordsForKnownBundle(result,
bundleId));
processResponse(request.getRequestId(), response);
}
});
@@ -162,22 +169,31 @@ public class BundleTreeDataSource extends RPCDataSource {
@Override
public Object copyValues(Record from) {
- return null; // TODO: Implement this method.
+ return null; // don't need this method.
}
@Override
public ListGridRecord[] buildRecords(Collection dataObjects) {
+ return buildRecordsForKnownBundle(dataObjects, null);
+ }
+
+ public ListGridRecord[] buildRecordsForKnownBundle(Collection dataObjects, Integer
bundleId) {
if (dataObjects == null) {
return null;
}
- List<ListGridRecord> records = new ArrayList<ListGridRecord>();
+ final List<ListGridRecord> records = new
ArrayList<ListGridRecord>();
for (Object item : dataObjects) {
+
+ // the resultant item is a direct node to build
records.add(copyValues(item));
+
+ // now build the children of the node
if (item instanceof Bundle) {
Bundle bundle = (Bundle) item;
+ // each bundle has two direct children - the versions and destinations
folders
TreeNode versionNode = new TreeNode(MSG.view_bundle_versions());
versionNode.setID(bundle.getId() + "_versions");
versionNode.setParentID(String.valueOf(bundle.getId()));
@@ -190,6 +206,15 @@ public class BundleTreeDataSource extends RPCDataSource {
deploymentsNode.setParentID(String.valueOf(bundle.getId()));
deploymentsNode.setName(MSG.view_bundle_destinations());
records.add(deploymentsNode);
+ } else if (item instanceof BundleDestination) {
+ BundleDestination dest = (BundleDestination) item;
+
+ // each destination has 0, 1 or more deployments
+ if (dest.getDeployments() != null) {
+ for (BundleDeployment deploy : dest.getDeployments()) {
+ records.add(copyValuesForKnownBundle(deploy, bundleId));
+ }
+ }
}
}
return records.toArray(new ListGridRecord[records.size()]);
@@ -197,6 +222,10 @@ public class BundleTreeDataSource extends RPCDataSource {
@Override
public ListGridRecord copyValues(Object from) {
+ return copyValuesForKnownBundle(from, null);
+ }
+
+ public ListGridRecord copyValuesForKnownBundle(Object from, Integer bundleId) {
TreeNode node = new TreeNode();
if (from instanceof Bundle) {
Bundle bundle = (Bundle) from;
@@ -214,19 +243,25 @@ public class BundleTreeDataSource extends RPCDataSource {
} else if (from instanceof BundleDeployment) {
BundleDeployment deployment = (BundleDeployment) from;
- node.setName(deployment.getName() + " (" +
deployment.getBundleVersion().getVersion() + ")");
- node.setID(deployment.getBundleVersion().getBundle().getId() +
"_deployments_" + deployment.getId());
- node.setParentID(deployment.getBundleVersion().getBundle().getId() +
"_deployments");
+ if (deployment.isLive()) {
+ node.setName("<span style=\"color: green; font-weight:
bold\">(live)</span> " + deployment.getName());
+ } else {
+ node.setName(deployment.getName());
+ }
+ node.setID(bundleId + "_deployments_" + deployment.getId());
+ node.setParentID(bundleId + "_destinations_" +
deployment.getDestination().getId());
node.setIsFolder(false);
node.setIcon("subsystems/bundle/BundleDeployment_16.png");
+
} else if (from instanceof BundleDestination) {
BundleDestination destination = (BundleDestination) from;
node.setName(destination.getName());
node.setID(destination.getBundle().getId() + "_destinations_" +
destination.getId());
node.setParentID(destination.getBundle().getId() +
"_destinations");
- node.setIsFolder(false);
+ node.setIsFolder(true);
node.setIcon("subsystems/bundle/BundleDestination_16.png");
}
+
return node;
}
}
commit f97b16484480fee641d73e80e1b9b9b711651cb4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 18 06:15:58 2010 -0500
add description, rearrange buttons and description field to be consistent across
pages.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index 548037b..2d40a23 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -42,6 +42,7 @@ import org.rhq.core.domain.tagging.Tag;
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.LinkManager;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
@@ -118,13 +119,13 @@ public class BundleDestinationView extends LocatableVLayout
implements Bookmarka
LinkItem bundleName = new LinkItem("bundle");
bundleName.setTitle(MSG.view_bundle_bundle());
- bundleName.setValue("#Bundles/Bundle/" + bundle.getId());
+ bundleName.setValue(LinkManager.getBundleLink(bundle.getId()));
bundleName.setLinkTitle(bundle.getName());
bundleName.setTarget("_self");
CanvasItem actionItem = new CanvasItem("actions");
actionItem.setColSpan(1);
- actionItem.setRowSpan(4);
+ actionItem.setRowSpan(5);
actionItem.setShowTitle(false);
actionItem.setCanvas(getActionLayout(form.extendLocatorId("actions")));
@@ -133,14 +134,17 @@ public class BundleDestinationView extends LocatableVLayout
implements Bookmarka
LinkItem destinationGroup = new LinkItem("group");
destinationGroup.setTitle(MSG.view_bundle_dest_group());
- destinationGroup.setValue("#ResourceGroup/" +
destination.getGroup().getId());
+
destinationGroup.setValue(LinkManager.getResourceGroupLink(destination.getGroup().getId()));
destinationGroup.setLinkTitle(destination.getGroup().getName());
destinationGroup.setTarget("_self");
StaticTextItem path = new StaticTextItem("path",
MSG.view_bundle_dest_deployDir());
path.setValue(destination.getDeployDir());
- form.setFields(bundleName, actionItem, created, destinationGroup, path);
+ StaticTextItem description = new StaticTextItem("description",
MSG.common_title_description());
+ description.setValue(destination.getDescription());
+
+ form.setFields(bundleName, actionItem, created, destinationGroup, path,
description);
return form;
}
@@ -176,9 +180,6 @@ public class BundleDestinationView extends LocatableVLayout implements
Bookmarka
new BundleDeployWizard(destination).startWizard();
}
});
- if (!canManageBundles) {
- deployButton.setDisabled(true);
- }
actionLayout.addMember(deployButton);
IButton revertButton = new
LocatableIButton(actionLayout.extendLocatorId("Revert"),
MSG.view_bundle_revert());
@@ -188,10 +189,13 @@ public class BundleDestinationView extends LocatableVLayout
implements Bookmarka
new BundleRevertWizard(destination).startWizard();
}
});
+ actionLayout.addMember(revertButton);
+
if (!canManageBundles) {
+ deployButton.setDisabled(true);
revertButton.setDisabled(true);
}
- actionLayout.addMember(revertButton);
+
return actionLayout;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index 1c9dc47..f90d8b3 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -27,6 +27,7 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -173,8 +174,11 @@ public class BundleView extends LocatableVLayout implements
BookmarkableView {
form.setGroupTitle(MSG.common_title_summary());
form.setPadding(5);
- StaticTextItem descriptionItem = new StaticTextItem("description",
MSG.common_title_description());
- descriptionItem.setValue(bundle.getDescription());
+ CanvasItem actionItem = new CanvasItem("actions");
+ actionItem.setColSpan(1);
+ actionItem.setRowSpan(3);
+ actionItem.setShowTitle(false);
+ actionItem.setCanvas(getActionCanvas());
StaticTextItem versionCountItem = new StaticTextItem("versionCount",
MSG.view_bundle_list_versionsCount());
versionCountItem.setValue(bundle.getBundleVersions() != null ?
bundle.getBundleVersions().size() : 0);
@@ -183,40 +187,17 @@ public class BundleView extends LocatableVLayout implements
BookmarkableView {
.view_bundle_list_destinationsCount());
destinationsCountItem.setValue(bundle.getDestinations() != null ?
bundle.getDestinations().size() : 0);
- form.setFields(descriptionItem, getActionItem(), versionCountItem,
destinationsCountItem);
+ StaticTextItem descriptionItem = new StaticTextItem("description",
MSG.common_title_description());
+ descriptionItem.setValue(bundle.getDescription());
+
+ form.setFields(versionCountItem, actionItem, destinationsCountItem,
descriptionItem);
return form;
}
- private CanvasItem getActionItem() {
+ private Canvas getActionCanvas() {
VLayout layout = new LocatableVLayout(form.extendLocatorId("Actions"),
10);
- IButton deleteButton = new
LocatableIButton(form.extendLocatorId("Delete"), MSG.common_button_delete());
- deleteButton.setIcon("subsystems/bundle/BundleAction_Delete_16.png");
- deleteButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- SC.ask(MSG.view_bundle_list_deleteConfirm(), new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- if (aBoolean) {
- bundleManager.deleteBundle(bundleBeingViewed, new
AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_bundle_list_deleteFailure(bundle.getName()), caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new
Message(MSG.view_bundle_list_deleteSuccessful(bundle.getName()),
- Message.Severity.Info));
- History.newItem("Bundles"); // Bundle is
deleted, go back to all bundles view
- }
- });
- }
- }
- });
- }
- });
-
IButton deployButton = new
LocatableIButton(form.extendLocatorId("Deploy"), MSG.view_bundle_deploy());
deployButton.setIcon("subsystems/bundle/BundleAction_Deploy_16.png");
deployButton.addClickHandler(new ClickHandler() {
@@ -244,21 +225,41 @@ public class BundleView extends LocatableVLayout implements
BookmarkableView {
});
}
});
+ layout.addMember(deployButton);
+
+ IButton deleteButton = new
LocatableIButton(form.extendLocatorId("Delete"), MSG.common_button_delete());
+ deleteButton.setIcon("subsystems/bundle/BundleAction_Delete_16.png");
+ deleteButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ SC.ask(MSG.view_bundle_list_deleteConfirm(), new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+ if (aBoolean) {
+ bundleManager.deleteBundle(bundleBeingViewed, new
AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.view_bundle_list_deleteFailure(bundle.getName()), caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new
Message(MSG.view_bundle_list_deleteSuccessful(bundle.getName()),
+ Message.Severity.Info));
+ History.newItem("Bundles"); // Bundle is
deleted, go back to all bundles view
+ }
+ });
+ }
+ }
+ });
+ }
+ });
+ layout.addMember(deleteButton);
if (!canManageBundles) {
- deleteButton.setDisabled(true);
deployButton.setDisabled(true);
+ deleteButton.setDisabled(true);
}
- layout.addMember(deleteButton);
- layout.addMember(deployButton);
-
- CanvasItem actionItem = new CanvasItem("actions");
- actionItem.setColSpan(1);
- actionItem.setRowSpan(3);
- actionItem.setShowTitle(false);
- actionItem.setCanvas(layout);
- return actionItem;
+ return layout;
}
public void renderView(final ViewPath viewPath) {
@@ -311,8 +312,7 @@ public class BundleView extends LocatableVLayout implements
BookmarkableView {
}
} else if (viewPath.getCurrent().getPath().equals("deployments"))
{
if (viewPath.isEnd()) {
- // TODO: go to deployments tab for the bundle
- // deployments list screen
+ // TODO: where to go? I don't think this is a valid url right
now
} else {
// a specific deployment
//removeMembers(getMembers());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
index 2985f06..284ef3c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
@@ -124,16 +124,16 @@ public class BundleVersionView extends LocatableVLayout implements
BookmarkableV
StaticTextItem versionItem = new StaticTextItem("version",
MSG.common_title_version());
versionItem.setValue(version.getVersion());
- StaticTextItem descriptionItem = new StaticTextItem("description",
MSG.common_title_description());
- descriptionItem.setValue(version.getDescription());
-
StaticTextItem liveDeploymentsItem = new StaticTextItem("deployments",
MSG.view_bundle_deployments());
liveDeploymentsItem.setValue(version.getBundleDeployments().size());
StaticTextItem filesItems = new StaticTextItem("files",
MSG.view_bundle_files());
filesItems.setValue(version.getBundleFiles().size());
- form.setFields(versionItem, descriptionItem, liveDeploymentsItem, filesItems);
+ StaticTextItem descriptionItem = new StaticTextItem("description",
MSG.common_title_description());
+ descriptionItem.setValue(version.getDescription());
+
+ form.setFields(versionItem, liveDeploymentsItem, filesItems, descriptionItem);
return form;
}