[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java | 26 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java | 135 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java | 58 +++-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2
6 files changed, 139 insertions(+), 86 deletions(-)
New commits:
commit 61056623da28a88d5055a2ca6bf4261de018f1fd
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Dec 17 11:28:30 2010 -0500
refactor the bundle version view. add authz checks.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
index a2412d5..a0658b0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
@@ -115,18 +115,20 @@ public class BundleDeploymentListView extends Table<RPCDataSource<BundleDeployme
setListGridFields(idField, nameField, descriptionField, bundleVersionField, deployTimeField, statusField);
- setListGridDoubleClickHandler(new DoubleClickHandler() {
- @Override
- public void onDoubleClick(DoubleClickEvent event) {
- ListGrid listGrid = (ListGrid) event.getSource();
- ListGridRecord[] selectedRows = listGrid.getSelection();
- if (selectedRows != null && selectedRows.length == 1) {
- String selectedId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_BUNDLE_ID);
- String selectedVersionId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_ID);
- CoreGUI.goToView(LinkManager.getBundleDeploymentLink(Integer.valueOf(selectedId), Integer
- .valueOf(selectedVersionId)));
+ if (canManageBundles) {
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length == 1) {
+ String selectedId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_BUNDLE_ID);
+ String selectedVersionId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_ID);
+ CoreGUI.goToView(LinkManager.getBundleDeploymentLink(Integer.valueOf(selectedId), Integer
+ .valueOf(selectedVersionId)));
+ }
}
- }
- });
+ });
+ }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index c298b35..548037b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -163,6 +163,7 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
}
});
tagEditor.setAutoHeight();
+ tagEditor.setExtraSpace(10);
return tagEditor;
}
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 b567a0a..15ebed4 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
@@ -140,6 +140,7 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
}
});
tagEditor.setAutoHeight();
+ tagEditor.setExtraSpace(10);
return tagEditor;
}
@@ -304,7 +305,7 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
if (viewPath.getCurrent().getPath().equals("versions")) {
if (!viewPath.isEnd()) {
// a specific version
- BundleVersionView view = new BundleVersionView(extendLocatorId("Version"));
+ BundleVersionView view = new BundleVersionView(extendLocatorId("Version"), canManageBundles);
addMember(view);
view.renderView(viewPath.next());
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
index ad55799..2985f06 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
@@ -26,11 +26,11 @@ import java.util.HashSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Canvas;
-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.form.fields.events.ChangeEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
@@ -40,6 +40,7 @@ import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.bundle.deployment.BundleDeploymentListView;
@@ -61,63 +62,84 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class BundleVersionView extends LocatableVLayout implements BookmarkableView {
private BundleVersion version;
+ private boolean canManageBundles = false;
- public BundleVersionView(String locatorId) {
+ public BundleVersionView(String locatorId, boolean canManageBundles) {
super(locatorId);
+ this.canManageBundles = canManageBundles;
setWidth100();
setHeight100();
+ //setMargin(10); // do not set margin, we already have our margin set outside of us
}
- public void viewBundleVersion(BundleVersion version, ViewId nextViewId) {
+ private void viewBundleVersion(BundleVersion version, ViewId nextViewId) {
// Whenever a new view request comes in, make sure to clean house to avoid ID conflicts for sub-widgets
this.destroyMembers();
this.version = version;
- TabSet tabs = new LocatableTabSet(getLocatorId());
- tabs.addTab(createSummaryTab());
-
- tabs.addTab(createLiveDeploymentsTab());
-
- tabs.addTab(createFilesTab());
-
- // tabs.addTab(createUpdateHistoryTab());
-
addMember(new BackButton(extendLocatorId("BackButton"), MSG.view_bundle_version_backToBundle() + ": "
- + version.getBundle().getName(), "Bundles/Bundle/" + version.getBundle().getId()));
+ + version.getBundle().getName(), LinkManager.getBundleLink(version.getBundle().getId())));
addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleVersion_24.png"), version.getName() + ": "
+ version.getVersion()));
+ addMember(createTagEditor());
+
+ addMember(createSummaryForm());
+
+ TabSet tabs = new LocatableTabSet(extendLocatorId("Tabs"));
+ tabs.addTab(createRecipeTab());
+ tabs.addTab(createLiveDeploymentsTab());
+ tabs.addTab(createFilesTab());
addMember(tabs);
if (nextViewId != null) {
- if (nextViewId.getPath().equals("deployments")) {
+ if (nextViewId.getPath().equals("recipe")) {
+ tabs.selectTab(0);
+ } else 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);
+ } else {
+ // should we throw an exception? someone gave a bad URL; just bring them to first tab
+ tabs.selectTab(0);
}
}
markForRedraw();
}
- private Tab createSummaryTab() {
- LocatableTab tab = new LocatableTab(extendLocatorId("Summary"), MSG.common_title_summary());
-
- LocatableDynamicForm form = new LocatableDynamicForm(tab.getLocatorId());
+ private LocatableDynamicForm createSummaryForm() {
+ LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("Summary"));
form.setWidth100();
- form.setHeight100();
- form.setNumCols(4);
+ form.setAutoHeight();
+ form.setNumCols(2);
+ form.setWrapItemTitles(false);
+ form.setExtraSpace(10);
+ form.setIsGroup(true);
+ form.setGroupTitle(MSG.common_title_summary());
+ form.setPadding(5);
StaticTextItem versionItem = new StaticTextItem("version", MSG.common_title_version());
versionItem.setValue(version.getVersion());
- CanvasItem tagItem = new CanvasItem("tag");
- tagItem.setShowTitle(false);
- TagEditorView tagEditor = new TagEditorView(form.getLocatorId(), version.getTags(), false,
+ StaticTextItem descriptionItem = new StaticTextItem("description", MSG.common_title_description());
+ descriptionItem.setValue(version.getDescription());
+
+ StaticTextItem liveDeploymentsItem = new StaticTextItem("deployments", MSG.view_bundle_deployments());
+ liveDeploymentsItem.setValue(version.getBundleDeployments().size());
+
+ StaticTextItem filesItems = new StaticTextItem("files", MSG.view_bundle_files());
+ filesItems.setValue(version.getBundleFiles().size());
+
+ form.setFields(versionItem, descriptionItem, liveDeploymentsItem, filesItems);
+ return form;
+ }
+
+ private TagEditorView createTagEditor() {
+ boolean readOnly = !this.canManageBundles;
+ TagEditorView tagEditor = new TagEditorView(extendLocatorId("Tags"), version.getTags(), readOnly,
new TagsChangedCallback() {
public void tagsChanged(HashSet<Tag> tags) {
GWTServiceLookup.getTagService().updateBundleVersionTags(version.getId(), tags,
@@ -135,61 +157,54 @@ public class BundleVersionView extends LocatableVLayout implements BookmarkableV
});
}
});
- tagEditor.setVertical(true);
- tagItem.setCanvas(tagEditor);
- tagItem.setRowSpan(4);
-
- StaticTextItem descriptionItem = new StaticTextItem("description", MSG.common_title_description());
- descriptionItem.setValue(version.getDescription());
-
- StaticTextItem liveDeploymentsItem = new StaticTextItem("deployments", MSG.view_bundle_deployments());
- liveDeploymentsItem.setValue(version.getBundleDeployments().size());
-
- StaticTextItem filesItems = new StaticTextItem("files", MSG.view_bundle_files());
- filesItems.setValue(version.getBundleFiles().size());
-
- TextAreaItem recipeItem = new TextAreaItem("recipe", MSG.view_bundle_recipe());
- recipeItem.setDisabled(true);
- recipeItem.setTitleOrientation(TitleOrientation.TOP);
- recipeItem.setColSpan(4);
- recipeItem.setWidth("*");
- recipeItem.setHeight("*");
- recipeItem.setValue(version.getRecipe());
+ tagEditor.setAutoHeight();
+ tagEditor.setExtraSpace(10);
+ return tagEditor;
+ }
- form.setFields(versionItem, tagItem, descriptionItem, liveDeploymentsItem, filesItems, recipeItem);
+ private Tab createRecipeTab() {
+ LocatableTab tab = new LocatableTab(extendLocatorId("Recipe"), MSG.view_bundle_recipe());
+ LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("RecipeForm"));
+
+ TextAreaItem recipeCanvas = new TextAreaItem("recipe", MSG.view_bundle_recipe());
+ recipeCanvas.setShowTitle(false);
+ recipeCanvas.setColSpan(2);
+ recipeCanvas.setWidth("100%");
+ recipeCanvas.setHeight("100%");
+ recipeCanvas.setValue(version.getRecipe());
+ recipeCanvas.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent event) {
+ // makes this read-only; however, since its not disabled, user can still select/copy the text
+ event.cancel();
+ }
+ });
+ form.setHeight100();
+ form.setWidth100();
+ form.setItems(recipeCanvas);
tab.setPane(form);
-
return tab;
}
private Tab createLiveDeploymentsTab() {
LocatableTab tab = new LocatableTab(extendLocatorId("Deployments"), MSG.view_bundle_deployments());
-
Criteria criteria = new Criteria();
criteria.setAttribute("bundleVersionId", version.getId());
-
- // TODO: get user perm, if has manage_bundle, pass true
- tab.setPane(new BundleDeploymentListView(tab.getLocatorId(), criteria, false));
-
+ tab.setPane(new BundleDeploymentListView(tab.getLocatorId(), criteria, this.canManageBundles));
return tab;
}
private Tab createFilesTab() {
LocatableTab tab = new LocatableTab(extendLocatorId("Files"), MSG.view_bundle_files());
-
FileListView filesView = new FileListView(tab.getLocatorId(), version.getId());
-
tab.setPane(filesView);
-
return tab;
}
public void renderView(final ViewPath viewPath) {
int bundleVersionId = Integer.parseInt(viewPath.getCurrent().getPath());
- final ViewId viewId = viewPath.getCurrent();
-
BundleVersionCriteria criteria = new BundleVersionCriteria();
criteria.addFilterId(bundleVersionId);
criteria.fetchBundle(true);
@@ -206,9 +221,9 @@ public class BundleVersionView extends LocatableVLayout implements BookmarkableV
public void onSuccess(PageList<BundleVersion> result) {
BundleVersion version = result.get(0);
- viewBundleVersion(version, viewPath.getCurrent());
+ ViewId nextPath = viewPath.next().getCurrent();
+ viewBundleVersion(version, nextPath);
}
});
-
}
}
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
index 31fce59..5b33200 100644
--- 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
@@ -25,10 +25,13 @@ package org.rhq.enterprise.gui.coregui.client.bundle.version.file;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.AutoFitWidthApproach;
+import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.bundle.BundleFile;
+import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.criteria.BundleFileCriteria;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.util.PageList;
@@ -43,6 +46,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class FileListView extends LocatableVLayout {
+ private static final String ID = "id";
+ private static final String NAME = "name";
+ private static final String FILESIZE = "fileSize";
+ private static final String MD5 = "md5";
+ private static final String SHA256 = "sha256";
+ private static final String VERSION = "version";
+
private int bundleVersionId;
public FileListView(String locatorId, int bundleVersionId) {
@@ -54,20 +64,32 @@ public class FileListView extends LocatableVLayout {
Table table = new Table(extendLocatorId("BundleFiles"), MSG.view_bundle_bundleFiles());
- ListGridField id = new ListGridField("id", MSG.common_title_id());
- id.setWidth("20%");
-
- ListGridField name = new ListGridField("name", MSG.common_title_name());
- name.setWidth("60%");
+ ListGridField id = new ListGridField(ID, MSG.common_title_id());
+ ListGridField name = new ListGridField(NAME, MSG.common_title_name());
+ ListGridField size = new ListGridField(FILESIZE, MSG.view_bundle_fileListView_fileSize());
+ //ListGridField md5 = new ListGridField(MD5, MSG.view_bundle_fileListView_md5());
+ ListGridField sha256 = new ListGridField(SHA256, MSG.view_bundle_fileListView_sha256());
+ ListGridField version = new ListGridField(VERSION, MSG.common_title_version());
- ListGridField size = new ListGridField("size", MSG.view_bundle_fileListView_fileSize());
- name.setWidth("20%");
+ id.setWidth("50");
+ setAutoFitOnField(name);
+ setAutoFitOnField(size);
+ //setAutoFitOnField(md5);
+ setAutoFitOnField(sha256);
+ setAutoFitOnField(version);
// To get the ListGrid the Table must be initialized (via onInit()) by adding to the Canvas
addMember(table);
- table.getListGrid().setFields(id, name, size);
- table.getListGrid().setData(buildRecords(files));
+ ListGrid listGrid = table.getListGrid();
+ listGrid.setFields(id, name, size, /*md5,*/sha256, version); // today, we don't set md5, no sense showing it
+ listGrid.setData(buildRecords(files));
+ table.setTableActionDisableOverride(true);
+ }
+
+ private void setAutoFitOnField(ListGridField field) {
+ field.setAutoFitWidth(true);
+ field.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
}
@Override
@@ -96,17 +118,27 @@ public class FileListView extends LocatableVLayout {
int i = 0;
for (BundleFile file : files) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", file.getId());
- record.setAttribute("name", file.getPackageVersion().getFileName());
+ PackageVersion packageVersion = file.getPackageVersion();
+
+ record.setAttribute(ID, file.getId());
+ record.setAttribute(NAME, returnValueOrUnknown(packageVersion.getFileName()));
+ record.setAttribute(MD5, returnValueOrUnknown(packageVersion.getMD5()));
+ record.setAttribute(SHA256, returnValueOrUnknown(packageVersion.getSHA256()));
+ record.setAttribute(VERSION, returnValueOrUnknown(packageVersion.getVersion()));
- Long size = file.getPackageVersion().getFileSize();
+ Long size = packageVersion.getFileSize();
if (size != null) {
- record.setAttribute("size", MeasurementConverterClient.format(size.doubleValue(),
+ record.setAttribute(FILESIZE, MeasurementConverterClient.format(size.doubleValue(),
MeasurementUnits.BYTES, true));
+ } else {
+ record.setAttribute(FILESIZE, MSG.common_val_na());
}
records[i++] = record;
}
return records;
}
+ private String returnValueOrUnknown(String val) {
+ return (val != null && val.length() > 0) ? val : MSG.common_val_na();
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index de1ef89..b0ceaf9 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -902,6 +902,8 @@ view_bundle_versions = Versions
# individual bundle views/wizards
view_bundle_fileListView_fileSize = File Size
+view_bundle_fileListView_md5 = MD5
+view_bundle_fileListView_sha256 = SHA256
view_bundle_fileListView_loadFailure = Failed to load bundle file data
view_bundle_version_backToBundle = Back to Bundle
view_bundle_version_bundleVersionTagUpdateFailure = Failed to update bundle version tags
13 years, 6 months
[rhq] 2 commits - modules/enterprise
by Heiko W. Rupp
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java | 119 +++++++---
2 files changed, 86 insertions(+), 35 deletions(-)
New commits:
commit 9a7672945dc3c4890b2d491e91a6c36fc633b37a
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Dec 17 17:25:26 2010 +0100
BZ 658491. Keep the direct path insert for the values as there is no reading from the same table involved.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java
index 0c38451..25778fd 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java
@@ -88,7 +88,7 @@ public class CallTimeDataManagerBean implements CallTimeDataManagerLocal, CallTi
+ "(schedule_id, call_destination) " + "SELECT ?, ? FROM RHQ_numbers WHERE i = 42 "
+ "AND NOT EXISTS (SELECT * FROM " + DATA_KEY_TABLE_NAME + " WHERE schedule_id = ? AND call_destination = ?)";
- private static final String CALLTIME_VALUE_INSERT_STATEMENT = "INSERT INTO " + DATA_VALUE_TABLE_NAME
+ private static final String CALLTIME_VALUE_INSERT_STATEMENT = "INSERT /*+ APPEND */ INTO " + DATA_VALUE_TABLE_NAME
+ "(id, key_id, begin_time, end_time, minimum, maximum, total, count) "
+ "SELECT %s, key.id, ?, ?, ?, ?, ?, ? FROM RHQ_numbers num, RHQ_calltime_data_key key WHERE num.i = 42 "
+ "AND key.id = (SELECT id FROM " + DATA_KEY_TABLE_NAME + " WHERE schedule_id = ? AND call_destination = ?)";
commit 19c306bc1906f6777a5273e61ec20c7ed4c3b9a7
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Dec 17 17:18:05 2010 +0100
Do a flush() to force writing stuff to the DB.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
index 6a09934..734f1df 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
@@ -22,11 +22,7 @@ import java.util.Date;
import java.util.Random;
import javax.persistence.EntityManager;
-import javax.transaction.Status;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -49,7 +45,6 @@ import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.measurement.CallTimeDataManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
-import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -60,23 +55,18 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class MeasurementDataManagerTest extends AbstractEJB3Test {
- private final Log log = LogFactory.getLog(MeasurementDataManagerTest.class);
-
- private ResourceManagerLocal resourceManager;
private MeasurementDataManagerLocal measurementDataManager;
private CallTimeDataManagerLocal callTimeDataManager;
private Subject overlord;
private Resource resource1,resource2;
- private ResourceType theResourceType;
- private Agent theAgent;
- private MeasurementDefinition theDefinition;
+ private MeasurementDefinition definitionCt1;
+ private MeasurementDefinition definitionCt2;
@BeforeMethod
public void beforeMethod() {
try {
- this.resourceManager = LookupUtil.getResourceManager();
this.measurementDataManager = LookupUtil.getMeasurementDataManager();
this.callTimeDataManager = LookupUtil.getCallTimeDataManager();
this.overlord = LookupUtil.getSubjectManager().getOverlord();
@@ -96,8 +86,18 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
try {
setupResources(em);
- MeasurementSchedule schedule1 = resource1.getSchedules().iterator().next();
- MeasurementSchedule schedule2 = resource2.getSchedules().iterator().next();
+ MeasurementSchedule schedule1 = new MeasurementSchedule(definitionCt1,resource1);
+ em.persist(schedule1);
+ definitionCt1.addSchedule(schedule1);
+ resource1.addSchedule(schedule1);
+
+ MeasurementSchedule schedule2 = new MeasurementSchedule(definitionCt1,resource2);
+ em.persist(schedule2);
+ definitionCt1.addSchedule(schedule2);
+ resource2.addSchedule(schedule2);
+
+ em.flush();
+
MeasurementScheduleRequest request1 = new MeasurementScheduleRequest(schedule1);
MeasurementScheduleRequest request2 = new MeasurementScheduleRequest(schedule2);
@@ -113,6 +113,66 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
measurementDataManager.mergeMeasurementReport(report);
+ em.flush();
+
+ PageList<CallTimeDataComposite> list1 = callTimeDataManager.findCallTimeDataForResource(overlord,schedule1.getId(),
+ 0,System.currentTimeMillis(),new PageControl());
+ PageList<CallTimeDataComposite> list2 = callTimeDataManager.findCallTimeDataForResource(overlord,schedule2.getId(),
+ 0,System.currentTimeMillis(),new PageControl());
+
+ assert list1 != null;
+ assert list2 != null;
+
+ assert list1.size() == 1 : "List 1 returned " + list1.size() + " entries, expected was 1";
+ assert list2.size() == 1 : "List 2 returned " + list2.size() + " entries, expected was 1";
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ } finally {
+ if (em != null) {
+ getTransactionManager().rollback();
+ em.close();
+ }
+ }
+ }
+
+ @Test(enabled = false)
+ public void bz658491OneResource() throws Exception {
+ EntityManager em = beginTx();
+
+ try {
+ setupResources(em);
+
+ MeasurementSchedule schedule1 = new MeasurementSchedule(definitionCt1,resource1);
+ em.persist(schedule1);
+ definitionCt1.addSchedule(schedule1);
+ resource1.addSchedule(schedule1);
+
+ MeasurementSchedule schedule2 = new MeasurementSchedule(definitionCt2,resource1);
+ em.persist(schedule2);
+ definitionCt1.addSchedule(schedule2);
+ resource2.addSchedule(schedule2);
+
+ em.flush();
+
+ MeasurementScheduleRequest request1 = new MeasurementScheduleRequest(schedule1);
+ MeasurementScheduleRequest request2 = new MeasurementScheduleRequest(schedule2);
+
+ CallTimeData data1 = new CallTimeData(request1);
+ CallTimeData data2 = new CallTimeData(request2);
+
+ data1.addCallData("/foo", new Date(),100);
+ data2.addCallData("/bar", new Date(),200);
+
+ MeasurementReport report = new MeasurementReport();
+ report.addData(data1);
+ report.addData(data2);
+
+ measurementDataManager.mergeMeasurementReport(report);
+
+ em.flush();
PageList<CallTimeDataComposite> list1 = callTimeDataManager.findCallTimeDataForResource(overlord,schedule1.getId(),
0,System.currentTimeMillis(),new PageControl());
@@ -139,23 +199,27 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
/**
- * Just set up a resource where we can attach the availabilities to
+ * Just set up two resources plus measurement definitions
*
* @param em The EntityManager to use
*
- * @return A Resource ready to use
*/
private void setupResources(EntityManager em) {
- theAgent = new Agent("testagent", "localhost", 1234, "", "randomToken");
+ Agent theAgent = new Agent("testagent", "localhost", 1234, "", "randomToken");
em.persist(theAgent);
- theResourceType = new ResourceType("test-plat", "test-plugin", ResourceCategory.PLATFORM, null);
+ ResourceType theResourceType = new ResourceType("test-plat", "test-plugin", ResourceCategory.PLATFORM, null);
em.persist(theResourceType);
- theDefinition = new MeasurementDefinition("CT-Def", MeasurementCategory.PERFORMANCE,
+ definitionCt1 = new MeasurementDefinition("CT-Def1", MeasurementCategory.PERFORMANCE,
+ MeasurementUnits.MILLISECONDS, DataType.CALLTIME,true,60000, DisplayType.SUMMARY);
+ definitionCt1.setResourceType(theResourceType);
+ em.persist(definitionCt1);
+
+ definitionCt2 = new MeasurementDefinition("CT-Def2", MeasurementCategory.PERFORMANCE,
MeasurementUnits.MILLISECONDS, DataType.CALLTIME,true,60000, DisplayType.SUMMARY);
- theDefinition.setResourceType(theResourceType);
- em.persist(theDefinition);
+ definitionCt2.setResourceType(theResourceType);
+ em.persist(definitionCt2);
resource1 = new Resource("test-platform-key1", "test-platform-name", theResourceType);
@@ -166,18 +230,6 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
resource2.setUuid("" + new Random().nextInt());
resource2.setAgent(theAgent);
em.persist(resource2);
-
- MeasurementSchedule schedule1 = new MeasurementSchedule(theDefinition,resource1);
- em.persist(schedule1);
- theDefinition.addSchedule(schedule1);
- resource1.addSchedule(schedule1);
-
- MeasurementSchedule schedule2 = new MeasurementSchedule(theDefinition,resource2);
- em.persist(schedule2);
- theDefinition.addSchedule(schedule2);
- resource2.addSchedule(schedule2);
-
- em.flush();
}
private EntityManager beginTx() throws Exception {
@@ -185,5 +237,4 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
EntityManager em = getEntityManager();
return em;
}
-
}
13 years, 6 months
[rhq] modules/enterprise
by Heiko W. Rupp
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java | 56 ++++------
1 file changed, 27 insertions(+), 29 deletions(-)
New commits:
commit f37a519a58108a372062745ff4b9d10b01cce7e7
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Dec 17 16:38:12 2010 +0100
Revert previous change and remove the direct path inserts.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java
index 2c76232..0c38451 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java
@@ -80,7 +80,7 @@ public class CallTimeDataManagerBean implements CallTimeDataManagerLocal, CallTi
private static final String DATA_VALUE_TABLE_NAME = "RHQ_CALLTIME_DATA_VALUE";
private static final String DATA_KEY_TABLE_NAME = "RHQ_CALLTIME_DATA_KEY";
- private static final String CALLTIME_KEY_INSERT_STATEMENT = "INSERT /*+ APPEND */ INTO " + DATA_KEY_TABLE_NAME
+ private static final String CALLTIME_KEY_INSERT_STATEMENT = "INSERT INTO " + DATA_KEY_TABLE_NAME
+ "(id, schedule_id, call_destination) " + "SELECT %s, ?, ? FROM RHQ_numbers WHERE i = 42 "
+ "AND NOT EXISTS (SELECT * FROM " + DATA_KEY_TABLE_NAME + " WHERE schedule_id = ? AND call_destination = ?)";
@@ -88,7 +88,7 @@ public class CallTimeDataManagerBean implements CallTimeDataManagerLocal, CallTi
+ "(schedule_id, call_destination) " + "SELECT ?, ? FROM RHQ_numbers WHERE i = 42 "
+ "AND NOT EXISTS (SELECT * FROM " + DATA_KEY_TABLE_NAME + " WHERE schedule_id = ? AND call_destination = ?)";
- private static final String CALLTIME_VALUE_INSERT_STATEMENT = "INSERT /*+ APPEND */ INTO " + DATA_VALUE_TABLE_NAME
+ private static final String CALLTIME_VALUE_INSERT_STATEMENT = "INSERT INTO " + DATA_VALUE_TABLE_NAME
+ "(id, key_id, begin_time, end_time, minimum, maximum, total, count) "
+ "SELECT %s, key.id, ?, ?, ?, ?, ?, ? FROM RHQ_numbers num, RHQ_calltime_data_key key WHERE num.i = 42 "
+ "AND key.id = (SELECT id FROM " + DATA_KEY_TABLE_NAME + " WHERE schedule_id = ? AND call_destination = ?)";
@@ -316,26 +316,25 @@ public class CallTimeDataManagerBean implements CallTimeDataManagerLocal, CallTi
for (String callDestination : callDestinations) {
ps.setString(2, callDestination);
ps.setString(4, callDestination);
-// ps.addBatch();
- ps.execute();
+ ps.addBatch();
}
}
-// results = ps.executeBatch();
+ results = ps.executeBatch();
int insertedRowCount = 0;
-// for (int i = 0; i < results.length; i++) {
-// if (((results[i] < 0) || (results[i] > 1)) && (results[i] != -2)) // oracle returns -2 because it can't count updated rows
-// {
-// throw new MeasurementStorageException("Failed to insert call-time data key rows - result ["
-// + results[i] + "] for batch command [" + i + "] is less than 0 or greater than 1.");
-// }
-//
-// insertedRowCount += results[i]==-2 ? 1 : results[i] ; // If Oracle returns -2, just count 1 row
-// }
-
-// log.debug("Inserted new call-time data key rows for " + ((insertedRowCount >= 0) ? insertedRowCount : "?")
-// + " out of " + results.length + " reported key-value pairs.");
+ for (int i = 0; i < results.length; i++) {
+ if (((results[i] < 0) || (results[i] > 1)) && (results[i] != -2)) // oracle returns -2 because it can't count updated rows
+ {
+ throw new MeasurementStorageException("Failed to insert call-time data key rows - result ["
+ + results[i] + "] for batch command [" + i + "] is less than 0 or greater than 1.");
+ }
+
+ insertedRowCount += results[i]==-2 ? 1 : results[i] ; // If Oracle returns -2, just count 1 row
+ }
+
+ log.debug("Inserted new call-time data key rows for " + ((insertedRowCount >= 0) ? insertedRowCount : "?")
+ + " out of " + results.length + " reported key-value pairs.");
} catch (SQLException e) {
logSQLException("Failed to persist call-time data keys", e);
} catch (Throwable t) {
@@ -393,23 +392,22 @@ public class CallTimeDataManagerBean implements CallTimeDataManagerLocal, CallTi
ps.setDouble(5, callTimeDataValue.getTotal());
ps.setLong(6, callTimeDataValue.getCount());
ps.setString(8, callDestination);
-// ps.addBatch();
- ps.execute();
+ ps.addBatch();
}
}
-// results = ps.executeBatch();
+ results = ps.executeBatch();
int insertedRowCount = 0;
-// for (int i = 0; i < results.length; i++) {
-// if ((results[i] != 1) && (results[i] != -2)) // Oracle likes to return -2 becuase it doesn't track batch update counts
-// {
-// throw new MeasurementStorageException("Failed to insert call-time data value rows - result ["
-// + results[i] + "] for batch command [" + i + "] does not equal 1.");
-// }
-//
-// insertedRowCount += results[i]==-2 ? 1 : results[i] ; // If Oracle returns -2, just count 1 row;
-// }
+ for (int i = 0; i < results.length; i++) {
+ if ((results[i] != 1) && (results[i] != -2)) // Oracle likes to return -2 becuase it doesn't track batch update counts
+ {
+ throw new MeasurementStorageException("Failed to insert call-time data value rows - result ["
+ + results[i] + "] for batch command [" + i + "] does not equal 1.");
+ }
+
+ insertedRowCount += results[i]==-2 ? 1 : results[i] ; // If Oracle returns -2, just count 1 row;
+ }
notifyAlertConditionCacheManager("insertCallTimeDataValues", callTimeDataSet
.toArray(new CallTimeData[callTimeDataSet.size()]));
13 years, 6 months
[rhq] 3 commits - modules/enterprise modules/plugins
by Heiko W. Rupp
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java | 52 +++++-----
modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml | 6 -
modules/plugins/perftest/src/main/resources/configurable-5.xml | 4
3 files changed, 32 insertions(+), 30 deletions(-)
New commits:
commit 2bbb4cf551c52288216a1d6ad3e1a43d44c320e3
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Dec 17 15:30:53 2010 +0100
Replace batching by individual statements. Related to BZ 658491
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java
index df8fbd2..2c76232 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java
@@ -316,25 +316,26 @@ public class CallTimeDataManagerBean implements CallTimeDataManagerLocal, CallTi
for (String callDestination : callDestinations) {
ps.setString(2, callDestination);
ps.setString(4, callDestination);
- ps.addBatch();
+// ps.addBatch();
+ ps.execute();
}
}
- results = ps.executeBatch();
+// results = ps.executeBatch();
int insertedRowCount = 0;
- for (int i = 0; i < results.length; i++) {
- if (((results[i] < 0) || (results[i] > 1)) && (results[i] != -2)) // oracle returns -2 because it can't count updated rows
- {
- throw new MeasurementStorageException("Failed to insert call-time data key rows - result ["
- + results[i] + "] for batch command [" + i + "] is less than 0 or greater than 1.");
- }
-
- insertedRowCount += results[i]==-2 ? 1 : results[i] ; // If Oracle returns -2, just count 1 row
- }
-
- log.debug("Inserted new call-time data key rows for " + ((insertedRowCount >= 0) ? insertedRowCount : "?")
- + " out of " + results.length + " reported key-value pairs.");
+// for (int i = 0; i < results.length; i++) {
+// if (((results[i] < 0) || (results[i] > 1)) && (results[i] != -2)) // oracle returns -2 because it can't count updated rows
+// {
+// throw new MeasurementStorageException("Failed to insert call-time data key rows - result ["
+// + results[i] + "] for batch command [" + i + "] is less than 0 or greater than 1.");
+// }
+//
+// insertedRowCount += results[i]==-2 ? 1 : results[i] ; // If Oracle returns -2, just count 1 row
+// }
+
+// log.debug("Inserted new call-time data key rows for " + ((insertedRowCount >= 0) ? insertedRowCount : "?")
+// + " out of " + results.length + " reported key-value pairs.");
} catch (SQLException e) {
logSQLException("Failed to persist call-time data keys", e);
} catch (Throwable t) {
@@ -392,22 +393,23 @@ public class CallTimeDataManagerBean implements CallTimeDataManagerLocal, CallTi
ps.setDouble(5, callTimeDataValue.getTotal());
ps.setLong(6, callTimeDataValue.getCount());
ps.setString(8, callDestination);
- ps.addBatch();
+// ps.addBatch();
+ ps.execute();
}
}
- results = ps.executeBatch();
+// results = ps.executeBatch();
int insertedRowCount = 0;
- for (int i = 0; i < results.length; i++) {
- if ((results[i] != 1) && (results[i] != -2)) // Oracle likes to return -2 becuase it doesn't track batch update counts
- {
- throw new MeasurementStorageException("Failed to insert call-time data value rows - result ["
- + results[i] + "] for batch command [" + i + "] does not equal 1.");
- }
-
- insertedRowCount += results[i]==-2 ? 1 : results[i] ; // If Oracle returns -2, just count 1 row;
- }
+// for (int i = 0; i < results.length; i++) {
+// if ((results[i] != 1) && (results[i] != -2)) // Oracle likes to return -2 becuase it doesn't track batch update counts
+// {
+// throw new MeasurementStorageException("Failed to insert call-time data value rows - result ["
+// + results[i] + "] for batch command [" + i + "] does not equal 1.");
+// }
+//
+// insertedRowCount += results[i]==-2 ? 1 : results[i] ; // If Oracle returns -2, just count 1 row;
+// }
notifyAlertConditionCacheManager("insertCallTimeDataValues", callTimeDataSet
.toArray(new CallTimeData[callTimeDataSet.size()]));
commit a3ff39c9c4a1a1e751ce951723d3d04192ab5d21
Merge: b5a1378... aa14f1b...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Dec 17 13:57:01 2010 +0100
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit b5a137896221a3f6980d31ed35fe9d09ffbd21f1
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Dec 17 13:44:26 2010 +0100
Provide less aggressive settings.
diff --git a/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml
index df3cdbc..2975ccd 100644
--- a/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml
@@ -314,9 +314,9 @@
<metric property="metric002" defaultOn="true" displayType="summary" defaultInterval="720000"/>
<metric property="metric003" defaultOn="true" displayType="summary" defaultInterval="600000"/>
<metric property="metric004" defaultOn="true" displayType="summary" defaultInterval="600000"/>
- <metric property="trait001" defaultOn="true" dataType="trait" displayType="summary" defaultInterval="1200000"/>
- <metric property="trait002" defaultOn="true" dataType="trait" displayType="summary" defaultInterval="1440000"/>
- <metric displayName="CallTime" property="calltime" defaultOn="true" dataType="calltime" defaultInterval="1200000" units="milliseconds"/>
+ <metric property="trait001" defaultOn="true" dataType="trait" displayType="summary" defaultInterval="3600000"/>
+ <metric property="trait002" defaultOn="true" dataType="trait" displayType="summary" defaultInterval="2400000"/>
+ <metric displayName="CallTime" property="calltime" defaultOn="true" dataType="calltime" defaultInterval="2400000" units="milliseconds"/>
<event name="PerfTestEventType" description="a test event type"/>
</service>
</server>
diff --git a/modules/plugins/perftest/src/main/resources/configurable-5.xml b/modules/plugins/perftest/src/main/resources/configurable-5.xml
index c3f68b4..889b2b2 100644
--- a/modules/plugins/perftest/src/main/resources/configurable-5.xml
+++ b/modules/plugins/perftest/src/main/resources/configurable-5.xml
@@ -23,9 +23,9 @@
<simpleNumericMeasurementGenerator/>
<simpleTraitMeasurementGenerator/>
<ConfigurableCallTimeDataGenerator
- minMsgCount="1" maxMsgCount="500"
+ minMsgCount="1" maxMsgCount="100"
minDuration="10" maxDuration="500"
- numberSubPaths="100"/>
+ numberSubPaths="10"/>
</resource>
</scenario>
13 years, 6 months
[rhq] Branch 'release-3.0.0' - modules/plugins
by fdrabek
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/AbstractMessagingComponent.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
New commits:
commit b2d970b37dd051b2519a460122aa8b0115084e73
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Fri Dec 17 13:05:15 2010 +0100
BZ 638216 - fix for AS4 messaging components - logging and collection of metrics
diff --git a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/AbstractMessagingComponent.java b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/AbstractMessagingComponent.java
index 7c48ed4..933c0c7 100644
--- a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/AbstractMessagingComponent.java
+++ b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/AbstractMessagingComponent.java
@@ -36,6 +36,7 @@ import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.mc4j.ems.connection.bean.EmsBean;
import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
@@ -71,7 +72,7 @@ public abstract class AbstractMessagingComponent extends MBeanResourceComponent<
ResourceType resourceType;
protected String name;
- protected Log LOG = null;
+ protected Log LOG = LogFactory.getLog(AbstractMessagingComponent.class);;
public void start(ResourceContext<JBossASServerComponent> resourceContext, XMLConfigurationEditor editor) {
super.start(resourceContext);
@@ -83,7 +84,7 @@ public abstract class AbstractMessagingComponent extends MBeanResourceComponent<
protected void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests, String pattern) {
Set<MeasurementScheduleRequest> others = new HashSet<MeasurementScheduleRequest>();
-
+ try {
for (MeasurementScheduleRequest request : requests) {
// Handle stuff for the generic Messaging MBeans ourselves. Pass the remainder
@@ -116,6 +117,9 @@ public abstract class AbstractMessagingComponent extends MBeanResourceComponent<
}
super.getValues(report, others);
+ }catch(Throwable e){
+ LOG.error("Failed to obtain measurement [" + name + "]", e);
+ }
}
@Override
13 years, 6 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java | 27 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java | 3 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 4 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java | 3 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java | 4 +
5 files changed, 26 insertions(+), 15 deletions(-)
New commits:
commit aa14f1b66731c4a3c4af55be772c8a0da611ad73
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Dec 17 03:51:13 2010 -0500
get more perms so non-auth user can't get to deployments
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
index 147aaf0..a2412d5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
@@ -47,8 +47,11 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class BundleDeploymentListView extends Table<RPCDataSource<BundleDeployment>> {
- public BundleDeploymentListView(String locatorId, Criteria criteria) {
+ private final boolean canManageBundles;
+
+ public BundleDeploymentListView(String locatorId, Criteria criteria, boolean canManageBundles) {
super(locatorId, MSG.view_bundle_bundleDeployments(), criteria);
+ this.canManageBundles = canManageBundles;
setDataSource(new BundleDeploymentDataSource());
setHeaderIcon("subsystems/bundle/BundleDeployment_24.png");
}
@@ -70,14 +73,18 @@ public class BundleDeploymentListView extends Table<RPCDataSource<BundleDeployme
deployTimeField.setType(ListGridFieldType.DATE);
deployTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
- nameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord record, int i, int i1) {
- return "<a href=\""
- + LinkManager.getBundleDeploymentLink(record
- .getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID), record
- .getAttributeAsInt(BundleDeploymentDataSource.FIELD_ID)) + "\">" + String.valueOf(o) + "</a>";
- }
- });
+ // only users that are authorized can see deployments
+ if (canManageBundles) {
+ nameField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord record, int i, int i1) {
+ return "<a href=\""
+ + LinkManager.getBundleDeploymentLink(record
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID), record
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_ID)) + "\">" + String.valueOf(o)
+ + "</a>";
+ }
+ });
+ }
bundleVersionField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord record, int i, int i1) {
@@ -116,7 +123,7 @@ public class BundleDeploymentListView extends Table<RPCDataSource<BundleDeployme
if (selectedRows != null && selectedRows.length == 1) {
String selectedId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_BUNDLE_ID);
String selectedVersionId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_ID);
- CoreGUI.goToView(LinkManager.getBundleDestinationLink(Integer.valueOf(selectedId), Integer
+ CoreGUI.goToView(LinkManager.getBundleDeploymentLink(Integer.valueOf(selectedId), Integer
.valueOf(selectedVersionId)));
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index b4aaba8..c298b35 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -197,7 +197,8 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
private Table createDeploymentsTable() {
Criteria criteria = new Criteria();
criteria.addCriteria("bundleDestinationId", destination.getId());
- BundleDeploymentListView deployments = new BundleDeploymentListView(extendLocatorId("Deployments"), criteria);
+ BundleDeploymentListView deployments = new BundleDeploymentListView(extendLocatorId("Deployments"), criteria,
+ canManageBundles);
deployments.setHeight100();
deployments.setShowResizeBar(true);
return deployments;
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 36968e8..b567a0a 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
@@ -100,10 +100,10 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
BundleTopView.VIEW_ID.getTitle());
headerLabel = new HeaderLabel("subsystems/bundle/Bundle_24.png", bundle.getName());
tabs = new LocatableTabSet(getLocatorId());
- destinationsTab = createDestinationsTab();
versionsTab = createVersionsTab();
- tabs.addTab(destinationsTab);
+ destinationsTab = createDestinationsTab();
tabs.addTab(versionsTab);
+ tabs.addTab(destinationsTab);
addMember(backButton);
addMember(headerLabel);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
index e3e8567..ad55799 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
@@ -169,7 +169,8 @@ public class BundleVersionView extends LocatableVLayout implements BookmarkableV
Criteria criteria = new Criteria();
criteria.setAttribute("bundleVersionId", version.getId());
- tab.setPane(new BundleDeploymentListView(tab.getLocatorId(), criteria));
+ // TODO: get user perm, if has manage_bundle, pass true
+ tab.setPane(new BundleDeploymentListView(tab.getLocatorId(), criteria, false));
return tab;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
index 7192f94..2517d3e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
@@ -110,7 +110,9 @@ public class TaggedView extends LocatableVLayout implements BookmarkableView {
tab.setPane(bundleVersionListView);
container.addTab(tab);
- BundleDeploymentListView bundleDeploymentListView = new BundleDeploymentListView(getLocatorId(), criteria);
+ // TODO: get manage_bundle perm, if user has it pass true
+ BundleDeploymentListView bundleDeploymentListView = new BundleDeploymentListView(getLocatorId(), criteria,
+ false);
viewsWithTags.add(bundleDeploymentListView);
tab = new LocatableTab(extendLocatorId("bundleDeploymentsList"), MSG.view_bundle_bundleDeployments());
tab.setPane(bundleDeploymentListView);
13 years, 6 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 12 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java | 59 +++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java | 82 ++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationDataSource.java | 76 +++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java | 93 +++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java | 99 +++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java | 34 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 101 +++-------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java | 63 ++++--
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Error_11.png |binary
10 files changed, 394 insertions(+), 225 deletions(-)
New commits:
commit cb37fdd5b2b814f32b0f92f9e7782f13cce9ee89
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Dec 17 03:27:07 2010 -0500
more cleanup of the bundle views
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index 49395c0..c7cc475 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -323,4 +323,16 @@ public class LinkManager {
public static String getBundleLink(int bundleId) {
return "#Bundles/Bundle/" + bundleId;
}
+
+ public static String getBundleVersionLink(int bundleId, int bundleVersionId) {
+ return "#Bundles/Bundle/" + bundleId + "/versions/" + bundleVersionId;
+ }
+
+ public static String getBundleDestinationLink(int bundleId, int bundleDestinationId) {
+ return "#Bundles/Bundle/" + bundleId + "/destinations/" + bundleDestinationId;
+ }
+
+ public static String getBundleDeploymentLink(int bundleId, int bundleDeploymentId) {
+ return "#Bundles/Bundle/" + bundleId + "/deployments/" + bundleDeploymentId;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java
index 48f6849..5e94e47 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java
@@ -48,6 +48,18 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class BundleDeploymentDataSource extends RPCDataSource<BundleDeployment> {
+ public static final String FIELD_ID = "id";
+ public static final String FIELD_NAME = "name";
+ public static final String FIELD_DEPLOY_DIR = "deployDir";
+ public static final String FIELD_DESCRIPTION = "description";
+ public static final String FIELD_DEPLOY_TIME = "deploymentTime";
+ public static final String FIELD_CONFIG = "configuration";
+ public static final String FIELD_STATUS = "status";
+ public static final String FIELD_DEPLOYER = "deployer"; // a user name
+ public static final String FIELD_BUNDLE_VERSION_VERSION = "bundleVersionVersion";
+ public static final String FIELD_BUNDLE_VERSION_ID = "bundleVersionId";
+ public static final String FIELD_BUNDLE_ID = "bundleId";
+
private BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
public BundleDeploymentDataSource() {
@@ -60,24 +72,24 @@ public class BundleDeploymentDataSource extends RPCDataSource<BundleDeployment>
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField id = new DataSourceIntegerField("id", MSG.common_title_id());
+ DataSourceIntegerField id = new DataSourceIntegerField(FIELD_ID, MSG.common_title_id());
id.setPrimaryKey(true);
fields.add(id);
- DataSourceTextField name = new DataSourceTextField("name", MSG.view_bundle_deploy_name());
+ DataSourceTextField name = new DataSourceTextField(FIELD_NAME, MSG.view_bundle_deploy_name());
fields.add(name);
- DataSourceTextField bundleVersion = new DataSourceTextField("bundleVersionVersion", MSG
+ DataSourceTextField bundleVersion = new DataSourceTextField(FIELD_BUNDLE_VERSION_VERSION, MSG
.view_bundle_bundleVersion());
fields.add(bundleVersion);
- DataSourceTextField description = new DataSourceTextField("description", MSG.common_title_description());
+ DataSourceTextField description = new DataSourceTextField(FIELD_DESCRIPTION, MSG.common_title_description());
fields.add(description);
- DataSourceTextField status = new DataSourceTextField("status", MSG.common_title_status());
+ DataSourceTextField status = new DataSourceTextField(FIELD_STATUS, MSG.common_title_status());
fields.add(status);
- DataSourceDateTimeField created = new DataSourceDateTimeField("deploymentTime", MSG.view_bundle_deploy_time());
+ DataSourceDateTimeField created = new DataSourceDateTimeField(FIELD_DEPLOY_TIME, MSG.view_bundle_deploy_time());
fields.add(created);
return fields;
@@ -88,12 +100,13 @@ public class BundleDeploymentDataSource extends RPCDataSource<BundleDeployment>
BundleDeploymentCriteria criteria = new BundleDeploymentCriteria();
criteria.fetchBundleVersion(true);
- if (request.getCriteria().getValues().containsKey("bundleId")) {
- criteria.addFilterBundleId(Integer.parseInt(request.getCriteria().getAttribute("bundleId")));
+ if (request.getCriteria().getValues().containsKey(FIELD_BUNDLE_ID)) {
+ criteria.addFilterBundleId(Integer.parseInt(request.getCriteria().getAttribute(FIELD_BUNDLE_ID)));
}
- if (request.getCriteria().getValues().containsKey("bundleVersionId")) {
- criteria.addFilterBundleVersionId(Integer.parseInt(request.getCriteria().getAttribute("bundleVersionId")));
+ if (request.getCriteria().getValues().containsKey(FIELD_BUNDLE_VERSION_ID)) {
+ criteria.addFilterBundleVersionId(Integer.parseInt(request.getCriteria().getAttribute(
+ FIELD_BUNDLE_VERSION_ID)));
}
if (request.getCriteria().getValues().containsKey("bundleDestinationId")) {
@@ -128,7 +141,7 @@ public class BundleDeploymentDataSource extends RPCDataSource<BundleDeployment>
@Override
public BundleDeployment copyValues(Record from) {
- return null; // TODO: Implement this method.
+ return (BundleDeployment) from.getAttributeAsObject("object");
}
@Override
@@ -136,24 +149,26 @@ public class BundleDeploymentDataSource extends RPCDataSource<BundleDeployment>
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("name", from.getName());
- record.setAttribute("deployDir", from.getDestination().getDeployDir());
- record.setAttribute("description", from.getDescription());
- record.setAttribute("deploymentTime", new Date(from.getCtime()));
- record.setAttribute("configuration", from.getConfiguration());
- record.setAttribute("status", from.getStatus().name());
- record.setAttribute("deployer", from.getSubjectName());
+ record.setAttribute(FIELD_ID, from.getId());
+ record.setAttribute(FIELD_NAME, from.getName());
+ record.setAttribute(FIELD_DEPLOY_DIR, from.getDestination().getDeployDir());
+ record.setAttribute(FIELD_DESCRIPTION, from.getDescription());
+ record.setAttribute(FIELD_DEPLOY_TIME, new Date(from.getCtime()));
+ record.setAttribute(FIELD_CONFIG, from.getConfiguration());
+ record.setAttribute(FIELD_STATUS, from.getStatus().name());
+ record.setAttribute(FIELD_DEPLOYER, from.getSubjectName());
if (from.getBundleVersion() != null) {
- record.setAttribute("bundleVersionVersion", from.getBundleVersion().getVersion());
- record.setAttribute("bundleVersionId", from.getBundleVersion().getId());
+ record.setAttribute(FIELD_BUNDLE_VERSION_VERSION, from.getBundleVersion().getVersion());
+ record.setAttribute(FIELD_BUNDLE_VERSION_ID, from.getBundleVersion().getId());
if (from.getBundleVersion().getBundle() != null) {
- record.setAttribute("bundleId", from.getBundleVersion().getBundle().getId());
+ record.setAttribute(FIELD_BUNDLE_ID, from.getBundleVersion().getBundle().getId());
}
}
+ record.setAttribute("object", from);
+
return record;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
index 93a55a1..147aaf0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
@@ -25,17 +25,27 @@ package org.rhq.enterprise.gui.coregui.client.bundle.deployment;
import java.util.HashMap;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.DateDisplayFormat;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleDeploymentStatus;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleVersionDataSource;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
* @author Greg Hinkle
*/
-public class BundleDeploymentListView extends Table {
+public class BundleDeploymentListView extends Table<RPCDataSource<BundleDeployment>> {
public BundleDeploymentListView(String locatorId, Criteria criteria) {
super(locatorId, MSG.view_bundle_bundleDeployments(), criteria);
@@ -45,37 +55,71 @@ public class BundleDeploymentListView extends Table {
@Override
protected void configureTable() {
- getListGrid().getField("id").setWidth("60");
- getListGrid().getField("name").setWidth("25%");
- getListGrid().getField("name").setCellFormatter(new CellFormatter() {
+ ListGridField idField = new ListGridField(BundleDeploymentDataSource.FIELD_ID, MSG.common_title_id());
+ ListGridField nameField = new ListGridField(BundleDeploymentDataSource.FIELD_NAME, MSG
+ .view_bundle_deploy_name());
+ ListGridField descriptionField = new ListGridField(BundleDeploymentDataSource.FIELD_DESCRIPTION, MSG
+ .common_title_description());
+ ListGridField bundleVersionField = new ListGridField(BundleDeploymentDataSource.FIELD_BUNDLE_VERSION_VERSION,
+ MSG.view_bundle_bundleVersion());
+ ListGridField statusField = new ListGridField(BundleDeploymentDataSource.FIELD_STATUS, MSG
+ .common_title_status());
+ ListGridField deployTimeField = new ListGridField(BundleDeploymentDataSource.FIELD_DEPLOY_TIME, MSG
+ .view_bundle_deploy_time());
+
+ deployTimeField.setType(ListGridFieldType.DATE);
+ deployTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+
+ nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord record, int i, int i1) {
- return "<a href=\"#Bundles/Bundle/" + record.getAttribute("bundleId") + "/deployments/"
- + record.getAttribute("id") + "\">" + String.valueOf(o) + "</a>";
+ return "<a href=\""
+ + LinkManager.getBundleDeploymentLink(record
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID), record
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_ID)) + "\">" + String.valueOf(o) + "</a>";
}
});
- getListGrid().getField("bundleVersionVersion").setWidth("80");
- getListGrid().getField("bundleVersionVersion").setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("bundleId") + "/versions/"
- + listGridRecord.getAttribute("bundleVersionId") + "\">" + o + "</a>";
+ bundleVersionField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord record, int i, int i1) {
+ return "<a href=\""
+ + LinkManager.getBundleVersionLink(record
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID), record
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_VERSION_ID)) + "\">"
+ + String.valueOf(o) + "</a>";
}
});
- getListGrid().getField("description").setWidth("25%");
- getListGrid().getField("deploymentTime").setWidth("20%");
- getListGrid().getField("status").setWidth("25%");
- ListGridField status = getListGrid().getField("status");
HashMap<String, String> statusIcons = new HashMap<String, String>();
statusIcons.put(BundleDeploymentStatus.IN_PROGRESS.name(), "subsystems/bundle/install-loader.gif");
- statusIcons.put(BundleDeploymentStatus.FAILURE.name(), "subsystems/bundle/Warning_11.png");
+ statusIcons.put(BundleDeploymentStatus.FAILURE.name(), "subsystems/bundle/Error_11.png");
statusIcons.put(BundleDeploymentStatus.MIXED.name(), "subsystems/bundle/Warning_11.png");
statusIcons.put(BundleDeploymentStatus.WARN.name(), "subsystems/bundle/Warning_11.png");
statusIcons.put(BundleDeploymentStatus.SUCCESS.name(), "subsystems/bundle/Ok_11.png");
- status.setValueIcons(statusIcons);
- status.setValueIconHeight(11);
- status.setWidth(80);
+ statusField.setValueIcons(statusIcons);
+ statusField.setValueIconWidth(11);
+ statusField.setValueIconHeight(11);
+ idField.setWidth(50);
+ nameField.setWidth("30%");
+ descriptionField.setWidth("40%");
+ bundleVersionField.setWidth("15%");
+ deployTimeField.setWidth("15%");
+ statusField.setWidth(80);
+ setListGridFields(idField, nameField, descriptionField, bundleVersionField, deployTimeField, statusField);
+
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length == 1) {
+ String selectedId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_BUNDLE_ID);
+ String selectedVersionId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_ID);
+ CoreGUI.goToView(LinkManager.getBundleDestinationLink(Integer.valueOf(selectedId), Integer
+ .valueOf(selectedVersionId)));
+ }
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationDataSource.java
index d52538c..1a6f3dc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationDataSource.java
@@ -49,6 +49,19 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class BundleDestinationDataSource extends RPCDataSource<BundleDestination> {
+ public static final String FIELD_ID = "id";
+ public static final String FIELD_NAME = "name";
+ public static final String FIELD_DESCRIPTION = "description";
+ public static final String FIELD_BUNDLE_ID = "bundleId";
+ public static final String FIELD_BUNDLE_NAME = "bundleName";
+ public static final String FIELD_GROUP_ID = "groupId";
+ public static final String FIELD_GROUP_NAME = "groupName";
+ public static final String FIELD_DEPLOY_DIR = "deployDir";
+ public static final String FIELD_LATEST_DEPLOY_VERSION = "latestDeploymentVersion";
+ public static final String FIELD_LATEST_DEPLOY_DATE = "latestDeploymentDate";
+ public static final String FIELD_LATEST_DEPLOY_STATUS = "latestDeploymentStatus";
+ public static final String FIELD_LATEST_DEPLOY = "latestDeployment";
+
public BundleDestinationDataSource() {
super();
List<DataSourceField> fields = addDataSourceFields();
@@ -59,34 +72,34 @@ public class BundleDestinationDataSource extends RPCDataSource<BundleDestination
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField idField = new DataSourceIntegerField("id", MSG.common_title_id());
+ DataSourceIntegerField idField = new DataSourceIntegerField(FIELD_ID, MSG.common_title_id());
idField.setPrimaryKey(true);
fields.add(idField);
- DataSourceTextField name = new DataSourceTextField("name", MSG.common_title_name());
+ DataSourceTextField name = new DataSourceTextField(FIELD_NAME, MSG.common_title_name());
fields.add(name);
- DataSourceTextField description = new DataSourceTextField("description", MSG.common_title_description());
+ DataSourceTextField description = new DataSourceTextField(FIELD_DESCRIPTION, MSG.common_title_description());
fields.add(description);
- DataSourceTextField bundle = new DataSourceTextField("bundleName", MSG.view_bundle_bundle());
+ DataSourceTextField bundle = new DataSourceTextField(FIELD_BUNDLE_NAME, MSG.view_bundle_bundle());
fields.add(bundle);
- DataSourceTextField group = new DataSourceTextField("groupName", MSG.view_bundle_dest_group());
+ DataSourceTextField group = new DataSourceTextField(FIELD_GROUP_NAME, MSG.view_bundle_dest_group());
fields.add(group);
- DataSourceTextField deployDir = new DataSourceTextField("deployDir", MSG.view_bundle_dest_deployDir());
+ DataSourceTextField deployDir = new DataSourceTextField(FIELD_DEPLOY_DIR, MSG.view_bundle_dest_deployDir());
fields.add(deployDir);
- DataSourceTextField latestDeploymentVersion = new DataSourceTextField("latestDeploymentVersion", MSG
+ DataSourceTextField latestDeploymentVersion = new DataSourceTextField(FIELD_LATEST_DEPLOY_VERSION, MSG
.view_bundle_dest_lastDeployedVersion());
fields.add(latestDeploymentVersion);
- DataSourceTextField latestDeploymentDate = new DataSourceTextField("latestDeploymentDate", MSG
+ DataSourceTextField latestDeploymentDate = new DataSourceTextField(FIELD_LATEST_DEPLOY_DATE, MSG
.view_bundle_dest_lastDeploymentDate());
fields.add(latestDeploymentDate);
- DataSourceTextField latestDeploymentStatus = new DataSourceTextField("latestDeploymentStatus", MSG
+ DataSourceTextField latestDeploymentStatus = new DataSourceTextField(FIELD_LATEST_DEPLOY_STATUS, MSG
.view_bundle_dest_lastDeploymentStatus());
fields.add(latestDeploymentStatus);
@@ -97,8 +110,8 @@ public class BundleDestinationDataSource extends RPCDataSource<BundleDestination
protected void executeFetch(final DSRequest request, final DSResponse response) {
BundleDestinationCriteria criteria = new BundleDestinationCriteria();
- if (request.getCriteria().getValues().containsKey("bundleId")) {
- criteria.addFilterBundleId(Integer.parseInt(request.getCriteria().getAttributeAsString("bundleId")));
+ if (request.getCriteria().getValues().containsKey(FIELD_BUNDLE_ID)) {
+ criteria.addFilterBundleId(Integer.parseInt(request.getCriteria().getAttributeAsString(FIELD_BUNDLE_ID)));
}
if (request.getCriteria().getValues().get("tagNamespace") != null) {
@@ -125,11 +138,10 @@ public class BundleDestinationDataSource extends RPCDataSource<BundleDestination
}
public void onSuccess(final PageList<BundleDestination> result) {
-
BundleVersionCriteria versionCriteria = new BundleVersionCriteria();
- if (request.getCriteria().getValues().containsKey("bundleId")) {
+ if (request.getCriteria().getValues().containsKey(FIELD_BUNDLE_ID)) {
versionCriteria.addFilterBundleId(Integer.parseInt(request.getCriteria().getAttributeAsString(
- "bundleId")));
+ FIELD_BUNDLE_ID)));
}
GWTServiceLookup.getBundleService().findBundleVersionsByCriteria(versionCriteria,
new AsyncCallback<PageList<BundleVersion>>() {
@@ -139,11 +151,8 @@ public class BundleDestinationDataSource extends RPCDataSource<BundleDestination
}
public void onSuccess(PageList<BundleVersion> versions) {
-
for (BundleDestination dest : result) {
-
for (BundleDeployment dep : dest.getDeployments()) {
-
for (BundleVersion version : versions) {
if (dep.getBundleVersion().getId() == version.getId()) {
dep.setBundleVersion(version);
@@ -151,10 +160,8 @@ public class BundleDestinationDataSource extends RPCDataSource<BundleDestination
}
}
}
-
response.setData(buildRecords(result));
processResponse(request.getRequestId(), response);
-
}
});
}
@@ -163,35 +170,32 @@ public class BundleDestinationDataSource extends RPCDataSource<BundleDestination
@Override
public BundleDestination copyValues(Record from) {
- return null;
+ return (BundleDestination) from.getAttributeAsObject("object");
}
@Override
public ListGridRecord copyValues(BundleDestination from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("name", from.getName());
- record.setAttribute("description", from.getDescription());
- record.setAttribute("bundleId", from.getBundle().getId());
- record.setAttribute("bundleName", from.getBundle().getName());
-
- record.setAttribute("groupId", from.getGroup().getId());
- record.setAttribute("groupName", from.getGroup().getName());
+ record.setAttribute(FIELD_ID, from.getId());
+ record.setAttribute(FIELD_NAME, from.getName());
+ record.setAttribute(FIELD_DESCRIPTION, from.getDescription());
+ record.setAttribute(FIELD_BUNDLE_ID, from.getBundle().getId());
+ record.setAttribute(FIELD_BUNDLE_NAME, from.getBundle().getName());
+ record.setAttribute(FIELD_GROUP_ID, from.getGroup().getId());
+ record.setAttribute(FIELD_GROUP_NAME, from.getGroup().getName());
+ record.setAttribute(FIELD_DEPLOY_DIR, from.getDeployDir());
- record.setAttribute("deployDir", from.getDeployDir());
- record.setAttribute("entity", from);
+ record.setAttribute("object", from);
long last = 0;
for (BundleDeployment dep : from.getDeployments()) {
if (last < dep.getCtime()) {
last = dep.getCtime();
-
- record.setAttribute("latestDeployment", dep);
- record.setAttribute("latestDeploymentVersion", dep.getBundleVersion().getVersion());
- record.setAttribute("latestDeploymentDate", new Date(dep.getCtime()));
- record.setAttribute("latestDeploymentStatus", dep.getStatus().name());
-
+ record.setAttribute(FIELD_LATEST_DEPLOY, dep);
+ record.setAttribute(FIELD_LATEST_DEPLOY_VERSION, dep.getBundleVersion().getVersion());
+ record.setAttribute(FIELD_LATEST_DEPLOY_DATE, new Date(dep.getCtime()));
+ record.setAttribute(FIELD_LATEST_DEPLOY_STATUS, dep.getStatus().name());
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
index f4052f7..5bfc174 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
@@ -25,17 +25,26 @@ package org.rhq.enterprise.gui.coregui.client.bundle.destination;
import java.util.HashMap;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.DateDisplayFormat;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.bundle.BundleDeploymentStatus;
+import org.rhq.core.domain.bundle.BundleDestination;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
* @author Greg Hinkle
*/
-public class BundleDestinationListView extends Table {
+public class BundleDestinationListView extends Table<RPCDataSource<BundleDestination>> {
public BundleDestinationListView(String locatorId) {
this(locatorId, null);
@@ -49,32 +58,84 @@ public class BundleDestinationListView extends Table {
@Override
protected void configureTable() {
- getListGrid().getField("id").setWidth(45);
- getListGrid().getField("name").setWidth("20%");
- getListGrid().getField("name").setCellFormatter(new CellFormatter() {
+ ListGridField idField = new ListGridField(BundleDestinationDataSource.FIELD_ID, MSG.common_title_id());
+ ListGridField nameField = new ListGridField(BundleDestinationDataSource.FIELD_NAME, MSG.common_title_name());
+ ListGridField descriptionField = new ListGridField(BundleDestinationDataSource.FIELD_DESCRIPTION, MSG
+ .common_title_description());
+ ListGridField bundleNameField = new ListGridField(BundleDestinationDataSource.FIELD_BUNDLE_NAME, MSG
+ .view_bundle_bundle());
+ ListGridField groupNameField = new ListGridField(BundleDestinationDataSource.FIELD_GROUP_NAME, MSG
+ .view_bundle_dest_group());
+ ListGridField deployDirField = new ListGridField(BundleDestinationDataSource.FIELD_DEPLOY_DIR, MSG
+ .view_bundle_dest_deployDir());
+ ListGridField latestDeploymentVersionField = new ListGridField(
+ BundleDestinationDataSource.FIELD_LATEST_DEPLOY_VERSION, MSG.view_bundle_dest_lastDeployedVersion());
+ ListGridField latestDeploymentDateField = new ListGridField(
+ BundleDestinationDataSource.FIELD_LATEST_DEPLOY_DATE, MSG.view_bundle_dest_lastDeploymentDate());
+ ListGridField latestDeploymentStatusField = new ListGridField(
+ BundleDestinationDataSource.FIELD_LATEST_DEPLOY_STATUS, MSG.view_bundle_dest_lastDeploymentStatus());
+
+ latestDeploymentDateField.setType(ListGridFieldType.DATE);
+ latestDeploymentDateField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+
+ nameField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ Integer bundleId = listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
+ Integer bundleDestId = listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_ID);
+ return "<a href=\"" + LinkManager.getBundleDestinationLink(bundleId, bundleDestId) + "\">" + o + "</a>";
+ }
+ });
+
+ groupNameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Bundles/Bundles/" + listGridRecord.getAttribute("bundleId") + "/destinations/"
- + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ Integer groupId = listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_GROUP_ID);
+ return "<a href=\"" + LinkManager.getResourceGroupLink(groupId) + "\">" + o + "</a>";
}
});
- getListGrid().getField("description").setWidth("15%");
- //getListGrid().getField("bundleName").setWidth("20%");
- getListGrid().hideField("bundleName");
- getListGrid().getField("groupName").setWidth("15%");
- getListGrid().getField("deployDir").setWidth("15%");
+ bundleNameField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ Integer bid = listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
+ return "<a href=\"" + LinkManager.getBundleLink(bid) + "\">" + o + "</a>";
+ }
+ });
- ListGridField status = getListGrid().getField("latestDeploymentStatus");
HashMap<String, String> statusIcons = new HashMap<String, String>();
statusIcons.put(BundleDeploymentStatus.IN_PROGRESS.name(), "subsystems/bundle/install-loader.gif");
- statusIcons.put(BundleDeploymentStatus.FAILURE.name(), "subsystems/bundle/Warning_11.png");
+ statusIcons.put(BundleDeploymentStatus.FAILURE.name(), "subsystems/bundle/Error_11.png");
statusIcons.put(BundleDeploymentStatus.MIXED.name(), "subsystems/bundle/Warning_11.png");
statusIcons.put(BundleDeploymentStatus.WARN.name(), "subsystems/bundle/Warning_11.png");
statusIcons.put(BundleDeploymentStatus.SUCCESS.name(), "subsystems/bundle/Ok_11.png");
- status.setValueIcons(statusIcons);
- status.setValueIconHeight(11);
- status.setWidth(80);
+ latestDeploymentStatusField.setValueIcons(statusIcons);
+ latestDeploymentStatusField.setValueIconHeight(11);
+ latestDeploymentStatusField.setValueIconWidth(11);
+ idField.setWidth(50);
+ nameField.setWidth("20%");
+ descriptionField.setWidth("25%");
+ bundleNameField.setHidden(true);
+ groupNameField.setWidth("15%");
+ deployDirField.setWidth("20%");
+ latestDeploymentVersionField.setWidth("10%");
+ latestDeploymentDateField.setWidth("10%");
+ latestDeploymentStatusField.setWidth(80);
+ // XXX there seems to be a bug here - i want to hide the bundle column, but setHidden(true) causes the entire rendering to fail
+ setListGridFields(idField, nameField, descriptionField, /*bundleNameField, */groupNameField, deployDirField,
+ latestDeploymentVersionField, latestDeploymentDateField, latestDeploymentStatusField);
+
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length == 1) {
+ String selectedId = selectedRows[0].getAttribute(BundleDestinationDataSource.FIELD_BUNDLE_ID);
+ String selectedDestId = selectedRows[0].getAttribute(BundleDestinationDataSource.FIELD_ID);
+ CoreGUI.goToView(LinkManager.getBundleDestinationLink(Integer.valueOf(selectedId), Integer
+ .valueOf(selectedDestId)));
+ }
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index 601c0c8..b4aaba8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -77,7 +77,7 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
this.canManageBundles = canManageBundles;
setWidth100();
setHeight100();
- setMargin(10);
+ //setMargin(10); // do not set margin, we already have our margin set outside of us
}
private void viewBundleDestination(BundleDestination bundleDestination, ViewId current) {
@@ -87,15 +87,34 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
this.destination = bundleDestination;
this.bundle = bundleDestination.getBundle();
- addMember(new BackButton(extendLocatorId("BackButton"), MSG.view_bundle_dest_backToBundle() + ": "
- + bundle.getName(), "Bundles/Bundle/" + bundle.getId()));
+ BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_bundle_dest_backToBundle()
+ + ": " + bundle.getName(), "Bundles/Bundle/" + bundle.getId());
- addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleDestination_24.png"), destination.getName()));
+ HeaderLabel header = new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleDestination_24.png"),
+ destination.getName());
- LocatableDynamicForm form = new LocatableDynamicForm(getLocatorId());
+ detail = new Canvas();
+ detail.setHeight("50%");
+ detail.hide();
+
+ addMember(backButton);
+ addMember(header);
+ addMember(createTagEditor());
+ addMember(createSummaryForm());
+ addMember(createDeploymentsTable());
+ addMember(detail);
+ }
+
+ private LocatableDynamicForm createSummaryForm() {
+ LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("Summary"));
form.setWidth100();
- form.setNumCols(4);
- form.setColWidths("20%", "30%", "25%", "25%");
+ form.setColWidths("20%", "40%", "40%");
+ form.setNumCols(3);
+ form.setWrapItemTitles(false);
+ form.setExtraSpace(10);
+ form.setIsGroup(true);
+ form.setGroupTitle(MSG.common_title_summary());
+ form.setPadding(5);
LinkItem bundleName = new LinkItem("bundle");
bundleName.setTitle(MSG.view_bundle_bundle());
@@ -103,32 +122,11 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
bundleName.setLinkTitle(bundle.getName());
bundleName.setTarget("_self");
- CanvasItem tagItem = new CanvasItem("tag");
- tagItem.setShowTitle(false);
- TagEditorView tagEditor = new TagEditorView(form.extendLocatorId("Tags"), destination.getTags(),
- !canManageBundles, new TagsChangedCallback() {
- public void tagsChanged(HashSet<Tag> tags) {
- GWTServiceLookup.getTagService().updateBundleDestinationTags(destination.getId(), tags,
- new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_bundle_dest_tagUpdateFailure(), caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_bundle_dest_tagUpdateSuccessful(), Message.Severity.Info));
- }
- });
- }
- });
- tagEditor.setVertical(true);
- tagItem.setCanvas(tagEditor);
- tagItem.setRowSpan(4);
-
CanvasItem actionItem = new CanvasItem("actions");
+ actionItem.setColSpan(1);
+ actionItem.setRowSpan(4);
actionItem.setShowTitle(false);
actionItem.setCanvas(getActionLayout(form.extendLocatorId("actions")));
- actionItem.setRowSpan(4);
StaticTextItem created = new StaticTextItem("created", MSG.view_bundle_dest_created());
created.setValue(new Date(destination.getCtime()));
@@ -142,24 +140,34 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
StaticTextItem path = new StaticTextItem("path", MSG.view_bundle_dest_deployDir());
path.setValue(destination.getDeployDir());
- form.setFields(bundleName, tagItem, actionItem, created, destinationGroup, path);
-
- addMember(form);
+ form.setFields(bundleName, actionItem, created, destinationGroup, path);
+ return form;
+ }
- Table deployments = createDeploymentsTable();
- deployments.setHeight100();
- deployments.setShowResizeBar(true);
- addMember(createDeploymentsTable());
+ private TagEditorView createTagEditor() {
+ boolean readOnly = !this.canManageBundles;
+ TagEditorView tagEditor = new TagEditorView(extendLocatorId("Tags"), destination.getTags(), readOnly,
+ new TagsChangedCallback() {
+ public void tagsChanged(HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateBundleDestinationTags(destination.getId(), tags,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_bundle_dest_tagUpdateFailure(), caught);
+ }
- detail = new Canvas();
- detail.setHeight("50%");
- detail.hide();
- addMember(detail);
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_bundle_dest_tagUpdateSuccessful(), Message.Severity.Info));
+ }
+ });
+ }
+ });
+ tagEditor.setAutoHeight();
+ return tagEditor;
}
private Canvas getActionLayout(String locatorId) {
- LocatableVLayout actionLayout = new LocatableVLayout(locatorId);
- actionLayout.setMembersMargin(10);
+ LocatableVLayout actionLayout = new LocatableVLayout(locatorId, 10);
IButton deployButton = new LocatableIButton(actionLayout.extendLocatorId("Deploy"), MSG.view_bundle_deploy());
deployButton.setIcon("subsystems/bundle/BundleAction_Deploy_16.png");
deployButton.addClickHandler(new ClickHandler() {
@@ -189,7 +197,10 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
private Table createDeploymentsTable() {
Criteria criteria = new Criteria();
criteria.addCriteria("bundleDestinationId", destination.getId());
- return new BundleDeploymentListView(extendLocatorId("Deployments"), criteria);
+ BundleDeploymentListView deployments = new BundleDeploymentListView(extendLocatorId("Deployments"), criteria);
+ deployments.setHeight100();
+ deployments.setShowResizeBar(true);
+ return deployments;
}
public void renderView(final ViewPath viewPath) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java
index cc21796..11edfdf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java
@@ -42,6 +42,13 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class BundleVersionDataSource extends RPCDataSource<BundleVersion> {
+ public static final String FIELD_ID = "id";
+ public static final String FIELD_BUNDLE_ID = "bundleId";
+ public static final String FIELD_VERSION = "version";
+ public static final String FIELD_NAME = "name";
+ public static final String FIELD_DESCRIPTION = "description";
+ public static final String FIELD_FILECOUNT = "fileCount";
+
private BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
public BundleVersionDataSource() {
@@ -54,22 +61,23 @@ public class BundleVersionDataSource extends RPCDataSource<BundleVersion> {
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField idField = new DataSourceIntegerField("id", MSG.common_title_id());
+ DataSourceIntegerField idField = new DataSourceIntegerField(FIELD_ID, MSG.common_title_id());
idField.setPrimaryKey(true);
fields.add(idField);
- DataSourceTextField latestVersionField = new DataSourceTextField("version", MSG.common_title_version());
- fields.add(latestVersionField);
+ DataSourceTextField versionField = new DataSourceTextField(FIELD_VERSION, MSG.common_title_version());
+ fields.add(versionField);
- DataSourceTextField nameField = new DataSourceTextField("name", MSG.common_title_name());
+ DataSourceTextField nameField = new DataSourceTextField(FIELD_NAME, MSG.common_title_name());
fields.add(nameField);
- DataSourceTextField descriptionField = new DataSourceTextField("description", MSG.common_title_description());
+ DataSourceTextField descriptionField = new DataSourceTextField(FIELD_DESCRIPTION, MSG
+ .common_title_description());
fields.add(descriptionField);
- DataSourceIntegerField deploymentCountField = new DataSourceIntegerField("fileCount", MSG
+ DataSourceIntegerField fileCountField = new DataSourceIntegerField(FIELD_FILECOUNT, MSG
.view_bundle_bundleFiles());
- fields.add(deploymentCountField);
+ fields.add(fileCountField);
return fields;
}
@@ -124,12 +132,12 @@ public class BundleVersionDataSource extends RPCDataSource<BundleVersion> {
public ListGridRecord copyValues(BundleVersion from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("bundleId", from.getBundle().getId());
- record.setAttribute("name", from.getName());
- record.setAttribute("description", from.getDescription());
- record.setAttribute("version", from.getVersion());
- record.setAttribute("fileCount", Integer.valueOf(from.getBundleFiles().size()));
+ record.setAttribute(FIELD_ID, from.getId());
+ record.setAttribute(FIELD_BUNDLE_ID, from.getBundle().getId());
+ record.setAttribute(FIELD_NAME, from.getName());
+ record.setAttribute(FIELD_DESCRIPTION, from.getDescription());
+ record.setAttribute(FIELD_VERSION, from.getVersion());
+ record.setAttribute(FIELD_FILECOUNT, Integer.valueOf(from.getBundleFiles().size()));
record.setAttribute("object", from);
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 c1e4ccc..36968e8 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
@@ -78,9 +78,7 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
private Tab destinationsTab;
private BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
-
private Bundle bundle;
-
private final boolean canManageBundles;
public BundleView(String locatorId, Set<Permission> perms) {
@@ -88,39 +86,32 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
this.canManageBundles = (perms != null) ? perms.contains(Permission.MANAGE_BUNDLE) : false;
setWidth100();
setHeight100();
- setPadding(10);
+ setMargin(10);
setOverflow(Overflow.AUTO);
}
- @Override
- protected void onInit() {
- super.onInit();
- }
-
public void viewBundle(Bundle bundle, ViewId nextViewId) {
// Whenever a new view request comes in, make sure to clean house to avoid ID conflicts for sub-widgets
this.destroyMembers();
this.bundle = bundle;
- addMember(new BackButton(extendLocatorId("BackButton"), MSG.view_bundle_list_backToAll(), BundleTopView.VIEW_ID
- .getTitle()));
-
+ BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_bundle_list_backToAll(),
+ BundleTopView.VIEW_ID.getTitle());
headerLabel = new HeaderLabel("subsystems/bundle/Bundle_24.png", bundle.getName());
-
- addMember(headerLabel);
-
- addMember(createSummaryForm());
-
tabs = new LocatableTabSet(getLocatorId());
- versionsTab = createVersionsTab();
- tabs.addTab(versionsTab);
-
destinationsTab = createDestinationsTab();
+ versionsTab = createVersionsTab();
tabs.addTab(destinationsTab);
+ tabs.addTab(versionsTab);
+ addMember(backButton);
+ addMember(headerLabel);
+ addMember(createTagEditor());
+ addMember(createSummaryForm());
addMember(tabs);
+ // select the correct tab based on what URL the user is going to (based on what tree node was selected)
if ((null == nextViewId) || (nextViewId.getPath().equals("versions"))) {
tabs.selectTab(versionsTab);
} else if (nextViewId.getPath().equals("destinations")) {
@@ -130,27 +121,42 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
markForRedraw();
}
+ private TagEditorView createTagEditor() {
+ boolean readOnly = !this.canManageBundles;
+ TagEditorView tagEditor = new TagEditorView(extendLocatorId("TagEditor"), bundle.getTags(), readOnly,
+ new TagsChangedCallback() {
+ public void tagsChanged(HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateBundleTags(bundleBeingViewed, tags,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_bundle_list_tagUpdateFailure(), caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_bundle_list_tagUpdateSuccessful(), Message.Severity.Info));
+ }
+ });
+ }
+ });
+ tagEditor.setAutoHeight();
+ return tagEditor;
+ }
+
private Tab createDestinationsTab() {
LocatableTab destinationsTab = new LocatableTab(extendLocatorId("Destinations"), MSG.view_bundle_destinations());
-
Criteria criteria = new Criteria();
criteria.addCriteria("bundleId", bundle.getId());
-
destinationsTab.setPane(new BundleDestinationListView(destinationsTab.getLocatorId(), criteria));
-
return destinationsTab;
}
private Tab createVersionsTab() {
LocatableTab versionsTab = new LocatableTab(extendLocatorId("Versions"), MSG.view_bundle_versions());
-
Criteria criteria = new Criteria();
criteria.addCriteria("bundleId", bundleBeingViewed);
-
bundleVersionsTable = new BundleVersionListView(versionsTab.getLocatorId(), criteria);
-
versionsTab.setPane(bundleVersionsTable);
-
return versionsTab;
}
@@ -158,13 +164,15 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
form = new LocatableDynamicForm(extendLocatorId("Summary"));
form.setWidth100();
- form.setColWidths("20%", "30%", "25%", "25%");
- form.setNumCols(4);
+ form.setColWidths("20%", "40%", "40%");
+ form.setNumCols(3);
form.setWrapItemTitles(false);
- form.setPadding(10);
+ form.setExtraSpace(10);
+ form.setIsGroup(true);
+ form.setGroupTitle(MSG.common_title_summary());
+ form.setPadding(5);
StaticTextItem descriptionItem = new StaticTextItem("description", MSG.common_title_description());
- descriptionItem.setWrap(false);
descriptionItem.setValue(bundle.getDescription());
StaticTextItem versionCountItem = new StaticTextItem("versionCount", MSG.view_bundle_list_versionsCount());
@@ -174,41 +182,11 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
.view_bundle_list_destinationsCount());
destinationsCountItem.setValue(bundle.getDestinations() != null ? bundle.getDestinations().size() : 0);
- form.setFields(descriptionItem, getTagItem(), getActionItem(), versionCountItem, destinationsCountItem);
+ form.setFields(descriptionItem, getActionItem(), versionCountItem, destinationsCountItem);
return form;
}
- private CanvasItem getTagItem() {
-
- boolean readOnly = !this.canManageBundles;
-
- TagEditorView tagEditor = new TagEditorView(form.extendLocatorId("TagEditor"), bundle.getTags(), readOnly,
- new TagsChangedCallback() {
- public void tagsChanged(HashSet<Tag> tags) {
- GWTServiceLookup.getTagService().updateBundleTags(bundleBeingViewed, tags,
- new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_bundle_list_tagUpdateFailure(), caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_bundle_list_tagUpdateSuccessful(), Message.Severity.Info));
- }
- });
- }
- });
- tagEditor.setVertical(true);
-
- CanvasItem tagItem = new CanvasItem("tags");
- tagItem.setShowTitle(false);
- tagItem.setRowSpan(3);
- tagItem.setCanvas(tagEditor);
-
- return tagItem;
- }
-
private CanvasItem getActionItem() {
VLayout layout = new LocatableVLayout(form.extendLocatorId("Actions"), 10);
@@ -275,6 +253,7 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
layout.addMember(deployButton);
CanvasItem actionItem = new CanvasItem("actions");
+ actionItem.setColSpan(1);
actionItem.setRowSpan(3);
actionItem.setShowTitle(false);
actionItem.setCanvas(layout);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
index 6e8f401..247907a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
@@ -23,18 +23,25 @@
package org.rhq.enterprise.gui.coregui.client.bundle.version;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleVersionDataSource;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
* @author Greg Hinkle
*/
-public class BundleVersionListView extends Table {
+public class BundleVersionListView extends Table<RPCDataSource<BundleVersion>> {
public BundleVersionListView(String locatorId) {
this(locatorId, null);
@@ -43,28 +50,56 @@ public class BundleVersionListView extends Table {
public BundleVersionListView(String locatorId, Criteria criteria) {
super(locatorId, MSG.view_bundle_bundleVersions(), criteria);
setHeaderIcon("subsystems/bundle/BundleVersion_24.png");
- BundleVersionDataSource bundleVersionsDataSource = new BundleVersionDataSource();
- setDataSource(bundleVersionsDataSource);
+ setDataSource(new BundleVersionDataSource());
+ }
+
+ @Override
+ protected SelectionStyle getDefaultSelectionStyle() {
+ return SelectionStyle.SINGLE;
}
@Override
protected void configureTable() {
- getListGrid().getField("id").setWidth("60");
- getListGrid().getField("name").setWidth("25%");
- getListGrid().getField("name").setCellFormatter(new CellFormatter() {
+ ListGridField idField = new ListGridField(FIELD_ID, MSG.common_title_id());
+
+ ListGridField versionField = new ListGridField(BundleVersionDataSource.FIELD_VERSION, MSG
+ .common_title_version());
+ versionField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("bundleId") + "/versions/"
- + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ Integer _bundleId = listGridRecord.getAttributeAsInt("bundleId");
+ Integer _bvId = listGridRecord.getAttributeAsInt("id");
+ return "<a href=\"" + LinkManager.getBundleVersionLink(_bundleId, _bvId) + "\">" + o + "</a>";
}
});
- getListGrid().getField("version").setWidth("10%");
- getListGrid().getField("fileCount").setWidth("10%");
- getListGrid().getField("description").setWidth("*");
+ ListGridField nameField = new ListGridField(BundleVersionDataSource.FIELD_NAME, MSG.common_title_name());
- getListGrid().setSelectionType(SelectionStyle.NONE);
- getListGrid().setSelectionAppearance(SelectionAppearance.ROW_STYLE);
+ ListGridField descriptionField = new ListGridField(BundleVersionDataSource.FIELD_DESCRIPTION, MSG
+ .common_title_description());
+ ListGridField fileCountField = new ListGridField(BundleVersionDataSource.FIELD_FILECOUNT, MSG
+ .view_bundle_bundleFiles());
+ idField.setWidth(50);
+ versionField.setWidth("20%");
+ nameField.setWidth("25%");
+ descriptionField.setWidth("*");
+ fileCountField.setWidth("10%");
+
+ setListGridFields(idField, versionField, nameField, descriptionField, fileCountField);
+
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length == 1) {
+ String selectedId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_BUNDLE_ID);
+ String selectedVersionId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_ID);
+ CoreGUI.goToView(LinkManager.getBundleVersionLink(Integer.valueOf(selectedId), Integer
+ .valueOf(selectedVersionId)));
+ }
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Error_11.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Error_11.png
new file mode 100644
index 0000000..371298c
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/Error_11.png differ
13 years, 6 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java | 66 +---------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 3
2 files changed, 14 insertions(+), 55 deletions(-)
New commits:
commit 6656ed9ffacd62f03eec1c34d1536356706c771b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Dec 17 00:13:20 2010 -0500
disable deploy/revert buttons if user doesn't have perms
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index dd65070..601c0c8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -70,8 +70,11 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
private Canvas detail;
- public BundleDestinationView(String locatorId) {
+ private boolean canManageBundles;
+
+ public BundleDestinationView(String locatorId, boolean canManageBundles) {
super(locatorId);
+ this.canManageBundles = canManageBundles;
setWidth100();
setHeight100();
setMargin(10);
@@ -102,8 +105,8 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
CanvasItem tagItem = new CanvasItem("tag");
tagItem.setShowTitle(false);
- TagEditorView tagEditor = new TagEditorView(form.extendLocatorId("Tags"), destination.getTags(), false,
- new TagsChangedCallback() {
+ TagEditorView tagEditor = new TagEditorView(form.extendLocatorId("Tags"), destination.getTags(),
+ !canManageBundles, new TagsChangedCallback() {
public void tagsChanged(HashSet<Tag> tags) {
GWTServiceLookup.getTagService().updateBundleDestinationTags(destination.getId(), tags,
new AsyncCallback<Void>() {
@@ -164,6 +167,9 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
new BundleDeployWizard(destination).startWizard();
}
});
+ if (!canManageBundles) {
+ deployButton.setDisabled(true);
+ }
actionLayout.addMember(deployButton);
IButton revertButton = new LocatableIButton(actionLayout.extendLocatorId("Revert"), MSG.view_bundle_revert());
@@ -173,69 +179,22 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
new BundleRevertWizard(destination).startWizard();
}
});
+ if (!canManageBundles) {
+ revertButton.setDisabled(true);
+ }
actionLayout.addMember(revertButton);
return actionLayout;
}
private Table createDeploymentsTable() {
-
Criteria criteria = new Criteria();
criteria.addCriteria("bundleDestinationId", destination.getId());
-
return new BundleDeploymentListView(extendLocatorId("Deployments"), criteria);
-
- /* Table table = new Table("Deployment History");
-
- ListGridField name = new ListGridField("name", "Name");
- name.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Bundles/Bundle/" + bundle.getId() + "/deployments/"
- + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
- }
- });
-
- ListGridField version = new ListGridField("version", "Version");
- ListGridField description = new ListGridField("description", "Description");
- ListGridField installDate = new ListGridField("installDate", "Install Date");
- ListGridField status = new ListGridField("status", "Status");
- HashMap<String, String> statusIcons = new HashMap<String, String>();
- statusIcons.put(BundleDeploymentStatus.IN_PROGRESS.name(), "subsystems/bundle/install-loader.gif");
- statusIcons.put(BundleDeploymentStatus.FAILURE.name(), "subsystems/bundle/Warning_11.png");
- statusIcons.put(BundleDeploymentStatus.MIXED.name(), "subsystems/bundle/Warning_11.png");
- statusIcons.put(BundleDeploymentStatus.WARN.name(), "subsystems/bundle/Warning_11.png");
- statusIcons.put(BundleDeploymentStatus.SUCCESS.name(), "subsystems/bundle/Ok_11.png");
- status.setValueIcons(statusIcons);
- status.setValueIconHeight(11);
- status.setWidth(80);
-
-
- table.getListGrid().setFields(name, version, description, installDate, status);
-
- ArrayList<ListGridRecord> records = new ArrayList<ListGridRecord>();
- for (BundleDeployment rd : destination.getDeployments()) {
- ListGridRecord record = new ListGridRecord();
-
- record.setAttribute("name", rd.getName());
- record.setAttribute("description", rd.getDescription());
- record.setAttribute("bundleId", bundle.getId());
- record.setAttribute("version", rd.getBundleVersion().getName());
- record.setAttribute("status", rd.getStatus().name());
- record.setAttribute("id", rd.getId());
- record.setAttribute("entity", rd);
- record.setAttribute("installDate", new Date(rd.getCtime()));
- records.add(record);
- }
-
- table.getListGrid().setData(records.toArray(new ListGridRecord[records.size()]));
-
- return table;*/
}
public void renderView(final ViewPath viewPath) {
int bundleDestinationId = Integer.parseInt(viewPath.getCurrent().getPath());
- final ViewId viewId = viewPath.getCurrent();
-
BundleDestinationCriteria criteria = new BundleDestinationCriteria();
criteria.addFilterId(bundleDestinationId);
criteria.fetchBundle(true);
@@ -253,7 +212,6 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
viewBundleDestination(destination, viewPath.getCurrent());
}
});
-
}
}
\ No newline at end of file
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 a94b133..c1e4ccc 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
@@ -343,7 +343,8 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
} else if (viewPath.getCurrent().getPath().equals("destinations")) {
if (!viewPath.isEnd()) {
// a specific destination
- BundleDestinationView view = new BundleDestinationView(extendLocatorId("Destination"));
+ BundleDestinationView view = new BundleDestinationView(extendLocatorId("Destination"),
+ canManageBundles);
addMember(view);
view.renderView(viewPath.next());
}
13 years, 6 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java | 10 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java | 5 +++--
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 9 ++++++---
3 files changed, 15 insertions(+), 9 deletions(-)
New commits:
commit 5f8c0d6c2b969ffcf88ed311afc9d561e81022f4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Dec 17 00:01:05 2010 -0500
the detail messages are too long for the message center -make them details and provide shorter concise messages
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
index bef5d91..bdd818c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
@@ -79,8 +79,9 @@ public class DeployStep extends AbstractWizardStep {
deployingImage.setSrc("/images/status_complete.gif");
deployingMessage.setText(MSG.view_bundle_deployWizard_deploymentCreated());
CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_bundle_deployWizard_deploymentCreatedDetail(result.getName(), result
- .getDescription()), Severity.Info));
+ new Message(MSG.view_bundle_deployWizard_deploymentCreatedDetail_concise(result.getName()),
+ MSG.view_bundle_deployWizard_deploymentCreatedDetail(result.getName(), result
+ .getDescription()), Severity.Info));
wizard.setNewDeployment(result);
bundleServer.scheduleBundleDeployment(wizard.getNewDeployment().getId(), wizard
@@ -90,8 +91,9 @@ public class DeployStep extends AbstractWizardStep {
deployingImage.setSrc("/images/status_complete.gif");
deployingMessage.setText(MSG.view_bundle_deployWizard_deploymentScheduled());
CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_bundle_deployWizard_deploymentScheduledDetail(result
- .getName(), result.getDestination().getGroup().getName()), Severity.Info));
+ new Message(MSG.view_bundle_deployWizard_deploymentScheduledDetail_concise(),
+ MSG.view_bundle_deployWizard_deploymentScheduledDetail(result.getName(),
+ result.getDestination().getGroup().getName()), Severity.Info));
CoreGUI.refresh();
wizard.setNewDeployment(result);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java
index ee0122e..78a9bf9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java
@@ -169,8 +169,9 @@ public class GetDestinationStep extends AbstractWizardStep {
wizard.setDestination(result);
wizard.setNewDestination(true);
CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_bundle_deployWizard_destinationCreatedDetail(result.getName(), result
- .getDescription()), Severity.Info));
+ new Message(MSG.view_bundle_deployWizard_destinationCreatedDetail_concise(result.getName()),
+ MSG.view_bundle_deployWizard_destinationCreatedDetail(result.getName(), result
+ .getDescription()), Severity.Info));
createInProgress = false;
wizard.getView().incrementStep();
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 69803a3..de1ef89 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -995,10 +995,13 @@ view_bundle_createWizard_createSuccessful = You have successfully created a bund
view_bundle_deployWizard_deploying = Deploying...
view_bundle_deployWizard_deployStep = Deploy Bundle to Destination Platforms
view_bundle_deployWizard_deploymentCreated = Created Deployment...
-view_bundle_deployWizard_deploymentCreatedDetail = Created deployment [{0}] description [{1}]
-view_bundle_deployWizard_destinationCreatedDetail = Created destination [{0}] description [{1}]
+view_bundle_deployWizard_deploymentCreatedDetail = You have created the deployment [{0}] with the description [{1}]
+view_bundle_deployWizard_deploymentCreatedDetail_concise = You have created the deployment [{0}]
+view_bundle_deployWizard_destinationCreatedDetail = You have created the destination [{0}] with the description [{1}]
+view_bundle_deployWizard_destinationCreatedDetail_concise = You have created the destination [{0}]
view_bundle_deployWizard_deploymentScheduled = Bundle Deployment Scheduled!
-view_bundle_deployWizard_deploymentScheduledDetail = Scheduled bundle deployment [{0}] destination group [{1}]
+view_bundle_deployWizard_deploymentScheduledDetail = You have scheduled the bundle deployment [{0}] to the destination group [{1}]
+view_bundle_deployWizard_deploymentScheduledDetail_concise = You have scheduled the bundle deployment
view_bundle_deployWizard_error_1 = Failed to delete new deployment on Cancel: {0}
view_bundle_deployWizard_error_2 = Failed to delete new destination on Cancel: {0}
view_bundle_deployWizard_error_3 = Failed to Schedule Deployment!
13 years, 6 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 2 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 17 ++++++++--
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Delete_16_Disabled.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Deploy_16_Disabled.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Revert_16_Disabled.png |binary
5 files changed, 15 insertions(+), 4 deletions(-)
New commits:
commit 515cd7359131215bee54396c2043766cdf9e6ff7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 23:18:13 2010 -0500
disable buttons when a user doesn't have perms
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 c8f9261..fd0bbe7 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
@@ -120,7 +120,7 @@ public class BundleTopView extends LocatableHLayout implements BookmarkableView
} else {
if (!viewPath.getNext().equals(currentNextPath)) {
currentNextPath = viewPath.getNext();
- bundleView = new BundleView(extendLocatorId("Bundle"));
+ bundleView = new BundleView(extendLocatorId("Bundle"), permissions);
setContent(bundleView);
bundleView.renderView(viewPath.next());
} else {
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 1d64b7a..a94b133 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
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.bundle.list;
import java.util.HashSet;
+import java.util.Set;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -36,6 +37,7 @@ 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.authz.Permission;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.tagging.Tag;
@@ -79,8 +81,11 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
private Bundle bundle;
- public BundleView(String locatorId) {
+ private final boolean canManageBundles;
+
+ public BundleView(String locatorId, Set<Permission> perms) {
super(locatorId);
+ this.canManageBundles = (perms != null) ? perms.contains(Permission.MANAGE_BUNDLE) : false;
setWidth100();
setHeight100();
setPadding(10);
@@ -176,7 +181,9 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
private CanvasItem getTagItem() {
- TagEditorView tagEditor = new TagEditorView(form.extendLocatorId("TagEditor"), bundle.getTags(), false,
+ boolean readOnly = !this.canManageBundles;
+
+ TagEditorView tagEditor = new TagEditorView(form.extendLocatorId("TagEditor"), bundle.getTags(), readOnly,
new TagsChangedCallback() {
public void tagsChanged(HashSet<Tag> tags) {
GWTServiceLookup.getTagService().updateBundleTags(bundleBeingViewed, tags,
@@ -259,6 +266,11 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
}
});
+ if (!canManageBundles) {
+ deleteButton.setDisabled(true);
+ deployButton.setDisabled(true);
+ }
+
layout.addMember(deleteButton);
layout.addMember(deployButton);
@@ -271,7 +283,6 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
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()) {
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Delete_16_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Delete_16_Disabled.png
new file mode 100644
index 0000000..b8b8468
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Delete_16_Disabled.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Deploy_16_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Deploy_16_Disabled.png
new file mode 100644
index 0000000..fcbd9c4
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Deploy_16_Disabled.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Revert_16_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Revert_16_Disabled.png
new file mode 100644
index 0000000..b851d16
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Revert_16_Disabled.png differ
13 years, 6 months