modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleType.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java | 8
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDefinition.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 23 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java | 135 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java | 59 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java | 45 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 63 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 206 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java | 26 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java | 188 +++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java | 91 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java | 199 +++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java | 84 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/store/StoredPortlet.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java | 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java | 16
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleDeployment_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleDeployment_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleVersion_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleVersion_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Bundle_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Bundle_24.png |binary
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java | 74 ++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java | 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java | 5
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 4
44 files changed, 1220 insertions(+), 151 deletions(-)
New commits:
commit 13f0733ccb8ca2b2bead6d9057ebbffe17cd4eff
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Apr 30 17:20:32 2010 -0400
icons for the bundle area
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleDeployment_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleDeployment_16.png
new file mode 100644
index 0000000..78a92d9
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleDeployment_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleDeployment_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleDeployment_24.png
new file mode 100644
index 0000000..b2ef100
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleDeployment_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleVersion_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleVersion_16.png
new file mode 100644
index 0000000..6b34692
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleVersion_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleVersion_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleVersion_24.png
new file mode 100644
index 0000000..442f70b
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleVersion_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Bundle_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Bundle_16.png
new file mode 100644
index 0000000..78f3f34
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Bundle_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Bundle_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Bundle_24.png
new file mode 100644
index 0000000..6605abb
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Bundle_24.png differ
commit cc3a928d78a8dccfdec4df1a653ac7f0af1e0305
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Apr 30 17:18:25 2010 -0400
First version of the bundle tree
updated bundle and bundle version screens
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
index c3d82b8..8ad5d1f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
@@ -72,4 +72,12 @@ public class ViewPath {
public boolean isNext(ViewId providedViewId) {
return ((index + 1) < viewPath.size() && providedViewId != null && getNext().equals(providedViewId));
}
+
+ public boolean isNextEnd() {
+ return viewPath.size() <= index+1;
+ }
+
+ public int viewsLeft() {
+ return viewPath.size() - index - 1;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 4741f56..e2907b5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -19,16 +19,30 @@
package org.rhq.enterprise.gui.coregui.client.bundle;
import com.smartgwt.client.types.VisibilityMode;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
+import com.smartgwt.client.widgets.tree.TreeNode;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleView;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView;
+import org.rhq.enterprise.gui.coregui.client.bundle.tree.BundleTreeView;
/**
* @author Greg Hinkle
*/
-public class BundleTopView extends HLayout {
+public class BundleTopView extends HLayout implements BookmarkableView {
+ private BundleTreeView bundleTreeView;
+
+ private Canvas contentCanvas;
+
+ private ViewId currentNextPath;
+ private BundleView bundleView;
public BundleTopView() {
setWidth100();
@@ -45,12 +59,51 @@ public class BundleTopView extends HLayout {
sectionStack.setWidth(250);
sectionStack.setHeight100();
- sectionStack.addSection(new SectionStackSection("Bundles"));
- sectionStack.addSection(new SectionStackSection("Repositories"));
- sectionStack.addSection(new SectionStackSection("Providers"));
+ SectionStackSection bundlesSection = new SectionStackSection("Bundles");
+ bundleTreeView = new BundleTreeView();
+ bundlesSection.addItem(bundleTreeView);
+ sectionStack.addSection(bundlesSection);
+
+ SectionStackSection repositoriesSection = new SectionStackSection("Repositories");
+ sectionStack.addSection(repositoriesSection);
+
+ SectionStackSection providersSection = new SectionStackSection("Providers");
+ sectionStack.addSection(providersSection);
addMember(sectionStack);
- addMember(new BundlesListView());
+ contentCanvas = new Canvas();
+ contentCanvas.setWidth100();
+ contentCanvas.setHeight100();
+ addMember(contentCanvas);
+
+ }
+
+ public void setContent(Canvas newContent) {
+ if (contentCanvas.getChildren().length > 0)
+ contentCanvas.getChildren()[0].destroy();
+ contentCanvas.addChild(newContent);
+ contentCanvas.markForRedraw();
+ }
+
+
+ public void renderView(ViewPath viewPath) {
+
+ bundleTreeView.selectPath(viewPath);
+
+
+ if (viewPath.isEnd()) {
+ currentNextPath = null;
+ setContent(new BundlesListView());
+ } else if (viewPath.getCurrent().getPath().equals("Bundle")) {
+ if (!viewPath.getNext().equals(currentNextPath)) {
+ currentNextPath = viewPath.getNext();
+ bundleView = new BundleView();
+ setContent(bundleView);
+ bundleView.renderView(viewPath.next());
+ } else {
+ bundleView.renderView(viewPath.next());
+ }
+ }
}
}
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 be0e415..cd23e12 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
@@ -18,36 +18,52 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.list;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.types.Alignment;
+import java.util.HashSet;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
-import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.criteria.BundleCriteria;
+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.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.bundle.version.BundleVersionView;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
+import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-public class BundleView extends VLayout {
+public class BundleView extends VLayout implements BookmarkableView {
private int bundleBeingViewed = 0;
- private Label message = new Label("Select a bundle...");
- private VLayout canvas;
private HeaderLabel headerLabel;
- private StaticTextItem descriptionItem;
- private StaticTextItem latestVersionItem;
+ DynamicForm form;
private Table bundleVersionsTable;
+ private Bundle bundle;
+
public BundleView() {
super();
+ setWidth100();
+ setHeight100();
setPadding(10);
setOverflow(Overflow.AUTO);
}
@@ -55,15 +71,14 @@ public class BundleView extends VLayout {
@Override
protected void onInit() {
super.onInit();
- addMember(message);
- addMember(buildCanvas());
- canvas.hide();
+
}
- private Canvas buildCanvas() {
- canvas = new VLayout();
+ public void viewBundle(Bundle bundle, ViewId nextViewId) {
+ this.bundle = bundle;
+
+ headerLabel = new HeaderLabel("<img src=\"" + Canvas.getImgURL("subsystems/bundle/Bundle_24.png") + "\"/> " + bundle.getName());
- headerLabel = new HeaderLabel("<bundle name>");
TabSet tabs = new TabSet();
Tab summaryTab = createSummaryTab();
@@ -75,9 +90,18 @@ public class BundleView extends VLayout {
Tab deploymentsTab = createDeploymentsTab();
tabs.addTab(deploymentsTab);
- canvas.addMember(headerLabel);
- canvas.addMember(tabs);
- return canvas;
+ addMember(headerLabel);
+ addMember(tabs);
+
+ if (nextViewId != null) {
+ if (nextViewId.getPath().equals("versions")) {
+ tabs.selectTab(versionsTab);
+ } else if (nextViewId.getPath().equals("deployments")) {
+ tabs.selectTab(deploymentsTab);
+ }
+ }
+
+ markForRedraw();
}
private Tab createDeploymentsTab() {
@@ -96,6 +120,12 @@ public class BundleView extends VLayout {
bundleVersionsTable.getListGrid().getField("id").setWidth("60");
bundleVersionsTable.getListGrid().getField("name").setWidth("25%");
+ bundleVersionsTable.getListGrid().getField("name").setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ return "<a href=\"#Bundles/Bundle/" + bundle.getId() + "/versions/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ }
+ });
+
bundleVersionsTable.getListGrid().getField("version").setWidth("10%");
bundleVersionsTable.getListGrid().getField("fileCount").setWidth("10%");
bundleVersionsTable.getListGrid().getField("description").setWidth("*");
@@ -104,73 +134,117 @@ public class BundleView extends VLayout {
bundleVersionsTable.getListGrid().setSelectionAppearance(SelectionAppearance.ROW_STYLE);
versionsTab.setPane(bundleVersionsTable);
+
+ // versions tab
+ BundleVersionDataSource bvDataSource;
+ bvDataSource = (BundleVersionDataSource) bundleVersionsTable.getDataSource();
+ bvDataSource.setBundleId(bundleBeingViewed);
+ bvDataSource.fetchData();
+ bundleVersionsTable.getListGrid().invalidateCache(); // TODO: is there a better way to refresh?
+
return versionsTab;
}
private Tab createSummaryTab() {
Tab summaryTab = new Tab("Summary");
- DynamicForm form = new DynamicForm();
+ form = new DynamicForm();
+ form.setWidth("50%");
+ form.setWrapItemTitles(false);
form.setPadding(10);
- descriptionItem = new StaticTextItem("description", "Description");
- descriptionItem.setTitleAlign(Alignment.LEFT);
- descriptionItem.setAlign(Alignment.LEFT);
+ StaticTextItem descriptionItem = new StaticTextItem("description", "Description");
descriptionItem.setWrap(false);
- descriptionItem.setValue("");
- latestVersionItem = new StaticTextItem("latestVersion", "Latest Version");
- latestVersionItem.setTitleAlign(Alignment.LEFT);
- latestVersionItem.setAlign(Alignment.LEFT);
+ StaticTextItem versionCountItem = new StaticTextItem("versionCount", "Version Count");
+
+
+ StaticTextItem latestVersionItem = new StaticTextItem("latestVersion", "Latest Version");
latestVersionItem.setWrap(false);
- latestVersionItem.setValue("");
- form.setFields(descriptionItem, latestVersionItem);
- summaryTab.setPane(form);
+
+ StaticTextItem liveDeployments = new StaticTextItem("liveDeployments", "Live Deployments");
+
+
+ form.setFields(descriptionItem, versionCountItem, latestVersionItem, liveDeployments);
+
+
+ form.setValue("description", bundle.getDescription());
+ form.setValue("versionCount", bundle.getBundleVersions() != null ? bundle.getBundleVersions().size() : 0);
+
+
+ HLayout layout = new HLayout();
+ layout.setWidth100();
+
+ layout.addMember(form);
+
+ TagEditorView tagEditor = new TagEditorView(bundle.getTags(), false, new TagsChangedCallback() {
+ public void tagsChanged(HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateBundleTags(bundleBeingViewed, tags, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update bundle's tags", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Bundle tags updated", Message.Severity.Info));
+ }
+ });
+ }
+ });
+ layout.addMember(tagEditor);
+
+
+ summaryTab.setPane(layout);
+
return summaryTab;
}
- public void viewRecord(Record record) {
- if (record == null) {
- viewNone();
- } else {
- final BundleWithLatestVersionComposite object;
- object = (BundleWithLatestVersionComposite) record.getAttributeAsObject("object");
-
- if (object == null) {
- viewNone();
- } else {
- if (bundleBeingViewed != object.getBundleId()) {
- bundleBeingViewed = object.getBundleId();
-
- // summary tab
- headerLabel.setContents(object.getBundleName());
- latestVersionItem.setValue(object.getLatestVersion());
- descriptionItem.setValue(object.getBundleDescription());
-
- // versions tab
- BundleVersionDataSource bvDataSource;
- bvDataSource = (BundleVersionDataSource) bundleVersionsTable.getDataSource();
- bvDataSource.setBundleId(bundleBeingViewed);
- bvDataSource.fetchData();
- bundleVersionsTable.getListGrid().invalidateCache(); // TODO: is there a better way to refresh?
- }
- try {
- message.hide();
- canvas.show();
- markForRedraw();
- } catch (Throwable t) {
- CoreGUI.getErrorHandler().handleError("Cannot view bundle record", t);
+
+ public void renderView(final ViewPath viewPath) {
+ int bundleId = Integer.parseInt(viewPath.getCurrent().getPath());
+
+ final ViewId viewId = viewPath.getCurrent();
+
+ viewPath.next();
+ if (viewPath.isEnd() || viewPath.isNextEnd()) {
+
+ if (bundleBeingViewed != bundleId) {
+ bundleBeingViewed = bundleId;
+
+ BundleCriteria criteria = new BundleCriteria();
+ criteria.addFilterId(bundleId);
+ criteria.fetchBundleVersions(true);
+ criteria.fetchTags(true);
+
+ GWTServiceLookup.getBundleService().findBundlesByCriteria(criteria,
+ new AsyncCallback<PageList<Bundle>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load bundle", caught);
+ }
+
+ public void onSuccess(PageList<Bundle> result) {
+ Bundle bundle = result.get(0);
+ viewBundle(bundle, viewPath.getCurrent());
+ viewId.getBreadcrumbs().add(new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
+ CoreGUI.refreshBreadCrumbTrail();
+ }
+ });
+ }
+ } else {
+ if (viewPath.getCurrent().getPath().equals("versions")) {
+ if (viewPath.isEnd()) {
+
+ // versions list screen
+ } else {
+ // one version
+ removeMembers(getMembers());
+ BundleVersionView view = new BundleVersionView();
+ addMember(view);
+ view.renderView(viewPath.next());
}
}
}
}
-
- public void viewNone() {
- message.show();
- canvas.hide();
- markForRedraw();
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 21b04bf..2d49a44 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -22,6 +22,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
@@ -49,19 +50,29 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
*/
public class BundlesListView extends VLayout {
+ public BundlesListView() {
+ setWidth100();
+ setHeight100();
+ }
+
@Override
protected void onDraw() {
super.onDraw();
final Table table = new Table("Bundles");
- table.setHeight("50%");
- table.setShowResizeBar(true);
- table.setResizeBarTarget("next");
table.setDataSource(new BundlesWithLatestVersionDataSource());
table.getListGrid().getField("id").setWidth("60");
table.getListGrid().getField("name").setWidth("25%");
+ table.getListGrid().getField("name").setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ return "<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ }
+ });
+
+
+
table.getListGrid().getField("description").setWidth("25%");
table.getListGrid().getField("latestVersion").setWidth("25%");
table.getListGrid().getField("versionsCount").setWidth("*");
@@ -154,14 +165,5 @@ public class BundlesListView extends VLayout {
addMember(table);
- final BundleView bundleView = new BundleView();
- bundleView.setOverflow(Overflow.AUTO);
- addMember(bundleView);
-
- table.getListGrid().addRecordClickHandler(new RecordClickHandler() {
- public void onRecordClick(RecordClickEvent event) {
- bundleView.viewRecord(event.getRecord());
- }
- });
}
}
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
new file mode 100644
index 0000000..e20dc58
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeDataSource.java
@@ -0,0 +1,188 @@
+/*
+ * 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.bundle.tree;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceImageField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.criteria.BundleCriteria;
+import org.rhq.core.domain.criteria.BundleVersionCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundleTreeDataSource extends RPCDataSource {
+
+ private BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
+
+
+
+ public BundleTreeDataSource() {
+ DataSourceField idDataField = new DataSourceTextField("id", "ID");
+ idDataField.setPrimaryKey(true);
+
+ DataSourceTextField nameDataField = new DataSourceTextField("name", "Name");
+ nameDataField.setCanEdit(false);
+
+ DataSourceTextField descriptionDataField = new DataSourceTextField("description", "Description");
+ descriptionDataField.setCanEdit(false);
+
+ DataSourceTextField parentIdField = new DataSourceTextField("parentId", "Parent ID");
+ parentIdField.setForeignKey("id");
+
+
+ setFields(idDataField, nameDataField, parentIdField);
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ String p = request.getCriteria().getAttribute("parentId");
+ // load the bundles
+
+ if (p == null) {
+
+ BundleCriteria criteria = new BundleCriteria();
+ criteria.setPageControl(getPageControl(request));
+
+ bundleService.findBundlesByCriteria(criteria, new AsyncCallback<PageList<Bundle>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load bundle data", caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<Bundle> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ } else {
+ if (p.endsWith(":versions")) {
+ int bundleId = Integer.parseInt(p.substring(0, p.indexOf(":")));
+ BundleVersionCriteria criteria = new BundleVersionCriteria();
+ criteria.addFilterBundleId(bundleId);
+ bundleService.findBundleVersionsByCriteria(criteria, new AsyncCallback<PageList<BundleVersion>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load bundle data", caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<BundleVersion> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ }
+
+
+ }
+
+ @Override
+ public Object copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
+ }
+
+ @Override
+ public ListGridRecord[] buildRecords(Collection list) {
+ if (list == null) {
+ return null;
+ }
+
+ ArrayList<ListGridRecord> records = new ArrayList<ListGridRecord>();
+
+ int i = 0;
+ for (Object item : list) {
+ records.add(copyValues(item));
+ if (item instanceof Bundle) {
+ Bundle bundle = (Bundle) item;
+
+ TreeNode versionNode = new TreeNode("Versions");
+ versionNode.setID(bundle.getId() + ":versions");
+ versionNode.setParentID(String.valueOf(bundle.getId()));
+ versionNode.setName("Versions");
+ versionNode.setAttribute("name", "Versions");
+ records.add(versionNode);
+
+ TreeNode deploymentsNode = new TreeNode("Deployments");
+ deploymentsNode.setID(bundle.getId() + ":deployments");
+ deploymentsNode.setParentID(String.valueOf(bundle.getId()));
+ deploymentsNode.setName("Deployments");
+ records.add(deploymentsNode);
+
+ }
+
+ }
+ return records.toArray(new ListGridRecord[records.size()]);
+ }
+
+
+ @Override
+ public ListGridRecord copyValues(Object from) {
+ TreeNode node = new TreeNode();
+ if (from instanceof Bundle) {
+ Bundle bundle = (Bundle) from;
+ node.setID(String.valueOf(bundle.getId()));
+ node.setName(bundle.getName());
+ node.setIcon("subsystems/bundle/Bundle_16.png");
+
+ } else if (from instanceof BundleVersion) {
+ BundleVersion version = (BundleVersion) from;
+ node.setName(version.getName() + " (" + version.getVersion() + ")");
+ node.setID(version.getBundle().getId() + ":versions:" + version.getId());
+ node.setParentID(version.getBundle().getId() + ":versions");
+ node.setIsFolder(false);
+ node.setIcon("subsystems/bundle/BundleVersion_16.png");
+
+ } else if (from instanceof BundleDeployment) {
+ BundleDeployment deployment = (BundleDeployment) from;
+ node.setName(deployment.getName() + " (" + deployment.getBundleVersion().getVersion() + ")");
+ node.setParentID(deployment.getBundleVersion().getBundle().getId() + ":deployments:" + deployment.getId());
+ node.setParentID(deployment.getBundleVersion().getBundle().getId() + ":deployments");
+ node.setIsFolder(false);
+ node.setIcon("subsystems/bundle/BundleDeployment_16.png");
+ }
+ return node;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
new file mode 100644
index 0000000..effd488
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
@@ -0,0 +1,91 @@
+/*
+ * 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.bundle.tree;
+
+import com.google.gwt.user.client.History;
+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;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeNode;
+import com.smartgwt.client.widgets.tree.events.NodeClickEvent;
+import com.smartgwt.client.widgets.tree.events.NodeClickHandler;
+
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundleTreeView extends TreeGrid {
+
+ public BundleTreeView() {
+
+ setWidth100();
+ setHeight100();
+
+ setWidth100();
+ setHeight100();
+ setShowRoot(true);
+ setAutoFetchData(true);
+ setAnimateFolders(false);
+ setSelectionType(SelectionStyle.SINGLE);
+ setShowRollOver(false);
+ setSortField("name");
+ setShowHeader(false);
+
+ setDataSource(new BundleTreeDataSource());
+
+ addNodeClickHandler(new NodeClickHandler() {
+ public void onNodeClick(NodeClickEvent event) {
+ String path = event.getNode().getAttribute("id").replaceAll(":", "/");
+ History.newItem("Bundles/Bundle/" + path);
+ }
+ });
+ }
+
+ public void selectPath(ViewPath viewPath) {
+
+ if (viewPath.viewsLeft() > 0) {
+ String key = "";
+ for (ViewId view : viewPath.getViewPath().subList(2, viewPath.getViewPath().size())) {
+ if (key.length() > 0)
+ key += ":";
+
+ key += view.getPath();
+ }
+
+ TreeNode node = getTree().findById(key);
+ if (node != null) {
+ deselectAllRecords();
+ selectRecord(node);
+ }
+ } else {
+ deselectAllRecords();
+ selectRecord(0);
+ }
+
+
+ }
+}
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
new file mode 100644
index 0000000..6a9aa6a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
@@ -0,0 +1,199 @@
+/*
+ * 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.bundle.version;
+
+import java.util.HashSet;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.TitleOrientation;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.TextAreaItem;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.Tab;
+import com.smartgwt.client.widgets.tab.TabSet;
+
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.criteria.BundleVersionCriteria;
+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.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.bundle.version.file.FileListView;
+import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
+import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundleVersionView extends VLayout implements BookmarkableView {
+
+ private BundleVersion version;
+
+ public BundleVersionView() {
+ setWidth100();
+ setHeight100();
+ }
+
+ public void viewBundleVersion(BundleVersion version, ViewId nextViewId) {
+ this.version = version;
+
+
+ TabSet tabs = new TabSet();
+ tabs.addTab(createSummaryTab());
+
+ tabs.addTab(createLiveDeploymentsTab());
+
+ tabs.addTab(createFilesTab());
+
+ tabs.addTab(createUpdateHistoryTab());
+
+
+ addMember(new HeaderLabel("<img src=\"" + Canvas.getImgURL("subsystems/bundle/BundleVersion_24.png") + "\"/> " + version.getName()));
+ addMember(tabs);
+
+ if (nextViewId != null) {
+ if (nextViewId.getPath().equals("deployments")) {
+ tabs.selectTab(1);
+ } else if (nextViewId.getPath().equals("files")) {
+ tabs.selectTab(2);
+ } else if (nextViewId.getPath().equals("history")) {
+ tabs.selectTab(3);
+ }
+ }
+
+ markForRedraw();
+ }
+
+
+ private Tab createSummaryTab() {
+ Tab tab = new Tab("Summary");
+
+ DynamicForm form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(4);
+
+ StaticTextItem versionItem = new StaticTextItem("version","Version");
+ versionItem.setValue(version.getVersion());
+
+ CanvasItem tagItem = new CanvasItem("tag");
+ tagItem.setShowTitle(false);
+ TagEditorView tagEditor = new TagEditorView(version.getTags(), false, new TagsChangedCallback() {
+ public void tagsChanged(HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateBundleVersionTags(version.getId(), tags, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update bundle version's tags", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Bundle Version tags updated", Message.Severity.Info));
+ }
+ });
+ }
+ });
+ tagItem.setCanvas(tagEditor);
+ tagItem.setRowSpan(4);
+
+ StaticTextItem descriptionItem = new StaticTextItem("description","Description");
+ descriptionItem.setValue(version.getDescription());
+
+ StaticTextItem liveDeploymentsItem = new StaticTextItem("deployments","Deployments");
+ liveDeploymentsItem.setValue(version.getBundleDeployments().size());
+
+ StaticTextItem filesItems = new StaticTextItem("files","Files");
+ filesItems.setValue(version.getBundleFiles().size());
+
+
+
+
+ TextAreaItem recipeItem = new TextAreaItem("recipe","Recipe");
+ recipeItem.setTitleOrientation(TitleOrientation.TOP);
+ recipeItem.setColSpan(4);
+ recipeItem.setWidth("100%");
+ recipeItem.setValue(version.getRecipe());
+
+
+ form.setFields(versionItem,tagItem, descriptionItem, liveDeploymentsItem, filesItems, recipeItem);
+
+ tab.setPane(form);
+
+ return tab;
+ }
+
+ private Tab createLiveDeploymentsTab() {
+ Tab tab = new Tab("Live Deployments");
+
+ return tab;
+ }
+
+ private Tab createFilesTab() {
+ Tab tab = new Tab("Files");
+
+ FileListView filesView = new FileListView(version.getBundleFiles());
+
+ tab.setPane(filesView);
+
+ return tab;
+ }
+
+ private Tab createUpdateHistoryTab() {
+ Tab tab = new Tab("Update History");
+
+ return tab;
+ }
+
+
+
+
+ public void renderView(final ViewPath viewPath) {
+ int bundleVersionId = Integer.parseInt(viewPath.getCurrent().getPath());
+
+
+ BundleVersionCriteria criteria = new BundleVersionCriteria();
+ criteria.addFilterId(bundleVersionId);
+ criteria.fetchBundle(true);
+ criteria.fetchBundleFiles(true);
+ criteria.fetchBundleDeployments(true);
+ criteria.fetchConfigurationDefinition(true);
+
+ GWTServiceLookup.getBundleService().findBundleVersionsByCriteria(criteria,
+ new AsyncCallback<PageList<BundleVersion>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load budle version", caught);
+ }
+
+ public void onSuccess(PageList<BundleVersion> result) {
+ viewBundleVersion(result.get(0), viewPath.getCurrent());
+ }
+ });
+
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
new file mode 100644
index 0000000..0d5f02e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
@@ -0,0 +1,84 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.bundle.version.file;
+
+import java.util.List;
+
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.bundle.BundleFile;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+
+/**
+ * @author Greg Hinkle
+ */
+public class FileListView extends VLayout {
+
+ private List<BundleFile> files;
+
+ public FileListView(List<BundleFile> files) {
+ this.files = files;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ Table table = new Table("Bundle Files");
+
+ ListGrid listGrid = table.getListGrid();
+
+ ListGridField id = new ListGridField("id", "Id");
+ id.setWidth("20%");
+
+ ListGridField name = new ListGridField("name", "Name");
+ name.setWidth("80%");
+
+ listGrid.setFields(id,name);
+
+ listGrid.setData(buildRecords(files));
+
+ addMember(listGrid);
+
+ }
+
+
+
+ private ListGridRecord[] buildRecords(List<BundleFile> files) {
+ ListGridRecord[] records = new ListGridRecord[files.size()];
+
+ int i = 0;
+ for (BundleFile file : files) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id",file.getId());
+ record.setAttribute("name", file.getPackageVersion().getFileName());
+ records[i++] = record;
+ }
+ return records;
+ }
+
+}
commit 8b73d728df3c1d81b467daa0714f2ae72882c38a
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Apr 30 16:51:21 2010 -0400
added missing method for webservices
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 6e952ef..c3fb229 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -1080,6 +1080,10 @@ public class WebservicesManagerBean implements WebservicesRemote {
roleManager.removeSubjectsFromRole(subject, roleId, subjectIds);
}
+ public void setAssignedResourceGroups(Subject subject, int roleId, int[] groupIds) {
+ roleManager.setAssignedResourceGroups(subject, roleId, groupIds);
+ }
+
//ROLEMANAGER: END ----------------------------------
//SUBJECT MANAGER: BEGIN ---------------------------------------
commit c8239a68740a082cd77c6d53e9eb360306b7f38a
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 29 16:47:57 2010 -0400
Start to login screen, test dashboard tweaks
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 995d19b..60b4b4b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -64,7 +64,10 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
private static ViewPath currentViewPath;
+ private static CoreGUI coreGUI;
+
public void onModuleLoad() {
+ coreGUI = this;
if (!GWT.isScript()) {
KeyIdentifier debugKey = new KeyIdentifier();
@@ -83,6 +86,9 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
}
});
+ messageCenter = new MessageCenter();
+
+
RequestBuilder b = new RequestBuilder(RequestBuilder.GET,
"/j_security_check.do?j_username=rhqadmin&j_password=rhqadmin");
try {
@@ -100,7 +106,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
- messageCenter = new MessageCenter();
SubjectGWTServiceAsync subjectService = SubjectGWTServiceAsync.Util.getInstance();
@@ -115,18 +120,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
System.out.println("Logged in: " + result.getSessionId());
setSessionSubject(result);
userPreferences = new UserPreferences(result);
-
- buildCoreUI();
-
- /* We can cache all metadata right here
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- (Integer[]) null, EnumSet.allOf(ResourceTypeRepository.MetadataType.class), new ResourceTypeRepository.TypesLoadedCallback() {
- public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
- System.out.println("Preloaded [" + types.size() + "] resource types");
- buildCoreUI();
- }
- });
- */
}
});
}
@@ -195,6 +188,8 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
canvas = new DashboardsView();
} else if (breadcrumbName.equals("Bundles")) {
canvas = new BundleTopView();
+ } else if (breadcrumbName.equals("LogOut")) {
+ canvas = new LoginView();
} else {
canvas = null;
}
@@ -229,6 +224,8 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
// Subject s = new Subject(subject.getName(),subject.getFactive(), subject.getFsystem());
// s.setSessionId(subject.getSessionId());
CoreGUI.sessionSubject = subject;
+ CoreGUI.userPreferences = new UserPreferences(subject);
+ coreGUI.buildCoreUI();
}
public static void setContent(Canvas newContent) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
new file mode 100644
index 0000000..8f5e35a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -0,0 +1,135 @@
+/*
+ * 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;
+
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.PasswordItem;
+import com.smartgwt.client.widgets.form.fields.SubmitItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.gui.coregui.client.gwt.SubjectGWTServiceAsync;
+
+/**
+ * @author Greg Hinkle
+ */
+public class LoginView extends VLayout {
+
+
+ public LoginView() {
+ setWidth100();
+ setHeight100();
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
+ final DynamicForm form = new DynamicForm();
+
+ TextItem user = new TextItem("user","User");
+ PasswordItem password = new PasswordItem("password","Password");
+
+ final SubmitItem login = new SubmitItem("login","Login");
+ login.setAlign(Alignment.CENTER);
+ login.setColSpan(2);
+
+ form.setFields(user,password,login);
+
+ Window graphPopup = new Window();
+ graphPopup.setTitle("RHQ Login");
+ graphPopup.setWidth(400);
+ graphPopup.setHeight(400);
+ graphPopup.setIsModal(true);
+ graphPopup.setShowModalMask(true);
+ graphPopup.setCanDragResize(true);
+ graphPopup.centerInPage();
+ graphPopup.addItem(form);
+ graphPopup.show();
+
+ login.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ login(form.getValueAsString("user"), form.getValueAsString("password"));
+ }
+ });
+
+ }
+
+ private void login(String user, String password) {
+ RequestBuilder b = new RequestBuilder(RequestBuilder.GET,
+ "/j_security_check.do?j_username=" + user + "&j_password=" + password );
+ try {
+ b.setCallback(new RequestCallback() {
+ public void onResponseReceived(Request request, Response response) {
+ System.out.println("Portal-War logged in");
+ }
+
+ public void onError(Request request, Throwable exception) {
+ System.out.println("Portal-War login failed");
+ }
+ });
+ b.send();
+ } catch (RequestException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+
+
+ SubjectGWTServiceAsync subjectService = SubjectGWTServiceAsync.Util.getInstance();
+
+ subjectService.login(user, password, new AsyncCallback<Subject>() {
+ public void onFailure(Throwable caught) {
+ System.out.println("Failed to login - cause: " + caught);
+ Label loginFailed = new Label("Failed to login - cause: " + caught);
+ loginFailed.draw();
+ }
+
+ public void onSuccess(Subject result) {
+ System.out.println("Logged in: " + result.getSessionId());
+ CoreGUI.setSessionSubject(result);
+
+ /* We can cache all metadata right here
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ (Integer[]) null, EnumSet.allOf(ResourceTypeRepository.MetadataType.class), new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
+ System.out.println("Preloaded [" + types.size() + "] resource types");
+ buildCoreUI();
+ }
+ });
+ */
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 5c31020..20ebafc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -174,8 +174,6 @@ public class AdministrationView extends HLayout implements BookmarkableView {
final TreeNode manageDownloads = new TreeNode("Downloads");
final TreeNode manageLicense = new TreeNode("License");
final TreeNode managePlugins = new TreeNode("Plugins");
- FullHTMLPane pane = new FullHTMLPane("/rhq/admin/plugin/plugin-list.xhtml");
-
tree.setRoot(new TreeNode("System Configuration",
manageSettings, manageTemplates, manageDownloads, manageLicense, managePlugins));
@@ -252,6 +250,8 @@ public class AdministrationView extends HLayout implements BookmarkableView {
url = "/rhq/admin/downloads-body.xhtml";
} else if ("License".equals(page)) {
url = "/admin/license/LicenseAdmin.do?mode=view";
+ } else if ("Plugins".equals(page)) {
+ url = "/rhq/admin/plugin/plugin-list.xhtml";
}
url = addQueryStringParam(url, "nomenu=true");
content = new FullHTMLPane(url);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java
index 73bf032..8b7288f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java
@@ -23,12 +23,10 @@
package org.rhq.enterprise.gui.coregui.client.admin.roles;
import java.util.Collection;
-import java.util.List;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceGroupSelector;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
index db4fbf8..f3dee98 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
@@ -116,6 +116,22 @@ public class SmallGraphView extends VLayout {
return "PlotHoverListener";
}
+ public int getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(int resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public int getDefinitionId() {
+ return definitionId;
+ }
+
+ public void setDefinitionId(int definitionId) {
+ this.definitionId = definitionId;
+ }
+
@Override
protected void onDraw() {
super.onDraw();
commit 2aabed546fc64f64356ca49231846aa30d8864ae
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 29 16:47:16 2010 -0400
Group member mgmt gwt exposed
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
index d0cc937..1915ec6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
@@ -39,4 +39,6 @@ public interface ResourceGroupGWTService extends RemoteService {
PageList<ResourceGroup> findResourceGroupsByCriteria(ResourceGroupCriteria criteria);
PageList<GroupDefinition> findGroupDefinitionsByCriteria(ResourceGroupDefinitionCriteria criteria);
+
+ void ensureMembershipMatches(int groupId, int[] resourceIds);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
index 867de6e..e154f45 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
@@ -18,8 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
import org.rhq.core.domain.resource.group.GroupDefinition;
@@ -27,7 +25,6 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
-import org.rhq.enterprise.server.resource.group.ResourceGroupManagerBean;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.definition.GroupDefinitionManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -54,4 +51,8 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
"ResourceGroupService.findGroupDefinitionsByCriteria");
}
+ public void ensureMembershipMatches(int groupId, int[] resourceIds) {
+ groupManager.ensureMembershipMatches(getSessionSubject(), groupId, resourceIds);
+ }
+
}
\ No newline at end of file
commit 4a405ebb6341bb94e7820c84ff798d58f03cde59
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 29 16:46:52 2010 -0400
type in the breadcrumbs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 898b56a..92b63ce 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -80,7 +80,7 @@ public class ResourceTreeView extends VLayout {
super();
this.selectedResource = selectedResource;
- setWidth("30%");
+ setWidth("250");
setHeight100();
setShowResizeBar(true);
@@ -317,7 +317,8 @@ public class ResourceTreeView extends VLayout {
for (int i = parents.length - 1; i >= 0; i--) {
TreeNode n = parents[i];
if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
- viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
+ viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"),
+ n.getName() + " (" + ((ResourceTreeDatasource.ResourceTreeNode)n).getResourceType().getName() + ")", true));
}
}
viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), node.getName(), true));
@@ -372,7 +373,8 @@ public class ResourceTreeView extends VLayout {
for (int i = parents.length - 1; i >= 0; i--) {
TreeNode n = parents[i];
if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
- viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
+ viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"),
+ n.getName() + " (" + ((ResourceTreeDatasource.ResourceTreeNode)n).getResourceType().getName() + ")", true));
}
}
viewId.getBreadcrumbs().add(new Breadcrumb(selectedNode.getAttribute("id"), selectedNode.getName(), true));
@@ -433,7 +435,8 @@ public class ResourceTreeView extends VLayout {
for (int i = parents.length - 1; i >= 0; i--) {
TreeNode n = parents[i];
if (n instanceof ResourceTreeDatasource.ResourceTreeNode) {
- viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"), n.getName(), true));
+ viewId.getBreadcrumbs().add(new Breadcrumb(n.getAttribute("id"),
+ n.getName() + " (" + ((ResourceTreeDatasource.ResourceTreeNode)n).getResourceType().getName() + ")", true));
}
}
viewId.getBreadcrumbs().add(new Breadcrumb(selectedNode.getAttribute("id"), selectedNode.getName(), true));
commit 55b8817da82e76b677a4609c9e34b51f11ffa07f
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 29 15:50:03 2010 -0400
Dashboard prototype tweaks
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index 9f3a1c5..34e0028 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -187,7 +187,7 @@ public class DashboardView extends VLayout {
for (ArrayList<StoredPortlet> column : storedDashboard.getPortlets()) {
for (StoredPortlet storedPortlet : column) {
- Canvas portalCanvas = PortletFactory.buildPortlet(storedPortlet.getPortletKey());
+ Canvas portalCanvas = PortletFactory.buildPortlet(storedPortlet);
final Portlet portlet = new Portlet(editMode);
portlet.addItem(portalCanvas);
@@ -212,7 +212,8 @@ public class DashboardView extends VLayout {
private void addPortlet(String portletName) {
final Portlet newPortlet = new Portlet(true);
- Canvas canvas = PortletFactory.buildPortlet(portletName);
+ StoredPortlet storedPortlet = new StoredPortlet(portletName, portletName, 250);
+ Canvas canvas = PortletFactory.buildPortlet(storedPortlet);
newPortlet.setTitle(portletName);
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 944a612..ac4e968 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
@@ -98,8 +98,17 @@ public class DashboardsView extends VLayout {
col1.add(summary);
StoredPortlet graph = new StoredPortlet("ghinkle (MAC OS X) CPU", GraphPortlet.KEY, 250);
+ graph.setProperty("resourceId","10001");
+ graph.setProperty("definitionId","10139");
col1.add(graph);
+ StoredPortlet graphTwo = new StoredPortlet("JBoss AS Txn / Min", GraphPortlet.KEY, 250);
+ graphTwo.setProperty("resourceId","10003");
+ graphTwo.setProperty("definitionId","10971");
+ col1.add(graphTwo);
+
+
+
// Experimental
// StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
// col2.add(platformSummary);
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 e46aaa6..df9037f 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
@@ -33,6 +33,7 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.Re
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.store.StoredPortlet;
/**
* @author Greg Hinkle
@@ -58,13 +59,15 @@ public class PortletFactory {
}
- public static Canvas buildPortlet(String portletKey) {
+ public static Canvas buildPortlet(StoredPortlet storedPortlet) {
- PortletViewFactory viewFactory = registeredPortlets.get(portletKey);
+ PortletViewFactory viewFactory = registeredPortlets.get(storedPortlet.getPortletKey());
Canvas canvas = null;
- canvas = (Canvas) viewFactory.getInstance();
+ PortletView view = viewFactory.getInstance();
+ view.configure(storedPortlet);
+ canvas = (Canvas) view;
return canvas;
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 ccba4e8..425cd42 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
@@ -34,11 +34,12 @@ public class GraphPortlet extends SmallGraphView implements PortletView {
public static final String KEY = "Resource Graph";
public GraphPortlet() {
- super(10001, 10100);
+
}
public void configure(StoredPortlet storedPortlet) {
- // TODO: Implement this method.
+ setResourceId(Integer.parseInt(storedPortlet.getProperties().get("resourceId")));
+ setDefinitionId(Integer.parseInt(storedPortlet.getProperties().get("definitionId")));
}
public Canvas getHelpCanvas() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/store/StoredPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/store/StoredPortlet.java
index 2ac35c4..e684f42 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/store/StoredPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/store/StoredPortlet.java
@@ -101,4 +101,9 @@ public class StoredPortlet {
public void setHeight(int height) {
this.height = height;
}
+
+ public void setProperty(String name, String value) {
+ properties.put(name, value);
+ }
+
}
commit e198490d4aac0eb3dc5b852287af099b9373442d
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 29 15:49:24 2010 -0400
Add resource icon to the favorites popup
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
index 72eb936..6ae4186 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -90,6 +90,12 @@ public class FavoritesButton extends IMenuButton {
// TODO: Ideally, we should use ResourceManagerLocal.disambiguate() here to obtain
// disambiguated Resource names.
item.setTitle(resource.getName());
+
+ String category = resource.getResourceType().getCategory().getDisplayName();
+
+ String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
+ ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
+ item.setIcon("types/" + category + "_" + avail + "_16.png");
}
favoritesMenu.setItems(items);
favoritesMenu.showContextMenu();
commit 5aa82f1e3cc3423e1048cd418d8fbbc4ce149e5d
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 29 15:46:36 2010 -0400
Support the selector having initially selected records (to update a current selection of groups to deploy to or for role assignments)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
index 8d4025e..523c822 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
@@ -22,8 +22,15 @@ import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.authz.Role;
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.components.HeaderLabel;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceGroupSelector;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.DSOperationType;
import com.smartgwt.client.types.Overflow;
@@ -32,6 +39,7 @@ import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.ResetItem;
import com.smartgwt.client.widgets.form.fields.SubmitItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
@@ -40,6 +48,8 @@ import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.Set;
/**
@@ -57,7 +67,8 @@ public class RoleEditView extends VLayout {
private HeaderLabel editLabel;
private DynamicForm form;
private PermissionEditorView permissionEditorItem;
- private RoleGroupsEditorItem assignedGroupEditorItem;
+ private CanvasItem selectorItem;
+ private ResourceGroupSelector groupSelector;
public RoleEditView() {
super();
@@ -97,10 +108,10 @@ public class RoleEditView extends VLayout {
permissionEditorItem.setShowTitle(false);
permissionEditorItem.setColSpan(2);
+ selectorItem = new CanvasItem("groupSelectionCanvas");
- assignedGroupEditorItem = new RoleGroupsEditorItem("assignedGroups", "Assigned Groups");
- assignedGroupEditorItem.setShowTitle(false);
- assignedGroupEditorItem.setColSpan(2);
+ selectorItem.setShowTitle(false);
+ selectorItem.setColSpan(2);
SubmitItem saveButton = new SubmitItem("save", "Save");
@@ -123,7 +134,7 @@ public class RoleEditView extends VLayout {
idItem,
nameItem,
permissionEditorItem,
- assignedGroupEditorItem,
+ selectorItem,
saveButton, new ResetItem("reset", "Reset"));
editCanvas.addMember(form);
@@ -140,7 +151,10 @@ public class RoleEditView extends VLayout {
form.editRecord(record);
permissionEditorItem.setParentForm(form);
permissionEditorItem.setPermissions((Set<Permission>) record.getAttributeAsObject("permissions"));
- assignedGroupEditorItem.setGroups((PageList<ResourceGroup>) record.getAttributeAsObject("assignedGroups"));
+
+ groupSelector = new RoleResourceGroupSelector((Collection<ResourceGroup>) record.getAttributeAsObject("resourceGroups"));
+ selectorItem.setCanvas(groupSelector);
+
} catch (Throwable t) {
t.printStackTrace();
}
@@ -164,8 +178,39 @@ public class RoleEditView extends VLayout {
public void save() {
+
System.out.println("Saving role");
- form.saveData();
+ form.saveData(new DSCallback() {
+ public void execute(DSResponse dsResponse, Object o, DSRequest dsRequest) {
+ HashSet<Integer> selection = groupSelector.getSelection();
+ int[] groupIds = new int[selection.size()];
+ int i = 0;
+ for (Integer id : selection) {
+ groupIds[i++] = id;
+ }
+
+ int roleId;
+ if (roleBeingEdited != null) {
+ roleId = roleBeingEdited.getId();
+ } else {
+ // new role
+ roleId = Integer.parseInt(new ListGridRecord(dsRequest.getData()).getAttribute("id"));
+ }
+
+
+ GWTServiceLookup.getRoleService().setAssignedResourceGroups(
+ roleId, groupIds,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update role's assigned groups",caught);
+ }
+
+ public void onSuccess(Void result) {
+ // TODO: Implement this method.
+ }
+ });
+ }
+ });
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java
new file mode 100644
index 0000000..73bf032
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java
@@ -0,0 +1,47 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.admin.roles;
+
+import java.util.Collection;
+import java.util.List;
+
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceGroupSelector;
+
+/**
+ * @author Greg Hinkle
+ */
+public class RoleResourceGroupSelector extends ResourceGroupSelector {
+
+ public RoleResourceGroupSelector(Collection<ResourceGroup> groups) {
+ super();
+ if (groups != null) {
+ ListGridRecord[] data = (new ResourceGroupsDataSource()).buildRecords(groups);
+ setAssigned(data);
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
index 230dbdc..768b8f4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
@@ -37,4 +37,8 @@ public interface RoleGWTService extends RemoteService {
Role updateRole(Role role);
void removeRoles(Integer[] roleIds);
+
+ void setAssignedResourceGroups(int roleId, int[] resourceGroupIds);
+
+ void setAssignedSubjects(int roleId, int[] subjectIds);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index 7499f0b..5738bd4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -55,7 +55,7 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
}
public ResourceGroupsDataSource() {
- super("ResourceGroups");
+// super("ResourceGroups");
DataSourceField idDataField = new DataSourceIntegerField("id", "ID", 20);
idDataField.setPrimaryKey(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java
index 06c322c..b1fbcb2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java
@@ -53,10 +53,12 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
* @author Greg Hinkle
*/
-public abstract class AbstractSelector extends HLayout {
+public abstract class AbstractSelector<T> extends HLayout {
protected HashSet<Integer> selection = new HashSet<Integer>();
+ protected ListGridRecord[] initialSelection;
+
protected ListGrid availableGrid;
protected ListGrid assignedGrid;
@@ -72,13 +74,17 @@ public abstract class AbstractSelector extends HLayout {
setHeight(380);
}
+ public void setAssigned(ListGridRecord[] assignedRecords) {
+ initialSelection = assignedRecords;
+ }
+
public HashSet<Integer> getSelection() {
return selection;
}
protected abstract DynamicForm getAvailableFilterForm();
- protected abstract RPCDataSource<?> getDataSource();
+ protected abstract RPCDataSource<T> getDataSource();
protected abstract Criteria getLatestCriteria(DynamicForm availableFilterForm);
@@ -219,6 +225,11 @@ public abstract class AbstractSelector extends HLayout {
select(recordDropEvent.getDropRecords());
}
});
+
+ if (initialSelection != null) {
+ assignedGrid.setData(initialSelection);
+ select(initialSelection);
+ }
}
protected void updateButtons() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
index 06f6e4b..e4d9a5b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+import java.util.Collection;
+
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.SelectItem;
@@ -32,7 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
* @author Greg Hinkle
*/
-public class ResourceGroupSelector extends AbstractSelector {
+public class ResourceGroupSelector extends AbstractSelector<ResourceGroup> {
public ResourceGroupSelector() {
super();
@@ -51,7 +53,7 @@ public class ResourceGroupSelector extends AbstractSelector {
return availableFilterForm;
}
- protected RPCDataSource<?> getDataSource() {
+ protected RPCDataSource<ResourceGroup> getDataSource() {
return new SelectedResourceGroupsDataSource();
}
@@ -68,7 +70,7 @@ public class ResourceGroupSelector extends AbstractSelector {
private class SelectedResourceGroupsDataSource extends ResourceGroupsDataSource {
@Override
- public ListGridRecord[] buildRecords(PageList<ResourceGroup> resourceGroups) {
+ public ListGridRecord[] buildRecords(Collection<ResourceGroup> resourceGroups) {
ListGridRecord[] records = super.buildRecords(resourceGroups);
for (ListGridRecord record : records) {
if (selection.contains(record.getAttributeAsInt("id"))) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
index ea092d5..2ed234f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+import java.util.Collection;
+
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.IPickTreeItem;
@@ -75,7 +77,7 @@ public class ResourceSelector extends AbstractSelector {
private class SelectedResourceDataSource extends ResourceDatasource {
@Override
- public ListGridRecord[] buildRecords(PageList<Resource> resources) {
+ public ListGridRecord[] buildRecords(Collection<Resource> resources) {
ListGridRecord[] records = super.buildRecords(resources);
for (ListGridRecord record : records) {
if (selection.contains(record.getAttributeAsInt("id"))) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 0774160..a288517 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.util;
+import java.util.Collection;
+
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -111,7 +113,7 @@ public abstract class RPCDataSource<T> extends DataSource {
}
- public ListGridRecord[] buildRecords(PageList<T> list) {
+ public ListGridRecord[] buildRecords(Collection<T> list) {
if (list == null) {
return null;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
index 373322f..1414025 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
@@ -18,23 +18,14 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
-import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.criteria.RoleCriteria;
-import org.rhq.core.domain.criteria.SubjectCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.RoleGWTService;
-import org.rhq.enterprise.gui.coregui.client.gwt.SubjectGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
-import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.RoleManagerLocal;
-import org.rhq.enterprise.server.exception.LoginException;
import org.rhq.enterprise.server.util.LookupUtil;
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-
-import javax.jws.WebParam;
-
/**
* @author Greg Hinkle
*/
@@ -62,4 +53,11 @@ public class RoleGWTServiceImpl extends AbstractGWTServiceImpl implements RoleGW
roleManager.deleteRoles(getSessionSubject(), roleIds);
}
+ public void setAssignedResourceGroups(int roleId, int[] resourceGroupIds) {
+ roleManager.setAssignedResourceGroups(getSessionSubject(), roleId, resourceGroupIds);
+ }
+
+ public void setAssignedSubjects(int roleId, int[] subjectIds) {
+ roleManager.setAssignedSubjects(getSessionSubject(), roleId, subjectIds);
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
index 00d4c31..0bbfff8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
@@ -27,6 +27,7 @@ import java.util.Set;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.interceptor.ExcludeDefaultInterceptors;
+import javax.jws.WebParam;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@@ -42,6 +43,7 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.server.PersistenceUtility;
+import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
@@ -179,7 +181,7 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
if (subjectToModify.getFsystem() || (authorizationManager.isSystemSuperuser(subjectToModify))) {
throw new PermissionException("You cannot assign roles to user [" + subjectToModify.getName()
- + "] - roles are fixed for this user");
+ + "] - roles are fixed for this user");
}
subjectToModify.getRoles().size();
@@ -188,7 +190,7 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
Role role = entityManager.find(Role.class, roleId);
if (role == null) {
throw new IllegalArgumentException("Tried to add role[" + roleId + "] to subject[" + subjectId
- + "], but role was not found");
+ + "], but role was not found");
}
role.addSubject(subjectToModify);
if (isLdap) {
@@ -213,12 +215,12 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
Subject newSubject = entityManager.find(Subject.class, subjectId);
if (newSubject == null) {
throw new IllegalArgumentException("Tried to add subject[" + subjectId + "] to role[" + roleId
- + "], but subject was not found");
+ + "], but subject was not found");
}
if (newSubject.getFsystem() || (authorizationManager.isSystemSuperuser(newSubject))) {
throw new PermissionException("You cannot alter the roles for user [" + newSubject.getName()
- + "] - roles are fixed for this user");
+ + "] - roles are fixed for this user");
}
role.addSubject(newSubject);
@@ -239,7 +241,7 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
if (subjectToModify.getFsystem() || (authorizationManager.isSystemSuperuser(subjectToModify))) {
throw new PermissionException("You cannot remove roles from user [" + subjectToModify.getName()
- + "] - roles are fixed for this user");
+ + "] - roles are fixed for this user");
}
for (Integer roleId : roleIds) {
@@ -353,7 +355,7 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
@RequiredPermission(Permission.MANAGE_SECURITY)
@SuppressWarnings("unchecked")
public PageList<Role> findAvailableRolesForSubject(Subject subject, Integer subjectId, Integer[] pendingRoleIds,
- PageControl pc) {
+ PageControl pc) {
pc.initDefaultOrderingField("r.name");
String queryName;
@@ -408,7 +410,7 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
ResourceGroup group = entityManager.find(ResourceGroup.class, groupId);
if (role == null) {
throw new IllegalArgumentException("Tried to add resourceGroup[" + groupId + "] to role[" + roleId
- + "], but resourceGroup was not found");
+ + "], but resourceGroup was not found");
}
role.addResourceGroup(group);
}
@@ -433,13 +435,37 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
ResourceGroup doomedGroup = entityManager.find(ResourceGroup.class, groupId);
if (doomedGroup == null) {
throw new IllegalArgumentException("Tried to remove doomedGroup[" + groupId + "] from role["
- + roleId + "], but subject was not found");
+ + roleId + "], but subject was not found");
}
role.removeResourceGroup(doomedGroup);
}
}
}
+ @RequiredPermission(Permission.MANAGE_SECURITY)
+ public void setAssignedResourceGroups(Subject subject, int roleId, int[] groupIds) {
+
+ Role role = getRole(subject, roleId);
+ List<Integer> currentMembers = new ArrayList<Integer>();
+ for (ResourceGroup group : role.getResourceGroups()) {
+ currentMembers.add(group.getId());
+ }
+
+
+ List<Integer> newMembers = ArrayUtils.wrapInList(groupIds); // members needing addition
+ newMembers.removeAll(currentMembers);
+ if (newMembers.size() > 0) {
+ addResourceGroupsToRole(subject, roleId, groupIds);
+ }
+
+ List<Integer> extraMembers = new ArrayList<Integer>(currentMembers); // members needing removal
+ extraMembers.removeAll(ArrayUtils.wrapInList(groupIds));
+ if (extraMembers.size() > 0) {
+ removeResourceGroupsFromRole(subject, roleId, groupIds);
+ }
+ }
+
+
private void processDependentPermissions(Role role) {
/*
* if you can control user/roles, then you can give yourself permissions, too; so we might as well
@@ -468,7 +494,7 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
Subject doomedSubject = entityManager.find(Subject.class, subjectId);
if (doomedSubject == null) {
throw new IllegalArgumentException("Tried to remove subject[" + subjectId + "] from role[" + roleId
- + "], but subject was not found");
+ + "], but subject was not found");
}
role.removeSubject(doomedSubject);
}
@@ -476,6 +502,28 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
}
@RequiredPermission(Permission.MANAGE_SECURITY)
+ public void setAssignedSubjects(Subject subject, int roleId, int[] subjectIds) {
+ Role role = getRole(subject, roleId);
+ List<Integer> currentMembers = new ArrayList<Integer>();
+ for (ResourceGroup group : role.getResourceGroups()) {
+ currentMembers.add(group.getId());
+ }
+
+
+ List<Integer> newMembers = ArrayUtils.wrapInList(subjectIds); // members needing addition
+ newMembers.removeAll(currentMembers);
+ if (newMembers.size() > 0) {
+ addSubjectsToRole(subject, roleId, subjectIds); }
+
+ List<Integer> extraMembers = new ArrayList<Integer>(currentMembers); // members needing removal
+ extraMembers.removeAll(ArrayUtils.wrapInList(subjectIds));
+ if (extraMembers.size() > 0) {
+ removeSubjectsFromRole(subject, roleId, subjectIds);
+ }
+ }
+
+
+ @RequiredPermission(Permission.MANAGE_SECURITY)
public void removeRolesFromResourceGroup(Subject subject, int groupId, int[] roleIds) {
if ((roleIds != null) && (roleIds.length > 0)) {
ResourceGroup group = entityManager.find(ResourceGroup.class, groupId);
@@ -488,7 +536,7 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
Role doomedRole = entityManager.find(Role.class, roleId);
if (doomedRole == null) {
throw new IllegalArgumentException("Tried to remove role[" + roleId + "] from resourceGroup["
- + groupId + "], but role was not found");
+ + groupId + "], but role was not found");
}
group.removeRole(doomedRole);
}
@@ -514,7 +562,7 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
Role role = entityManager.find(Role.class, roleId);
if (role == null) {
throw new IllegalArgumentException("Tried to add role[" + roleId + "] to resourceGroup[" + groupId
- + "], but role was not found");
+ + "], but role was not found");
}
group.addRole(role);
}
@@ -527,9 +575,9 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
public PageList<Role> findRolesByCriteria(Subject subject, RoleCriteria criteria) {
if (criteria.isSecurityManagerRequired()
- && !authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SECURITY)) {
+ && !authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SECURITY)) {
throw new PermissionException("Subject [" + subject.getName()
- + "] requires SecurityManager permission for requested query criteria.");
+ + "] requires SecurityManager permission for requested query criteria.");
}
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
index 58f962a..3b6e6e2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.authz;
import java.util.Set;
import javax.ejb.Local;
+import javax.jws.WebParam;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
@@ -187,6 +188,8 @@ public interface RoleManagerLocal {
void removeSubjectsFromRole(Subject subject, int roleId, int[] subjectIds);
+ void setAssignedSubjects(Subject sessionSubject, int roleId, int[] subjectIds);
+
/**
* Adds the given resource groups to the given role.
*
@@ -198,6 +201,10 @@ public interface RoleManagerLocal {
void addRolesToResourceGroup(Subject subject, int groupId, int[] roleIds);
+ void setAssignedResourceGroups(Subject subject, int roleId, int[] groupIds);
+
+
+
/**
* Removes the given resource groups from the given role.
*
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java
index 55da160..e0008cc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java
@@ -184,6 +184,11 @@ public interface RoleManagerRemote {
@WebParam(name = "groupId") int groupId, //
@WebParam(name = "roleIds") int[] roleIds);
+ void setAssignedResourceGroups(
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "roleId") int roleId, //
+ @WebParam(name = "groupIds") int[] groupIds);
+
/**
* Removes the given resource groups from the given role.
*
commit ddc67fa913b8f7cf21aa5a6f45d2b2fc518e852a
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Apr 29 14:37:40 2010 -0400
Some jaxb binding fixes for webservices
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleType.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleType.java
index 72605e0..8e766ae 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleType.java
@@ -38,6 +38,7 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlTransient;
import org.rhq.core.domain.resource.ResourceType;
@@ -70,6 +71,7 @@ public class BundleType implements Serializable {
@JoinColumn(name = "RESOURCE_TYPE_ID", referencedColumnName = "ID", nullable = false)
@OneToOne(fetch = FetchType.LAZY, optional = false)
+ @XmlTransient
private ResourceType resourceType;
public BundleType() {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java
index 6d0be7f..7fefa3e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java
@@ -32,12 +32,17 @@ import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
-/**
+ /**
* Represents data that was collected either due to a schedule or an on-demand, live collection.
*/
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement
public abstract class MeasurementData implements Serializable {
@EmbeddedId
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java
index d2f81dc..4e82c43 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java
@@ -24,11 +24,17 @@ package org.rhq.core.domain.measurement;
import java.io.Serializable;
-/**
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+ /**
* Subclass for numerical measurement data
*
* @author Heiko W. Rupp
*/
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlRootElement
public class MeasurementDataNumeric extends MeasurementData implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDefinition.java
index 48a682d..2d20882 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDefinition.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDefinition.java
@@ -43,6 +43,9 @@ import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Version;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -73,6 +76,8 @@ import org.rhq.core.domain.resource.ResourceType;
+ " SET md.defaultOn = false") })
@SequenceGenerator(name = "id", sequenceName = "RHQ_MEASUREMENT_DEF_ID_SEQ")
@Table(name = "RHQ_MEASUREMENT_DEF")
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement
public class MeasurementDefinition implements Serializable {
public static final String QUERY_NATIVE_UPDATE_DEFAULT_ON_BY_IDS = "" //