[rhq] Branch 'cli-alert-notifs' - 4 commits - modules/core modules/enterprise
by lkrejci
modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 276 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/PropertyMapListGridRecord.java | 67
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java | 787 ++++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java | 787 +---------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 36
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/Activity2View.java | 203 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java | 10
9 files changed, 1219 insertions(+), 957 deletions(-)
New commits:
commit 3fc1998054a6390702a46d4db4f71689e2f723e6
Merge: 51f82ef... d470c4f...
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Mar 3 13:17:34 2011 +0100
Merge remote branch 'origin/master' into cli-alert-notifs
commit d470c4facb824dfc13f032a71e8e2ed2a76ffb2c
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 2 17:40:00 2011 -0500
fix list of maps editing in config editor; fix several other minor config editor bugs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index f2a2580..993f303 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -35,7 +35,6 @@ import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.Autofit;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.MultipleAppearance;
import com.smartgwt.client.types.Overflow;
@@ -81,8 +80,6 @@ import com.smartgwt.client.widgets.form.validator.Validator;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.CellSavedEvent;
-import com.smartgwt.client.widgets.grid.events.CellSavedHandler;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -123,12 +120,15 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* A SmartGWT widget for editing an RHQ {@link Configuration} that conforms to a {@link ConfigurationDefinition}.
@@ -143,8 +143,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
//
public class ConfigurationEditor extends LocatableVLayout {
- private static final String RHQ_PROPERTY_ATTRIBUTE_NAME = "rhq:property";
-
private ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
private LocatableToolStrip toolStrip;
@@ -153,7 +151,7 @@ public class ConfigurationEditor extends LocatableVLayout {
private Configuration configuration;
private Configuration originalConfiguration;
- private ValuesManager valuesManager = new ValuesManager();
+ private ValuesManager topLevelPropertiesValuesManager = new ValuesManager();
private Label loadingLabel = new Label("<b>" + MSG.common_msg_loading() + "</b>");
@@ -246,11 +244,11 @@ public class ConfigurationEditor extends LocatableVLayout {
}
public boolean validate() {
- return this.valuesManager.validate();
+ return this.topLevelPropertiesValuesManager.validate();
}
public boolean isValid() {
- return this.valuesManager.hasErrors();
+ return this.topLevelPropertiesValuesManager.hasErrors();
}
public void addPropertyValueChangeListener(PropertyValueChangeListener propertyValueChangeListener) {
@@ -487,7 +485,7 @@ public class ConfigurationEditor extends LocatableVLayout {
((group == null) ? configurationDefinition.getNonGroupedProperties() : configurationDefinition
.getPropertiesInGroup(group.getName())));
- DynamicForm form = buildPropertiesForm(locatorId + "_Props", propertyDefinitions, configuration);
+ DynamicForm form = buildPropertiesForm(locatorId, propertyDefinitions, configuration);
section.addItem(form);
return section;
@@ -497,8 +495,10 @@ public class ConfigurationEditor extends LocatableVLayout {
AbstractPropertyMap propertyMap) {
LocatableDynamicForm form = new LocatableDynamicForm(locatorId);
- form.setValuesManager(valuesManager);
- form.setValidateOnExit(true);
+ if (propertyMap instanceof Configuration) {
+ this.topLevelPropertiesValuesManager.addMember(form);
+ }
+ form.setValidateOnExit(true); // TODO: Remove this?
form.setHiliteRequiredFields(true);
form.setNumCols(4);
form.setCellPadding(5);
@@ -528,6 +528,7 @@ public class ConfigurationEditor extends LocatableVLayout {
property, odd, fields);
odd = !odd;
}
+ return;
}
public void addItemsForPropertyRecursively(String locatorId, PropertyDefinition propertyDefinition,
@@ -606,7 +607,7 @@ public class ConfigurationEditor extends LocatableVLayout {
// Note: This field spans 3 columns.
PropertyDefinitionMap memberDefinitionMap = (PropertyDefinitionMap) memberDefinition;
CanvasItem listOfMapsItem = buildListOfMapsField(locatorId, memberDefinitionMap, propertyDefinitionList,
- propertyList, oddRow);
+ propertyList);
fields.add(listOfMapsItem);
} else if (memberDefinition instanceof PropertyDefinitionSimple) {
SpacerItem unsetItem = new SpacerItem();
@@ -865,66 +866,36 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private CanvasItem buildListOfMapsField(final String locatorId,
- final PropertyDefinitionMap memberPropertyDefinitionMap, PropertyDefinitionList propertyDefinitionList,
- final PropertyList propertyList, boolean oddRow) {
- Log.debug("Building list-of-maps field for " + propertyList + "...");
+ final PropertyDefinitionMap memberPropertyDefinitionMap, final PropertyDefinitionList propertyDefinitionList,
+ final PropertyList propertyList) {
+ Log.debug("Building list-of-maps grid for " + propertyList + "...");
- final ListGrid summaryTable = new ListGrid();
- // summaryTable.setID("config_summaryTable_" + propertyDefinition.getName());
+ final LocatableListGrid summaryTable = new LocatableListGrid(locatorId);
summaryTable.setAlternateRecordStyles(true);
summaryTable.setShowAllRecords(true);
summaryTable.setBodyOverflow(Overflow.VISIBLE);
summaryTable.setOverflow(Overflow.VISIBLE);
- summaryTable.setAutoFitData(Autofit.HORIZONTAL);
-
- summaryTable.addCellSavedHandler(new CellSavedHandler() {
- public void onCellSaved(CellSavedEvent cellSavedEvent) {
- Record record = cellSavedEvent.getRecord();
- PropertyMap propertyMap = (PropertyMap) record.getAttributeAsObject(RHQ_PROPERTY_ATTRIBUTE_NAME);
- for (String memberPropertyName : memberPropertyDefinitionMap.getPropertyDefinitions().keySet()) {
- PropertySimple memberProperty = propertyMap.getSimple(memberPropertyName);
- if (memberProperty == null) {
- memberProperty = new PropertySimple(memberPropertyName, null);
- propertyMap.put(memberProperty);
- }
- String newValue = record.getAttribute(memberPropertyName);
- memberProperty.setStringValue(newValue);
- }
- }
- });
+ summaryTable.setWidth100();
List<ListGridField> fieldsList = new ArrayList<ListGridField>();
- List<PropertyDefinition> propertyDefinitions = new ArrayList<PropertyDefinition>(memberPropertyDefinitionMap
+ final List<PropertyDefinition> propertyDefinitions = new ArrayList<PropertyDefinition>(memberPropertyDefinitionMap
.getPropertyDefinitions().values());
Collections.sort(propertyDefinitions, new PropertyDefinitionComparator());
+ List<PropertyDefinition> summaryPropertyDefinitions = new ArrayList<PropertyDefinition>();
for (PropertyDefinition subDef : propertyDefinitions) {
if (subDef.isSummary()) {
- ListGridField field = new ListGridField(subDef.getName(), subDef.getDisplayName(), 90);
-
- PropertyDefinitionSimple defSimple = (PropertyDefinitionSimple) subDef;
- if (defSimple.getType() == PropertySimpleType.INTEGER) {
- field.setType(ListGridFieldType.INTEGER);
- } else if (defSimple.getType() == PropertySimpleType.FLOAT) {
- field.setType(ListGridFieldType.FLOAT);
- }
-
- fieldsList.add(field);
+ summaryPropertyDefinitions.add(subDef);
}
}
-
- if (fieldsList.isEmpty()) {
+ if (summaryPropertyDefinitions.isEmpty()) {
// An extra "feature of the config system". If no fields are labeled summary, all are considered summary.
- for (PropertyDefinition subDef : propertyDefinitions) {
- ListGridField field = new ListGridField(subDef.getName(), subDef.getDisplayName());
- fieldsList.add(field);
- PropertyDefinitionSimple defSimple = (PropertyDefinitionSimple) subDef;
- if (defSimple.getType() == PropertySimpleType.INTEGER) {
- field.setType(ListGridFieldType.FLOAT);
- } else if (defSimple.getType() == PropertySimpleType.FLOAT) {
- field.setType(ListGridFieldType.FLOAT);
- }
- }
+ summaryPropertyDefinitions.addAll(propertyDefinitions);
+ }
+
+ for (PropertyDefinition summaryPropDef : summaryPropertyDefinitions) {
+ ListGridField field = createListGridField(summaryPropDef);
+ fieldsList.add(field);
}
boolean allSubDefsReadOnly = isAllReadOnly(propertyDefinitions);
@@ -940,11 +911,11 @@ public class ConfigurationEditor extends LocatableVLayout {
editField.setCanHide(false);
editField.addRecordClickHandler(new RecordClickHandler() {
public void onRecordClick(RecordClickEvent recordClickEvent) {
- Log.debug("Editing property map: " + recordClickEvent.getRecord());
- PropertyMap memberPropertyMap = (PropertyMap) recordClickEvent.getRecord().getAttributeAsObject(
- RHQ_PROPERTY_ATTRIBUTE_NAME);
- displayMapEditor(extendLocatorId("MapEdit"), summaryTable, recordClickEvent.getRecord(),
- memberPropertyDefinitionMap, propertyList, memberPropertyMap, mapReadOnly);
+ PropertyMapListGridRecord record = (PropertyMapListGridRecord) recordClickEvent.getRecord();
+ PropertyMap memberPropertyMap = (PropertyMap) record.getPropertyMap();
+ Log.debug("Editing property map: " + memberPropertyMap);
+ displayMapEditor(summaryTable, record, memberPropertyDefinitionMap, propertyList, memberPropertyMap,
+ mapReadOnly);
}
});
fieldsList.add(editField);
@@ -965,9 +936,13 @@ public class ConfigurationEditor extends LocatableVLayout {
public void onRecordClick(final RecordClickEvent recordClickEvent) {
Log.info("You want to delete: " + recordClickEvent.getRecordNum());
SC.confirm(MSG.view_configEdit_confirm_2(), new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- if (aBoolean) {
- summaryTable.removeData(recordClickEvent.getRecord());
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ PropertyMapListGridRecord recordToBeDeleted = (PropertyMapListGridRecord) recordClickEvent.getRecord();
+ propertyList.getList().remove(recordToBeDeleted.getIndex());
+ ListGridRecord[] rows = buildSummaryRecords(propertyList, propertyDefinitions);
+ summaryTable.setData(rows);
+ firePropertyChangedEvent(propertyList, propertyDefinitionList, true);
}
}
});
@@ -993,7 +968,7 @@ public class ConfigurationEditor extends LocatableVLayout {
addRowButton.setIcon(Window.getImgURL("[SKIN]/actions/add.png"));
addRowButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- displayMapEditor(extendLocatorId("MapEdit"), summaryTable, null, memberPropertyDefinitionMap,
+ displayMapEditor(summaryTable, null, memberPropertyDefinitionMap,
propertyList, null, mapReadOnly);
}
});
@@ -1009,6 +984,27 @@ public class ConfigurationEditor extends LocatableVLayout {
return canvasItem;
}
+ private ListGridField createListGridField(PropertyDefinition summaryPropDef) {
+ ListGridField field = new ListGridField(summaryPropDef.getName(), summaryPropDef.getDisplayName(), 90);
+ PropertyDefinitionSimple defSimple = (PropertyDefinitionSimple) summaryPropDef;
+ PropertySimpleType propSimpleType = defSimple.getType();
+ switch (propSimpleType) {
+ case BOOLEAN:
+ field.setType(ListGridFieldType.BOOLEAN);
+ break;
+ case INTEGER:
+ field.setType(ListGridFieldType.INTEGER);
+ break;
+ case FLOAT:
+ case DOUBLE:
+ field.setType(ListGridFieldType.FLOAT);
+ break;
+ default:
+ field.setType(ListGridFieldType.TEXT);
+ }
+ return field;
+ }
+
private static boolean isAllReadOnly(List<PropertyDefinition> propertyDefinitions) {
boolean allPropsDefsReadOnly = true;
for (PropertyDefinition subDef : propertyDefinitions) {
@@ -1020,51 +1016,16 @@ public class ConfigurationEditor extends LocatableVLayout {
return allPropsDefsReadOnly;
}
- private ListGridRecord[] buildSummaryRecords(PropertyList propertyList, List<PropertyDefinition> definitions) {
- ListGridRecord[] rows = new ListGridRecord[propertyList == null ? 0 : propertyList.getList().size()];
- int i = 0;
- for (Property row : propertyList.getList()) {
+ private PropertyMapListGridRecord[] buildSummaryRecords(PropertyList propertyList, List<PropertyDefinition> definitions) {
+ PropertyMapListGridRecord[] records = new PropertyMapListGridRecord[propertyList == null ? 0 : propertyList.getList().size()];
+ List<Property> list = propertyList.getList();
+ for (int index = 0, listSize = list.size(); index < listSize; index++) {
+ Property row = list.get(index);
PropertyMap rowMap = (PropertyMap) row;
- ListGridRecord record = buildSummaryRecord(definitions, rowMap);
- rows[i++] = record;
+ PropertyMapListGridRecord record = new PropertyMapListGridRecord(rowMap, index, definitions);
+ records[index] = record;
}
- return rows;
- }
-
- private ListGridRecord buildSummaryRecord(List<PropertyDefinition> memberPropertyDefinitions,
- PropertyMap memberPropertyMap) {
- ListGridRecord record = new ListGridRecord();
- for (PropertyDefinition subDef : memberPropertyDefinitions) {
- PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
- PropertySimple propertySimple = ((PropertySimple) memberPropertyMap.get(subDefSimple.getName()));
-
- if (propertySimple.getStringValue() != null) {
- record.setAttribute(subDefSimple.getName(), propertySimple.getStringValue());
- /*
- switch (((PropertyDefinitionSimple) subDef).getType()) {
- case BOOLEAN:
- record.setAttribute(subDefSimple.getName(), propertySimple.getBooleanValue());
- break;
- case INTEGER:
- record.setAttribute(subDefSimple.getName(), propertySimple.getLongValue());
- break;
- case LONG:
- record.setAttribute(subDefSimple.getName(), propertySimple.getLongValue());
- break;
- case FLOAT:
- record.setAttribute(subDefSimple.getName(), propertySimple.getDoubleValue());
- break;
- case DOUBLE:
- record.setAttribute(subDefSimple.getName(), propertySimple.getDoubleValue());
- break;
- default:
- record.setAttribute(subDefSimple.getName(), propertySimple.getStringValue());
- break;
- }*/
- }
- }
- record.setAttribute(RHQ_PROPERTY_ATTRIBUTE_NAME, memberPropertyMap);
- return record;
+ return records;
}
private CanvasItem buildListOfSimplesField(String locatorId, final PropertyDefinitionList propertyDefinitionList,
@@ -1330,23 +1291,23 @@ public class ConfigurationEditor extends LocatableVLayout {
valueItem.setWidth(220);
- // Only update the underlying property when the input is changed if it's a top-level simple or a simple within a
- // top-level map.
- if (updatePropertyValueOnChange(propertyDefinitionSimple, propertySimple)) {
- valueItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent changedEvent) {
- updatePropertySimpleValue(changedEvent.getValue(), propertySimple, propertyDefinitionSimple);
+ valueItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent changedEvent) {
+ updatePropertySimpleValue(changedEvent.getValue(), propertySimple, propertyDefinitionSimple);
+ // Only fire a prop value change event if the prop's a top-level simple or a simple within a
+ // top-level map.
+ if (fireEventOnPropertyValueChange(propertyDefinitionSimple, propertySimple)) {
boolean isValid = changedEvent.getItem().validate();
firePropertyChangedEvent(propertySimple, propertyDefinitionSimple, isValid);
}
- });
- }
+ }
+ });
return valueItem;
}
- protected boolean updatePropertyValueOnChange(PropertyDefinitionSimple propertyDefinitionSimple,
- PropertySimple propertySimple) {
+ protected boolean fireEventOnPropertyValueChange(PropertyDefinitionSimple propertyDefinitionSimple,
+ PropertySimple propertySimple) {
PropertyDefinitionMap parentPropertyMapDefinition = propertyDefinitionSimple.getParentPropertyMapDefinition();
return propertyDefinitionSimple.getConfigurationDefinition() != null
|| (parentPropertyMapDefinition != null && parentPropertyMapDefinition.getConfigurationDefinition() != null);
@@ -1398,6 +1359,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
valueItem.redraw();
propertySimple.setValue(valueItem.getValue());
+ firePropertyChangedEvent(propertySimple, propertyDefinitionSimple, true);
}
});
@@ -1503,24 +1465,18 @@ public class ConfigurationEditor extends LocatableVLayout {
return validators;
}
- private void displayMapEditor(String locatorId, final ListGrid summaryTable, final Record existingRecord,
- PropertyDefinitionMap definition, final PropertyList list, final PropertyMap map, boolean mapReadOnly) {
+ private void displayMapEditor(final ListGrid summaryTable, final PropertyMapListGridRecord existingRecord,
+ PropertyDefinitionMap definition, final PropertyList list, final PropertyMap map,
+ boolean mapReadOnly) {
final List<PropertyDefinition> memberDefinitions = new ArrayList<PropertyDefinition>(definition
.getPropertyDefinitions().values());
Collections.sort(memberDefinitions, new PropertyDefinitionComparator());
final boolean newRow = (map == null);
- final PropertyMap workingMap = newRow ? new PropertyMap(definition.getName()) : map.deepCopy(true);
-
- LocatableVLayout layout = new LocatableVLayout(locatorId);
- layout.setHeight100();
-
- final DynamicForm childForm = buildPropertiesForm(extendLocatorId("Editor"), memberDefinitions, workingMap);
- childForm.setHeight100();
- layout.addMember(childForm);
+ final PropertyMap workingMap = (newRow) ? new PropertyMap(definition.getName()) : map.deepCopy(true);
- final Window popup = new Window();
+ final LocatableWindow popup = new LocatableWindow(extendLocatorId("MapEditor"));
popup.setTitle(MSG.view_configEdit_editRow());
popup.setWidth(800);
popup.setHeight(600);
@@ -1529,39 +1485,46 @@ public class ConfigurationEditor extends LocatableVLayout {
popup.setShowCloseButton(false);
popup.centerInPage();
- final IButton okButton = new LocatableIButton(extendLocatorId("OK"), MSG.common_button_ok());
+ final LocatableVLayout layout = new LocatableVLayout(popup.extendLocatorId("Layout"));
+ layout.setHeight100();
+
+ final DynamicForm childForm = buildPropertiesForm(layout.extendLocatorId("Form"), memberDefinitions, workingMap);
+ childForm.setHeight100();
+ layout.addMember(childForm);
+
+ LocatableHLayout buttonBar = new LocatableHLayout(layout.extendLocatorId("ButtonBar"));
+ buttonBar.setAlign(Alignment.CENTER);
+ buttonBar.setMembersMargin(10);
+
+ final IButton okButton = new LocatableIButton(buttonBar.extendLocatorId("OK"), MSG.common_button_ok());
if (!mapReadOnly) {
okButton.disable();
}
okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
if (newRow) {
- list.add(workingMap);
- ListGridRecord record = buildSummaryRecord(memberDefinitions, workingMap);
try {
+ list.add(workingMap);
+ int index = list.getList().size();
+ PropertyMapListGridRecord record = new PropertyMapListGridRecord(workingMap, index,
+ memberDefinitions);
summaryTable.addData(record);
} catch (Exception e) {
e.printStackTrace();
}
} else {
- // TODO: Pass in the map's index, rather than using indexOf(), which is not 100% reliable,
- // since a list could contain two or more identical maps.
- //list.getList().set(list.getList().indexOf(map), workingMap);
- for (PropertyDefinition subDef : memberDefinitions) {
- PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
- PropertySimple propertySimple = ((PropertySimple) workingMap.get(subDefSimple.getName()));
- existingRecord.setAttribute(subDefSimple.getName(), propertySimple != null ? propertySimple
- .getStringValue() : null);
+ try {
+ mergePropertyMap(workingMap, map, memberDefinitions);
+ existingRecord.refresh();
+ summaryTable.updateData(existingRecord);
+ } catch (Exception e) {
+ e.printStackTrace();
}
- summaryTable.updateData(existingRecord);
}
firePropertyChangedEvent(list, null, true);
summaryTable.redraw();
- // ListGridRecord[] rows = buildSummaryRecords(list, definitions);
- // summaryTable.setData(rows);
- // summaryTable.redraw();
- // summaryTable.addData();
+ layout.destroy();
popup.destroy();
}
});
@@ -1573,24 +1536,33 @@ public class ConfigurationEditor extends LocatableVLayout {
}
});
- final IButton cancelButton = new LocatableIButton(extendLocatorId("Cancel"), MSG.common_button_cancel());
+ final IButton cancelButton = new LocatableIButton(buttonBar.extendLocatorId("Cancel"), MSG.common_button_cancel());
cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
+ layout.destroy();
popup.destroy();
}
});
- HLayout buttons = new HLayout();
- buttons.setAlign(Alignment.CENTER);
- buttons.setMembersMargin(10);
- buttons.setMembers(okButton, cancelButton);
- layout.addMember(buttons);
+ buttonBar.setMembers(okButton, cancelButton);
+ layout.addMember(buttonBar);
popup.addItem(layout);
popup.show();
}
+ private void mergePropertyMap(PropertyMap sourceMap, PropertyMap targetMap,
+ List<PropertyDefinition> memberDefinitions) {
+ for (PropertyDefinition subDef : memberDefinitions) {
+ PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
+ PropertySimple propertySimple = ((PropertySimple) sourceMap.get(subDefSimple.getName()));
+ String newValue = (propertySimple != null) ? propertySimple.getStringValue() : null;
+ PropertySimple existingProp = targetMap.getSimple(subDefSimple.getName());
+ existingProp.setStringValue(newValue);
+ }
+ }
+
protected static void setValue(FormItem item, Object value) {
if (value instanceof String) {
item.setValue((String) value);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index 1f266b8..80d6269 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -456,10 +456,10 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
@Override
- protected boolean updatePropertyValueOnChange(PropertyDefinitionSimple propertyDefinitionSimple,
- PropertySimple propertySimple) {
+ protected boolean fireEventOnPropertyValueChange(PropertyDefinitionSimple propertyDefinitionSimple,
+ PropertySimple propertySimple) {
return isAggregateProperty(propertySimple)
- && super.updatePropertyValueOnChange(propertyDefinitionSimple, propertySimple);
+ && super.fireEventOnPropertyValueChange(propertyDefinitionSimple, propertySimple);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/PropertyMapListGridRecord.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/PropertyMapListGridRecord.java
new file mode 100644
index 0000000..9c24a57
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/PropertyMapListGridRecord.java
@@ -0,0 +1,67 @@
+package org.rhq.enterprise.gui.coregui.client.components.configuration;
+
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.configuration.AbstractPropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+
+import java.util.List;
+
+/**
+ *
+ */
+public class PropertyMapListGridRecord extends ListGridRecord {
+
+ private AbstractPropertyMap propertyMap;
+ private int index;
+ private List<PropertyDefinition> memberPropertyDefinitions;
+
+ public PropertyMapListGridRecord(AbstractPropertyMap propertyMap, int index,
+ List<PropertyDefinition> memberPropertyDefinitions) {
+ this.propertyMap = propertyMap;
+ this.index = index;
+ this.memberPropertyDefinitions = memberPropertyDefinitions;
+
+ refresh();
+ }
+
+ public AbstractPropertyMap getPropertyMap() {
+ return propertyMap;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void refresh() {
+ for (PropertyDefinition subDef : memberPropertyDefinitions) {
+ PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
+ String propertyName = subDefSimple.getName();
+ PropertySimple propertySimple = propertyMap.getSimple(propertyName);
+
+ if ((propertySimple != null) && (propertySimple.getStringValue() != null)) {
+ switch (((PropertyDefinitionSimple) subDef).getType()) {
+ case BOOLEAN:
+ setAttribute(propertyName, propertySimple.getBooleanValue());
+ break;
+ case INTEGER:
+ setAttribute(propertyName, propertySimple.getIntegerValue());
+ break;
+ case FLOAT:
+ setAttribute(propertyName, propertySimple.getFloatValue());
+ break;
+ case DOUBLE:
+ setAttribute(propertyName, propertySimple.getDoubleValue());
+ break;
+ default:
+ setAttribute(propertyName, propertySimple.getStringValue());
+ break;
+ }
+ } else {
+ setAttribute(propertyName, (String) null);
+ }
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java
index 56f34bd..417a604 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java
@@ -35,4 +35,14 @@ public class LocatableWindow extends Window implements Locatable {
return this.locatorId + "_" + extension;
}
+/* public void destroyMembers() {
+ SeleniumUtility.destroyMembers(this);
+ }
+
+ @Override
+ public void destroy() {
+ destroyMembers();
+ super.destroy();
+ }*/
+
}
commit e9502f4e0efb638d65018d2b2789fd7f437baa6e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 2 10:05:23 2011 -0500
Add Activity2 (Dashboard style) subtab for Summary Tab in
ResourceDetailView. This just has dummy portlets at the moment.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
index 4c061fb..2f5d41e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
@@ -154,11 +154,11 @@ public class Dashboard implements Serializable {
this.category = category;
}
- protected Resource getResource() {
+ public Resource getResource() {
return resource;
}
- protected void setResource(Resource resource) {
+ public void setResource(Resource resource) {
this.resource = resource;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 576f102..aec77ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -67,6 +67,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitorin
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.history.ResourceOperationHistoryListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.schedule.ResourceOperationScheduleListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.Activity2View;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ActivityView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -113,6 +114,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
private TwoLevelTab contentTab;
private SubTab summaryActivity;
+ private SubTab summaryActivity2;
private SubTab summaryTimeline;
private SubTab monitorGraphs;
private SubTab monitorTables;
@@ -150,9 +152,12 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
.view_tabs_common_summary()), ImageManager.getResourceIcon(ResourceCategory.SERVICE, Boolean.TRUE));
summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"), new ViewName("Activity", MSG
.view_tabs_common_activity()), null);
+ summaryActivity2 = new SubTab(summaryTab.extendLocatorId("Activity2"), new ViewName("Activity2", MSG
+ .view_tabs_common_activity()
+ + "2"), null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), new ViewName("Timeline", MSG
.view_tabs_common_timeline()), null);
- summaryTab.registerSubTabs(summaryActivity, summaryTimeline);
+ summaryTab.registerSubTabs(summaryActivity, summaryActivity2, summaryTimeline);
tabs.add(summaryTab);
inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new ViewName("Inventory", MSG
@@ -208,21 +213,19 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
tabs.add(eventsTab);
operationsTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.OPERATIONS), new ViewName(Tab.OPERATIONS, MSG
.view_tabs_common_operations()), "/images/icons/Operation_grey_16.png");
- this.operationsSchedules = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.SCHEDULES),
- new ViewName(OperationsSubTab.SCHEDULES, MSG.view_tabs_common_schedules()), null);
- this.operationsHistory = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.HISTORY),
- new ViewName(OperationsSubTab.HISTORY, MSG.view_tabs_common_history()), null);
+ this.operationsSchedules = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.SCHEDULES), new ViewName(
+ OperationsSubTab.SCHEDULES, MSG.view_tabs_common_schedules()), null);
+ this.operationsHistory = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.HISTORY), new ViewName(
+ OperationsSubTab.HISTORY, MSG.view_tabs_common_history()), null);
operationsTab.registerSubTabs(this.operationsSchedules, this.operationsHistory);
tabs.add(operationsTab);
- configurationTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.CONFIGURATION), new ViewName(Tab.CONFIGURATION,
- MSG.view_tabs_common_configuration()), "/images/icons/Configure_grey_16.png");
- this.configCurrent = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.CURRENT),
- new ViewName(ConfigurationSubTab.CURRENT, MSG
- .view_tabs_common_current()), null);
- this.configHistory = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.HISTORY),
- new ViewName(ConfigurationSubTab.HISTORY, MSG
- .view_tabs_common_history()), null);
+ configurationTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.CONFIGURATION), new ViewName(
+ Tab.CONFIGURATION, MSG.view_tabs_common_configuration()), "/images/icons/Configure_grey_16.png");
+ this.configCurrent = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.CURRENT), new ViewName(
+ ConfigurationSubTab.CURRENT, MSG.view_tabs_common_current()), null);
+ this.configHistory = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.HISTORY), new ViewName(
+ ConfigurationSubTab.HISTORY, MSG.view_tabs_common_history()), null);
configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
tabs.add(configurationTab);
@@ -281,6 +284,13 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
}
});
+ updateSubTab(this.summaryTab, this.summaryActivity2, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new Activity2View(summaryActivity2.extendLocatorId("View"), resourceComposite);
+ }
+ });
+
updateSubTab(this.summaryTab, this.summaryTimeline, true, true, new ViewFactory() {
@Override
public Canvas createView() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/Activity2View.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/Activity2View.java
new file mode 100644
index 0000000..8c03071
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/Activity2View.java
@@ -0,0 +1,203 @@
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
+
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.InitializableView;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardContainer;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
+import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * The content pane for the resource Summary>Dashboard subtab.
+ *
+ * @author Jay Shaughnessy
+ */
+
+public class Activity2View extends LocatableVLayout implements DashboardContainer, InitializableView {
+
+ private static final String DASHBOARD_NAME_PREFIX = "ResourceDashboard_";
+
+ private ResourceComposite resourceComposite;
+
+ private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
+
+ private DashboardView dashboardView;
+
+ private LocatableToolStrip footer;
+ private IButton editButton;
+ private IButton resetButton;
+
+ // Capture the user's global permissions for use by any dashboard or portlet that may need it for rendering.
+ private Set<Permission> globalPermissions;
+
+ private boolean editMode = false;
+
+ private boolean isInitialized = false;
+
+ public Activity2View(String locatorId, ResourceComposite resourceComposite) {
+ super(locatorId);
+ this.resourceComposite = resourceComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ if (!isInitialized()) {
+ super.onInit();
+
+ // first async call to get global permissions
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ globalPermissions = permissions;
+
+ // now make async call to look for customized dash for this user and entity
+ DashboardCriteria criteria = new DashboardCriteria();
+ criteria.addFilterCategory(DashboardCategory.RESOURCE);
+ criteria.addFilterResourceId(resourceComposite.getResource().getId());
+ dashboardService.findDashboardsByCriteria(criteria, new AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
+ }
+
+ public void onSuccess(final PageList<Dashboard> result) {
+ Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
+ setDashboard(dashboard);
+
+ isInitialized = true;
+
+ // draw() may be done since onInit finishes asynchronously, if so redraw
+ if (isDrawn()) {
+ markForRedraw();
+ }
+ }
+ });
+ }
+ });
+ }
+ }
+
+ private void setDashboard(Dashboard dashboard) {
+ Canvas[] members = getMembers();
+ removeMembers(members);
+
+ dashboardView = new DashboardView(extendLocatorId(dashboard.getName()), this, dashboard);
+ addMember(dashboardView);
+
+ footer = new LocatableToolStrip(extendLocatorId("Footer"));
+ footer.setPadding(5);
+ footer.setWidth100();
+ footer.setMembersMargin(15);
+
+ editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
+ .common_title_edit_mode());
+ editButton.setAutoFit(true);
+ editButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ editMode = !editMode;
+ editButton.setTitle(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
+ dashboardView.setEditMode(editMode);
+ }
+ });
+
+ resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
+ resetButton.setAutoFit(true);
+ resetButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ String message = MSG.view_summaryDashboard_resetConfirm();
+
+ SC.ask(message, new BooleanCallback() {
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ dashboardView.delete();
+ setDashboard(getDefaultDashboard());
+ markForRedraw();
+ }
+ }
+ });
+ }
+ });
+
+ footer.addMember(editButton);
+ footer.addMember(resetButton);
+
+ addMember(footer);
+ }
+
+ protected Dashboard getDefaultDashboard() {
+ Subject sessionSubject = UserSessionManager.getSessionSubject();
+ Resource resource = resourceComposite.getResource();
+
+ Dashboard dashboard = new Dashboard();
+
+ dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + resource.getId());
+ dashboard.setCategory(DashboardCategory.RESOURCE);
+ dashboard.setResource(resource);
+ dashboard.setColumns(2);
+
+ // TODO, add real portlets
+ // set leftmost column and let the rest be equally divided
+ dashboard.setColumnWidths("40%");
+ dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
+
+ // Left Column
+ DashboardPortlet dummyLeft = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyLeft.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyLeft, 0, 0);
+
+ // right Column
+ DashboardPortlet dummyRight = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyRight.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyRight, 1, 0);
+
+ return dashboard;
+ }
+
+ @Override
+ public boolean isInitialized() {
+ return isInitialized;
+ }
+
+ public Set<Permission> getGlobalPermissions() {
+ return globalPermissions;
+ }
+
+ /**
+ * name update not supported because the name is derived from the entity id.
+ * @return
+ */
+ public boolean supportsDashboardNameEdit() {
+ return false;
+ }
+
+ public void updateDashboardNames() {
+ return;
+ }
+
+}
commit 7294c38922ff2284479d9baa9b87c7a272624cb8
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Mar 1 17:54:22 2011 -0500
swapping 'Dashboard' Group ActivityView content with Group ActivityView2 content.
Default Summary>Activity will be the older static Activity/Dashboard.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index 38b4194..27dfc22 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -18,204 +18,695 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.Set;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
+import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.criteria.DashboardCriteria;
-import org.rhq.core.domain.dashboard.Dashboard;
-import org.rhq.core.domain.dashboard.DashboardCategory;
-import org.rhq.core.domain.dashboard.DashboardPortlet;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.form.fields.LinkItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
+import org.rhq.core.domain.content.InstalledPackageHistory;
+import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.criteria.GroupBundleDeploymentCriteria;
+import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
+import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
+import org.rhq.core.domain.event.EventSeverity;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
+import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
+import org.rhq.core.domain.operation.GroupOperationHistory;
+import org.rhq.core.domain.resource.ResourceTypeFacet;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.InitializableView;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
-import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardContainer;
-import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
-import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
+import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
+import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
+import org.rhq.enterprise.gui.coregui.client.util.GwtTuple;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
- * The content pane for the group Summary>Dashboard subtab.
+ * The content pane for the group Summary>Activity subtab.
*
- * @author Jay Shaughnessy
+ * @author Simeon Pinder
*/
-
-public class ActivityView extends LocatableVLayout implements DashboardContainer, InitializableView {
-
- private static final String DASHBOARD_NAME_PREFIX = "GroupDashboard_";
+public class ActivityView extends AbstractActivityView {
private ResourceGroupComposite groupComposite;
- private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
+ public ActivityView(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId, groupComposite, null);
+ this.groupComposite = groupComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ loadData();
+ }
- private DashboardView dashboardView;
+ /**Initiates data request.
+ */
+ protected void loadData() {
+ ResourceGroup group = null;
+ GroupCategory groupCategory = null;
+ Set<ResourceTypeFacet> facets = null;
+ if ((groupComposite != null) && (groupComposite.getResourceGroup() != null)) {
+ group = groupComposite.getResourceGroup();
+ groupCategory = groupComposite.getResourceGroup().getGroupCategory();
+ //Load Facets to conditionally display relevant tabs
+ facets = groupComposite.getResourceFacets().getFacets();
+
+ getRecentAlerts();
+ //events
+ if (displayGroupEvents(groupCategory, facets)) {
+ getRecentEventUpdates();
+ }
+ //operations
+ if (displayGroupOperations(groupCategory, facets)) {
+ getRecentOperations();
+ }
+ //Config updates
+ if (displayGroupConfigurationUpdates(groupCategory, facets)) {
+ getRecentConfigurationUpdates();
+ }
+ //recentMetrics,oobs,pkghistory
+ if (groupCategory == GroupCategory.COMPATIBLE) {
+ getRecentOobs();
+ getRecentPkgHistory();
+ getRecentMetrics();
+ }
- private LocatableToolStrip footer;
- private IButton editButton;
- private IButton resetButton;
+ //conditionally display Bundle deployments for groups of platforms only
+ displayBundleDeploymentsForPlatformGroups(group);
+ }
+ }
- // Capture the user's global permissions for use by any dashboard or portlet that may need it for rendering.
- private Set<Permission> globalPermissions;
+ /** Fetches alerts and updates the DynamicForm instance with the latest
+ * alert information.
+ */
+ private void getRecentAlerts() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ Integer[] filterGroupAlertDefinitionIds;
+ Set<AlertDefinition> alertDefinitions = this.groupComposite.getResourceGroup().getAlertDefinitions();
+ filterGroupAlertDefinitionIds = new Integer[alertDefinitions.size()];
+ int i = 0;
+ for (AlertDefinition def : alertDefinitions) {
+ filterGroupAlertDefinitionIds[i++] = def.getId();
+ }
+ //fetches last five alerts for this resource
+ AlertCriteria criteria = new AlertCriteria();
+ PageControl pageControl = new PageControl(0, 5);
+ pageControl.initDefaultOrderingField("ctime", PageOrdering.DESC);
+ criteria.setPageControl(pageControl);
+ criteria.addFilterGroupAlertDefinitionIds(filterGroupAlertDefinitionIds);
+ GWTServiceLookup.getAlertService().findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
+ @Override
+ public void onSuccess(PageList<Alert> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ int rowNum = 0;
+ for (Alert alert : result) {
+ // alert history records do not have a usable locatorId, we'll use rownum, which is unique and
+ // may be repeatable.
+ LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
+ .valueOf(rowNum++)));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon(ImageManager.getAlertIcon(alert.getAlertDefinition()
+ .getPriority()), alert.getAlertDefinition().getPriority().getDisplayName());
+ LinkItem link = newLinkItem(alert.getAlertDefinition().getName() + ": ",
+ ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/" + alert.getId());
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(alert.getCtime()));
+ row.setItems(iconItem, link, time);
+
+ column.addMember(row);
+ }
+ //link to more details
+ LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
+ .valueOf(rowNum++)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentAlertsContent.extendLocatorId("None"),
+ RECENT_ALERTS_NONE);
+ column.addMember(row);
+ }
+ for (Canvas child : recentAlertsContent.getChildren()) {
+ child.destroy();
+ }
+ recentAlertsContent.addChild(column);
+ recentAlertsContent.markForRedraw();
+ }
- private boolean editMode = false;
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent alerts for group [" + groupId + "]:" + caught.getMessage());
+ }
+ });
+ }
- private boolean isInitialized = false;
+ /** Fetches operations and updates the DynamicForm instance with the latest
+ * operation information.
+ */
+ private void getRecentOperations() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ //fetches five most recent operations.
+ PageControl pageControl = new PageControl(0, 5);
+
+ GroupOperationHistoryCriteria criteria = new GroupOperationHistoryCriteria();
+ List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
+ filterResourceGroupIds.add(groupId);
+ criteria.addFilterResourceGroupIds(filterResourceGroupIds);
+ criteria.setPageControl(pageControl);
+ criteria.addSortStatus(PageOrdering.DESC);
+
+ GWTServiceLookup.getOperationService().findGroupOperationHistoriesByCriteriaDisambiguated(criteria,
+ new AsyncCallback<List<DisambiguationReport<GroupOperationHistory>>>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent operations for group [" + groupId + "]:" + caught.getMessage());
+ }
- public ActivityView(String locatorId, ResourceGroupComposite groupComposite) {
- super(locatorId);
- this.groupComposite = groupComposite;
+ @Override
+ public void onSuccess(List<DisambiguationReport<GroupOperationHistory>> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ int rowNum = 0;
+ for (DisambiguationReport<GroupOperationHistory> report : result) {
+ // operation history records do not have a usable locatorId, we'll use rownum, which is unique and
+ // may be repeatable.
+ LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon(ImageManager.getOperationResultsIcon(report
+ .getOriginal().getStatus()), report.getOriginal().getStatus().getDisplayName());
+ LinkItem link = newLinkItem(report.getOriginal().getOperationDefinition().getDisplayName()
+ + ": ", ReportDecorator.GWT_GROUP_URL + groupId + "/Operations/History/"
+ + report.getOriginal().getId());
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(report.getOriginal()
+ .getStartedTime()));
+ row.setItems(iconItem, link, time);
+
+ column.addMember(row);
+ }
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Operations/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentOperationsContent
+ .extendLocatorId("None"), RECENT_OPERATIONS_NONE);
+ column.addMember(row);
+ }
+ for (Canvas child : recentOperationsContent.getChildren()) {
+ child.destroy();
+ }
+ recentOperationsContent.addChild(column);
+ recentOperationsContent.markForRedraw();
+ }
+ });
}
- @Override
- protected void onInit() {
- if (!isInitialized()) {
- super.onInit();
-
- // first async call to get global permissions
- new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
-
- public void onPermissionsLoaded(Set<Permission> permissions) {
- globalPermissions = permissions;
-
- // now make async call to look for customized dash for this user and entity
- DashboardCriteria criteria = new DashboardCriteria();
- criteria.addFilterCategory(DashboardCategory.GROUP);
- criteria.addFilterGroupId(groupComposite.getResourceGroup().getId());
- dashboardService.findDashboardsByCriteria(criteria, new AsyncCallback<PageList<Dashboard>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
+ /** Fetches configuration updates and updates the DynamicForm instance with the latest
+ * config change information.
+ */
+ private void getRecentConfigurationUpdates() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+
+ PageControl lastFive = new PageControl(0, 5);
+ GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();
+ criteria.setPageControl(lastFive);
+ criteria.addSortStatus(PageOrdering.DESC);
+ List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
+ filterResourceGroupIds.add(groupId);
+ criteria.addFilterResourceGroupIds(filterResourceGroupIds);
+
+ GWTServiceLookup.getConfigurationService().findGroupResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<GroupResourceConfigurationUpdate>>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent configuration updates for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
+
+ @Override
+ public void onSuccess(PageList<GroupResourceConfigurationUpdate> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ int rowNum = 0;
+ for (GroupResourceConfigurationUpdate update : result) {
+ // config update history records do not have a usable locatorId, we'll use rownum, which is unique and
+ // may be repeatable.
+ LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon(ImageManager.getResourceConfigurationIcon(update
+ .getStatus()), null);
+ String linkTitle = MSG.view_resource_inventory_activity_changed_by() + " "
+ + update.getSubjectName() + ":";
+ if ((update.getSubjectName() == null) || (update.getSubjectName().trim().isEmpty())) {
+ linkTitle = MSG.common_msg_changeAutoDetected();
+ }
+ LinkItem link = newLinkItem(linkTitle, ReportDecorator.GWT_GROUP_URL + groupId
+ + "/Configuration/History/" + update.getId());
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(update
+ .getCreatedTime()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
}
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Configuration/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentConfigurationContent
+ .extendLocatorId("None"), RECENT_CONFIGURATIONS_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentConfigurationContent.getChildren()) {
+ child.destroy();
+ }
+ recentConfigurationContent.addChild(column);
+ recentConfigurationContent.markForRedraw();
- public void onSuccess(final PageList<Dashboard> result) {
- Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
- setDashboard(dashboard);
+ }
+ });
+ }
- isInitialized = true;
+ /** Fetches recent events and updates the DynamicForm instance with the latest
+ * event information over last 24hrs.
+ */
+ private void getRecentEventUpdates() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ long now = System.currentTimeMillis();
+ long nowMinus24Hours = now - (24 * 60 * 60 * 1000);
+ GWTServiceLookup.getEventService().getEventCountsBySeverityForGroup(groupId, nowMinus24Hours, now,
+ new AsyncCallback<Map<EventSeverity, Integer>>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log
+ .debug("Error retrieving recent event counts for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- // draw() may be done since onInit finishes asynchronously, if so redraw
- if (isDrawn()) {
- markForRedraw();
- }
+ @Override
+ public void onSuccess(Map<EventSeverity, Integer> eventCounts) {
+ //Now populated Tuples
+ List<GwtTuple<EventSeverity, Integer>> results = new ArrayList<GwtTuple<EventSeverity, Integer>>();
+ for (EventSeverity severity : eventCounts.keySet()) {
+ int count = eventCounts.get(severity);
+ if (count > 0) {
+ results.add(new GwtTuple<EventSeverity, Integer>(severity, count));
+ }
+ }
+ //build display
+ VLayout column = new VLayout();
+ column.setHeight(10);
+
+ if (!results.isEmpty()) {
+ int rowNum = 0;
+ for (GwtTuple<EventSeverity, Integer> tuple : results) {
+ // event history records do not have a usable locatorId, we'll use rownum, which is unique and
+ // may be repeatable.
+ LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ row.setNumCols(2);
+ row.setWidth(10);//pack.
+
+ //icon
+ StaticTextItem iconItem = newTextItemIcon(ImageManager.getEventSeverityIcon(tuple
+ .getLefty()), tuple.getLefty().name());
+ //count
+ StaticTextItem count = newTextItem(String.valueOf(tuple.righty));
+ row.setItems(iconItem, count);
+
+ column.addMember(row);
}
- });
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent.extendLocatorId(String
+ .valueOf(rowNum)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Events/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentEventsContent.extendLocatorId("None"),
+ RECENT_EVENTS_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentEventsContent.getChildren()) {
+ child.destroy();
+ }
+ recentEventsContent.addChild(column);
+ recentEventsContent.markForRedraw();
}
});
- }
}
- private void setDashboard(Dashboard dashboard) {
- Canvas[] members = getMembers();
- removeMembers(members);
-
- dashboardView = new DashboardView(extendLocatorId(dashboard.getName()), this, dashboard);
- addMember(dashboardView);
-
- footer = new LocatableToolStrip(extendLocatorId("Footer"));
- footer.setPadding(5);
- footer.setWidth100();
- footer.setMembersMargin(15);
-
- editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
- .common_title_edit_mode());
- editButton.setAutoFit(true);
- editButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- editMode = !editMode;
- editButton.setTitle(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
- dashboardView.setEditMode(editMode);
- }
- });
+ /** Fetches OOB measurements and updates the DynamicForm instance with the latest 5
+ * oob change details.
+ */
+ private void getRecentOobs() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+
+ GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForGroup(groupId, 5,
+ new AsyncCallback<PageList<MeasurementOOBComposite>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent out of bound metrics for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
- resetButton.setAutoFit(true);
- resetButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- String message = MSG.view_summaryDashboard_resetConfirm();
-
- SC.ask(message, new BooleanCallback() {
- public void execute(Boolean confirmed) {
- if (confirmed) {
- dashboardView.delete();
- setDashboard(getDefaultDashboard());
- markForRedraw();
+ @Override
+ public void onSuccess(PageList<MeasurementOOBComposite> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (MeasurementOOBComposite oob : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentOobContent.extendLocatorId(oob
+ .getScheduleName()));
+ row.setNumCols(2);
+
+ String title = oob.getScheduleName() + ":";
+ String destination = "/resource/common/monitor/Visibility.do?m=" + oob.getDefinitionId()
+ + "&id=" + groupId + "&mode=chartSingleMetricSingleResource";
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(oob.getTimestamp()));
+
+ row.setItems(link, time);
+ column.addMember(row);
}
+ //insert see more link spinder(2/24/11): no page that displays all oobs... See More not possible.
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentOobContent.extendLocatorId("None"),
+ RECENT_OOB_NONE);
+ column.addMember(row);
}
- });
- }
- });
+ recentOobContent.setContents("");
+ for (Canvas child : recentOobContent.getChildren()) {
+ child.destroy();
+ }
+ recentOobContent.addChild(column);
+ recentOobContent.markForRedraw();
+ }
+ });
+ }
- footer.addMember(editButton);
- footer.addMember(resetButton);
+ /** Fetches recent package history information and updates the DynamicForm instance with details.
+ */
+ private void getRecentPkgHistory() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ InstalledPackageHistoryCriteria criteria = new InstalledPackageHistoryCriteria();
+ PageControl pageControl = new PageControl(0, 5);
+ criteria.setPageControl(pageControl);
+ criteria.addFilterResourceGroupIds(groupId);
+ criteria.addSortStatus(PageOrdering.DESC);
+
+ GWTServiceLookup.getContentService().findInstalledPackageHistoryByCriteria(criteria,
+
+ new AsyncCallback<PageList<InstalledPackageHistory>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving installed package history for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- addMember(footer);
+ @Override
+ public void onSuccess(PageList<InstalledPackageHistory> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (InstalledPackageHistory history : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
+ .extendLocatorId(history.getPackageVersion().getFileName()
+ + history.getPackageVersion().getVersion()));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon("subsystems/content/Package_16.png", null);
+ String title = history.getPackageVersion().getFileName() + ":";
+ String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId
+ + "&selectedHistoryId=" + history.getId();
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(history.getTimestamp()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
+ }
+ // //insert see more link
+ // LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
+ // .extendLocatorId("PkgHistoryContentSeeMore"));
+ // String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId;
+ // addSeeMoreLink(row, destination, column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentPkgHistoryContent.extendLocatorId("None"),
+ RECENT_PKG_HISTORY_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentPkgHistoryContent.getChildren()) {
+ child.destroy();
+ }
+ recentPkgHistoryContent.addChild(column);
+ recentPkgHistoryContent.markForRedraw();
+ }
+ });
}
- protected Dashboard getDefaultDashboard() {
- Subject sessionSubject = UserSessionManager.getSessionSubject();
- ResourceGroup group = groupComposite.getResourceGroup();
+ /** Fetches recent metric information and updates the DynamicForm instance with i)sparkline information,
+ * ii) link to recent metric graph for more details and iii) last metric value formatted to show significant
+ * digits.
+ */
+ private void getRecentMetrics() {
- Dashboard dashboard = new Dashboard();
+ //display container
+ final VLayout column = new VLayout();
+ column.setHeight(10);//pack
+ final int groupId = this.groupComposite.getResourceGroup().getId();
- dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + group.getId());
- dashboard.setCategory(DashboardCategory.GROUP);
- dashboard.setGroup(group);
- dashboard.setColumns(2);
+ //retrieve all relevant measurement definition ids.
+ Set<MeasurementDefinition> definitions = this.groupComposite.getResourceGroup().getResourceType()
+ .getMetricDefinitions();
- // TODO, add real portlets
- // set leftmost column and let the rest be equally divided
- dashboard.setColumnWidths("40%");
- dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
+ //build id mapping for measurementDefinition instances Ex. Free Memory -> MeasurementDefinition[100071]
+ final HashMap<String, MeasurementDefinition> measurementDefMap = new HashMap<String, MeasurementDefinition>();
+ for (MeasurementDefinition definition : definitions) {
+ measurementDefMap.put(definition.getDisplayName(), definition);
+ }
+ //bundle definition ids for asynch call.
+ int[] definitionArrayIds = new int[definitions.size()];
+ final String[] displayOrder = new String[definitions.size()];
+ measurementDefMap.keySet().toArray(displayOrder);
+ //sort the charting data ex. Free Memory, Free Swap Space,..System Load
+ Arrays.sort(displayOrder);
+
+ //organize definitionArrayIds for ordered request on server.
+ int index = 0;
+ for (String definitionToDisplay : displayOrder) {
+ definitionArrayIds[index++] = measurementDefMap.get(definitionToDisplay).getId();
+ }
- // Left Column
- DashboardPortlet dummyLeft = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
- dummyLeft.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
- dashboard.addPortlet(dummyLeft, 0, 0);
+ //make the asynchronous call for all the measurement data
+ GWTServiceLookup.getMeasurementDataService().findDataForCompatibleGroup(groupId, definitionArrayIds,
+ System.currentTimeMillis() - (1000L * 60 * 60 * 8), System.currentTimeMillis(), 60,
+ new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent metrics charting data for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- // right Column
- DashboardPortlet dummyRight = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
- dummyRight.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
- dashboard.addPortlet(dummyRight, 1, 0);
+ @Override
+ public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> results) {
+ if (!results.isEmpty()) {
+ boolean someChartedData = false;
+ //iterate over the retrieved charting data
+ for (int index = 0; index < displayOrder.length; index++) {
+ //retrieve the correct measurement definition
+ MeasurementDefinition md = measurementDefMap.get(displayOrder[index]);
+
+ //load the data results for the given metric definition
+ List<MeasurementDataNumericHighLowComposite> data = results.get(index);
+
+ //locate last and minimum values.
+ double lastValue = -1;
+ double minValue = Double.MAX_VALUE;//
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
+ if (d.getValue() < minValue) {
+ minValue = d.getValue();
+ }
+ lastValue = d.getValue();
+ }
+ }
- return dashboard;
- }
+ //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
+ String commaDelimitedList = "";
- @Override
- public boolean isInitialized() {
- return isInitialized;
- }
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
+ commaDelimitedList += d.getValue() + ",";
+ }
+ }
+ LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
+ .extendLocatorId(md.getName()));
+ row.setNumCols(3);
+ HTMLFlow graph = new HTMLFlow();
+ // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0'>"
+ // + commaDelimitedList + "</span>";
+ String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0' "
+ + "values='" + commaDelimitedList + "'>...</span>";
+ graph.setContents(contents);
+ graph.setContentsType(ContentsType.PAGE);
+ //diable scrollbars on span
+ graph.setScrollbarSize(0);
+
+ CanvasItem graphContainer = new CanvasItem();
+ graphContainer.setShowTitle(false);
+ graphContainer.setHeight(16);
+ graphContainer.setWidth(60);
+ graphContainer.setCanvas(graph);
+
+ //Link/title element
+ //TODO: spinder, change link whenever portal.war/graphing is removed.
+ String title = md.getDisplayName() + ":";
+ // String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricSingleResource&id="
+ // + resourceId + "&m=" + md.getId();
+ String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricMultiResource&groupId="
+ + groupId + "&m=" + md.getId();
+ LinkItem link = newLinkItem(title, destination);
+
+ //Value
+ String convertedValue = lastValue + " " + md.getUnits();
+ convertedValue = convertLastValueForDisplay(lastValue, md);
+ StaticTextItem value = newTextItem(convertedValue);
+
+ row.setItems(graphContainer, link, value);
+ //if graph content returned
+ if ((md.getName().trim().indexOf("Trait.") == -1) && (lastValue != -1)) {
+ column.addMember(row);
+ someChartedData = true;
+ }
+ }
+ if (!someChartedData) {// when there are results but no chartable entries.
+ LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
+ .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
+ column.addMember(row);
+ } else {
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
+ .extendLocatorId("RecentMeasurementsContentSeeMore"));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Monitoring/Graphs/", column);
+ }
+ //call out to 3rd party javascript lib
+ BrowserUtility.graphSparkLines();
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
+ .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
+ column.addMember(row);
+ }
+ }
+ });
- public Set<Permission> getGlobalPermissions() {
- return globalPermissions;
+ //cleanup
+ for (Canvas child : recentMeasurementsContent.getChildren()) {
+ child.destroy();
+ }
+ recentMeasurementsContent.addChild(column);
+ recentMeasurementsContent.markForRedraw();
}
- /**
- * name update not supported because the name is derived from the entity id.
- * @return
+ /** Fetches recent bundle deployment information and updates the DynamicForm instance with details.
*/
- public boolean supportsDashboardNameEdit() {
- return false;
- }
+ protected void getRecentBundleDeployments() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ GroupBundleDeploymentCriteria criteria = new GroupBundleDeploymentCriteria();
+ PageControl pageControl = new PageControl(0, 5);
+ criteria.setPageControl(pageControl);
+ criteria.addFilterResourceGroupIds(groupId);
+ criteria.addSortStatus(PageOrdering.DESC);
+ criteria.fetchDestination(true);
+ criteria.fetchBundleVersion(true);
+
+ GWTServiceLookup.getBundleService().findBundleDeploymentsByCriteria(criteria,
+ new AsyncCallback<PageList<BundleDeployment>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving installed bundle deployments for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- public void updateDashboardNames() {
- return;
+ @Override
+ public void onSuccess(PageList<BundleDeployment> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (BundleDeployment deployment : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent
+ .extendLocatorId(deployment.getBundleVersion().getName()
+ + deployment.getBundleVersion().getVersion()));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
+ String title = deployment.getBundleVersion().getName() + "["
+ + deployment.getBundleVersion().getVersion() + "]:";
+ String destination = ReportDecorator.GWT_BUNDLE_URL
+ + deployment.getBundleVersion().getBundle().getId() + "/destinations/"
+ + deployment.getDestination().getId();
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter
+ .format(deployment.getCtime()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
+ }
+ //insert see more link
+ //TODO: spinder:2/25/11 (add this later) no current view for seeing all bundle deployments
+ // LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent.extendLocatorId("RecentBundleContentSeeMore"));
+ // addSeeMoreLink(row, LinkManager.getResourceGroupLink(groupId) + "/Events/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentBundleDeployContent
+ .extendLocatorId("None"), RECENT_BUNDLE_DEPLOY_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentBundleDeployContent.getChildren()) {
+ child.destroy();
+ }
+ recentBundleDeployContent.addChild(column);
+ recentBundleDeployContent.markForRedraw();
+ }
+ });
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 71a1bf8..121193f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -18,695 +18,204 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
-import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.ContentsType;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.form.fields.LinkItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import org.rhq.core.domain.alert.Alert;
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.bundle.BundleDeployment;
-import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
-import org.rhq.core.domain.content.InstalledPackageHistory;
-import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.core.domain.criteria.GroupBundleDeploymentCriteria;
-import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
-import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
-import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
-import org.rhq.core.domain.event.EventSeverity;
-import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
-import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
-import org.rhq.core.domain.operation.GroupOperationHistory;
-import org.rhq.core.domain.resource.ResourceTypeFacet;
-import org.rhq.core.domain.resource.composite.DisambiguationReport;
-import org.rhq.core.domain.resource.group.GroupCategory;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.InitializableView;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardContainer;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
+import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
-import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
-import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
-import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
-import org.rhq.enterprise.gui.coregui.client.util.GwtTuple;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
- * The content pane for the group Summary>Activity subtab.
+ * The content pane for the group Summary>Dashboard subtab.
*
- * @author Simeon Pinder
+ * @author Jay Shaughnessy
*/
-public class ActivityView2 extends AbstractActivityView {
- private ResourceGroupComposite groupComposite;
-
- public ActivityView2(String locatorId, ResourceGroupComposite groupComposite) {
- super(locatorId, groupComposite, null);
- this.groupComposite = groupComposite;
- }
-
- @Override
- protected void onInit() {
- super.onInit();
- loadData();
- }
-
- /**Initiates data request.
- */
- protected void loadData() {
- ResourceGroup group = null;
- GroupCategory groupCategory = null;
- Set<ResourceTypeFacet> facets = null;
- if ((groupComposite != null) && (groupComposite.getResourceGroup() != null)) {
- group = groupComposite.getResourceGroup();
- groupCategory = groupComposite.getResourceGroup().getGroupCategory();
- //Load Facets to conditionally display relevant tabs
- facets = groupComposite.getResourceFacets().getFacets();
-
- getRecentAlerts();
- //events
- if (displayGroupEvents(groupCategory, facets)) {
- getRecentEventUpdates();
- }
- //operations
- if (displayGroupOperations(groupCategory, facets)) {
- getRecentOperations();
- }
- //Config updates
- if (displayGroupConfigurationUpdates(groupCategory, facets)) {
- getRecentConfigurationUpdates();
- }
- //recentMetrics,oobs,pkghistory
- if (groupCategory == GroupCategory.COMPATIBLE) {
- getRecentOobs();
- getRecentPkgHistory();
- getRecentMetrics();
- }
+public class ActivityView2 extends LocatableVLayout implements DashboardContainer, InitializableView {
- //conditionally display Bundle deployments for groups of platforms only
- displayBundleDeploymentsForPlatformGroups(group);
- }
- }
+ private static final String DASHBOARD_NAME_PREFIX = "GroupDashboard_";
- /** Fetches alerts and updates the DynamicForm instance with the latest
- * alert information.
- */
- private void getRecentAlerts() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- Integer[] filterGroupAlertDefinitionIds;
- Set<AlertDefinition> alertDefinitions = this.groupComposite.getResourceGroup().getAlertDefinitions();
- filterGroupAlertDefinitionIds = new Integer[alertDefinitions.size()];
- int i = 0;
- for (AlertDefinition def : alertDefinitions) {
- filterGroupAlertDefinitionIds[i++] = def.getId();
- }
- //fetches last five alerts for this resource
- AlertCriteria criteria = new AlertCriteria();
- PageControl pageControl = new PageControl(0, 5);
- pageControl.initDefaultOrderingField("ctime", PageOrdering.DESC);
- criteria.setPageControl(pageControl);
- criteria.addFilterGroupAlertDefinitionIds(filterGroupAlertDefinitionIds);
- GWTServiceLookup.getAlertService().findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
- @Override
- public void onSuccess(PageList<Alert> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- int rowNum = 0;
- for (Alert alert : result) {
- // alert history records do not have a usable locatorId, we'll use rownum, which is unique and
- // may be repeatable.
- LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
- .valueOf(rowNum++)));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon(ImageManager.getAlertIcon(alert.getAlertDefinition()
- .getPriority()), alert.getAlertDefinition().getPriority().getDisplayName());
- LinkItem link = newLinkItem(alert.getAlertDefinition().getName() + ": ",
- ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/" + alert.getId());
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(alert.getCtime()));
- row.setItems(iconItem, link, time);
-
- column.addMember(row);
- }
- //link to more details
- LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
- .valueOf(rowNum++)));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentAlertsContent.extendLocatorId("None"),
- RECENT_ALERTS_NONE);
- column.addMember(row);
- }
- for (Canvas child : recentAlertsContent.getChildren()) {
- child.destroy();
- }
- recentAlertsContent.addChild(column);
- recentAlertsContent.markForRedraw();
- }
+ private ResourceGroupComposite groupComposite;
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent alerts for group [" + groupId + "]:" + caught.getMessage());
- }
- });
- }
+ private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
- /** Fetches operations and updates the DynamicForm instance with the latest
- * operation information.
- */
- private void getRecentOperations() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- //fetches five most recent operations.
- PageControl pageControl = new PageControl(0, 5);
-
- GroupOperationHistoryCriteria criteria = new GroupOperationHistoryCriteria();
- List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
- filterResourceGroupIds.add(groupId);
- criteria.addFilterResourceGroupIds(filterResourceGroupIds);
- criteria.setPageControl(pageControl);
- criteria.addSortStatus(PageOrdering.DESC);
-
- GWTServiceLookup.getOperationService().findGroupOperationHistoriesByCriteriaDisambiguated(criteria,
- new AsyncCallback<List<DisambiguationReport<GroupOperationHistory>>>() {
-
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent operations for group [" + groupId + "]:" + caught.getMessage());
- }
+ private DashboardView dashboardView;
- @Override
- public void onSuccess(List<DisambiguationReport<GroupOperationHistory>> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- int rowNum = 0;
- for (DisambiguationReport<GroupOperationHistory> report : result) {
- // operation history records do not have a usable locatorId, we'll use rownum, which is unique and
- // may be repeatable.
- LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
- .extendLocatorId(String.valueOf(rowNum)));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon(ImageManager.getOperationResultsIcon(report
- .getOriginal().getStatus()), report.getOriginal().getStatus().getDisplayName());
- LinkItem link = newLinkItem(report.getOriginal().getOperationDefinition().getDisplayName()
- + ": ", ReportDecorator.GWT_GROUP_URL + groupId + "/Operations/History/"
- + report.getOriginal().getId());
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(report.getOriginal()
- .getStartedTime()));
- row.setItems(iconItem, link, time);
-
- column.addMember(row);
- }
- //insert see more link
- LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
- .extendLocatorId(String.valueOf(rowNum)));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Operations/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentOperationsContent
- .extendLocatorId("None"), RECENT_OPERATIONS_NONE);
- column.addMember(row);
- }
- for (Canvas child : recentOperationsContent.getChildren()) {
- child.destroy();
- }
- recentOperationsContent.addChild(column);
- recentOperationsContent.markForRedraw();
- }
- });
- }
+ private LocatableToolStrip footer;
+ private IButton editButton;
+ private IButton resetButton;
- /** Fetches configuration updates and updates the DynamicForm instance with the latest
- * config change information.
- */
- private void getRecentConfigurationUpdates() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
-
- PageControl lastFive = new PageControl(0, 5);
- GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();
- criteria.setPageControl(lastFive);
- criteria.addSortStatus(PageOrdering.DESC);
- List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
- filterResourceGroupIds.add(groupId);
- criteria.addFilterResourceGroupIds(filterResourceGroupIds);
-
- GWTServiceLookup.getConfigurationService().findGroupResourceConfigurationUpdatesByCriteria(criteria,
- new AsyncCallback<PageList<GroupResourceConfigurationUpdate>>() {
-
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent configuration updates for group [" + groupId + "]:"
- + caught.getMessage());
- }
+ // Capture the user's global permissions for use by any dashboard or portlet that may need it for rendering.
+ private Set<Permission> globalPermissions;
- @Override
- public void onSuccess(PageList<GroupResourceConfigurationUpdate> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- int rowNum = 0;
- for (GroupResourceConfigurationUpdate update : result) {
- // config update history records do not have a usable locatorId, we'll use rownum, which is unique and
- // may be repeatable.
- LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
- .extendLocatorId(String.valueOf(rowNum)));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon(ImageManager.getResourceConfigurationIcon(update
- .getStatus()), null);
- String linkTitle = MSG.view_resource_inventory_activity_changed_by() + " "
- + update.getSubjectName() + ":";
- if ((update.getSubjectName() == null) || (update.getSubjectName().trim().isEmpty())) {
- linkTitle = MSG.common_msg_changeAutoDetected();
- }
- LinkItem link = newLinkItem(linkTitle, ReportDecorator.GWT_GROUP_URL + groupId
- + "/Configuration/History/" + update.getId());
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(update
- .getCreatedTime()));
+ private boolean editMode = false;
- row.setItems(iconItem, link, time);
- column.addMember(row);
- }
- //insert see more link
- LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
- .extendLocatorId(String.valueOf(rowNum)));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Configuration/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentConfigurationContent
- .extendLocatorId("None"), RECENT_CONFIGURATIONS_NONE);
- column.addMember(row);
- }
- //cleanup
- for (Canvas child : recentConfigurationContent.getChildren()) {
- child.destroy();
- }
- recentConfigurationContent.addChild(column);
- recentConfigurationContent.markForRedraw();
+ private boolean isInitialized = false;
- }
- });
+ public ActivityView2(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
+ this.groupComposite = groupComposite;
}
- /** Fetches recent events and updates the DynamicForm instance with the latest
- * event information over last 24hrs.
- */
- private void getRecentEventUpdates() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- long now = System.currentTimeMillis();
- long nowMinus24Hours = now - (24 * 60 * 60 * 1000);
- GWTServiceLookup.getEventService().getEventCountsBySeverityForGroup(groupId, nowMinus24Hours, now,
- new AsyncCallback<Map<EventSeverity, Integer>>() {
-
- @Override
- public void onFailure(Throwable caught) {
- Log
- .debug("Error retrieving recent event counts for group [" + groupId + "]:"
- + caught.getMessage());
- }
-
- @Override
- public void onSuccess(Map<EventSeverity, Integer> eventCounts) {
- //Now populated Tuples
- List<GwtTuple<EventSeverity, Integer>> results = new ArrayList<GwtTuple<EventSeverity, Integer>>();
- for (EventSeverity severity : eventCounts.keySet()) {
- int count = eventCounts.get(severity);
- if (count > 0) {
- results.add(new GwtTuple<EventSeverity, Integer>(severity, count));
- }
- }
- //build display
- VLayout column = new VLayout();
- column.setHeight(10);
-
- if (!results.isEmpty()) {
- int rowNum = 0;
- for (GwtTuple<EventSeverity, Integer> tuple : results) {
- // event history records do not have a usable locatorId, we'll use rownum, which is unique and
- // may be repeatable.
- LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent
- .extendLocatorId(String.valueOf(rowNum)));
- row.setNumCols(2);
- row.setWidth(10);//pack.
-
- //icon
- StaticTextItem iconItem = newTextItemIcon(ImageManager.getEventSeverityIcon(tuple
- .getLefty()), tuple.getLefty().name());
- //count
- StaticTextItem count = newTextItem(String.valueOf(tuple.righty));
- row.setItems(iconItem, count);
-
- column.addMember(row);
+ @Override
+ protected void onInit() {
+ if (!isInitialized()) {
+ super.onInit();
+
+ // first async call to get global permissions
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ globalPermissions = permissions;
+
+ // now make async call to look for customized dash for this user and entity
+ DashboardCriteria criteria = new DashboardCriteria();
+ criteria.addFilterCategory(DashboardCategory.GROUP);
+ criteria.addFilterGroupId(groupComposite.getResourceGroup().getId());
+ dashboardService.findDashboardsByCriteria(criteria, new AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
}
- //insert see more link
- LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent.extendLocatorId(String
- .valueOf(rowNum)));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Events/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentEventsContent.extendLocatorId("None"),
- RECENT_EVENTS_NONE);
- column.addMember(row);
- }
- //cleanup
- for (Canvas child : recentEventsContent.getChildren()) {
- child.destroy();
- }
- recentEventsContent.addChild(column);
- recentEventsContent.markForRedraw();
- }
- });
- }
- /** Fetches OOB measurements and updates the DynamicForm instance with the latest 5
- * oob change details.
- */
- private void getRecentOobs() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
-
- GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForGroup(groupId, 5,
- new AsyncCallback<PageList<MeasurementOOBComposite>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent out of bound metrics for group [" + groupId + "]:"
- + caught.getMessage());
- }
+ public void onSuccess(final PageList<Dashboard> result) {
+ Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
+ setDashboard(dashboard);
+
+ isInitialized = true;
- @Override
- public void onSuccess(PageList<MeasurementOOBComposite> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- for (MeasurementOOBComposite oob : result) {
- LocatableDynamicForm row = new LocatableDynamicForm(recentOobContent.extendLocatorId(oob
- .getScheduleName()));
- row.setNumCols(2);
-
- String title = oob.getScheduleName() + ":";
- String destination = "/resource/common/monitor/Visibility.do?m=" + oob.getDefinitionId()
- + "&id=" + groupId + "&mode=chartSingleMetricSingleResource";
- LinkItem link = newLinkItem(title, destination);
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(oob.getTimestamp()));
-
- row.setItems(link, time);
- column.addMember(row);
+ // draw() may be done since onInit finishes asynchronously, if so redraw
+ if (isDrawn()) {
+ markForRedraw();
+ }
}
- //insert see more link spinder(2/24/11): no page that displays all oobs... See More not possible.
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentOobContent.extendLocatorId("None"),
- RECENT_OOB_NONE);
- column.addMember(row);
- }
- recentOobContent.setContents("");
- for (Canvas child : recentOobContent.getChildren()) {
- child.destroy();
- }
- recentOobContent.addChild(column);
- recentOobContent.markForRedraw();
+ });
}
});
+ }
}
- /** Fetches recent package history information and updates the DynamicForm instance with details.
- */
- private void getRecentPkgHistory() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- InstalledPackageHistoryCriteria criteria = new InstalledPackageHistoryCriteria();
- PageControl pageControl = new PageControl(0, 5);
- criteria.setPageControl(pageControl);
- criteria.addFilterResourceGroupIds(groupId);
- criteria.addSortStatus(PageOrdering.DESC);
-
- GWTServiceLookup.getContentService().findInstalledPackageHistoryByCriteria(criteria,
-
- new AsyncCallback<PageList<InstalledPackageHistory>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving installed package history for group [" + groupId + "]:"
- + caught.getMessage());
+ private void setDashboard(Dashboard dashboard) {
+ Canvas[] members = getMembers();
+ removeMembers(members);
+
+ dashboardView = new DashboardView(extendLocatorId(dashboard.getName()), this, dashboard);
+ addMember(dashboardView);
+
+ footer = new LocatableToolStrip(extendLocatorId("Footer"));
+ footer.setPadding(5);
+ footer.setWidth100();
+ footer.setMembersMargin(15);
+
+ editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
+ .common_title_edit_mode());
+ editButton.setAutoFit(true);
+ editButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ editMode = !editMode;
+ editButton.setTitle(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
+ dashboardView.setEditMode(editMode);
}
+ });
- @Override
- public void onSuccess(PageList<InstalledPackageHistory> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- for (InstalledPackageHistory history : result) {
- LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
- .extendLocatorId(history.getPackageVersion().getFileName()
- + history.getPackageVersion().getVersion()));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon("subsystems/content/Package_16.png", null);
- String title = history.getPackageVersion().getFileName() + ":";
- String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId
- + "&selectedHistoryId=" + history.getId();
- LinkItem link = newLinkItem(title, destination);
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(history.getTimestamp()));
-
- row.setItems(iconItem, link, time);
- column.addMember(row);
+ resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
+ resetButton.setAutoFit(true);
+ resetButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ String message = MSG.view_summaryDashboard_resetConfirm();
+
+ SC.ask(message, new BooleanCallback() {
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ dashboardView.delete();
+ setDashboard(getDefaultDashboard());
+ markForRedraw();
+ }
}
- // //insert see more link
- // LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
- // .extendLocatorId("PkgHistoryContentSeeMore"));
- // String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId;
- // addSeeMoreLink(row, destination, column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentPkgHistoryContent.extendLocatorId("None"),
- RECENT_PKG_HISTORY_NONE);
- column.addMember(row);
- }
- //cleanup
- for (Canvas child : recentPkgHistoryContent.getChildren()) {
- child.destroy();
- }
- recentPkgHistoryContent.addChild(column);
- recentPkgHistoryContent.markForRedraw();
+ });
}
});
+
+ footer.addMember(editButton);
+ footer.addMember(resetButton);
+
+ addMember(footer);
}
- /** Fetches recent metric information and updates the DynamicForm instance with i)sparkline information,
- * ii) link to recent metric graph for more details and iii) last metric value formatted to show significant
- * digits.
- */
- private void getRecentMetrics() {
+ protected Dashboard getDefaultDashboard() {
+ Subject sessionSubject = UserSessionManager.getSessionSubject();
+ ResourceGroup group = groupComposite.getResourceGroup();
- //display container
- final VLayout column = new VLayout();
- column.setHeight(10);//pack
- final int groupId = this.groupComposite.getResourceGroup().getId();
+ Dashboard dashboard = new Dashboard();
- //retrieve all relevant measurement definition ids.
- Set<MeasurementDefinition> definitions = this.groupComposite.getResourceGroup().getResourceType()
- .getMetricDefinitions();
+ dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + group.getId());
+ dashboard.setCategory(DashboardCategory.GROUP);
+ dashboard.setGroup(group);
+ dashboard.setColumns(2);
- //build id mapping for measurementDefinition instances Ex. Free Memory -> MeasurementDefinition[100071]
- final HashMap<String, MeasurementDefinition> measurementDefMap = new HashMap<String, MeasurementDefinition>();
- for (MeasurementDefinition definition : definitions) {
- measurementDefMap.put(definition.getDisplayName(), definition);
- }
- //bundle definition ids for asynch call.
- int[] definitionArrayIds = new int[definitions.size()];
- final String[] displayOrder = new String[definitions.size()];
- measurementDefMap.keySet().toArray(displayOrder);
- //sort the charting data ex. Free Memory, Free Swap Space,..System Load
- Arrays.sort(displayOrder);
-
- //organize definitionArrayIds for ordered request on server.
- int index = 0;
- for (String definitionToDisplay : displayOrder) {
- definitionArrayIds[index++] = measurementDefMap.get(definitionToDisplay).getId();
- }
+ // TODO, add real portlets
+ // set leftmost column and let the rest be equally divided
+ dashboard.setColumnWidths("40%");
+ dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
- //make the asynchronous call for all the measurement data
- GWTServiceLookup.getMeasurementDataService().findDataForCompatibleGroup(groupId, definitionArrayIds,
- System.currentTimeMillis() - (1000L * 60 * 60 * 8), System.currentTimeMillis(), 60,
- new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent metrics charting data for group [" + groupId + "]:"
- + caught.getMessage());
- }
+ // Left Column
+ DashboardPortlet dummyLeft = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyLeft.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyLeft, 0, 0);
- @Override
- public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> results) {
- if (!results.isEmpty()) {
- boolean someChartedData = false;
- //iterate over the retrieved charting data
- for (int index = 0; index < displayOrder.length; index++) {
- //retrieve the correct measurement definition
- MeasurementDefinition md = measurementDefMap.get(displayOrder[index]);
-
- //load the data results for the given metric definition
- List<MeasurementDataNumericHighLowComposite> data = results.get(index);
-
- //locate last and minimum values.
- double lastValue = -1;
- double minValue = Double.MAX_VALUE;//
- for (MeasurementDataNumericHighLowComposite d : data) {
- if ((!Double.isNaN(d.getValue()))
- && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
- if (d.getValue() < minValue) {
- minValue = d.getValue();
- }
- lastValue = d.getValue();
- }
- }
+ // right Column
+ DashboardPortlet dummyRight = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyRight.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyRight, 1, 0);
- //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
- String commaDelimitedList = "";
+ return dashboard;
+ }
- for (MeasurementDataNumericHighLowComposite d : data) {
- if ((!Double.isNaN(d.getValue()))
- && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
- commaDelimitedList += d.getValue() + ",";
- }
- }
- LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
- .extendLocatorId(md.getName()));
- row.setNumCols(3);
- HTMLFlow graph = new HTMLFlow();
- // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0'>"
- // + commaDelimitedList + "</span>";
- String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0' "
- + "values='" + commaDelimitedList + "'>...</span>";
- graph.setContents(contents);
- graph.setContentsType(ContentsType.PAGE);
- //diable scrollbars on span
- graph.setScrollbarSize(0);
-
- CanvasItem graphContainer = new CanvasItem();
- graphContainer.setShowTitle(false);
- graphContainer.setHeight(16);
- graphContainer.setWidth(60);
- graphContainer.setCanvas(graph);
-
- //Link/title element
- //TODO: spinder, change link whenever portal.war/graphing is removed.
- String title = md.getDisplayName() + ":";
- // String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricSingleResource&id="
- // + resourceId + "&m=" + md.getId();
- String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricMultiResource&groupId="
- + groupId + "&m=" + md.getId();
- LinkItem link = newLinkItem(title, destination);
-
- //Value
- String convertedValue = lastValue + " " + md.getUnits();
- convertedValue = convertLastValueForDisplay(lastValue, md);
- StaticTextItem value = newTextItem(convertedValue);
-
- row.setItems(graphContainer, link, value);
- //if graph content returned
- if ((md.getName().trim().indexOf("Trait.") == -1) && (lastValue != -1)) {
- column.addMember(row);
- someChartedData = true;
- }
- }
- if (!someChartedData) {// when there are results but no chartable entries.
- LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
- .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
- column.addMember(row);
- } else {
- //insert see more link
- LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
- .extendLocatorId("RecentMeasurementsContentSeeMore"));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Monitoring/Graphs/", column);
- }
- //call out to 3rd party javascript lib
- BrowserUtility.graphSparkLines();
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
- .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
- column.addMember(row);
- }
- }
- });
+ @Override
+ public boolean isInitialized() {
+ return isInitialized;
+ }
- //cleanup
- for (Canvas child : recentMeasurementsContent.getChildren()) {
- child.destroy();
- }
- recentMeasurementsContent.addChild(column);
- recentMeasurementsContent.markForRedraw();
+ public Set<Permission> getGlobalPermissions() {
+ return globalPermissions;
}
- /** Fetches recent bundle deployment information and updates the DynamicForm instance with details.
+ /**
+ * name update not supported because the name is derived from the entity id.
+ * @return
*/
- protected void getRecentBundleDeployments() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- GroupBundleDeploymentCriteria criteria = new GroupBundleDeploymentCriteria();
- PageControl pageControl = new PageControl(0, 5);
- criteria.setPageControl(pageControl);
- criteria.addFilterResourceGroupIds(groupId);
- criteria.addSortStatus(PageOrdering.DESC);
- criteria.fetchDestination(true);
- criteria.fetchBundleVersion(true);
-
- GWTServiceLookup.getBundleService().findBundleDeploymentsByCriteria(criteria,
- new AsyncCallback<PageList<BundleDeployment>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving installed bundle deployments for group [" + groupId + "]:"
- + caught.getMessage());
- }
+ public boolean supportsDashboardNameEdit() {
+ return false;
+ }
- @Override
- public void onSuccess(PageList<BundleDeployment> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- for (BundleDeployment deployment : result) {
- LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent
- .extendLocatorId(deployment.getBundleVersion().getName()
- + deployment.getBundleVersion().getVersion()));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
- String title = deployment.getBundleVersion().getName() + "["
- + deployment.getBundleVersion().getVersion() + "]:";
- String destination = ReportDecorator.GWT_BUNDLE_URL
- + deployment.getBundleVersion().getBundle().getId() + "/destinations/"
- + deployment.getDestination().getId();
- LinkItem link = newLinkItem(title, destination);
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter
- .format(deployment.getCtime()));
-
- row.setItems(iconItem, link, time);
- column.addMember(row);
- }
- //insert see more link
- //TODO: spinder:2/25/11 (add this later) no current view for seeing all bundle deployments
- // LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent.extendLocatorId("RecentBundleContentSeeMore"));
- // addSeeMoreLink(row, LinkManager.getResourceGroupLink(groupId) + "/Events/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentBundleDeployContent
- .extendLocatorId("None"), RECENT_BUNDLE_DEPLOY_NONE);
- column.addMember(row);
- }
- //cleanup
- for (Canvas child : recentBundleDeployContent.getChildren()) {
- child.destroy();
- }
- recentBundleDeployContent.addChild(column);
- recentBundleDeployContent.markForRedraw();
- }
- });
+ public void updateDashboardNames() {
+ return;
}
+
}
13 years, 3 months
[rhq] Branch 'cli-alert-notifs' - 3 commits - modules/core modules/enterprise
by lkrejci
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PackageVersionFileUploadServlet.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/CreateNewPackageUIBean.java | 7
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/audit-trail-item-plain.xhtml | 83 ++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/confirm-create-plain.xhtml | 196 ++++++++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/confirm-delete-plain.xhtml | 70 +++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-item-plain.xhtml | 131 ++++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-plain.xhtml | 189 +++++++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-step-details-plain.xhtml | 57 ++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription_packages-plain.xhtml | 114 +++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/update-plain.xhtml | 154 +++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java | 39 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java | 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java | 2
14 files changed, 1032 insertions(+), 33 deletions(-)
New commits:
commit 51f82ef62d7124f40c84d9b95606d3e983517855
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Mar 3 13:15:51 2011 +0100
fixing db-upgrade to successfully add the "is_private" column on rhq_repo.
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 71ca67e..f0d6cc5 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3348,6 +3348,16 @@
<schemaSpec version="2.105">
<schema-addColumn table="RHQ_REPO" column="OWNER_ID" columnType="INTEGER" />
<schema-addColumn table="RHQ_REPO" column="IS_PRIVATE" columnType="BOOLEAN" />
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql" desc="Set is_private flag for existing repos to false">
+ UPDATE RHQ_REPO
+ SET IS_PRIVATE = false
+ </statement>
+ <statement targetDBVendor="oracle" desc="Set is_private flag for existing repos to false">
+ UPDATE RHQ_REPO
+ SET IS_PRIVATE = 0
+ </statement>
+ </schema-directSQL>
<schema-alterColumn table="RHQ_REPO" column="IS_PRIVATE" nullable="FALSE" default="TRUE"/>
<schema-directSQL>
<statement desc="Creating OWNER_ID foreign key relation on RHQ_REPO">
commit c3a40646af0bae0dc917631cb421a824ab4180f7
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Mar 3 13:15:13 2011 +0100
Creating *-plain.xhtml views for rhq/resource/content pages. These are *NOT* finished as they still contain links to "full" views.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/audit-trail-item-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/audit-trail-item-plain.xhtml
new file mode 100644
index 0000000..796f038
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/audit-trail-item-plain.xhtml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main-plain.xhtml">
+
+<ui:param name="pageTitle" value="Audit Trail for Resource '#{ResourceUIBean.name}'"/>
+<ui:param name="selectedTabName" value="Content.History"/>
+
+<ui:define name="content">
+
+<!-- Content Requests Table -->
+
+<h:form id="contentRequestsForm">
+<input type="hidden" name="id" value="${param.id}"/>
+
+<rich:panel>
+ <f:facet name="header"><h:outputText value="Package Details"/></f:facet>
+
+ <table class="revision-data-table" width="100%">
+ <tr class="revision-data-table-even-row">
+ <td><b>Package Name</b></td>
+ <td>
+ <h:outputText value="#{AuditTrailItemUIBean.history.packageVersion.displayName}"
+ rendered="#{!empty AuditTrailItemUIBean.history.packageVersion.displayName}"/>
+ <h:outputText value="#{AuditTrailItemUIBean.history.packageVersion.generalPackage.name}"
+ rendered="#{empty AuditTrailItemUIBean.history.packageVersion.displayName}"/>
+
+ </td>
+ </tr>
+ <tr class="revision-data-table-odd-row">
+ <td><b>Version</b></td>
+ <td>
+ <h:outputText value="#{AuditTrailItemUIBean.history.packageVersion.displayVersion}"
+ rendered="#{!empty AuditTrailItemUIBean.history.packageVersion.displayVersion}"/>
+ <h:outputText value="#{AuditTrailItemUIBean.history.packageVersion.version}"
+ rendered="#{empty AuditTrailItemUIBean.history.packageVersion.displayVersion}"/>
+ </td>
+ </tr>
+ <tr class="revision-data-table-even-row">
+ <td><b>Architecture</b></td>
+ <td>
+ <h:outputText value="#{AuditTrailItemUIBean.history.packageVersion.architecture.name}"/>
+ </td>
+ </tr>
+ <tr class="revision-data-table-odd-row">
+ <td><b>Result</b></td>
+ <td>
+ <h:outputText value="#{AuditTrailItemUIBean.history.status.displayName}"/>
+ </td>
+ </tr>
+ <tr class="revision-data-table-even-row">
+ <td valign="top"><b>Error Message</b></td>
+ <td><pre><h:outputText value="#{AuditTrailItemUIBean.history.errorMessage}" rendered="#{!empty AuditTrailItemUIBean.history.errorMessage}"/></pre></td>
+ </tr>
+ </table>
+</rich:panel>
+
+<p align="center">
+ <h:outputLink value="../content/history.xhtml">
+ <f:param name="id" value="${param.id}"/>
+ <h:outputText value="Return to Package History"/>
+ </h:outputLink>
+</p>
+
+</h:form>
+
+
+</ui:define>
+</ui:composition>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/confirm-create-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/confirm-create-plain.xhtml
new file mode 100644
index 0000000..3ba40b0
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/confirm-create-plain.xhtml
@@ -0,0 +1,196 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main-plain.xhtml">
+
+ <ui:param name="pageTitle" value="Confirm Deploy Package"/>
+ <ui:param name="selectedTabName" value="Content.New"/>
+ <ui:define name="content">
+
+ <h:form>
+
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <ui:remove><!-- Package selected for installation steps and they were returned from the plugin. --></ui:remove>
+ <rich:panel rendered="#{!empty InstallationStepsUIBean.packageVersion and !empty InstallationStepsUIBean.deploySteps}">
+
+ <f:facet name="header"><h:outputText value="Installation Steps"/></f:facet>
+
+ <p><b><h:outputText value="Package: #{InstallationStepsUIBean.packageVersion.generalPackage.name} #{InstallationStepsUIBean.packageVersion.displayVersion}"/></b></p>
+
+ <p>The following steps were provided by the plugin. They describe the steps that will take place during
+ the deployment of this package. Please review the steps before deciding whether or not to continue
+ with the deployment.</p>
+
+ <h:dataTable value="#{InstallationStepsUIBean.deploySteps}"
+ var="item"
+ styleClass="instructions-data-table"
+ headerClass="instructions-data-table-header"
+ columnClasses="instructions-data-table-number-col, instructions-data-table-description-col"
+ rowClasses="instructions-data-table-even-row, instructions-data-table-odd-row"
+ cellpadding="3"
+ cellspacing="0"
+ width="100%">
+
+ <h:column>
+ <f:facet name="header">Step Number</f:facet>
+ <h:outputText value="#{InstallationStepsUIBean.stepsData.rowIndex + 1}"/>
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">Description</f:facet>
+ <h:outputText value="#{item.description}"/>
+ </h:column>
+
+ </h:dataTable>
+
+ </rich:panel>
+
+ <ui:remove><!-- Package selected but no installation steps were returned. --></ui:remove>
+ <rich:panel rendered="#{!empty InstallationStepsUIBean.packageVersion and empty InstallationStepsUIBean.deploySteps}">
+
+ <f:facet name="header"><h:outputText value="Installation Steps"/></f:facet>
+
+ <p><b><h:outputText value="Package: #{InstallationStepsUIBean.packageVersion.generalPackage.name} #{InstallationStepsUIBean.packageVersion.displayVersion}"/></b></p>
+
+ <p>No installation steps were provided by the plugin for this package.</p>
+ </rich:panel>
+
+ <ui:remove><!-- Table of packages that are to be deployed in this request. --></ui:remove>
+ <rich:panel>
+ <f:facet name="header"><h:outputText value="Review Packages"/></f:facet>
+ <p>The following packages will be deployed. For each package, the plugin may be able to generate a
+ list of what steps will be performed in the deployment. Click the 'view' button on the desired package
+ to request the instructions from the agent. Note that this will make a live call to the agent
+ and thus may take some time.</p>
+
+ <ui:param name="packagesToDeployDataModel" value="#{DeployPackagesUIBean.dataModel}"/>
+ <rich:dataTable id="packagesToDeployDataTable"
+ rows="#{PageControl.PackagesToDeployList.pageSize}"
+ value="#{packagesToDeployDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="20%, 15%, 15%, 10%, 32%, 8%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="PackagesToDeployList" />
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.generalPackage.name">
+ <h:outputText styleClass="headerText" value="Package Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.displayVersion">
+ <h:outputText styleClass="headerText" value="Version" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.displayVersion}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.generalPackage.packageType.displayName">
+ <h:outputText styleClass="headerText" value="Type" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageTypeName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.architecture">
+ <h:outputText styleClass="headerText" value="Architecture" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.architectureName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description" />
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.shortDescription}" escape="false"/>
+ </rich:column>
+
+ <rich:column style="text-align: center;">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Instructions"/>
+ </f:facet>
+
+ <h:commandLink style="margin-top: 10px;" value="VIEW"
+ action="#{InstallationStepsUIBean.loadSteps}">
+ <f:param name="selectedPackageId" value="#{item.packageVersion.id}"/>
+ </h:commandLink>
+
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
+ <ui:include src="/rhq/resource/include/pagination.xhtml">
+ <ui:param name="paginationDataTableName" value="packagesToDeployDataTable"/>
+ <ui:param name="paginationDataModel" value="#{packagesToDeployDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.PackagesToDeployList}"/>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </rich:panel>
+
+ <rich:panel>
+ <f:facet name="header"><h:outputText value="Packages Deployment Notes"/></f:facet>
+ <p>Notes specified below will be displayed when tracking the status of this request in order to help
+ further identify the purpose of this request. They are not sent to the plugin for use during the
+ installation. </p>
+
+ <h:inputTextarea value="#{DeployPackagesUIBean.notes}" rows="5" cols="80"/>
+
+ </rich:panel>
+
+ <rich:panel>
+ <h:panelGrid id="buttonGrid" columns="2" styleClass="buttons-table" columnClasses="button-cell">
+ <h:commandButton style="margin-top: 10px;" value="CANCEL"
+ action="cancel" styleClass="buttonmed"/>
+
+ <h:commandButton style="margin-top: 10px;" value="CONTINUE"
+ action="#{DeployPackagesUIBean.deployPackages}" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.content}"/>
+ </h:panelGrid>
+ </rich:panel>
+
+ </h:form>
+
+ </ui:define>
+</ui:composition>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/confirm-delete-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/confirm-delete-plain.xhtml
new file mode 100644
index 0000000..7f410a1
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/confirm-delete-plain.xhtml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main-plain.xhtml">
+
+ <ui:param name="pageTitle" value="Confirm Delete Package"/>
+ <ui:param name="selectedTabName" value="Content.Deployed"/>
+ <ui:define name="content">
+
+ <h:form>
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <rich:panel>
+
+ <f:facet name="header"><h:outputText value="Packages to be Deleted"/></f:facet>
+
+ <p>The following packages will be deleted on the resource.</p>
+
+ <ul>
+ <c:forEach items="#{DeletePackagesUIBean.packagesToDelete}" var="installedPackage">
+ <li>
+ <h:outputText value="${installedPackage.packageVersion.displayName} " rendered="${!empty installedPackage.packageVersion.displayName}"/>
+ <h:outputText value="${installedPackage.packageVersion.generalPackage.name} " rendered="${empty installedPackage.packageVersion.displayName}"/>
+
+ <h:outputText value="${installedPackage.packageVersion.displayVersion}" rendered="${!empty installedPackage.packageVersion.displayVersion}"/>
+ <h:outputText value="${installedPackage.packageVersion.version}" rendered="${empty installedPackage.packageVersion.displayVersion}"/>
+ </li>
+ </c:forEach>
+ </ul>
+
+ </rich:panel>
+
+ <rich:panel>
+ <f:facet name="header"><h:outputText value="Packages Delete Notes"/></f:facet>
+ <p>Notes specified below will be displayed when tracking the status of this request in order to help
+ further identify the purpose of this request. They are not sent to the plugin for use during the
+ the delete attempt. </p>
+
+ <h:inputTextarea value="#{DeletePackagesUIBean.notes}" rows="5" cols="80"/>
+
+ </rich:panel>
+
+ <rich:panel>
+ <h:panelGrid id="buttonGrid" columns="2" styleClass="buttons-table" columnClasses="button-cell">
+ <h:commandButton style="margin-top: 10px;" value="CANCEL"
+ action="cancel" styleClass="buttonmed"/>
+
+ <h:commandButton style="margin-top: 10px;" value="CONTINUE"
+ action="#{DeletePackagesUIBean.deleteSelectedInstalledPackages}" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.content}"/>
+ </h:panelGrid>
+ </rich:panel>
+
+ </h:form>
+
+ </ui:define>
+</ui:composition>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-item-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-item-plain.xhtml
new file mode 100644
index 0000000..de42127
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-item-plain.xhtml
@@ -0,0 +1,131 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main-plain.xhtml">
+
+<ui:param name="pageTitle" value="View Content for Resource '#{ResourceUIBean.name}'"/>
+<ui:param name="selectedTabName" value="Content.History"/>
+
+<ui:define name="content">
+
+<!-- Content Requests Table -->
+
+<h:form id="contentRequestsForm">
+<input type="hidden" name="id" value="${param.id}"/>
+
+<rich:panel>
+ <f:facet name="header"><h:outputText value="Package Details"/></f:facet>
+
+ <ui:remove><!-- Ultimately, this page should display the deployment time configuration values specified by
+ the user. --></ui:remove>
+
+ <table class="revision-data-table" width="100%">
+ <tr class="revision-data-table-even-row">
+ <td><b>Package Name</b></td>
+ <td>
+ <h:outputText value="#{ShowInstalledPackageHistoryUIBean.history.packageVersion.displayName}"
+ rendered="#{!empty ShowInstalledPackageHistoryUIBean.history.packageVersion.displayName}"/>
+ <h:outputText value="#{ShowInstalledPackageHistoryUIBean.history.packageVersion.generalPackage.name}"
+ rendered="#{empty ShowInstalledPackageHistoryUIBean.history.packageVersion.displayName}"/>
+
+ </td>
+ </tr>
+ <tr class="revision-data-table-odd-row">
+ <td><b>Version</b></td>
+ <td>
+ <h:outputText value="#{ShowInstalledPackageHistoryUIBean.history.packageVersion.displayVersion}"
+ rendered="#{!empty ShowInstalledPackageHistoryUIBean.history.packageVersion.displayVersion}"/>
+ <h:outputText value="#{ShowInstalledPackageHistoryUIBean.history.packageVersion.version}"
+ rendered="#{empty ShowInstalledPackageHistoryUIBean.history.packageVersion.displayVersion}"/>
+ </td>
+ </tr>
+ <tr class="revision-data-table-even-row">
+ <td><b>Architecture</b></td>
+ <td>
+ <h:outputText value="#{ShowInstalledPackageHistoryUIBean.history.packageVersion.architecture.name}"/>
+ </td>
+ </tr>
+ <tr class="revision-data-table-odd-row">
+ <td><b>Result</b></td>
+ <td>
+ <h:outputText value="#{ShowInstalledPackageHistoryUIBean.history.status.displayName}"/>
+ </td>
+ </tr>
+ <tr class="revision-data-table-even-row">
+ <td valign="top"><b>Error Message</b></td>
+ <td><pre><h:outputText value="#{ShowInstalledPackageHistoryUIBean.history.errorMessage}" rendered="#{!empty ShowInstalledPackageHistoryUIBean.history.errorMessage}"/></pre></td>
+ </tr>
+ </table>
+</rich:panel>
+
+<rich:panel rendered="#{!empty ShowInstalledPackageHistoryUIBean.installationSteps}">
+ <f:facet name="header"><h:outputText value="Installation Step Details"/></f:facet>
+
+ <h:dataTable value="#{ShowInstalledPackageHistoryUIBean.installationSteps}"
+ var="item"
+ styleClass="instructions-data-table"
+ headerClass="instructions-data-table-header"
+ columnClasses="instructions-data-table-number-col, instructions-data-table-description-col"
+ rowClasses="instructions-data-table-even-row, instructions-data-table-odd-row"
+ cellpadding="3"
+ cellspacing="0"
+ width="100%">
+
+ <h:column>
+ <f:facet name="header">Step Number</f:facet>
+ <h:outputText value="#{ShowInstalledPackageHistoryUIBean.stepsData.rowIndex + 1}"/>
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">Description</f:facet>
+ <h:outputText value="#{item.description}"/>
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">Errors</f:facet>
+
+ <h:commandLink action="stepDetails" value="View" rendered="#{!empty item.errorMessage}">
+ <f:param name="id" value="${param.id}"/>
+ <f:param name="stepId" value="#{item.id}"/>
+ <f:param name="selectedRequestId" value="${param.selectedRequestId}"/>
+ <f:param name="selectedHistoryId" value="${param.selectedHistoryId}"/>
+ </h:commandLink>
+
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">Result</f:facet>
+ <h:outputText value="#{item.result}"/>
+ </h:column>
+
+ </h:dataTable>
+
+</rich:panel>
+
+<p align="center">
+ <h:commandLink action="returnToRequest" value="Return to Request Details">
+ <f:param name="id" value="${param.id}"/>
+ <f:param name="selectedRequestId" value="${param.selectedRequestId}"/>
+ <f:param name="selectedHistoryId" value="${param.selectedHistoryId}"/>
+ </h:commandLink>
+</p>
+
+</h:form>
+
+
+</ui:define>
+</ui:composition>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-plain.xhtml
new file mode 100644
index 0000000..1419931
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-plain.xhtml
@@ -0,0 +1,189 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main-plain.xhtml">
+
+<ui:param name="pageTitle" value="View Content for Resource '#{ResourceUIBean.name}'"/>
+<ui:param name="selectedTabName" value="Content.History"/>
+
+<ui:define name="metaHeaders">
+ <meta http-equiv="refresh" content="10"/>
+</ui:define>
+
+<ui:define name="content">
+
+<!-- Content Requests Table -->
+
+<h:form id="contentRequestsForm">
+<input type="hidden" name="id" value="${param.id}"/>
+
+<rich:panel>
+ <f:facet name="header"><h:outputText value="Request Details"/></f:facet>
+ <ui:param name="csr" value="#{ShowContentServiceRequestUIBean.contentServiceRequest}"/>
+
+ <table class="revision-data-table" width="100%">
+
+ <tr class="revision-data-table-even-row">
+ <td valign="top"><b>Status</b></td>
+ <td><h:outputText value="#{csr.status}"/></td>
+ </tr>
+
+ <tr class="revision-data-table-odd-row">
+ <td valign="top"><b>Request Type</b></td>
+ <td><h:outputText value="#{csr.contentRequestType}"/></td>
+ </tr>
+
+ <tr class="revision-data-table-even-row">
+ <td valign="top"><b>Timestamp</b></td>
+ <td><h:outputText value="#{csr.createdDate}"/></td>
+ </tr>
+
+ <tr class="revision-data-table-odd-row">
+ <td valign="top"><b>User</b></td>
+ <td><h:outputText value="#{csr.subjectName}"/></td>
+ </tr>
+
+ <tr class="revision-data-table-even-row">
+ <td valign="top"><b>Notes</b></td>
+ <td><h:outputText value="#{csr.notes}"/></td>
+ </tr>
+
+ <tr class="revision-data-table-odd-row">
+ <td valign="top"><b>Error</b></td>
+ <td><pre><h:outputText value="#{csr.errorMessage}"/></pre></td>
+ </tr>
+
+ </table>
+
+</rich:panel>
+
+<rich:panel>
+ <f:facet name="header"><h:outputText value="Package Audit Trail"/></f:facet>
+
+ <p>The following is a complete listing of all of the package operations that took place during this request.
+ By default, they are ordered from newest to oldest. In other words, for packages that are referenced more than
+ one time in this list, the most recent item indicates the current status of the package.</p>
+
+ <ui:param name="packageHistoryDataModel" value="#{ShowContentServiceRequestUIBean.dataModel}"/>
+ <rich:dataTable id="packageHistoryDataTable"
+ rows="#{PageControl.InstalledPackageHistoryList.pageSize}"
+ value="#{packageHistoryDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="20%, 20%, 20%, 10%, 20%, 10%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="PackagesToDeployList" />
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.packageVersion.displayName">
+ <h:outputText styleClass="headerText" value="Package Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.displayName}" rendered="#{!empty item.packageVersion.displayName}"/>
+ <h:outputText value="#{item.packageVersion.generalPackage.name}" rendered="#{empty item.packageVersion.displayName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.packageVersion.displayVersion">
+ <h:outputText styleClass="headerText" value="Version" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.displayVersion}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.packageVersion.architecture">
+ <h:outputText styleClass="headerText" value="Architecture" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.architecture.name}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.status.displayName">
+ <h:outputText styleClass="headerText" value="Status" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.status.displayName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.timestamp">
+ <h:outputText styleClass="headerText" value="Timestamp" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.timestamp}">
+ <f:converter converterId="UserDateTimeConverter" />
+ </h:outputText>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Details" />
+ </f:facet>
+
+ <h:commandLink style="margin-top: 10px;" value="VIEW"
+ action="showHistoryItem">
+ <f:param name="selectedRequestId" value="#{ShowContentServiceRequestUIBean.selectedRequestId}"/>
+ <f:param name="selectedHistoryId" value="#{item.id}"/>
+ </h:commandLink>
+
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
+ <ui:include src="/rhq/resource/include/pagination.xhtml">
+ <ui:param name="paginationDataTableName" value="packageHistoryDataTable"/>
+ <ui:param name="paginationDataModel" value="#{packageHistoryDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.InstalledPackageHistoryList}"/>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+</rich:panel>
+
+<p align="center">
+ <h:commandLink action="returnToAllRequests" value="Return to Request List">
+ <f:param name="id" value="${param.id}"/>
+ <f:param name="selectedRequestId" value="${param.selectedRequestId}"/>
+ </h:commandLink>
+</p>
+
+</h:form>
+
+</ui:define>
+</ui:composition>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-step-details-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-step-details-plain.xhtml
new file mode 100644
index 0000000..c7631e2
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-request-step-details-plain.xhtml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main-plain.xhtml">
+
+<ui:param name="pageTitle" value="View Content for Resource '#{ResourceUIBean.name}'"/>
+<ui:param name="selectedTabName" value="Content.History"/>
+
+<ui:define name="content">
+
+<!-- Content Requests Table -->
+
+<h:form id="contentRequestsForm">
+<input type="hidden" name="id" value="${param.id}"/>
+
+<rich:panel>
+ <f:facet name="header"><h:outputText value="Step Error"/></f:facet>
+
+ <p>
+ <b>Step Description:</b><br/>
+ <h:outputText value="#{ShowInstalledPackageHistoryUIBean.step.description}"/>
+ </p>
+
+ <b>Error Message:</b><br/>
+ <pre>
+ <h:outputText value="#{ShowInstalledPackageHistoryUIBean.step.errorMessage}"/>
+ </pre>
+
+ <p align="center">
+ <h:commandLink action="returnToHistory" value="Return to History Entry">
+ <f:param name="id" value="${param.id}"/>
+ <f:param name="selectedRequestId" value="${param.selectedRequestId}"/>
+ <f:param name="selectedHistoryId" value="${param.selectedHistoryId}"/>
+ </h:commandLink>
+ </p>
+
+</rich:panel>
+
+</h:form>
+
+
+</ui:define>
+</ui:composition>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription_packages-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription_packages-plain.xhtml
new file mode 100644
index 0000000..6bb83b6
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription_packages-plain.xhtml
@@ -0,0 +1,114 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main-plain.xhtml">
+
+ <ui:param name="pageTitle" value="View Repo Subscriptions for Resource '#{ResourceUIBean.name}'"/>
+ <ui:param name="selectedTabName" value="Content.Subscriptions"/>
+
+ <ui:define name="content">
+
+ <!-- CURRENT REPOS -->
+ <h:form id="currentPackageVersionsForm">
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <rich:panel styleClass="BlockContent">
+ <f:facet name="header"><h:outputText value="Currently Subscribed Resource Packages"/></f:facet>
+
+ <ui:param name="resourcePackageVersionsDataModel" value="#{ResourcePackageVersionsUIBean.dataModel}"/>
+ <rich:dataTable id="resourcePackageVersionsDataTable"
+ rows="#{PageControl.ResourcePackageVersionsList.pageSize}"
+ value="#{resourcePackageVersionsDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="17%, 11%, 9%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="ResourcePackageVersionsList" />
+ </f:facet>
+
+ <rich:column rendered="#{param.debug}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.id">
+ <h:outputText styleClass="headerText" value="ID" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.id}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.fileName">
+ <h:outputText styleClass="headerText" value="File Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.fileName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.displayVersion">
+ <h:outputText styleClass="headerText" value="Version" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.displayVersion}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.generalPackage.packageType.name">
+ <h:outputText styleClass="headerText" value="Type" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageTypeName}"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="#{param.debug ? 4 : 3}" width="100%">
+
+ <ui:include src="/rhq/resource/include/pagination.xhtml">
+ <ui:param name="paginationDataTableName" value="resourcePackageVersionsDataTable"/>
+ <ui:param name="paginationDataModel" value="#{resourcePackageVersionsDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.ResourcePackageVersionsList}"/>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </rich:panel>
+ </h:form>
+
+ <p align="center">
+ <h:outputLink value="/rhq/resource/content/subscription.xhtml">
+ <f:param name="id" value="${param.id}"/>
+ <h:outputText value="Switch To Repo Mode" />
+ </h:outputLink>
+ </p>
+
+ </ui:define>
+</ui:composition>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/update-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/update-plain.xhtml
new file mode 100644
index 0000000..ab99878
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/update-plain.xhtml
@@ -0,0 +1,154 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main-plain.xhtml">
+
+ <ui:param name="pageTitle" value="Update Existing Package"/>
+ <ui:param name="selectedTabName" value="Content.Update"/>
+ <ui:define name="content">
+
+ <h:form id="currentPackageVersionsForm">
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <rich:panel styleClass="BlockContent">
+ <f:facet name="header"><h:outputText value="Packages Eligible for Update"/></f:facet>
+
+ <p>The following packages were found from the repositories currently subscribed to by this resource. In order
+ to enable more existing packages for deployment, use the subscriptions sub-tab to subscribe this resource
+ to more repositories.</p>
+
+ <a4j:keepAlive beanName="ResourceUpdatePackageVersionsUIBean"/>
+
+ <ui:param name="resourceUpdatePackageVersionsDataModel" value="#{ResourceUpdatePackageVersionsUIBean.dataModel}"/>
+ <rich:dataTable id="resourceUpdatePackageVersionsDataTable"
+ rows="#{PageControl.ResourceUpdatePackageVersionsList.pageSize}"
+ value="#{resourceUpdatePackageVersionsDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="1%, 15%, 10%, 10%, 10%, 54%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="ResourceUpdatePackageVersionsList" />
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:allSelect target="selectedPackages" />
+ </f:facet>
+
+ <onc:select name="selectedPackages" value="#{item.packageVersion.id}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.generalPackage.name">
+ <h:outputText styleClass="headerText" value="Package Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputLink value="../../content/packageVersion.xhtml">
+ <f:param name="id" value="#{item.packageVersion.id}"/>
+ <h:outputText value="#{item.packageName}"/>
+ </h:outputLink>
+
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.displayVersion">
+ <h:outputText styleClass="headerText" value="Version" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.displayVersion}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.generalPackage.packageType.displayName">
+ <h:outputText styleClass="headerText" value="Type" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageTypeName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.architecture">
+ <h:outputText styleClass="headerText" value="Architecture" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.architectureName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description" />
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.shortDescription}" escape="false"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
+ <onc:selectCommandButton action="#{CreateNewPackageUIBean.deployExisting}"
+ value="DEPLOY SELECTED" target="selectedPackages" styleClass="on-pager-button buttonsmall"
+ rendered="${ResourceUIBean.permissions.content}"/>
+
+ <ui:include src="/rhq/resource/include/pagination.xhtml">
+ <ui:param name="paginationDataTableName" value="resourceUpdatePackageVersionsDataTable"/>
+ <ui:param name="paginationDataModel" value="#{resourceUpdatePackageVersionsDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.ResourceUpdatePackageVersionsList}"/>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+
+ </rich:panel>
+
+ <rich:panel styleClass="BlockContent"
+ rendered="${ResourceUIBean.permissions.content}">
+ <f:facet name="header"><h:outputText value="Upload New Package"/></f:facet>
+
+ <p>The following option will begin the workflow to upload a new package into the system. Once
+ the package information has been specified and the file uploaded, the workflow to deploy the newly
+ created package to this resource will resume.</p>
+
+ <h:panelGrid columns="1" styleClass="buttons-table" columnClasses="button-cell">
+ <h:commandButton action="uploadNew"
+ value="UPLOAD NEW PACKAGE" styleClass="buttonmed"/>
+ </h:panelGrid>
+
+ <br/>
+ </rich:panel>
+
+
+ </h:form>
+
+
+ </ui:define>
+</ui:composition>
+
+</html>
commit 03a95ebff5116019ccece5604550ced776a1ce2e
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Mar 3 13:14:12 2011 +0100
Fixing the ContentManagerLocal.getUploadedPackageVersion() and thus enabling the content upload from the resource content tab again.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PackageVersionFileUploadServlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PackageVersionFileUploadServlet.java
index 02d69a4..9aed016 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PackageVersionFileUploadServlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PackageVersionFileUploadServlet.java
@@ -85,7 +85,7 @@ public class PackageVersionFileUploadServlet extends FileUploadServlet {
metaData.put(ContentManagerLocal.UPLOAD_FILE_INSTALL_DATE, Long.toString(file.lastModified()));
metaData.put(ContentManagerLocal.UPLOAD_FILE_NAME, packageName);
PackageVersion packageVersion = contentManager.getUploadedPackageVersion(subject, packageName,
- packageTypeId, version, architectureId, fileStream, metaData, null, repoId);
+ packageTypeId, version, architectureId, fileStream, metaData, repoId);
successMsg = "success [packageVersionId=" + packageVersion.getId() + ",packageId=" + packageVersion.getGeneralPackage().getId() + "]";
} catch (Exception e) {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/CreateNewPackageUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/CreateNewPackageUIBean.java
index 7c1cf1d..17ada7a 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/CreateNewPackageUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/CreateNewPackageUIBean.java
@@ -240,15 +240,12 @@ public class CreateNewPackageUIBean {
packageUploadDetails.put(ContentManagerLocal.UPLOAD_SHA256, new MessageDigestGenerator(
MessageDigestGenerator.SHA_256).calcDigestString(fileItem.getFile()));
} catch (IOException e1) {
- log.warn("Error calculating file digest(s) : " + e1.getMessage());
- e1.printStackTrace();
+ log.warn("Error calculating file digest(s)", e1);
}
- //TODO: need to get parent id instead right? ref to app server inst itself?
- Integer newResourceTypeId = resource == null ? null : resource.getResourceType().getId();
Integer iRepoId = usingARepo ? Integer.parseInt(repoId) : null;
packageVersion = contentManager.getUploadedPackageVersion(subject, packageName, packageTypeId,
- version, architectureId, packageStream, packageUploadDetails, newResourceTypeId, iRepoId);
+ version, architectureId, packageStream, packageUploadDetails, iRepoId);
} catch (NoResultException nre) {
//eat the exception. Some of the queries return no results if no package yet exists which is fine.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index 2713ff4..9915959 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -1617,10 +1617,9 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
@SuppressWarnings("unchecked")
public PackageVersion getUploadedPackageVersion(Subject subject, String packageName, int packageTypeId,
String version, int architectureId, InputStream packageBitStream,
- Map<String, String> packageUploadDetails, Integer newResourceTypeId, Integer repoId) {
+ Map<String, String> packageUploadDetails, Integer repoId) {
PackageVersion packageVersion = null;
- PackageType packageType = null;
//default version to 1.0 if is null, not provided for any reason.
if ((version == null) || (version.trim().length() == 0)) {
@@ -1628,31 +1627,33 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
}
Architecture architecture = entityManager.find(Architecture.class, architectureId);
+ PackageType packageType = entityManager.find(PackageType.class, packageTypeId);
// See if package version already exists for the resource package
- if (newResourceTypeId != null) {
- Query packageVersionQuery = null;
+ Query packageVersionQuery = null;
+ if (packageType.getResourceType() != null) {
packageVersionQuery = entityManager.createNamedQuery(PackageVersion.QUERY_FIND_BY_PACKAGE_DETAILS_KEY_WITH_NON_NULL_RESOURCE_TYPE);
- packageVersionQuery.setParameter("resourceTypeId", newResourceTypeId);
-
- packageVersionQuery.setFlushMode(FlushModeType.COMMIT);
- packageVersionQuery.setParameter("packageName", packageName);
+ packageVersionQuery.setParameter("resourceTypeId", packageType.getResourceType().getId());
- packageType = contentManager.getResourceCreationPackageType(newResourceTypeId);
- packageVersionQuery.setParameter("packageTypeName", packageType.getName());
+ } else {
+ packageVersionQuery = entityManager.createNamedQuery(PackageVersion.QUERY_FIND_BY_PACKAGE_DETAILS_KEY);
+ packageVersionQuery.setParameter("resourceType", null);
+ }
- packageVersionQuery.setParameter("architectureName", architecture.getName());
- packageVersionQuery.setParameter("version", version);
+ packageVersionQuery.setFlushMode(FlushModeType.COMMIT);
+ packageVersionQuery.setParameter("packageName", packageName);
+
+ packageVersionQuery.setParameter("packageTypeName", packageType.getName());
- // Result of the query should be either 0 or 1
- List<PackageVersion> existingPackageVersionList = packageVersionQuery.getResultList();
+ packageVersionQuery.setParameter("architectureName", architecture.getName());
+ packageVersionQuery.setParameter("version", version);
- if (existingPackageVersionList.size() > 0) {
- packageVersion = existingPackageVersionList.get(0);
- }
- } else {
- packageType = entityManager.find(PackageType.class, packageTypeId);
+ // Result of the query should be either 0 or 1
+ List<PackageVersion> existingPackageVersionList = packageVersionQuery.getResultList();
+
+ if (existingPackageVersionList.size() > 0) {
+ packageVersion = existingPackageVersionList.get(0);
}
try {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java
index b4644d0..4295e3a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java
@@ -241,9 +241,9 @@ public interface ContentManagerLocal {
int architectureId, InputStream packageBitStream);
/**
- * This method is similar to the {@link #createPackageVersion(Subject, String, int, String, int, InputStream)} but fails if
- * the package version with the provided details already exists which is a desired behaviour for the GUI originating
- * requests.
+ * This method is essentially the same as {@link #createPackageVersion(Subject, String, int, String, int, InputStream)}
+ * but will update the package bits if a package version with the provided identification already exists.
+ *
* @param subject the current user
* @param packageName the name of the package (the general package will be created if none exists)
* @param packageTypeId the id of the package type. This is ignored if the <code>newResourceTypeId</code> is not null
@@ -251,14 +251,11 @@ public interface ContentManagerLocal {
* @param architectureId the architecture of the package version
* @param packageBitStream the input stream with the package bits
* @param packageUploadDetails additional details about the package. See the constants defined in this interface
- * @param newResourceTypeId the resource type id the package version should be bound to. This is to support the usecase
- * where a package version is being created as the backing content of a resource.
* @param repoId an optional id of the repo to insert the package version in
- *
* @return the newly create package version
*/
PackageVersion getUploadedPackageVersion(Subject subject, String packageName, int packageTypeId, String version,
- int architectureId, InputStream packageBitStream, Map<String, String> packageUploadDetails, Integer newResourceTypeId, Integer repoId);
+ int architectureId, InputStream packageBitStream, Map<String, String> packageUploadDetails, Integer repoId);
/**
* Very simple method that persists the given package version within its own transaction.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
index 8d5fad4..cad1e08 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
@@ -467,7 +467,7 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
newPackageType.getId(), packageVersionNumber, architectureId, packageBitStream);
} else {
packageVersion = contentManager.getUploadedPackageVersion(user, packageName,
- newPackageType.getId(), packageVersionNumber, architectureId, packageBitStream, packageUploadDetails, newResourceTypeId, null);
+ newPackageType.getId(), packageVersionNumber, architectureId, packageBitStream, packageUploadDetails, null);
}
return doCreatePackageBackedResource(user, parentResource, newResourceType, newResourceName,
13 years, 3 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 276 ++++------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/PropertyMapListGridRecord.java | 67 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java | 10
4 files changed, 204 insertions(+), 155 deletions(-)
New commits:
commit d470c4facb824dfc13f032a71e8e2ed2a76ffb2c
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 2 17:40:00 2011 -0500
fix list of maps editing in config editor; fix several other minor config editor bugs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index f2a2580..993f303 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -35,7 +35,6 @@ import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.Autofit;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.MultipleAppearance;
import com.smartgwt.client.types.Overflow;
@@ -81,8 +80,6 @@ import com.smartgwt.client.widgets.form.validator.Validator;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.CellSavedEvent;
-import com.smartgwt.client.widgets.grid.events.CellSavedHandler;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -123,12 +120,15 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* A SmartGWT widget for editing an RHQ {@link Configuration} that conforms to a {@link ConfigurationDefinition}.
@@ -143,8 +143,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
//
public class ConfigurationEditor extends LocatableVLayout {
- private static final String RHQ_PROPERTY_ATTRIBUTE_NAME = "rhq:property";
-
private ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
private LocatableToolStrip toolStrip;
@@ -153,7 +151,7 @@ public class ConfigurationEditor extends LocatableVLayout {
private Configuration configuration;
private Configuration originalConfiguration;
- private ValuesManager valuesManager = new ValuesManager();
+ private ValuesManager topLevelPropertiesValuesManager = new ValuesManager();
private Label loadingLabel = new Label("<b>" + MSG.common_msg_loading() + "</b>");
@@ -246,11 +244,11 @@ public class ConfigurationEditor extends LocatableVLayout {
}
public boolean validate() {
- return this.valuesManager.validate();
+ return this.topLevelPropertiesValuesManager.validate();
}
public boolean isValid() {
- return this.valuesManager.hasErrors();
+ return this.topLevelPropertiesValuesManager.hasErrors();
}
public void addPropertyValueChangeListener(PropertyValueChangeListener propertyValueChangeListener) {
@@ -487,7 +485,7 @@ public class ConfigurationEditor extends LocatableVLayout {
((group == null) ? configurationDefinition.getNonGroupedProperties() : configurationDefinition
.getPropertiesInGroup(group.getName())));
- DynamicForm form = buildPropertiesForm(locatorId + "_Props", propertyDefinitions, configuration);
+ DynamicForm form = buildPropertiesForm(locatorId, propertyDefinitions, configuration);
section.addItem(form);
return section;
@@ -497,8 +495,10 @@ public class ConfigurationEditor extends LocatableVLayout {
AbstractPropertyMap propertyMap) {
LocatableDynamicForm form = new LocatableDynamicForm(locatorId);
- form.setValuesManager(valuesManager);
- form.setValidateOnExit(true);
+ if (propertyMap instanceof Configuration) {
+ this.topLevelPropertiesValuesManager.addMember(form);
+ }
+ form.setValidateOnExit(true); // TODO: Remove this?
form.setHiliteRequiredFields(true);
form.setNumCols(4);
form.setCellPadding(5);
@@ -528,6 +528,7 @@ public class ConfigurationEditor extends LocatableVLayout {
property, odd, fields);
odd = !odd;
}
+ return;
}
public void addItemsForPropertyRecursively(String locatorId, PropertyDefinition propertyDefinition,
@@ -606,7 +607,7 @@ public class ConfigurationEditor extends LocatableVLayout {
// Note: This field spans 3 columns.
PropertyDefinitionMap memberDefinitionMap = (PropertyDefinitionMap) memberDefinition;
CanvasItem listOfMapsItem = buildListOfMapsField(locatorId, memberDefinitionMap, propertyDefinitionList,
- propertyList, oddRow);
+ propertyList);
fields.add(listOfMapsItem);
} else if (memberDefinition instanceof PropertyDefinitionSimple) {
SpacerItem unsetItem = new SpacerItem();
@@ -865,66 +866,36 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private CanvasItem buildListOfMapsField(final String locatorId,
- final PropertyDefinitionMap memberPropertyDefinitionMap, PropertyDefinitionList propertyDefinitionList,
- final PropertyList propertyList, boolean oddRow) {
- Log.debug("Building list-of-maps field for " + propertyList + "...");
+ final PropertyDefinitionMap memberPropertyDefinitionMap, final PropertyDefinitionList propertyDefinitionList,
+ final PropertyList propertyList) {
+ Log.debug("Building list-of-maps grid for " + propertyList + "...");
- final ListGrid summaryTable = new ListGrid();
- // summaryTable.setID("config_summaryTable_" + propertyDefinition.getName());
+ final LocatableListGrid summaryTable = new LocatableListGrid(locatorId);
summaryTable.setAlternateRecordStyles(true);
summaryTable.setShowAllRecords(true);
summaryTable.setBodyOverflow(Overflow.VISIBLE);
summaryTable.setOverflow(Overflow.VISIBLE);
- summaryTable.setAutoFitData(Autofit.HORIZONTAL);
-
- summaryTable.addCellSavedHandler(new CellSavedHandler() {
- public void onCellSaved(CellSavedEvent cellSavedEvent) {
- Record record = cellSavedEvent.getRecord();
- PropertyMap propertyMap = (PropertyMap) record.getAttributeAsObject(RHQ_PROPERTY_ATTRIBUTE_NAME);
- for (String memberPropertyName : memberPropertyDefinitionMap.getPropertyDefinitions().keySet()) {
- PropertySimple memberProperty = propertyMap.getSimple(memberPropertyName);
- if (memberProperty == null) {
- memberProperty = new PropertySimple(memberPropertyName, null);
- propertyMap.put(memberProperty);
- }
- String newValue = record.getAttribute(memberPropertyName);
- memberProperty.setStringValue(newValue);
- }
- }
- });
+ summaryTable.setWidth100();
List<ListGridField> fieldsList = new ArrayList<ListGridField>();
- List<PropertyDefinition> propertyDefinitions = new ArrayList<PropertyDefinition>(memberPropertyDefinitionMap
+ final List<PropertyDefinition> propertyDefinitions = new ArrayList<PropertyDefinition>(memberPropertyDefinitionMap
.getPropertyDefinitions().values());
Collections.sort(propertyDefinitions, new PropertyDefinitionComparator());
+ List<PropertyDefinition> summaryPropertyDefinitions = new ArrayList<PropertyDefinition>();
for (PropertyDefinition subDef : propertyDefinitions) {
if (subDef.isSummary()) {
- ListGridField field = new ListGridField(subDef.getName(), subDef.getDisplayName(), 90);
-
- PropertyDefinitionSimple defSimple = (PropertyDefinitionSimple) subDef;
- if (defSimple.getType() == PropertySimpleType.INTEGER) {
- field.setType(ListGridFieldType.INTEGER);
- } else if (defSimple.getType() == PropertySimpleType.FLOAT) {
- field.setType(ListGridFieldType.FLOAT);
- }
-
- fieldsList.add(field);
+ summaryPropertyDefinitions.add(subDef);
}
}
-
- if (fieldsList.isEmpty()) {
+ if (summaryPropertyDefinitions.isEmpty()) {
// An extra "feature of the config system". If no fields are labeled summary, all are considered summary.
- for (PropertyDefinition subDef : propertyDefinitions) {
- ListGridField field = new ListGridField(subDef.getName(), subDef.getDisplayName());
- fieldsList.add(field);
- PropertyDefinitionSimple defSimple = (PropertyDefinitionSimple) subDef;
- if (defSimple.getType() == PropertySimpleType.INTEGER) {
- field.setType(ListGridFieldType.FLOAT);
- } else if (defSimple.getType() == PropertySimpleType.FLOAT) {
- field.setType(ListGridFieldType.FLOAT);
- }
- }
+ summaryPropertyDefinitions.addAll(propertyDefinitions);
+ }
+
+ for (PropertyDefinition summaryPropDef : summaryPropertyDefinitions) {
+ ListGridField field = createListGridField(summaryPropDef);
+ fieldsList.add(field);
}
boolean allSubDefsReadOnly = isAllReadOnly(propertyDefinitions);
@@ -940,11 +911,11 @@ public class ConfigurationEditor extends LocatableVLayout {
editField.setCanHide(false);
editField.addRecordClickHandler(new RecordClickHandler() {
public void onRecordClick(RecordClickEvent recordClickEvent) {
- Log.debug("Editing property map: " + recordClickEvent.getRecord());
- PropertyMap memberPropertyMap = (PropertyMap) recordClickEvent.getRecord().getAttributeAsObject(
- RHQ_PROPERTY_ATTRIBUTE_NAME);
- displayMapEditor(extendLocatorId("MapEdit"), summaryTable, recordClickEvent.getRecord(),
- memberPropertyDefinitionMap, propertyList, memberPropertyMap, mapReadOnly);
+ PropertyMapListGridRecord record = (PropertyMapListGridRecord) recordClickEvent.getRecord();
+ PropertyMap memberPropertyMap = (PropertyMap) record.getPropertyMap();
+ Log.debug("Editing property map: " + memberPropertyMap);
+ displayMapEditor(summaryTable, record, memberPropertyDefinitionMap, propertyList, memberPropertyMap,
+ mapReadOnly);
}
});
fieldsList.add(editField);
@@ -965,9 +936,13 @@ public class ConfigurationEditor extends LocatableVLayout {
public void onRecordClick(final RecordClickEvent recordClickEvent) {
Log.info("You want to delete: " + recordClickEvent.getRecordNum());
SC.confirm(MSG.view_configEdit_confirm_2(), new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- if (aBoolean) {
- summaryTable.removeData(recordClickEvent.getRecord());
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ PropertyMapListGridRecord recordToBeDeleted = (PropertyMapListGridRecord) recordClickEvent.getRecord();
+ propertyList.getList().remove(recordToBeDeleted.getIndex());
+ ListGridRecord[] rows = buildSummaryRecords(propertyList, propertyDefinitions);
+ summaryTable.setData(rows);
+ firePropertyChangedEvent(propertyList, propertyDefinitionList, true);
}
}
});
@@ -993,7 +968,7 @@ public class ConfigurationEditor extends LocatableVLayout {
addRowButton.setIcon(Window.getImgURL("[SKIN]/actions/add.png"));
addRowButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- displayMapEditor(extendLocatorId("MapEdit"), summaryTable, null, memberPropertyDefinitionMap,
+ displayMapEditor(summaryTable, null, memberPropertyDefinitionMap,
propertyList, null, mapReadOnly);
}
});
@@ -1009,6 +984,27 @@ public class ConfigurationEditor extends LocatableVLayout {
return canvasItem;
}
+ private ListGridField createListGridField(PropertyDefinition summaryPropDef) {
+ ListGridField field = new ListGridField(summaryPropDef.getName(), summaryPropDef.getDisplayName(), 90);
+ PropertyDefinitionSimple defSimple = (PropertyDefinitionSimple) summaryPropDef;
+ PropertySimpleType propSimpleType = defSimple.getType();
+ switch (propSimpleType) {
+ case BOOLEAN:
+ field.setType(ListGridFieldType.BOOLEAN);
+ break;
+ case INTEGER:
+ field.setType(ListGridFieldType.INTEGER);
+ break;
+ case FLOAT:
+ case DOUBLE:
+ field.setType(ListGridFieldType.FLOAT);
+ break;
+ default:
+ field.setType(ListGridFieldType.TEXT);
+ }
+ return field;
+ }
+
private static boolean isAllReadOnly(List<PropertyDefinition> propertyDefinitions) {
boolean allPropsDefsReadOnly = true;
for (PropertyDefinition subDef : propertyDefinitions) {
@@ -1020,51 +1016,16 @@ public class ConfigurationEditor extends LocatableVLayout {
return allPropsDefsReadOnly;
}
- private ListGridRecord[] buildSummaryRecords(PropertyList propertyList, List<PropertyDefinition> definitions) {
- ListGridRecord[] rows = new ListGridRecord[propertyList == null ? 0 : propertyList.getList().size()];
- int i = 0;
- for (Property row : propertyList.getList()) {
+ private PropertyMapListGridRecord[] buildSummaryRecords(PropertyList propertyList, List<PropertyDefinition> definitions) {
+ PropertyMapListGridRecord[] records = new PropertyMapListGridRecord[propertyList == null ? 0 : propertyList.getList().size()];
+ List<Property> list = propertyList.getList();
+ for (int index = 0, listSize = list.size(); index < listSize; index++) {
+ Property row = list.get(index);
PropertyMap rowMap = (PropertyMap) row;
- ListGridRecord record = buildSummaryRecord(definitions, rowMap);
- rows[i++] = record;
+ PropertyMapListGridRecord record = new PropertyMapListGridRecord(rowMap, index, definitions);
+ records[index] = record;
}
- return rows;
- }
-
- private ListGridRecord buildSummaryRecord(List<PropertyDefinition> memberPropertyDefinitions,
- PropertyMap memberPropertyMap) {
- ListGridRecord record = new ListGridRecord();
- for (PropertyDefinition subDef : memberPropertyDefinitions) {
- PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
- PropertySimple propertySimple = ((PropertySimple) memberPropertyMap.get(subDefSimple.getName()));
-
- if (propertySimple.getStringValue() != null) {
- record.setAttribute(subDefSimple.getName(), propertySimple.getStringValue());
- /*
- switch (((PropertyDefinitionSimple) subDef).getType()) {
- case BOOLEAN:
- record.setAttribute(subDefSimple.getName(), propertySimple.getBooleanValue());
- break;
- case INTEGER:
- record.setAttribute(subDefSimple.getName(), propertySimple.getLongValue());
- break;
- case LONG:
- record.setAttribute(subDefSimple.getName(), propertySimple.getLongValue());
- break;
- case FLOAT:
- record.setAttribute(subDefSimple.getName(), propertySimple.getDoubleValue());
- break;
- case DOUBLE:
- record.setAttribute(subDefSimple.getName(), propertySimple.getDoubleValue());
- break;
- default:
- record.setAttribute(subDefSimple.getName(), propertySimple.getStringValue());
- break;
- }*/
- }
- }
- record.setAttribute(RHQ_PROPERTY_ATTRIBUTE_NAME, memberPropertyMap);
- return record;
+ return records;
}
private CanvasItem buildListOfSimplesField(String locatorId, final PropertyDefinitionList propertyDefinitionList,
@@ -1330,23 +1291,23 @@ public class ConfigurationEditor extends LocatableVLayout {
valueItem.setWidth(220);
- // Only update the underlying property when the input is changed if it's a top-level simple or a simple within a
- // top-level map.
- if (updatePropertyValueOnChange(propertyDefinitionSimple, propertySimple)) {
- valueItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent changedEvent) {
- updatePropertySimpleValue(changedEvent.getValue(), propertySimple, propertyDefinitionSimple);
+ valueItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent changedEvent) {
+ updatePropertySimpleValue(changedEvent.getValue(), propertySimple, propertyDefinitionSimple);
+ // Only fire a prop value change event if the prop's a top-level simple or a simple within a
+ // top-level map.
+ if (fireEventOnPropertyValueChange(propertyDefinitionSimple, propertySimple)) {
boolean isValid = changedEvent.getItem().validate();
firePropertyChangedEvent(propertySimple, propertyDefinitionSimple, isValid);
}
- });
- }
+ }
+ });
return valueItem;
}
- protected boolean updatePropertyValueOnChange(PropertyDefinitionSimple propertyDefinitionSimple,
- PropertySimple propertySimple) {
+ protected boolean fireEventOnPropertyValueChange(PropertyDefinitionSimple propertyDefinitionSimple,
+ PropertySimple propertySimple) {
PropertyDefinitionMap parentPropertyMapDefinition = propertyDefinitionSimple.getParentPropertyMapDefinition();
return propertyDefinitionSimple.getConfigurationDefinition() != null
|| (parentPropertyMapDefinition != null && parentPropertyMapDefinition.getConfigurationDefinition() != null);
@@ -1398,6 +1359,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
valueItem.redraw();
propertySimple.setValue(valueItem.getValue());
+ firePropertyChangedEvent(propertySimple, propertyDefinitionSimple, true);
}
});
@@ -1503,24 +1465,18 @@ public class ConfigurationEditor extends LocatableVLayout {
return validators;
}
- private void displayMapEditor(String locatorId, final ListGrid summaryTable, final Record existingRecord,
- PropertyDefinitionMap definition, final PropertyList list, final PropertyMap map, boolean mapReadOnly) {
+ private void displayMapEditor(final ListGrid summaryTable, final PropertyMapListGridRecord existingRecord,
+ PropertyDefinitionMap definition, final PropertyList list, final PropertyMap map,
+ boolean mapReadOnly) {
final List<PropertyDefinition> memberDefinitions = new ArrayList<PropertyDefinition>(definition
.getPropertyDefinitions().values());
Collections.sort(memberDefinitions, new PropertyDefinitionComparator());
final boolean newRow = (map == null);
- final PropertyMap workingMap = newRow ? new PropertyMap(definition.getName()) : map.deepCopy(true);
-
- LocatableVLayout layout = new LocatableVLayout(locatorId);
- layout.setHeight100();
-
- final DynamicForm childForm = buildPropertiesForm(extendLocatorId("Editor"), memberDefinitions, workingMap);
- childForm.setHeight100();
- layout.addMember(childForm);
+ final PropertyMap workingMap = (newRow) ? new PropertyMap(definition.getName()) : map.deepCopy(true);
- final Window popup = new Window();
+ final LocatableWindow popup = new LocatableWindow(extendLocatorId("MapEditor"));
popup.setTitle(MSG.view_configEdit_editRow());
popup.setWidth(800);
popup.setHeight(600);
@@ -1529,39 +1485,46 @@ public class ConfigurationEditor extends LocatableVLayout {
popup.setShowCloseButton(false);
popup.centerInPage();
- final IButton okButton = new LocatableIButton(extendLocatorId("OK"), MSG.common_button_ok());
+ final LocatableVLayout layout = new LocatableVLayout(popup.extendLocatorId("Layout"));
+ layout.setHeight100();
+
+ final DynamicForm childForm = buildPropertiesForm(layout.extendLocatorId("Form"), memberDefinitions, workingMap);
+ childForm.setHeight100();
+ layout.addMember(childForm);
+
+ LocatableHLayout buttonBar = new LocatableHLayout(layout.extendLocatorId("ButtonBar"));
+ buttonBar.setAlign(Alignment.CENTER);
+ buttonBar.setMembersMargin(10);
+
+ final IButton okButton = new LocatableIButton(buttonBar.extendLocatorId("OK"), MSG.common_button_ok());
if (!mapReadOnly) {
okButton.disable();
}
okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
if (newRow) {
- list.add(workingMap);
- ListGridRecord record = buildSummaryRecord(memberDefinitions, workingMap);
try {
+ list.add(workingMap);
+ int index = list.getList().size();
+ PropertyMapListGridRecord record = new PropertyMapListGridRecord(workingMap, index,
+ memberDefinitions);
summaryTable.addData(record);
} catch (Exception e) {
e.printStackTrace();
}
} else {
- // TODO: Pass in the map's index, rather than using indexOf(), which is not 100% reliable,
- // since a list could contain two or more identical maps.
- //list.getList().set(list.getList().indexOf(map), workingMap);
- for (PropertyDefinition subDef : memberDefinitions) {
- PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
- PropertySimple propertySimple = ((PropertySimple) workingMap.get(subDefSimple.getName()));
- existingRecord.setAttribute(subDefSimple.getName(), propertySimple != null ? propertySimple
- .getStringValue() : null);
+ try {
+ mergePropertyMap(workingMap, map, memberDefinitions);
+ existingRecord.refresh();
+ summaryTable.updateData(existingRecord);
+ } catch (Exception e) {
+ e.printStackTrace();
}
- summaryTable.updateData(existingRecord);
}
firePropertyChangedEvent(list, null, true);
summaryTable.redraw();
- // ListGridRecord[] rows = buildSummaryRecords(list, definitions);
- // summaryTable.setData(rows);
- // summaryTable.redraw();
- // summaryTable.addData();
+ layout.destroy();
popup.destroy();
}
});
@@ -1573,24 +1536,33 @@ public class ConfigurationEditor extends LocatableVLayout {
}
});
- final IButton cancelButton = new LocatableIButton(extendLocatorId("Cancel"), MSG.common_button_cancel());
+ final IButton cancelButton = new LocatableIButton(buttonBar.extendLocatorId("Cancel"), MSG.common_button_cancel());
cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
+ layout.destroy();
popup.destroy();
}
});
- HLayout buttons = new HLayout();
- buttons.setAlign(Alignment.CENTER);
- buttons.setMembersMargin(10);
- buttons.setMembers(okButton, cancelButton);
- layout.addMember(buttons);
+ buttonBar.setMembers(okButton, cancelButton);
+ layout.addMember(buttonBar);
popup.addItem(layout);
popup.show();
}
+ private void mergePropertyMap(PropertyMap sourceMap, PropertyMap targetMap,
+ List<PropertyDefinition> memberDefinitions) {
+ for (PropertyDefinition subDef : memberDefinitions) {
+ PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
+ PropertySimple propertySimple = ((PropertySimple) sourceMap.get(subDefSimple.getName()));
+ String newValue = (propertySimple != null) ? propertySimple.getStringValue() : null;
+ PropertySimple existingProp = targetMap.getSimple(subDefSimple.getName());
+ existingProp.setStringValue(newValue);
+ }
+ }
+
protected static void setValue(FormItem item, Object value) {
if (value instanceof String) {
item.setValue((String) value);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index 1f266b8..80d6269 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -456,10 +456,10 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
@Override
- protected boolean updatePropertyValueOnChange(PropertyDefinitionSimple propertyDefinitionSimple,
- PropertySimple propertySimple) {
+ protected boolean fireEventOnPropertyValueChange(PropertyDefinitionSimple propertyDefinitionSimple,
+ PropertySimple propertySimple) {
return isAggregateProperty(propertySimple)
- && super.updatePropertyValueOnChange(propertyDefinitionSimple, propertySimple);
+ && super.fireEventOnPropertyValueChange(propertyDefinitionSimple, propertySimple);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/PropertyMapListGridRecord.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/PropertyMapListGridRecord.java
new file mode 100644
index 0000000..9c24a57
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/PropertyMapListGridRecord.java
@@ -0,0 +1,67 @@
+package org.rhq.enterprise.gui.coregui.client.components.configuration;
+
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.configuration.AbstractPropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+
+import java.util.List;
+
+/**
+ *
+ */
+public class PropertyMapListGridRecord extends ListGridRecord {
+
+ private AbstractPropertyMap propertyMap;
+ private int index;
+ private List<PropertyDefinition> memberPropertyDefinitions;
+
+ public PropertyMapListGridRecord(AbstractPropertyMap propertyMap, int index,
+ List<PropertyDefinition> memberPropertyDefinitions) {
+ this.propertyMap = propertyMap;
+ this.index = index;
+ this.memberPropertyDefinitions = memberPropertyDefinitions;
+
+ refresh();
+ }
+
+ public AbstractPropertyMap getPropertyMap() {
+ return propertyMap;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void refresh() {
+ for (PropertyDefinition subDef : memberPropertyDefinitions) {
+ PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
+ String propertyName = subDefSimple.getName();
+ PropertySimple propertySimple = propertyMap.getSimple(propertyName);
+
+ if ((propertySimple != null) && (propertySimple.getStringValue() != null)) {
+ switch (((PropertyDefinitionSimple) subDef).getType()) {
+ case BOOLEAN:
+ setAttribute(propertyName, propertySimple.getBooleanValue());
+ break;
+ case INTEGER:
+ setAttribute(propertyName, propertySimple.getIntegerValue());
+ break;
+ case FLOAT:
+ setAttribute(propertyName, propertySimple.getFloatValue());
+ break;
+ case DOUBLE:
+ setAttribute(propertyName, propertySimple.getDoubleValue());
+ break;
+ default:
+ setAttribute(propertyName, propertySimple.getStringValue());
+ break;
+ }
+ } else {
+ setAttribute(propertyName, (String) null);
+ }
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java
index 56f34bd..417a604 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableWindow.java
@@ -35,4 +35,14 @@ public class LocatableWindow extends Window implements Locatable {
return this.locatorId + "_" + extension;
}
+/* public void destroyMembers() {
+ SeleniumUtility.destroyMembers(this);
+ }
+
+ @Override
+ public void destroy() {
+ destroyMembers();
+ super.destroy();
+ }*/
+
}
13 years, 3 months
[rhq] modules/core modules/enterprise
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 36 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/Activity2View.java | 203 ++++++++++
3 files changed, 228 insertions(+), 15 deletions(-)
New commits:
commit e9502f4e0efb638d65018d2b2789fd7f437baa6e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 2 10:05:23 2011 -0500
Add Activity2 (Dashboard style) subtab for Summary Tab in
ResourceDetailView. This just has dummy portlets at the moment.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
index 4c061fb..2f5d41e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
@@ -154,11 +154,11 @@ public class Dashboard implements Serializable {
this.category = category;
}
- protected Resource getResource() {
+ public Resource getResource() {
return resource;
}
- protected void setResource(Resource resource) {
+ public void setResource(Resource resource) {
this.resource = resource;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 576f102..aec77ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -67,6 +67,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitorin
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.history.ResourceOperationHistoryListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.schedule.ResourceOperationScheduleListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.Activity2View;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ActivityView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -113,6 +114,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
private TwoLevelTab contentTab;
private SubTab summaryActivity;
+ private SubTab summaryActivity2;
private SubTab summaryTimeline;
private SubTab monitorGraphs;
private SubTab monitorTables;
@@ -150,9 +152,12 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
.view_tabs_common_summary()), ImageManager.getResourceIcon(ResourceCategory.SERVICE, Boolean.TRUE));
summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"), new ViewName("Activity", MSG
.view_tabs_common_activity()), null);
+ summaryActivity2 = new SubTab(summaryTab.extendLocatorId("Activity2"), new ViewName("Activity2", MSG
+ .view_tabs_common_activity()
+ + "2"), null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), new ViewName("Timeline", MSG
.view_tabs_common_timeline()), null);
- summaryTab.registerSubTabs(summaryActivity, summaryTimeline);
+ summaryTab.registerSubTabs(summaryActivity, summaryActivity2, summaryTimeline);
tabs.add(summaryTab);
inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new ViewName("Inventory", MSG
@@ -208,21 +213,19 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
tabs.add(eventsTab);
operationsTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.OPERATIONS), new ViewName(Tab.OPERATIONS, MSG
.view_tabs_common_operations()), "/images/icons/Operation_grey_16.png");
- this.operationsSchedules = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.SCHEDULES),
- new ViewName(OperationsSubTab.SCHEDULES, MSG.view_tabs_common_schedules()), null);
- this.operationsHistory = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.HISTORY),
- new ViewName(OperationsSubTab.HISTORY, MSG.view_tabs_common_history()), null);
+ this.operationsSchedules = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.SCHEDULES), new ViewName(
+ OperationsSubTab.SCHEDULES, MSG.view_tabs_common_schedules()), null);
+ this.operationsHistory = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.HISTORY), new ViewName(
+ OperationsSubTab.HISTORY, MSG.view_tabs_common_history()), null);
operationsTab.registerSubTabs(this.operationsSchedules, this.operationsHistory);
tabs.add(operationsTab);
- configurationTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.CONFIGURATION), new ViewName(Tab.CONFIGURATION,
- MSG.view_tabs_common_configuration()), "/images/icons/Configure_grey_16.png");
- this.configCurrent = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.CURRENT),
- new ViewName(ConfigurationSubTab.CURRENT, MSG
- .view_tabs_common_current()), null);
- this.configHistory = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.HISTORY),
- new ViewName(ConfigurationSubTab.HISTORY, MSG
- .view_tabs_common_history()), null);
+ configurationTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.CONFIGURATION), new ViewName(
+ Tab.CONFIGURATION, MSG.view_tabs_common_configuration()), "/images/icons/Configure_grey_16.png");
+ this.configCurrent = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.CURRENT), new ViewName(
+ ConfigurationSubTab.CURRENT, MSG.view_tabs_common_current()), null);
+ this.configHistory = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.HISTORY), new ViewName(
+ ConfigurationSubTab.HISTORY, MSG.view_tabs_common_history()), null);
configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
tabs.add(configurationTab);
@@ -281,6 +284,13 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
}
});
+ updateSubTab(this.summaryTab, this.summaryActivity2, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new Activity2View(summaryActivity2.extendLocatorId("View"), resourceComposite);
+ }
+ });
+
updateSubTab(this.summaryTab, this.summaryTimeline, true, true, new ViewFactory() {
@Override
public Canvas createView() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/Activity2View.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/Activity2View.java
new file mode 100644
index 0000000..8c03071
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/Activity2View.java
@@ -0,0 +1,203 @@
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
+
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.InitializableView;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardContainer;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
+import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * The content pane for the resource Summary>Dashboard subtab.
+ *
+ * @author Jay Shaughnessy
+ */
+
+public class Activity2View extends LocatableVLayout implements DashboardContainer, InitializableView {
+
+ private static final String DASHBOARD_NAME_PREFIX = "ResourceDashboard_";
+
+ private ResourceComposite resourceComposite;
+
+ private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
+
+ private DashboardView dashboardView;
+
+ private LocatableToolStrip footer;
+ private IButton editButton;
+ private IButton resetButton;
+
+ // Capture the user's global permissions for use by any dashboard or portlet that may need it for rendering.
+ private Set<Permission> globalPermissions;
+
+ private boolean editMode = false;
+
+ private boolean isInitialized = false;
+
+ public Activity2View(String locatorId, ResourceComposite resourceComposite) {
+ super(locatorId);
+ this.resourceComposite = resourceComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ if (!isInitialized()) {
+ super.onInit();
+
+ // first async call to get global permissions
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ globalPermissions = permissions;
+
+ // now make async call to look for customized dash for this user and entity
+ DashboardCriteria criteria = new DashboardCriteria();
+ criteria.addFilterCategory(DashboardCategory.RESOURCE);
+ criteria.addFilterResourceId(resourceComposite.getResource().getId());
+ dashboardService.findDashboardsByCriteria(criteria, new AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
+ }
+
+ public void onSuccess(final PageList<Dashboard> result) {
+ Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
+ setDashboard(dashboard);
+
+ isInitialized = true;
+
+ // draw() may be done since onInit finishes asynchronously, if so redraw
+ if (isDrawn()) {
+ markForRedraw();
+ }
+ }
+ });
+ }
+ });
+ }
+ }
+
+ private void setDashboard(Dashboard dashboard) {
+ Canvas[] members = getMembers();
+ removeMembers(members);
+
+ dashboardView = new DashboardView(extendLocatorId(dashboard.getName()), this, dashboard);
+ addMember(dashboardView);
+
+ footer = new LocatableToolStrip(extendLocatorId("Footer"));
+ footer.setPadding(5);
+ footer.setWidth100();
+ footer.setMembersMargin(15);
+
+ editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
+ .common_title_edit_mode());
+ editButton.setAutoFit(true);
+ editButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ editMode = !editMode;
+ editButton.setTitle(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
+ dashboardView.setEditMode(editMode);
+ }
+ });
+
+ resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
+ resetButton.setAutoFit(true);
+ resetButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ String message = MSG.view_summaryDashboard_resetConfirm();
+
+ SC.ask(message, new BooleanCallback() {
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ dashboardView.delete();
+ setDashboard(getDefaultDashboard());
+ markForRedraw();
+ }
+ }
+ });
+ }
+ });
+
+ footer.addMember(editButton);
+ footer.addMember(resetButton);
+
+ addMember(footer);
+ }
+
+ protected Dashboard getDefaultDashboard() {
+ Subject sessionSubject = UserSessionManager.getSessionSubject();
+ Resource resource = resourceComposite.getResource();
+
+ Dashboard dashboard = new Dashboard();
+
+ dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + resource.getId());
+ dashboard.setCategory(DashboardCategory.RESOURCE);
+ dashboard.setResource(resource);
+ dashboard.setColumns(2);
+
+ // TODO, add real portlets
+ // set leftmost column and let the rest be equally divided
+ dashboard.setColumnWidths("40%");
+ dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
+
+ // Left Column
+ DashboardPortlet dummyLeft = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyLeft.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyLeft, 0, 0);
+
+ // right Column
+ DashboardPortlet dummyRight = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyRight.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyRight, 1, 0);
+
+ return dashboard;
+ }
+
+ @Override
+ public boolean isInitialized() {
+ return isInitialized;
+ }
+
+ public Set<Permission> getGlobalPermissions() {
+ return globalPermissions;
+ }
+
+ /**
+ * name update not supported because the name is derived from the entity id.
+ * @return
+ */
+ public boolean supportsDashboardNameEdit() {
+ return false;
+ }
+
+ public void updateDashboardNames() {
+ return;
+ }
+
+}
13 years, 3 months
[rhq] modules/enterprise
by Simeon Pinder
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java | 787 ++++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java | 787 +---------
2 files changed, 787 insertions(+), 787 deletions(-)
New commits:
commit 7294c38922ff2284479d9baa9b87c7a272624cb8
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Mar 1 17:54:22 2011 -0500
swapping 'Dashboard' Group ActivityView content with Group ActivityView2 content.
Default Summary>Activity will be the older static Activity/Dashboard.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index 38b4194..27dfc22 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -18,204 +18,695 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.Set;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
+import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.criteria.DashboardCriteria;
-import org.rhq.core.domain.dashboard.Dashboard;
-import org.rhq.core.domain.dashboard.DashboardCategory;
-import org.rhq.core.domain.dashboard.DashboardPortlet;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.form.fields.LinkItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
+import org.rhq.core.domain.content.InstalledPackageHistory;
+import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.criteria.GroupBundleDeploymentCriteria;
+import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
+import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
+import org.rhq.core.domain.event.EventSeverity;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
+import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
+import org.rhq.core.domain.operation.GroupOperationHistory;
+import org.rhq.core.domain.resource.ResourceTypeFacet;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.InitializableView;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
-import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardContainer;
-import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
-import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
+import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
+import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
+import org.rhq.enterprise.gui.coregui.client.util.GwtTuple;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
- * The content pane for the group Summary>Dashboard subtab.
+ * The content pane for the group Summary>Activity subtab.
*
- * @author Jay Shaughnessy
+ * @author Simeon Pinder
*/
-
-public class ActivityView extends LocatableVLayout implements DashboardContainer, InitializableView {
-
- private static final String DASHBOARD_NAME_PREFIX = "GroupDashboard_";
+public class ActivityView extends AbstractActivityView {
private ResourceGroupComposite groupComposite;
- private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
+ public ActivityView(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId, groupComposite, null);
+ this.groupComposite = groupComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ loadData();
+ }
- private DashboardView dashboardView;
+ /**Initiates data request.
+ */
+ protected void loadData() {
+ ResourceGroup group = null;
+ GroupCategory groupCategory = null;
+ Set<ResourceTypeFacet> facets = null;
+ if ((groupComposite != null) && (groupComposite.getResourceGroup() != null)) {
+ group = groupComposite.getResourceGroup();
+ groupCategory = groupComposite.getResourceGroup().getGroupCategory();
+ //Load Facets to conditionally display relevant tabs
+ facets = groupComposite.getResourceFacets().getFacets();
+
+ getRecentAlerts();
+ //events
+ if (displayGroupEvents(groupCategory, facets)) {
+ getRecentEventUpdates();
+ }
+ //operations
+ if (displayGroupOperations(groupCategory, facets)) {
+ getRecentOperations();
+ }
+ //Config updates
+ if (displayGroupConfigurationUpdates(groupCategory, facets)) {
+ getRecentConfigurationUpdates();
+ }
+ //recentMetrics,oobs,pkghistory
+ if (groupCategory == GroupCategory.COMPATIBLE) {
+ getRecentOobs();
+ getRecentPkgHistory();
+ getRecentMetrics();
+ }
- private LocatableToolStrip footer;
- private IButton editButton;
- private IButton resetButton;
+ //conditionally display Bundle deployments for groups of platforms only
+ displayBundleDeploymentsForPlatformGroups(group);
+ }
+ }
- // Capture the user's global permissions for use by any dashboard or portlet that may need it for rendering.
- private Set<Permission> globalPermissions;
+ /** Fetches alerts and updates the DynamicForm instance with the latest
+ * alert information.
+ */
+ private void getRecentAlerts() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ Integer[] filterGroupAlertDefinitionIds;
+ Set<AlertDefinition> alertDefinitions = this.groupComposite.getResourceGroup().getAlertDefinitions();
+ filterGroupAlertDefinitionIds = new Integer[alertDefinitions.size()];
+ int i = 0;
+ for (AlertDefinition def : alertDefinitions) {
+ filterGroupAlertDefinitionIds[i++] = def.getId();
+ }
+ //fetches last five alerts for this resource
+ AlertCriteria criteria = new AlertCriteria();
+ PageControl pageControl = new PageControl(0, 5);
+ pageControl.initDefaultOrderingField("ctime", PageOrdering.DESC);
+ criteria.setPageControl(pageControl);
+ criteria.addFilterGroupAlertDefinitionIds(filterGroupAlertDefinitionIds);
+ GWTServiceLookup.getAlertService().findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
+ @Override
+ public void onSuccess(PageList<Alert> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ int rowNum = 0;
+ for (Alert alert : result) {
+ // alert history records do not have a usable locatorId, we'll use rownum, which is unique and
+ // may be repeatable.
+ LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
+ .valueOf(rowNum++)));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon(ImageManager.getAlertIcon(alert.getAlertDefinition()
+ .getPriority()), alert.getAlertDefinition().getPriority().getDisplayName());
+ LinkItem link = newLinkItem(alert.getAlertDefinition().getName() + ": ",
+ ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/" + alert.getId());
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(alert.getCtime()));
+ row.setItems(iconItem, link, time);
+
+ column.addMember(row);
+ }
+ //link to more details
+ LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
+ .valueOf(rowNum++)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentAlertsContent.extendLocatorId("None"),
+ RECENT_ALERTS_NONE);
+ column.addMember(row);
+ }
+ for (Canvas child : recentAlertsContent.getChildren()) {
+ child.destroy();
+ }
+ recentAlertsContent.addChild(column);
+ recentAlertsContent.markForRedraw();
+ }
- private boolean editMode = false;
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent alerts for group [" + groupId + "]:" + caught.getMessage());
+ }
+ });
+ }
- private boolean isInitialized = false;
+ /** Fetches operations and updates the DynamicForm instance with the latest
+ * operation information.
+ */
+ private void getRecentOperations() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ //fetches five most recent operations.
+ PageControl pageControl = new PageControl(0, 5);
+
+ GroupOperationHistoryCriteria criteria = new GroupOperationHistoryCriteria();
+ List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
+ filterResourceGroupIds.add(groupId);
+ criteria.addFilterResourceGroupIds(filterResourceGroupIds);
+ criteria.setPageControl(pageControl);
+ criteria.addSortStatus(PageOrdering.DESC);
+
+ GWTServiceLookup.getOperationService().findGroupOperationHistoriesByCriteriaDisambiguated(criteria,
+ new AsyncCallback<List<DisambiguationReport<GroupOperationHistory>>>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent operations for group [" + groupId + "]:" + caught.getMessage());
+ }
- public ActivityView(String locatorId, ResourceGroupComposite groupComposite) {
- super(locatorId);
- this.groupComposite = groupComposite;
+ @Override
+ public void onSuccess(List<DisambiguationReport<GroupOperationHistory>> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ int rowNum = 0;
+ for (DisambiguationReport<GroupOperationHistory> report : result) {
+ // operation history records do not have a usable locatorId, we'll use rownum, which is unique and
+ // may be repeatable.
+ LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon(ImageManager.getOperationResultsIcon(report
+ .getOriginal().getStatus()), report.getOriginal().getStatus().getDisplayName());
+ LinkItem link = newLinkItem(report.getOriginal().getOperationDefinition().getDisplayName()
+ + ": ", ReportDecorator.GWT_GROUP_URL + groupId + "/Operations/History/"
+ + report.getOriginal().getId());
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(report.getOriginal()
+ .getStartedTime()));
+ row.setItems(iconItem, link, time);
+
+ column.addMember(row);
+ }
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Operations/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentOperationsContent
+ .extendLocatorId("None"), RECENT_OPERATIONS_NONE);
+ column.addMember(row);
+ }
+ for (Canvas child : recentOperationsContent.getChildren()) {
+ child.destroy();
+ }
+ recentOperationsContent.addChild(column);
+ recentOperationsContent.markForRedraw();
+ }
+ });
}
- @Override
- protected void onInit() {
- if (!isInitialized()) {
- super.onInit();
-
- // first async call to get global permissions
- new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
-
- public void onPermissionsLoaded(Set<Permission> permissions) {
- globalPermissions = permissions;
-
- // now make async call to look for customized dash for this user and entity
- DashboardCriteria criteria = new DashboardCriteria();
- criteria.addFilterCategory(DashboardCategory.GROUP);
- criteria.addFilterGroupId(groupComposite.getResourceGroup().getId());
- dashboardService.findDashboardsByCriteria(criteria, new AsyncCallback<PageList<Dashboard>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
+ /** Fetches configuration updates and updates the DynamicForm instance with the latest
+ * config change information.
+ */
+ private void getRecentConfigurationUpdates() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+
+ PageControl lastFive = new PageControl(0, 5);
+ GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();
+ criteria.setPageControl(lastFive);
+ criteria.addSortStatus(PageOrdering.DESC);
+ List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
+ filterResourceGroupIds.add(groupId);
+ criteria.addFilterResourceGroupIds(filterResourceGroupIds);
+
+ GWTServiceLookup.getConfigurationService().findGroupResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<GroupResourceConfigurationUpdate>>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent configuration updates for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
+
+ @Override
+ public void onSuccess(PageList<GroupResourceConfigurationUpdate> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ int rowNum = 0;
+ for (GroupResourceConfigurationUpdate update : result) {
+ // config update history records do not have a usable locatorId, we'll use rownum, which is unique and
+ // may be repeatable.
+ LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon(ImageManager.getResourceConfigurationIcon(update
+ .getStatus()), null);
+ String linkTitle = MSG.view_resource_inventory_activity_changed_by() + " "
+ + update.getSubjectName() + ":";
+ if ((update.getSubjectName() == null) || (update.getSubjectName().trim().isEmpty())) {
+ linkTitle = MSG.common_msg_changeAutoDetected();
+ }
+ LinkItem link = newLinkItem(linkTitle, ReportDecorator.GWT_GROUP_URL + groupId
+ + "/Configuration/History/" + update.getId());
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(update
+ .getCreatedTime()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
}
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Configuration/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentConfigurationContent
+ .extendLocatorId("None"), RECENT_CONFIGURATIONS_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentConfigurationContent.getChildren()) {
+ child.destroy();
+ }
+ recentConfigurationContent.addChild(column);
+ recentConfigurationContent.markForRedraw();
- public void onSuccess(final PageList<Dashboard> result) {
- Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
- setDashboard(dashboard);
+ }
+ });
+ }
- isInitialized = true;
+ /** Fetches recent events and updates the DynamicForm instance with the latest
+ * event information over last 24hrs.
+ */
+ private void getRecentEventUpdates() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ long now = System.currentTimeMillis();
+ long nowMinus24Hours = now - (24 * 60 * 60 * 1000);
+ GWTServiceLookup.getEventService().getEventCountsBySeverityForGroup(groupId, nowMinus24Hours, now,
+ new AsyncCallback<Map<EventSeverity, Integer>>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log
+ .debug("Error retrieving recent event counts for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- // draw() may be done since onInit finishes asynchronously, if so redraw
- if (isDrawn()) {
- markForRedraw();
- }
+ @Override
+ public void onSuccess(Map<EventSeverity, Integer> eventCounts) {
+ //Now populated Tuples
+ List<GwtTuple<EventSeverity, Integer>> results = new ArrayList<GwtTuple<EventSeverity, Integer>>();
+ for (EventSeverity severity : eventCounts.keySet()) {
+ int count = eventCounts.get(severity);
+ if (count > 0) {
+ results.add(new GwtTuple<EventSeverity, Integer>(severity, count));
+ }
+ }
+ //build display
+ VLayout column = new VLayout();
+ column.setHeight(10);
+
+ if (!results.isEmpty()) {
+ int rowNum = 0;
+ for (GwtTuple<EventSeverity, Integer> tuple : results) {
+ // event history records do not have a usable locatorId, we'll use rownum, which is unique and
+ // may be repeatable.
+ LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ row.setNumCols(2);
+ row.setWidth(10);//pack.
+
+ //icon
+ StaticTextItem iconItem = newTextItemIcon(ImageManager.getEventSeverityIcon(tuple
+ .getLefty()), tuple.getLefty().name());
+ //count
+ StaticTextItem count = newTextItem(String.valueOf(tuple.righty));
+ row.setItems(iconItem, count);
+
+ column.addMember(row);
}
- });
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent.extendLocatorId(String
+ .valueOf(rowNum)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Events/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentEventsContent.extendLocatorId("None"),
+ RECENT_EVENTS_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentEventsContent.getChildren()) {
+ child.destroy();
+ }
+ recentEventsContent.addChild(column);
+ recentEventsContent.markForRedraw();
}
});
- }
}
- private void setDashboard(Dashboard dashboard) {
- Canvas[] members = getMembers();
- removeMembers(members);
-
- dashboardView = new DashboardView(extendLocatorId(dashboard.getName()), this, dashboard);
- addMember(dashboardView);
-
- footer = new LocatableToolStrip(extendLocatorId("Footer"));
- footer.setPadding(5);
- footer.setWidth100();
- footer.setMembersMargin(15);
-
- editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
- .common_title_edit_mode());
- editButton.setAutoFit(true);
- editButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- editMode = !editMode;
- editButton.setTitle(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
- dashboardView.setEditMode(editMode);
- }
- });
+ /** Fetches OOB measurements and updates the DynamicForm instance with the latest 5
+ * oob change details.
+ */
+ private void getRecentOobs() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+
+ GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForGroup(groupId, 5,
+ new AsyncCallback<PageList<MeasurementOOBComposite>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent out of bound metrics for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
- resetButton.setAutoFit(true);
- resetButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- String message = MSG.view_summaryDashboard_resetConfirm();
-
- SC.ask(message, new BooleanCallback() {
- public void execute(Boolean confirmed) {
- if (confirmed) {
- dashboardView.delete();
- setDashboard(getDefaultDashboard());
- markForRedraw();
+ @Override
+ public void onSuccess(PageList<MeasurementOOBComposite> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (MeasurementOOBComposite oob : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentOobContent.extendLocatorId(oob
+ .getScheduleName()));
+ row.setNumCols(2);
+
+ String title = oob.getScheduleName() + ":";
+ String destination = "/resource/common/monitor/Visibility.do?m=" + oob.getDefinitionId()
+ + "&id=" + groupId + "&mode=chartSingleMetricSingleResource";
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(oob.getTimestamp()));
+
+ row.setItems(link, time);
+ column.addMember(row);
}
+ //insert see more link spinder(2/24/11): no page that displays all oobs... See More not possible.
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentOobContent.extendLocatorId("None"),
+ RECENT_OOB_NONE);
+ column.addMember(row);
}
- });
- }
- });
+ recentOobContent.setContents("");
+ for (Canvas child : recentOobContent.getChildren()) {
+ child.destroy();
+ }
+ recentOobContent.addChild(column);
+ recentOobContent.markForRedraw();
+ }
+ });
+ }
- footer.addMember(editButton);
- footer.addMember(resetButton);
+ /** Fetches recent package history information and updates the DynamicForm instance with details.
+ */
+ private void getRecentPkgHistory() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ InstalledPackageHistoryCriteria criteria = new InstalledPackageHistoryCriteria();
+ PageControl pageControl = new PageControl(0, 5);
+ criteria.setPageControl(pageControl);
+ criteria.addFilterResourceGroupIds(groupId);
+ criteria.addSortStatus(PageOrdering.DESC);
+
+ GWTServiceLookup.getContentService().findInstalledPackageHistoryByCriteria(criteria,
+
+ new AsyncCallback<PageList<InstalledPackageHistory>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving installed package history for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- addMember(footer);
+ @Override
+ public void onSuccess(PageList<InstalledPackageHistory> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (InstalledPackageHistory history : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
+ .extendLocatorId(history.getPackageVersion().getFileName()
+ + history.getPackageVersion().getVersion()));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon("subsystems/content/Package_16.png", null);
+ String title = history.getPackageVersion().getFileName() + ":";
+ String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId
+ + "&selectedHistoryId=" + history.getId();
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(history.getTimestamp()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
+ }
+ // //insert see more link
+ // LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
+ // .extendLocatorId("PkgHistoryContentSeeMore"));
+ // String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId;
+ // addSeeMoreLink(row, destination, column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentPkgHistoryContent.extendLocatorId("None"),
+ RECENT_PKG_HISTORY_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentPkgHistoryContent.getChildren()) {
+ child.destroy();
+ }
+ recentPkgHistoryContent.addChild(column);
+ recentPkgHistoryContent.markForRedraw();
+ }
+ });
}
- protected Dashboard getDefaultDashboard() {
- Subject sessionSubject = UserSessionManager.getSessionSubject();
- ResourceGroup group = groupComposite.getResourceGroup();
+ /** Fetches recent metric information and updates the DynamicForm instance with i)sparkline information,
+ * ii) link to recent metric graph for more details and iii) last metric value formatted to show significant
+ * digits.
+ */
+ private void getRecentMetrics() {
- Dashboard dashboard = new Dashboard();
+ //display container
+ final VLayout column = new VLayout();
+ column.setHeight(10);//pack
+ final int groupId = this.groupComposite.getResourceGroup().getId();
- dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + group.getId());
- dashboard.setCategory(DashboardCategory.GROUP);
- dashboard.setGroup(group);
- dashboard.setColumns(2);
+ //retrieve all relevant measurement definition ids.
+ Set<MeasurementDefinition> definitions = this.groupComposite.getResourceGroup().getResourceType()
+ .getMetricDefinitions();
- // TODO, add real portlets
- // set leftmost column and let the rest be equally divided
- dashboard.setColumnWidths("40%");
- dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
+ //build id mapping for measurementDefinition instances Ex. Free Memory -> MeasurementDefinition[100071]
+ final HashMap<String, MeasurementDefinition> measurementDefMap = new HashMap<String, MeasurementDefinition>();
+ for (MeasurementDefinition definition : definitions) {
+ measurementDefMap.put(definition.getDisplayName(), definition);
+ }
+ //bundle definition ids for asynch call.
+ int[] definitionArrayIds = new int[definitions.size()];
+ final String[] displayOrder = new String[definitions.size()];
+ measurementDefMap.keySet().toArray(displayOrder);
+ //sort the charting data ex. Free Memory, Free Swap Space,..System Load
+ Arrays.sort(displayOrder);
+
+ //organize definitionArrayIds for ordered request on server.
+ int index = 0;
+ for (String definitionToDisplay : displayOrder) {
+ definitionArrayIds[index++] = measurementDefMap.get(definitionToDisplay).getId();
+ }
- // Left Column
- DashboardPortlet dummyLeft = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
- dummyLeft.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
- dashboard.addPortlet(dummyLeft, 0, 0);
+ //make the asynchronous call for all the measurement data
+ GWTServiceLookup.getMeasurementDataService().findDataForCompatibleGroup(groupId, definitionArrayIds,
+ System.currentTimeMillis() - (1000L * 60 * 60 * 8), System.currentTimeMillis(), 60,
+ new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent metrics charting data for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- // right Column
- DashboardPortlet dummyRight = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
- dummyRight.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
- dashboard.addPortlet(dummyRight, 1, 0);
+ @Override
+ public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> results) {
+ if (!results.isEmpty()) {
+ boolean someChartedData = false;
+ //iterate over the retrieved charting data
+ for (int index = 0; index < displayOrder.length; index++) {
+ //retrieve the correct measurement definition
+ MeasurementDefinition md = measurementDefMap.get(displayOrder[index]);
+
+ //load the data results for the given metric definition
+ List<MeasurementDataNumericHighLowComposite> data = results.get(index);
+
+ //locate last and minimum values.
+ double lastValue = -1;
+ double minValue = Double.MAX_VALUE;//
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
+ if (d.getValue() < minValue) {
+ minValue = d.getValue();
+ }
+ lastValue = d.getValue();
+ }
+ }
- return dashboard;
- }
+ //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
+ String commaDelimitedList = "";
- @Override
- public boolean isInitialized() {
- return isInitialized;
- }
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
+ commaDelimitedList += d.getValue() + ",";
+ }
+ }
+ LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
+ .extendLocatorId(md.getName()));
+ row.setNumCols(3);
+ HTMLFlow graph = new HTMLFlow();
+ // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0'>"
+ // + commaDelimitedList + "</span>";
+ String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0' "
+ + "values='" + commaDelimitedList + "'>...</span>";
+ graph.setContents(contents);
+ graph.setContentsType(ContentsType.PAGE);
+ //diable scrollbars on span
+ graph.setScrollbarSize(0);
+
+ CanvasItem graphContainer = new CanvasItem();
+ graphContainer.setShowTitle(false);
+ graphContainer.setHeight(16);
+ graphContainer.setWidth(60);
+ graphContainer.setCanvas(graph);
+
+ //Link/title element
+ //TODO: spinder, change link whenever portal.war/graphing is removed.
+ String title = md.getDisplayName() + ":";
+ // String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricSingleResource&id="
+ // + resourceId + "&m=" + md.getId();
+ String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricMultiResource&groupId="
+ + groupId + "&m=" + md.getId();
+ LinkItem link = newLinkItem(title, destination);
+
+ //Value
+ String convertedValue = lastValue + " " + md.getUnits();
+ convertedValue = convertLastValueForDisplay(lastValue, md);
+ StaticTextItem value = newTextItem(convertedValue);
+
+ row.setItems(graphContainer, link, value);
+ //if graph content returned
+ if ((md.getName().trim().indexOf("Trait.") == -1) && (lastValue != -1)) {
+ column.addMember(row);
+ someChartedData = true;
+ }
+ }
+ if (!someChartedData) {// when there are results but no chartable entries.
+ LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
+ .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
+ column.addMember(row);
+ } else {
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
+ .extendLocatorId("RecentMeasurementsContentSeeMore"));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Monitoring/Graphs/", column);
+ }
+ //call out to 3rd party javascript lib
+ BrowserUtility.graphSparkLines();
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
+ .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
+ column.addMember(row);
+ }
+ }
+ });
- public Set<Permission> getGlobalPermissions() {
- return globalPermissions;
+ //cleanup
+ for (Canvas child : recentMeasurementsContent.getChildren()) {
+ child.destroy();
+ }
+ recentMeasurementsContent.addChild(column);
+ recentMeasurementsContent.markForRedraw();
}
- /**
- * name update not supported because the name is derived from the entity id.
- * @return
+ /** Fetches recent bundle deployment information and updates the DynamicForm instance with details.
*/
- public boolean supportsDashboardNameEdit() {
- return false;
- }
+ protected void getRecentBundleDeployments() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ GroupBundleDeploymentCriteria criteria = new GroupBundleDeploymentCriteria();
+ PageControl pageControl = new PageControl(0, 5);
+ criteria.setPageControl(pageControl);
+ criteria.addFilterResourceGroupIds(groupId);
+ criteria.addSortStatus(PageOrdering.DESC);
+ criteria.fetchDestination(true);
+ criteria.fetchBundleVersion(true);
+
+ GWTServiceLookup.getBundleService().findBundleDeploymentsByCriteria(criteria,
+ new AsyncCallback<PageList<BundleDeployment>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving installed bundle deployments for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
- public void updateDashboardNames() {
- return;
+ @Override
+ public void onSuccess(PageList<BundleDeployment> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (BundleDeployment deployment : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent
+ .extendLocatorId(deployment.getBundleVersion().getName()
+ + deployment.getBundleVersion().getVersion()));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
+ String title = deployment.getBundleVersion().getName() + "["
+ + deployment.getBundleVersion().getVersion() + "]:";
+ String destination = ReportDecorator.GWT_BUNDLE_URL
+ + deployment.getBundleVersion().getBundle().getId() + "/destinations/"
+ + deployment.getDestination().getId();
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter
+ .format(deployment.getCtime()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
+ }
+ //insert see more link
+ //TODO: spinder:2/25/11 (add this later) no current view for seeing all bundle deployments
+ // LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent.extendLocatorId("RecentBundleContentSeeMore"));
+ // addSeeMoreLink(row, LinkManager.getResourceGroupLink(groupId) + "/Events/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentBundleDeployContent
+ .extendLocatorId("None"), RECENT_BUNDLE_DEPLOY_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentBundleDeployContent.getChildren()) {
+ child.destroy();
+ }
+ recentBundleDeployContent.addChild(column);
+ recentBundleDeployContent.markForRedraw();
+ }
+ });
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 71a1bf8..121193f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -18,695 +18,204 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
-import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.ContentsType;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.form.fields.LinkItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import org.rhq.core.domain.alert.Alert;
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.bundle.BundleDeployment;
-import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
-import org.rhq.core.domain.content.InstalledPackageHistory;
-import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.core.domain.criteria.GroupBundleDeploymentCriteria;
-import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
-import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
-import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
-import org.rhq.core.domain.event.EventSeverity;
-import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
-import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
-import org.rhq.core.domain.operation.GroupOperationHistory;
-import org.rhq.core.domain.resource.ResourceTypeFacet;
-import org.rhq.core.domain.resource.composite.DisambiguationReport;
-import org.rhq.core.domain.resource.group.GroupCategory;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.InitializableView;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardContainer;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
+import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
-import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
-import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
-import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
-import org.rhq.enterprise.gui.coregui.client.util.GwtTuple;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
- * The content pane for the group Summary>Activity subtab.
+ * The content pane for the group Summary>Dashboard subtab.
*
- * @author Simeon Pinder
+ * @author Jay Shaughnessy
*/
-public class ActivityView2 extends AbstractActivityView {
- private ResourceGroupComposite groupComposite;
-
- public ActivityView2(String locatorId, ResourceGroupComposite groupComposite) {
- super(locatorId, groupComposite, null);
- this.groupComposite = groupComposite;
- }
-
- @Override
- protected void onInit() {
- super.onInit();
- loadData();
- }
-
- /**Initiates data request.
- */
- protected void loadData() {
- ResourceGroup group = null;
- GroupCategory groupCategory = null;
- Set<ResourceTypeFacet> facets = null;
- if ((groupComposite != null) && (groupComposite.getResourceGroup() != null)) {
- group = groupComposite.getResourceGroup();
- groupCategory = groupComposite.getResourceGroup().getGroupCategory();
- //Load Facets to conditionally display relevant tabs
- facets = groupComposite.getResourceFacets().getFacets();
-
- getRecentAlerts();
- //events
- if (displayGroupEvents(groupCategory, facets)) {
- getRecentEventUpdates();
- }
- //operations
- if (displayGroupOperations(groupCategory, facets)) {
- getRecentOperations();
- }
- //Config updates
- if (displayGroupConfigurationUpdates(groupCategory, facets)) {
- getRecentConfigurationUpdates();
- }
- //recentMetrics,oobs,pkghistory
- if (groupCategory == GroupCategory.COMPATIBLE) {
- getRecentOobs();
- getRecentPkgHistory();
- getRecentMetrics();
- }
+public class ActivityView2 extends LocatableVLayout implements DashboardContainer, InitializableView {
- //conditionally display Bundle deployments for groups of platforms only
- displayBundleDeploymentsForPlatformGroups(group);
- }
- }
+ private static final String DASHBOARD_NAME_PREFIX = "GroupDashboard_";
- /** Fetches alerts and updates the DynamicForm instance with the latest
- * alert information.
- */
- private void getRecentAlerts() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- Integer[] filterGroupAlertDefinitionIds;
- Set<AlertDefinition> alertDefinitions = this.groupComposite.getResourceGroup().getAlertDefinitions();
- filterGroupAlertDefinitionIds = new Integer[alertDefinitions.size()];
- int i = 0;
- for (AlertDefinition def : alertDefinitions) {
- filterGroupAlertDefinitionIds[i++] = def.getId();
- }
- //fetches last five alerts for this resource
- AlertCriteria criteria = new AlertCriteria();
- PageControl pageControl = new PageControl(0, 5);
- pageControl.initDefaultOrderingField("ctime", PageOrdering.DESC);
- criteria.setPageControl(pageControl);
- criteria.addFilterGroupAlertDefinitionIds(filterGroupAlertDefinitionIds);
- GWTServiceLookup.getAlertService().findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
- @Override
- public void onSuccess(PageList<Alert> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- int rowNum = 0;
- for (Alert alert : result) {
- // alert history records do not have a usable locatorId, we'll use rownum, which is unique and
- // may be repeatable.
- LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
- .valueOf(rowNum++)));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon(ImageManager.getAlertIcon(alert.getAlertDefinition()
- .getPriority()), alert.getAlertDefinition().getPriority().getDisplayName());
- LinkItem link = newLinkItem(alert.getAlertDefinition().getName() + ": ",
- ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/" + alert.getId());
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(alert.getCtime()));
- row.setItems(iconItem, link, time);
-
- column.addMember(row);
- }
- //link to more details
- LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
- .valueOf(rowNum++)));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentAlertsContent.extendLocatorId("None"),
- RECENT_ALERTS_NONE);
- column.addMember(row);
- }
- for (Canvas child : recentAlertsContent.getChildren()) {
- child.destroy();
- }
- recentAlertsContent.addChild(column);
- recentAlertsContent.markForRedraw();
- }
+ private ResourceGroupComposite groupComposite;
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent alerts for group [" + groupId + "]:" + caught.getMessage());
- }
- });
- }
+ private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
- /** Fetches operations and updates the DynamicForm instance with the latest
- * operation information.
- */
- private void getRecentOperations() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- //fetches five most recent operations.
- PageControl pageControl = new PageControl(0, 5);
-
- GroupOperationHistoryCriteria criteria = new GroupOperationHistoryCriteria();
- List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
- filterResourceGroupIds.add(groupId);
- criteria.addFilterResourceGroupIds(filterResourceGroupIds);
- criteria.setPageControl(pageControl);
- criteria.addSortStatus(PageOrdering.DESC);
-
- GWTServiceLookup.getOperationService().findGroupOperationHistoriesByCriteriaDisambiguated(criteria,
- new AsyncCallback<List<DisambiguationReport<GroupOperationHistory>>>() {
-
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent operations for group [" + groupId + "]:" + caught.getMessage());
- }
+ private DashboardView dashboardView;
- @Override
- public void onSuccess(List<DisambiguationReport<GroupOperationHistory>> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- int rowNum = 0;
- for (DisambiguationReport<GroupOperationHistory> report : result) {
- // operation history records do not have a usable locatorId, we'll use rownum, which is unique and
- // may be repeatable.
- LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
- .extendLocatorId(String.valueOf(rowNum)));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon(ImageManager.getOperationResultsIcon(report
- .getOriginal().getStatus()), report.getOriginal().getStatus().getDisplayName());
- LinkItem link = newLinkItem(report.getOriginal().getOperationDefinition().getDisplayName()
- + ": ", ReportDecorator.GWT_GROUP_URL + groupId + "/Operations/History/"
- + report.getOriginal().getId());
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(report.getOriginal()
- .getStartedTime()));
- row.setItems(iconItem, link, time);
-
- column.addMember(row);
- }
- //insert see more link
- LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
- .extendLocatorId(String.valueOf(rowNum)));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Operations/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentOperationsContent
- .extendLocatorId("None"), RECENT_OPERATIONS_NONE);
- column.addMember(row);
- }
- for (Canvas child : recentOperationsContent.getChildren()) {
- child.destroy();
- }
- recentOperationsContent.addChild(column);
- recentOperationsContent.markForRedraw();
- }
- });
- }
+ private LocatableToolStrip footer;
+ private IButton editButton;
+ private IButton resetButton;
- /** Fetches configuration updates and updates the DynamicForm instance with the latest
- * config change information.
- */
- private void getRecentConfigurationUpdates() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
-
- PageControl lastFive = new PageControl(0, 5);
- GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();
- criteria.setPageControl(lastFive);
- criteria.addSortStatus(PageOrdering.DESC);
- List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
- filterResourceGroupIds.add(groupId);
- criteria.addFilterResourceGroupIds(filterResourceGroupIds);
-
- GWTServiceLookup.getConfigurationService().findGroupResourceConfigurationUpdatesByCriteria(criteria,
- new AsyncCallback<PageList<GroupResourceConfigurationUpdate>>() {
-
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent configuration updates for group [" + groupId + "]:"
- + caught.getMessage());
- }
+ // Capture the user's global permissions for use by any dashboard or portlet that may need it for rendering.
+ private Set<Permission> globalPermissions;
- @Override
- public void onSuccess(PageList<GroupResourceConfigurationUpdate> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- int rowNum = 0;
- for (GroupResourceConfigurationUpdate update : result) {
- // config update history records do not have a usable locatorId, we'll use rownum, which is unique and
- // may be repeatable.
- LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
- .extendLocatorId(String.valueOf(rowNum)));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon(ImageManager.getResourceConfigurationIcon(update
- .getStatus()), null);
- String linkTitle = MSG.view_resource_inventory_activity_changed_by() + " "
- + update.getSubjectName() + ":";
- if ((update.getSubjectName() == null) || (update.getSubjectName().trim().isEmpty())) {
- linkTitle = MSG.common_msg_changeAutoDetected();
- }
- LinkItem link = newLinkItem(linkTitle, ReportDecorator.GWT_GROUP_URL + groupId
- + "/Configuration/History/" + update.getId());
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(update
- .getCreatedTime()));
+ private boolean editMode = false;
- row.setItems(iconItem, link, time);
- column.addMember(row);
- }
- //insert see more link
- LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
- .extendLocatorId(String.valueOf(rowNum)));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Configuration/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentConfigurationContent
- .extendLocatorId("None"), RECENT_CONFIGURATIONS_NONE);
- column.addMember(row);
- }
- //cleanup
- for (Canvas child : recentConfigurationContent.getChildren()) {
- child.destroy();
- }
- recentConfigurationContent.addChild(column);
- recentConfigurationContent.markForRedraw();
+ private boolean isInitialized = false;
- }
- });
+ public ActivityView2(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
+ this.groupComposite = groupComposite;
}
- /** Fetches recent events and updates the DynamicForm instance with the latest
- * event information over last 24hrs.
- */
- private void getRecentEventUpdates() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- long now = System.currentTimeMillis();
- long nowMinus24Hours = now - (24 * 60 * 60 * 1000);
- GWTServiceLookup.getEventService().getEventCountsBySeverityForGroup(groupId, nowMinus24Hours, now,
- new AsyncCallback<Map<EventSeverity, Integer>>() {
-
- @Override
- public void onFailure(Throwable caught) {
- Log
- .debug("Error retrieving recent event counts for group [" + groupId + "]:"
- + caught.getMessage());
- }
-
- @Override
- public void onSuccess(Map<EventSeverity, Integer> eventCounts) {
- //Now populated Tuples
- List<GwtTuple<EventSeverity, Integer>> results = new ArrayList<GwtTuple<EventSeverity, Integer>>();
- for (EventSeverity severity : eventCounts.keySet()) {
- int count = eventCounts.get(severity);
- if (count > 0) {
- results.add(new GwtTuple<EventSeverity, Integer>(severity, count));
- }
- }
- //build display
- VLayout column = new VLayout();
- column.setHeight(10);
-
- if (!results.isEmpty()) {
- int rowNum = 0;
- for (GwtTuple<EventSeverity, Integer> tuple : results) {
- // event history records do not have a usable locatorId, we'll use rownum, which is unique and
- // may be repeatable.
- LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent
- .extendLocatorId(String.valueOf(rowNum)));
- row.setNumCols(2);
- row.setWidth(10);//pack.
-
- //icon
- StaticTextItem iconItem = newTextItemIcon(ImageManager.getEventSeverityIcon(tuple
- .getLefty()), tuple.getLefty().name());
- //count
- StaticTextItem count = newTextItem(String.valueOf(tuple.righty));
- row.setItems(iconItem, count);
-
- column.addMember(row);
+ @Override
+ protected void onInit() {
+ if (!isInitialized()) {
+ super.onInit();
+
+ // first async call to get global permissions
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ globalPermissions = permissions;
+
+ // now make async call to look for customized dash for this user and entity
+ DashboardCriteria criteria = new DashboardCriteria();
+ criteria.addFilterCategory(DashboardCategory.GROUP);
+ criteria.addFilterGroupId(groupComposite.getResourceGroup().getId());
+ dashboardService.findDashboardsByCriteria(criteria, new AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
}
- //insert see more link
- LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent.extendLocatorId(String
- .valueOf(rowNum)));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Events/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentEventsContent.extendLocatorId("None"),
- RECENT_EVENTS_NONE);
- column.addMember(row);
- }
- //cleanup
- for (Canvas child : recentEventsContent.getChildren()) {
- child.destroy();
- }
- recentEventsContent.addChild(column);
- recentEventsContent.markForRedraw();
- }
- });
- }
- /** Fetches OOB measurements and updates the DynamicForm instance with the latest 5
- * oob change details.
- */
- private void getRecentOobs() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
-
- GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForGroup(groupId, 5,
- new AsyncCallback<PageList<MeasurementOOBComposite>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent out of bound metrics for group [" + groupId + "]:"
- + caught.getMessage());
- }
+ public void onSuccess(final PageList<Dashboard> result) {
+ Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
+ setDashboard(dashboard);
+
+ isInitialized = true;
- @Override
- public void onSuccess(PageList<MeasurementOOBComposite> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- for (MeasurementOOBComposite oob : result) {
- LocatableDynamicForm row = new LocatableDynamicForm(recentOobContent.extendLocatorId(oob
- .getScheduleName()));
- row.setNumCols(2);
-
- String title = oob.getScheduleName() + ":";
- String destination = "/resource/common/monitor/Visibility.do?m=" + oob.getDefinitionId()
- + "&id=" + groupId + "&mode=chartSingleMetricSingleResource";
- LinkItem link = newLinkItem(title, destination);
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(oob.getTimestamp()));
-
- row.setItems(link, time);
- column.addMember(row);
+ // draw() may be done since onInit finishes asynchronously, if so redraw
+ if (isDrawn()) {
+ markForRedraw();
+ }
}
- //insert see more link spinder(2/24/11): no page that displays all oobs... See More not possible.
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentOobContent.extendLocatorId("None"),
- RECENT_OOB_NONE);
- column.addMember(row);
- }
- recentOobContent.setContents("");
- for (Canvas child : recentOobContent.getChildren()) {
- child.destroy();
- }
- recentOobContent.addChild(column);
- recentOobContent.markForRedraw();
+ });
}
});
+ }
}
- /** Fetches recent package history information and updates the DynamicForm instance with details.
- */
- private void getRecentPkgHistory() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- InstalledPackageHistoryCriteria criteria = new InstalledPackageHistoryCriteria();
- PageControl pageControl = new PageControl(0, 5);
- criteria.setPageControl(pageControl);
- criteria.addFilterResourceGroupIds(groupId);
- criteria.addSortStatus(PageOrdering.DESC);
-
- GWTServiceLookup.getContentService().findInstalledPackageHistoryByCriteria(criteria,
-
- new AsyncCallback<PageList<InstalledPackageHistory>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving installed package history for group [" + groupId + "]:"
- + caught.getMessage());
+ private void setDashboard(Dashboard dashboard) {
+ Canvas[] members = getMembers();
+ removeMembers(members);
+
+ dashboardView = new DashboardView(extendLocatorId(dashboard.getName()), this, dashboard);
+ addMember(dashboardView);
+
+ footer = new LocatableToolStrip(extendLocatorId("Footer"));
+ footer.setPadding(5);
+ footer.setWidth100();
+ footer.setMembersMargin(15);
+
+ editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
+ .common_title_edit_mode());
+ editButton.setAutoFit(true);
+ editButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ editMode = !editMode;
+ editButton.setTitle(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
+ dashboardView.setEditMode(editMode);
}
+ });
- @Override
- public void onSuccess(PageList<InstalledPackageHistory> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- for (InstalledPackageHistory history : result) {
- LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
- .extendLocatorId(history.getPackageVersion().getFileName()
- + history.getPackageVersion().getVersion()));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon("subsystems/content/Package_16.png", null);
- String title = history.getPackageVersion().getFileName() + ":";
- String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId
- + "&selectedHistoryId=" + history.getId();
- LinkItem link = newLinkItem(title, destination);
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(history.getTimestamp()));
-
- row.setItems(iconItem, link, time);
- column.addMember(row);
+ resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
+ resetButton.setAutoFit(true);
+ resetButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ String message = MSG.view_summaryDashboard_resetConfirm();
+
+ SC.ask(message, new BooleanCallback() {
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ dashboardView.delete();
+ setDashboard(getDefaultDashboard());
+ markForRedraw();
+ }
}
- // //insert see more link
- // LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
- // .extendLocatorId("PkgHistoryContentSeeMore"));
- // String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId;
- // addSeeMoreLink(row, destination, column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentPkgHistoryContent.extendLocatorId("None"),
- RECENT_PKG_HISTORY_NONE);
- column.addMember(row);
- }
- //cleanup
- for (Canvas child : recentPkgHistoryContent.getChildren()) {
- child.destroy();
- }
- recentPkgHistoryContent.addChild(column);
- recentPkgHistoryContent.markForRedraw();
+ });
}
});
+
+ footer.addMember(editButton);
+ footer.addMember(resetButton);
+
+ addMember(footer);
}
- /** Fetches recent metric information and updates the DynamicForm instance with i)sparkline information,
- * ii) link to recent metric graph for more details and iii) last metric value formatted to show significant
- * digits.
- */
- private void getRecentMetrics() {
+ protected Dashboard getDefaultDashboard() {
+ Subject sessionSubject = UserSessionManager.getSessionSubject();
+ ResourceGroup group = groupComposite.getResourceGroup();
- //display container
- final VLayout column = new VLayout();
- column.setHeight(10);//pack
- final int groupId = this.groupComposite.getResourceGroup().getId();
+ Dashboard dashboard = new Dashboard();
- //retrieve all relevant measurement definition ids.
- Set<MeasurementDefinition> definitions = this.groupComposite.getResourceGroup().getResourceType()
- .getMetricDefinitions();
+ dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + group.getId());
+ dashboard.setCategory(DashboardCategory.GROUP);
+ dashboard.setGroup(group);
+ dashboard.setColumns(2);
- //build id mapping for measurementDefinition instances Ex. Free Memory -> MeasurementDefinition[100071]
- final HashMap<String, MeasurementDefinition> measurementDefMap = new HashMap<String, MeasurementDefinition>();
- for (MeasurementDefinition definition : definitions) {
- measurementDefMap.put(definition.getDisplayName(), definition);
- }
- //bundle definition ids for asynch call.
- int[] definitionArrayIds = new int[definitions.size()];
- final String[] displayOrder = new String[definitions.size()];
- measurementDefMap.keySet().toArray(displayOrder);
- //sort the charting data ex. Free Memory, Free Swap Space,..System Load
- Arrays.sort(displayOrder);
-
- //organize definitionArrayIds for ordered request on server.
- int index = 0;
- for (String definitionToDisplay : displayOrder) {
- definitionArrayIds[index++] = measurementDefMap.get(definitionToDisplay).getId();
- }
+ // TODO, add real portlets
+ // set leftmost column and let the rest be equally divided
+ dashboard.setColumnWidths("40%");
+ dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
- //make the asynchronous call for all the measurement data
- GWTServiceLookup.getMeasurementDataService().findDataForCompatibleGroup(groupId, definitionArrayIds,
- System.currentTimeMillis() - (1000L * 60 * 60 * 8), System.currentTimeMillis(), 60,
- new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent metrics charting data for group [" + groupId + "]:"
- + caught.getMessage());
- }
+ // Left Column
+ DashboardPortlet dummyLeft = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyLeft.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyLeft, 0, 0);
- @Override
- public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> results) {
- if (!results.isEmpty()) {
- boolean someChartedData = false;
- //iterate over the retrieved charting data
- for (int index = 0; index < displayOrder.length; index++) {
- //retrieve the correct measurement definition
- MeasurementDefinition md = measurementDefMap.get(displayOrder[index]);
-
- //load the data results for the given metric definition
- List<MeasurementDataNumericHighLowComposite> data = results.get(index);
-
- //locate last and minimum values.
- double lastValue = -1;
- double minValue = Double.MAX_VALUE;//
- for (MeasurementDataNumericHighLowComposite d : data) {
- if ((!Double.isNaN(d.getValue()))
- && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
- if (d.getValue() < minValue) {
- minValue = d.getValue();
- }
- lastValue = d.getValue();
- }
- }
+ // right Column
+ DashboardPortlet dummyRight = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyRight.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyRight, 1, 0);
- //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
- String commaDelimitedList = "";
+ return dashboard;
+ }
- for (MeasurementDataNumericHighLowComposite d : data) {
- if ((!Double.isNaN(d.getValue()))
- && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
- commaDelimitedList += d.getValue() + ",";
- }
- }
- LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
- .extendLocatorId(md.getName()));
- row.setNumCols(3);
- HTMLFlow graph = new HTMLFlow();
- // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0'>"
- // + commaDelimitedList + "</span>";
- String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0' "
- + "values='" + commaDelimitedList + "'>...</span>";
- graph.setContents(contents);
- graph.setContentsType(ContentsType.PAGE);
- //diable scrollbars on span
- graph.setScrollbarSize(0);
-
- CanvasItem graphContainer = new CanvasItem();
- graphContainer.setShowTitle(false);
- graphContainer.setHeight(16);
- graphContainer.setWidth(60);
- graphContainer.setCanvas(graph);
-
- //Link/title element
- //TODO: spinder, change link whenever portal.war/graphing is removed.
- String title = md.getDisplayName() + ":";
- // String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricSingleResource&id="
- // + resourceId + "&m=" + md.getId();
- String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricMultiResource&groupId="
- + groupId + "&m=" + md.getId();
- LinkItem link = newLinkItem(title, destination);
-
- //Value
- String convertedValue = lastValue + " " + md.getUnits();
- convertedValue = convertLastValueForDisplay(lastValue, md);
- StaticTextItem value = newTextItem(convertedValue);
-
- row.setItems(graphContainer, link, value);
- //if graph content returned
- if ((md.getName().trim().indexOf("Trait.") == -1) && (lastValue != -1)) {
- column.addMember(row);
- someChartedData = true;
- }
- }
- if (!someChartedData) {// when there are results but no chartable entries.
- LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
- .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
- column.addMember(row);
- } else {
- //insert see more link
- LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
- .extendLocatorId("RecentMeasurementsContentSeeMore"));
- addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Monitoring/Graphs/", column);
- }
- //call out to 3rd party javascript lib
- BrowserUtility.graphSparkLines();
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
- .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
- column.addMember(row);
- }
- }
- });
+ @Override
+ public boolean isInitialized() {
+ return isInitialized;
+ }
- //cleanup
- for (Canvas child : recentMeasurementsContent.getChildren()) {
- child.destroy();
- }
- recentMeasurementsContent.addChild(column);
- recentMeasurementsContent.markForRedraw();
+ public Set<Permission> getGlobalPermissions() {
+ return globalPermissions;
}
- /** Fetches recent bundle deployment information and updates the DynamicForm instance with details.
+ /**
+ * name update not supported because the name is derived from the entity id.
+ * @return
*/
- protected void getRecentBundleDeployments() {
- final int groupId = this.groupComposite.getResourceGroup().getId();
- GroupBundleDeploymentCriteria criteria = new GroupBundleDeploymentCriteria();
- PageControl pageControl = new PageControl(0, 5);
- criteria.setPageControl(pageControl);
- criteria.addFilterResourceGroupIds(groupId);
- criteria.addSortStatus(PageOrdering.DESC);
- criteria.fetchDestination(true);
- criteria.fetchBundleVersion(true);
-
- GWTServiceLookup.getBundleService().findBundleDeploymentsByCriteria(criteria,
- new AsyncCallback<PageList<BundleDeployment>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving installed bundle deployments for group [" + groupId + "]:"
- + caught.getMessage());
- }
+ public boolean supportsDashboardNameEdit() {
+ return false;
+ }
- @Override
- public void onSuccess(PageList<BundleDeployment> result) {
- VLayout column = new VLayout();
- column.setHeight(10);
- if (!result.isEmpty()) {
- for (BundleDeployment deployment : result) {
- LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent
- .extendLocatorId(deployment.getBundleVersion().getName()
- + deployment.getBundleVersion().getVersion()));
- row.setNumCols(3);
-
- StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
- String title = deployment.getBundleVersion().getName() + "["
- + deployment.getBundleVersion().getVersion() + "]:";
- String destination = ReportDecorator.GWT_BUNDLE_URL
- + deployment.getBundleVersion().getBundle().getId() + "/destinations/"
- + deployment.getDestination().getId();
- LinkItem link = newLinkItem(title, destination);
- StaticTextItem time = newTextItem(GwtRelativeDurationConverter
- .format(deployment.getCtime()));
-
- row.setItems(iconItem, link, time);
- column.addMember(row);
- }
- //insert see more link
- //TODO: spinder:2/25/11 (add this later) no current view for seeing all bundle deployments
- // LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent.extendLocatorId("RecentBundleContentSeeMore"));
- // addSeeMoreLink(row, LinkManager.getResourceGroupLink(groupId) + "/Events/History/", column);
- } else {
- LocatableDynamicForm row = createEmptyDisplayRow(recentBundleDeployContent
- .extendLocatorId("None"), RECENT_BUNDLE_DEPLOY_NONE);
- column.addMember(row);
- }
- //cleanup
- for (Canvas child : recentBundleDeployContent.getChildren()) {
- child.destroy();
- }
- recentBundleDeployContent.addChild(column);
- recentBundleDeployContent.markForRedraw();
- }
- });
+ public void updateDashboardNames() {
+ return;
}
+
}
13 years, 3 months
[rhq] Branch 'cli-alert-notifs' - modules/enterprise
by lkrejci
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java | 5 +++--
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 04806d4a5dc6a9ce36b45bf5fd6cfa50bdf68812
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Mar 2 14:02:19 2011 +0100
Finish i18n of the CLI notification form + a minor correction in setting the version field.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java
index dd18191..38dbf8b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java
@@ -139,7 +139,7 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
protected List<FormItem> getOnDrawItems() {
List<FormItem> items = super.getOnDrawItems();
- TextItem version = new TextItem("editableVersion", "Version"); //TODO i18n
+ TextItem version = new TextItem("editableVersion", MSG.view_alert_definition_notification_cliScript_editor_newScriptVersion());
version.setColSpan(getNumCols());
version.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
@@ -225,7 +225,7 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
SectionItem userSection = new SectionItem("userSection");
userSection.setDefaultValue(MSG.view_alert_definition_notification_cliScript_editor_whichUser());
- repoSelector = new SelectItem(extendLocatorId("repoSelector"), "Select the repository to look for the script in"); //TODO i18n
+ repoSelector = new SelectItem(extendLocatorId("repoSelector"), MSG.view_alert_definition_notification_cliScript_editor_selectRepo());
repoSelector.setDefaultToFirstOption(true);
repoSelector.setWrapTitle(false);
repoSelector.setWidth(400);
@@ -594,6 +594,7 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
if (event.getItem() instanceof UploadItem) {
if (event.getNewValue() == null) {
uploadForm.getField("editableVersion").setValue("");
+ uploadForm.getField("version").setValue("");
return;
}
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 c20d997..a0d6421 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
@@ -1012,6 +1012,8 @@ view_alert_definition_notification_cliScript_editor_loadFailed = Loading the CLI
view_alert_definition_notification_cliScript_editor_selectRepoFirst = Select a repo first.
view_alert_definition_notification_cliScript_editor_existingScript = Existing Script
view_alert_definition_notification_cliScript_editor_uploadNewScript = Upload New Script
+view_alert_definition_notification_cliScript_editor_newScriptVersion = Version
+view_alert_definition_notification_cliScript_editor_selectRepo = Select the repository where the script should reside
view_alert_definition_recovery_editor_disable_when_fired = Disable When Fired
view_alert_definition_recovery_editor_disable_when_fired_tooltip = Indicates if this alert will be disabled after it fires. Once disabled, the alert can be manually re-enabled or a recovery alert can be set up to automatically re-enable it. If this alert is a recovery alert itself, this setting cannot be turned on.
view_alert_definition_recovery_editor_recovery_alert = Recover Alert
13 years, 3 months
[rhq] Branch 'cli-alert-notifs' - 75 commits - modules/core modules/enterprise
by lkrejci
modules/core/dbutils/pom.xml | 2
modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml | 5
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 50
modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java | 23
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractConfigurationUpdate.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractResourceConfigurationUpdate.java | 9
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java | 126 +
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GroupBundleDeploymentCriteria.java | 55
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageHistoryCriteria.java | 110 +
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceBundleDeploymentCriteria.java | 55
modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java | 66
modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardCategory.java | 68
modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java | 6
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java | 17
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java | 13
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 70
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java | 49
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 21
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/TemplateSchedulesView.java | 26
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java | 45
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java | 22
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 168 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java | 19
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TimeUnit.java | 42
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java | 21
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java | 55
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardContainer.java | 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java | 181 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java | 45
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java | 27
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java | 95 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java | 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/UpdateCollectionIntervalWidget.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDataSource.java | 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java | 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDataSource.java | 31
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java | 43
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/ExecutionSchedule.java | 311 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationCreateWizard.java | 157 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationParametersStep.java | 78 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationSchedulingStep.java | 430 -----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java | 228 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java | 113 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 183 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java | 245 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationSettings.java | 150 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java | 276 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationView.java | 86 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java | 236 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java | 249 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java | 96 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java | 19
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java | 97 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java | 188 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java | 779 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 298 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 110 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java | 290 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryView.java | 176 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java | 143 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 158 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java | 51
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java | 25
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDataSource.java | 124 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDetailView.java | 91 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryView.java | 103 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java | 168 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java | 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationFactory.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestGroupConfigurationView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestReadOnlyConfigurationView.java | 41
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestReadOnlyGroupConfigurationView.java | 41
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java | 292 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java | 62
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RemoteServiceStatistics.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java | 93 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java | 19
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java | 26
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 227 ++
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Package_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Package_24.png |binary
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java | 12
modules/enterprise/server/container/src/main/resources/jbossas/server/default/deploy/rhq-postinstaller.war.rej/welcome.jsf | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java | 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 36
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java | 47
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerBean.java | 28
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerLocal.java | 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java | 50
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java | 15
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerBean.java | 57
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerLocal.java | 9
modules/enterprise/server/plugins/packagetype-cli/src/main/java/org/rhq/enterprise/server/plugins/packagetypeCli/CliPackageTypeBehavior.java | 2
130 files changed, 5967 insertions(+), 2806 deletions(-)
New commits:
commit 219e643126f785902ea29530d3601442103e0fe4
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Mar 2 13:51:45 2011 +0100
forgot to change the cli package type name to the new value in the cli package type plugin itself, d'oh! :)
diff --git a/modules/enterprise/server/plugins/packagetype-cli/src/main/java/org/rhq/enterprise/server/plugins/packagetypeCli/CliPackageTypeBehavior.java b/modules/enterprise/server/plugins/packagetype-cli/src/main/java/org/rhq/enterprise/server/plugins/packagetypeCli/CliPackageTypeBehavior.java
index ea9c376..634539a 100644
--- a/modules/enterprise/server/plugins/packagetype-cli/src/main/java/org/rhq/enterprise/server/plugins/packagetypeCli/CliPackageTypeBehavior.java
+++ b/modules/enterprise/server/plugins/packagetype-cli/src/main/java/org/rhq/enterprise/server/plugins/packagetypeCli/CliPackageTypeBehavior.java
@@ -54,7 +54,7 @@ public class CliPackageTypeBehavior extends AbstractPackageTypeBehavior<ServerPl
private static final String OSGI_EXTRACT_REGEX = "^([^:]+:)?(\\d+(\\.\\d+(\\.\\d+(\\..*)?)?)?)$";
private static final int OSGI_EXTRACT_VERSION_GROUP = 2;
- private static final String PACKAGETYPE_NAME = "__SERVER_SIDE_CLI_SCRIPT";
+ private static final String PACKAGETYPE_NAME = "org.rhq.enterprise.server.plugins.packagetypeCli.SERVER_SIDE_CLI_SCRIPT";
private static final Comparator<PackageVersion> VERSION_COMPARATOR = new Comparator<PackageVersion>() {
private final OSGiVersionComparator OSGI_COMPARATOR = new OSGiVersionComparator();
commit d6a305ee3d3e9e2ae9a1e5d018e5e8116b019695
Merge: f786a5d... 239280b...
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Mar 2 11:40:31 2011 +0100
Merge remote branch 'origin/master' into cli-alert-notifs
diff --cc modules/core/dbutils/pom.xml
index 9e27c56,bf65ffb..e2b59a9
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@@ -22,7 -22,7 +22,7 @@@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.104</db.schema.version>
- <db.schema.version>2.103</db.schema.version>
++ <db.schema.version>2.105</db.schema.version>
</properties>
<dependencies>
diff --cc modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 88b53c2,e9b78a8..71ca67e
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@@ -3297,32 -3297,49 +3297,76 @@@
</schemaSpec>
<schemaSpec version="2.103">
- <!-- package types no longer require to be coupled with a resource type. They can exist on their own. -->
- <schema-alterColumn table="RHQ_PACKAGE_TYPE" column="RESOURCE_TYPE_ID" nullable="true"/>
+ <!-- add FK for owning Subject -->
+ <schema-directSQL>
+ <statement desc="Creating RHQ_DASHBOARD foreign key relation to RHQ_SUBJECT for resource dashboards">
+ ALTER TABLE RHQ_DASHBOARD
+ ADD CONSTRAINT RHQ_DB_SUBJECT_ID_FK
+ FOREIGN KEY (SUBJECT_ID)
+ REFERENCES RHQ_SUBJECT (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Support resource specific dashboards -->
+ <schema-addColumn table="RHQ_DASHBOARD" column="RESOURCE_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_DASHBOARD foreign key relation to RHQ_RESOURCE for resource dashboards">
+ ALTER TABLE RHQ_DASHBOARD
+ ADD CONSTRAINT RHQ_DB_RESOURCE_ID_FK
+ FOREIGN KEY (RESOURCE_ID)
+ REFERENCES RHQ_RESOURCE (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Support group specific dashboards -->
+ <schema-addColumn table="RHQ_DASHBOARD" column="GROUP_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_DASHBOARD foreign key relation to RHQ_RESOURCE_GROUP for group dashboards">
+ ALTER TABLE RHQ_DASHBOARD
+ ADD CONSTRAINT RHQ_DB_RG_ID_FK
+ FOREIGN KEY (GROUP_ID)
+ REFERENCES RHQ_RESOURCE_GROUP (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Add category for distinguishing what kind of dashboard this is -->
+ <schema-addColumn table="RHQ_DASHBOARD" column="CATEGORY" columnType="VARCHAR2" precision="20"/>
+ <schema-directSQL>
+ <statement desc="Set dashboard category for existing dashboards to INVENTORY">
+ UPDATE RHQ_DASHBOARD
+ SET CATEGORY = 'INVENTORY'
+ </statement>
+ </schema-directSQL>
+ <schema-alterColumn table="RHQ_DASHBOARD" column="CATEGORY" nullable="FALSE" />
</schemaSpec>
+ <schemaSpec version="2.104">
++ <!-- package types no longer require to be coupled with a resource type. They can exist on their own. -->
++ <schema-alterColumn table="RHQ_PACKAGE_TYPE" column="RESOURCE_TYPE_ID" nullable="true"/>
++ </schemaSpec>
++
++ <schemaSpec version="2.105">
+ <schema-addColumn table="RHQ_REPO" column="OWNER_ID" columnType="INTEGER" />
+ <schema-addColumn table="RHQ_REPO" column="IS_PRIVATE" columnType="BOOLEAN" />
- <schema-alterColumn table="RHQ_REPO" column="IS_PRIVATE" nullable="FALSE" default="TRUE"/>
++ <schema-alterColumn table="RHQ_REPO" column="IS_PRIVATE" nullable="FALSE" default="TRUE"/>
+ <schema-directSQL>
+ <statement desc="Creating OWNER_ID foreign key relation on RHQ_REPO">
+ ALTER TABLE RHQ_REPO
+ ADD CONSTRAINT RHQ_REPO_OWNER_ID_FK
+ FOREIGN KEY (OWNER_ID)
+ REFERENCES RHQ_SUBJECT (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Now add modify the permissions to give all the roles with MANAGE_INVENTORY
+ the new MANAGE_REPOSITORIES privilege so that people's privs remain unchanged. -->
+ <schema-directSQL>
+ <statement>
+ INSERT INTO RHQ_PERMISSION (role_id, operation)
+ SELECT role_id, 15 FROM RHQ_PERMISSION WHERE operation = 1
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
</dbupgrade>
</target>
</project>
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
index e9b9e58,dd66c1b..1ae43ca
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
@@@ -50,7 -50,7 +50,8 @@@ import org.jetbrains.annotations.NotNul
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.content.Repo;
+ import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.resource.group.ResourceGroup;
/**
@@@ -310,9 -310,10 +311,13 @@@ public class Subject implements Seriali
@OneToMany(mappedBy = "subject", fetch = FetchType.LAZY)
private List<ResourceGroup> ownedGroups = null;
+ @OneToMany(mappedBy = "owner", fetch = FetchType.LAZY)
+ private Set<Repo> ownedRepos;
+
+ // When a subject is removed any owned dashboards are removed automatically
+ @OneToMany(mappedBy = "owner", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
+ private List<Dashboard> ownedDashboards = null;
+
@Transient
private Integer sessionId = null;
@@@ -507,6 -508,14 +512,22 @@@
this.ownedGroups = ownedGroups;
}
++ protected Set<Repo> getOwnedrepos(){
++ return ownedRepos;
++ }
++
++ protected void setOwnedRepos(Set<Repo> repos) {
++ ownedRepos = repos;
++ }
++
+ protected List<Dashboard> getOwnedDashboards() {
+ return ownedDashboards;
+ }
+
+ protected void setOwnedDashboards(List<Dashboard> ownedDashboards) {
+ this.ownedDashboards = ownedDashboards;
+ }
+
@Override
public String toString() {
return "Subject[id=" + id + ",name=" + name + "]";
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java
index e9428a4,080d749..d6322a6
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java
@@@ -28,12 -28,9 +28,13 @@@ import com.google.gwt.user.client.rpc.R
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.InstalledPackageHistory;
+import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
+import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
+import org.rhq.core.domain.content.composite.PackageTypeAndVersionFormatComposite;
+import org.rhq.core.domain.criteria.PackageCriteria;
+ import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
import org.rhq.core.domain.util.PageList;
@@@ -47,12 -43,10 +48,14 @@@ public interface ContentGWTService exte
PageList<PackageVersion> findPackageVersionsByCriteria(PackageVersionCriteria criteria) throws RuntimeException;
+ PageList<Package> findPackagesByCriteria(PackageCriteria criteria);
+
+ PageList<PackageAndLatestVersionComposite> findPackagesWithLatestVersion(PackageCriteria criteria);
+
PageList<InstalledPackageHistory> getInstalledPackageHistoryForResource(int resourceId, int count);
+ PageList<InstalledPackageHistory> findInstalledPackageHistoryByCriteria(InstalledPackageHistoryCriteria criteria);
+
List<Architecture> getArchitectures() throws RuntimeException;
PackageType getResourceCreationPackageType(int resourceTypeId) throws RuntimeException;
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java
index 7a66cff,603288e..69c5d20
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java
@@@ -26,13 -26,9 +26,13 @@@ import java.util.List
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.InstalledPackageHistory;
+import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
- import org.rhq.core.domain.content.PackageVersionFormatDescription;
+import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
+import org.rhq.core.domain.content.composite.PackageTypeAndVersionFormatComposite;
+ import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
+import org.rhq.core.domain.criteria.PackageCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
@@@ -73,24 -70,18 +74,35 @@@ public class ContentGWTServiceImpl exte
}
}
+ public PageList<Package> findPackagesByCriteria(PackageCriteria criteria) {
+ try {
+ return SerialUtility.prepare(contentManager.findPackagesByCriteria(getSessionSubject(), criteria),
+ "ContentService.findPackagesByCriteria");
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
++
+ public PageList<InstalledPackageHistory> findInstalledPackageHistoryByCriteria(
+ InstalledPackageHistoryCriteria criteria) throws RuntimeException {
+ try {
+ PageList<InstalledPackageHistory> results = SerialUtility.prepare(contentUiManager
+ .findInstalledPackageHistoryByCriteria(getSessionSubject(), criteria),
+ "ContentService.findInstalledPackageHistoryByCriteria");
+ return results;
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
-
+
+ public PageList<PackageAndLatestVersionComposite> findPackagesWithLatestVersion(PackageCriteria criteria) {
+ try {
+ return SerialUtility.prepare(contentManager.findPackagesWithLatestVersion(getSessionSubject(), criteria),
+ "ContentService.findPackagesByCriteria");
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
-
public PageList<InstalledPackageHistory> getInstalledPackageHistoryForResource(int resourceId, int count)
throws RuntimeException {
try {
commit 239280baebbfa542c60cc6430ae526150ab84398
Merge: 0ca30d0... ef1a25d...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 18:01:30 2011 -0500
Merge commit 'origin/master' into group-config-history
commit 0ca30d011810cfdd624e41cc8316d76e838428e8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 18:01:27 2011 -0500
firs try at group resource config history
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 5770cd3..61bfede 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
@@ -98,7 +98,7 @@ public class LinkManager {
public static String getGroupResourceConfigurationUpdateHistoryLink(int groupId, Integer groupUpdateHistoryId) {
if (groupUpdateHistoryId != null) {
- return getResourceGroupLink(groupId) + "/Configuration/History/" + groupUpdateHistoryId;
+ return getResourceGroupLink(groupId) + "/Configuration/History/" + groupUpdateHistoryId + "/Members";
} else {
return getResourceGroupLink(groupId) + "/Configuration/History";
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index e1757b8..62f9655 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -73,6 +73,9 @@ public interface ConfigurationGWTService extends RemoteService {
List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroup(int groupId)
throws RuntimeException;
+ List<DisambiguationReport<ResourceConfigurationComposite>> findResourceConfigurationsForGroupUpdate(
+ int groupUpdateId) throws RuntimeException;
+
List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroupUpdate(int groupUpdateId)
throws RuntimeException;
@@ -87,6 +90,4 @@ public interface ConfigurationGWTService extends RemoteService {
void deleteGroupResourceConfigurationUpdate(Integer groupId, Integer[] groupResourceConfigUpdateIds)
throws RuntimeException;
-
- //RawConfiguration dummy(RawConfiguration config) throws RuntimeException;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index a137250..9b89dff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -55,6 +55,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
import org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventCompositeHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.GroupResourceConfigurationEditView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.HistoryGroupResourceConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.GroupPluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.HistoryGroupPluginConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.MembersView;
@@ -337,8 +338,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
true, new ViewFactory() {
@Override
public Canvas createView() {
- return new GroupPluginConfigurationEditView(inventoryConn.extendLocatorId("View"),
- groupComposite);
+ return new GroupPluginConfigurationEditView(inventoryConn.extendLocatorId("View"), groupComposite);
}
});
updateSubTab(this.inventoryTab, this.inventoryConnHistory, facets
@@ -397,8 +397,6 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
.contains(ResourceTypeFacet.CONFIGURATION));
Set<Permission> groupPermissions = this.groupComposite.getResourcePermission().getPermissions();
if (updateTab(this.configurationTab, visible, visible && groupPermissions.contains(Permission.CONFIGURE_READ))) {
- //updateSubTab(this.configurationTab, this.configCurrent, new FullHTMLPane(
- // "/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId), true, true);
updateSubTab(this.configurationTab, this.configCurrent, true, true, new ViewFactory() {
@Override
public Canvas createView() {
@@ -408,8 +406,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
updateSubTab(this.configurationTab, this.configHistory, true, true, new ViewFactory() {
@Override
public Canvas createView() {
- return new FullHTMLPane(configHistory.extendLocatorId("View"),
- "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId);
+ return new HistoryGroupResourceConfigurationView(inventoryConnHistory.extendLocatorId("View"),
+ groupComposite);
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java
new file mode 100644
index 0000000..99fd567
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java
@@ -0,0 +1,245 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import java.util.Date;
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * Shows a table of individual resource members that belonged to the group when the group configuration was updated.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryGroupResourceConfigurationMembers extends LocatableVLayout {
+ private final ResourceGroup group;
+ private final ResourcePermission groupPerms;
+ private final int groupUpdateId;
+
+ public HistoryGroupResourceConfigurationMembers(String locatorId, ResourceGroupComposite groupComposite,
+ int updateId) {
+ super(locatorId);
+ this.group = groupComposite.getResourceGroup();
+ this.groupPerms = groupComposite.getResourcePermission();
+ this.groupUpdateId = updateId;
+
+ setMargin(5);
+ setMembersMargin(5);
+ String backPath = LinkManager.getGroupResourceConfigurationUpdateHistoryLink(this.group.getId(), null);
+ BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
+ backPath);
+ addMember(backButton);
+
+ MembersTable table = new MembersTable(extendLocatorId("Table"));
+ addMember(table);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ }
+
+ private class MembersTable extends Table<MembersTable.DataSource> {
+ public MembersTable(String locatorId) {
+ super(locatorId, MSG.view_group_resConfig_members_title());
+ setDataSource(new DataSource());
+ }
+
+ @Override
+ protected void configureTable() {
+ ListGridField fieldResource = new ListGridField(DataSource.Field.RESOURCELINK, MSG.common_title_resource());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG
+ .common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG
+ .common_title_lastUpdated());
+ ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
+ ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
+
+ fieldResource.setWidth("*");
+ fieldDateCreated.setWidth("15%");
+ fieldLastUpdated.setWidth("15%");
+ fieldStatus.setWidth("10%");
+ fieldUser.setWidth("10%");
+
+ fieldResource.setType(ListGridFieldType.LINK);
+ fieldResource.setTarget("_self");
+
+ fieldStatus.setType(ListGridFieldType.ICON);
+ HashMap<String, String> statusIcons = new HashMap<String, String>(4);
+ statusIcons.put(ConfigurationUpdateStatus.SUCCESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.SUCCESS));
+ statusIcons.put(ConfigurationUpdateStatus.FAILURE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.FAILURE));
+ statusIcons.put(ConfigurationUpdateStatus.INPROGRESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.INPROGRESS));
+ statusIcons.put(ConfigurationUpdateStatus.NOCHANGE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.NOCHANGE));
+ fieldStatus.setValueIcons(statusIcons);
+ fieldStatus.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ new ErrorMessageWindow("statusDetailsWin", MSG.view_group_resConfig_members_statusDetails(),
+ "<pre>" + getStatusHtmlString(event.getRecord()) + "</pre>").show();
+ }
+ });
+ fieldStatus.setShowHover(true);
+ fieldStatus.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String html = getStatusHtmlString(record);
+ if (html.length() > 80) {
+ // this was probably an error stack trace, snip it so the tooltip isn't too big
+ html = "<pre>" + html.substring(0, 80) + "...</pre><p>"
+ + MSG.view_group_resConfig_table_clickStatusIcon() + "</p>";
+ }
+ return html;
+ }
+ });
+
+ ListGrid listGrid = getListGrid();
+ listGrid.setFields(fieldResource, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
+ listGrid.setLinkTextProperty(DataSource.Field.RESOURCENAME);
+ }
+
+ private String getStatusHtmlString(Record record) {
+ String html = null;
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record
+ .getAttributeAsObject(DataSource.Field.OBJECT);
+ switch (obj.getStatus()) {
+ case SUCCESS: {
+ html = MSG.view_group_resConfig_members_statusSuccess();
+ break;
+ }
+ case INPROGRESS: {
+ html = MSG.view_group_resConfig_members_statusInprogress();
+ break;
+ }
+ case NOCHANGE: {
+ html = MSG.view_group_resConfig_members_statusNochange();
+ break;
+ }
+ case FAILURE: {
+ html = obj.getErrorMessage();
+ if (html == null) {
+ html = MSG.view_group_resConfig_members_statusFailure();
+ }
+ break;
+ }
+ }
+ return html;
+ }
+
+ private class DataSource extends RPCDataSource<ResourceConfigurationUpdate> {
+
+ public class Field {
+ public static final String ID = "id";
+ public static final String RESOURCELINK = "resourceLink";
+ public static final String RESOURCENAME = "resourceName";
+ public static final String DATECREATED = "dateCreated";
+ public static final String LASTUPDATED = "lastUpdated";
+ public static final String STATUS = "status";
+ public static final String USER = "user";
+ public static final String OBJECT = "object";
+ }
+
+ @Override
+ public ResourceConfigurationUpdate copyValues(Record from) {
+ return (ResourceConfigurationUpdate) from.getAttributeAsObject(Field.OBJECT);
+ }
+
+ @Override
+ public ListGridRecord copyValues(ResourceConfigurationUpdate from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.RESOURCELINK, LinkManager.getResourceLink(from.getResource().getId()));
+ record.setAttribute(Field.RESOURCENAME, from.getResource().getName());
+ record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(Field.USER, from.getSubjectName());
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+
+ record.setAttribute(Field.OBJECT, from);
+
+ return record;
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+ ResourceConfigurationUpdateCriteria criteria = new ResourceConfigurationUpdateCriteria();
+ criteria
+ .addFilterGroupConfigurationUpdateId(HistoryGroupResourceConfigurationMembers.this.groupUpdateId);
+ // TODO need to disambiguate resources
+ criteria.fetchResource(true);
+
+ configurationService.findResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
+
+ @Override
+ public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_resConfig_members_fetchFailure(String
+ .valueOf(HistoryGroupResourceConfigurationMembers.this.groupUpdateId)), caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationSettings.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationSettings.java
new file mode 100644
index 0000000..375183a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationSettings.java
@@ -0,0 +1,150 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * Read only view that shows group resource configuration properties. These are properties
+ * that are common across all members of the group.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryGroupResourceConfigurationSettings extends LocatableVLayout {
+ private final ResourceGroup group;
+ private final ResourcePermission groupPerms;
+ private final int groupUpdateId;
+ private ConfigurationDefinition configurationDefinition;
+ private List<GroupMemberConfiguration> memberConfigurations;
+ private GroupConfigurationEditor editor;
+
+ public HistoryGroupResourceConfigurationSettings(String locatorId, ResourceGroupComposite groupComposite,
+ int updateId) {
+ super(locatorId);
+ this.group = groupComposite.getResourceGroup();
+ this.groupPerms = groupComposite.getResourcePermission();
+ this.groupUpdateId = updateId;
+
+ setMargin(5);
+ setMembersMargin(5);
+ String backPath = LinkManager.getGroupResourceConfigurationUpdateHistoryLink(this.group.getId(), null);
+ BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
+ backPath);
+ addMember(backButton);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ if (this.groupPerms.isInventory()) {
+ loadConfigurationDefinition();
+ loadConfigurations();
+ } else {
+ CoreGUI.getMessageCenter().notify(new Message(MSG.view_group_resConfig_view_noperm()));
+ }
+ }
+
+ private void initEditor() {
+ if (this.configurationDefinition != null && this.memberConfigurations != null) {
+ this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
+ this.memberConfigurations);
+ this.editor.setEditorTitle(MSG.view_group_resConfig_view_groupProperties() + " - " + this.groupUpdateId);
+ this.editor.setOverflow(Overflow.AUTO);
+ this.editor.setReadOnly(true);
+ addMember(this.editor);
+ }
+ }
+
+ private void loadConfigurationDefinition() {
+ if (this.configurationDefinition == null) {
+ final ResourceType type = this.group.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(Map<Integer, ResourceType> types) {
+ configurationDefinition = types.get(type.getId()).getResourceConfigurationDefinition();
+ if (configurationDefinition == null) {
+ throw new IllegalStateException("Resource configuration is not supported by this group.");
+ }
+ initEditor();
+ }
+ });
+ }
+ }
+
+ private void loadConfigurations() {
+ this.memberConfigurations = null;
+ GWTServiceLookup.getConfigurationService().findResourceConfigurationsForGroupUpdate(groupUpdateId,
+ new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
+ public void onFailure(Throwable caught) {
+ if (caught.getMessage().contains("ConfigurationUpdateStillInProgressException")) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_resConfig_members_fetchFailureConfigInProgress(), caught,
+ Severity.Info));
+ } else {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_resConfig_members_fetchFailureConfig(group.toString()), caught);
+ }
+ }
+
+ public void onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results) {
+ memberConfigurations = new ArrayList<GroupMemberConfiguration>(results.size());
+ for (DisambiguationReport<ResourceConfigurationComposite> result : results) {
+ int resourceId = result.getOriginal().getResourceId();
+ String label = ReportDecorator.decorateDisambiguationReport(result, resourceId, false);
+ Configuration configuration = result.getOriginal().getConfiguration();
+ GroupMemberConfiguration memberConfiguration = new GroupMemberConfiguration(resourceId, label,
+ configuration);
+ if (configuration == null || configuration.getProperties().isEmpty()) {
+ throw new RuntimeException(
+ "One or more null or empty member resource configurations was returned by the Server.");
+ }
+ memberConfigurations.add(memberConfiguration);
+ }
+ initEditor();
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
new file mode 100644
index 0000000..38174c8
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
@@ -0,0 +1,276 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
+import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * Table showing group resource configuration history.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryGroupResourceConfigurationTable extends Table<HistoryGroupResourceConfigurationTable.DataSource> {
+ private final ResourceGroup group;
+ private final ResourcePermission groupPerms;
+
+ public HistoryGroupResourceConfigurationTable(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId, MSG.view_group_resConfig_table_title());
+ this.group = groupComposite.getResourceGroup();
+ this.groupPerms = groupComposite.getResourcePermission();
+
+ setDataSource(new DataSource());
+ }
+
+ @Override
+ protected void configureTable() {
+ ListGridField fieldId = new ListGridField(DataSource.Field.ID, MSG.common_title_version());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG.common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG.common_title_lastUpdated());
+ ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
+ ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
+
+ fieldId.setWidth("10%");
+ fieldDateCreated.setWidth("35%");
+ fieldLastUpdated.setWidth("35%");
+ fieldStatus.setWidth("10%");
+ fieldUser.setWidth("*");
+
+ fieldStatus.setType(ListGridFieldType.ICON);
+ HashMap<String, String> statusIcons = new HashMap<String, String>(4);
+ statusIcons.put(ConfigurationUpdateStatus.SUCCESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.SUCCESS));
+ statusIcons.put(ConfigurationUpdateStatus.FAILURE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.FAILURE));
+ statusIcons.put(ConfigurationUpdateStatus.INPROGRESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.INPROGRESS));
+ statusIcons.put(ConfigurationUpdateStatus.NOCHANGE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.NOCHANGE));
+ fieldStatus.setValueIcons(statusIcons);
+ fieldStatus.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ new ErrorMessageWindow("errWin", MSG.common_title_error(), getStatusHtmlString(event.getRecord()))
+ .show();
+ }
+ });
+ fieldStatus.setShowHover(true);
+ fieldStatus.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String html = getStatusHtmlString(record);
+ return html;
+ }
+ });
+
+ ListGrid listGrid = getListGrid();
+ listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
+
+ addTableAction(extendLocatorId("deleteAction"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ new AbstractTableAction(this.groupPerms.isInventory() ? TableActionEnablement.ANY
+ : TableActionEnablement.NEVER) {
+
+ @Override
+ public void executeAction(final ListGridRecord[] selection, Object actionValue) {
+ if (selection == null || selection.length == 0) {
+ return;
+ }
+
+ ConfigurationGWTServiceAsync service = GWTServiceLookup.getConfigurationService();
+ Integer groupId = HistoryGroupResourceConfigurationTable.this.group.getId();
+ Integer[] updateIds = new Integer[selection.length];
+ int i = 0;
+ for (ListGridRecord record : selection) {
+ updateIds[i++] = record.getAttributeAsInt(DataSource.Field.ID);
+ }
+
+ service.deleteGroupResourceConfigurationUpdate(groupId, updateIds, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ refresh();
+ Message message = new Message(MSG.view_group_resConfig_table_deleteSuccessful(String
+ .valueOf(selection.length)), Message.Severity.Info, EnumSet.of(
+ Message.Option.Transient, Message.Option.Sticky));
+ CoreGUI.getMessageCenter().notify(message);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_group_resConfig_table_deleteFailure(),
+ caught);
+ }
+ });
+ }
+ });
+
+ addTableAction(extendLocatorId("viewSettingsAction"), MSG.view_group_resConfig_table_viewSettings(),
+ new AbstractTableAction(TableActionEnablement.SINGLE) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ CoreGUI.goToView(LinkManager.getGroupResourceConfigurationUpdateHistoryLink(
+ HistoryGroupResourceConfigurationTable.this.group.getId(), null)
+ + "/" + selection[0].getAttribute(DataSource.Field.ID) + "/Settings");
+ }
+ });
+
+ addTableAction(extendLocatorId("viewMemberHistoryAction"), MSG.view_group_resConfig_table_viewMemberHistory(),
+ new AbstractTableAction(TableActionEnablement.SINGLE) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ CoreGUI.goToView(LinkManager.getGroupResourceConfigurationUpdateHistoryLink(
+ HistoryGroupResourceConfigurationTable.this.group.getId(), null)
+ + "/" + selection[0].getAttribute(DataSource.Field.ID) + "/Members");
+ }
+ });
+
+ }
+
+ private String getStatusHtmlString(Record record) {
+ String html = null;
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record
+ .getAttributeAsObject(DataSource.Field.OBJECT);
+ switch (obj.getStatus()) {
+ case SUCCESS: {
+ html = MSG.view_group_resConfig_table_statusSuccess();
+ break;
+ }
+ case INPROGRESS: {
+ html = "<p>" + MSG.view_group_resConfig_table_statusInprogress() + "</p><p>"
+ + MSG.view_group_resConfig_table_msg1() + "</p>";
+ break;
+ }
+ case NOCHANGE: {
+ html = MSG.view_group_resConfig_table_statusNochange();
+ break;
+ }
+ case FAILURE: {
+ html = obj.getErrorMessage();
+ if (html == null) {
+ html = "<p>" + MSG.view_group_resConfig_table_statusFailure() + "</p><p>"
+ + MSG.view_group_resConfig_table_msg1() + "</p>";
+ } else {
+ if (html.length() > 80) {
+ // this was probably an error stack trace, snip it so the tooltip isn't too big
+ html = "<pre>" + html.substring(0, 80) + "...</pre><p>"
+ + MSG.view_group_resConfig_table_clickStatusIcon() + "</p>";
+ } else {
+ html = "<pre>" + html + "</pre>";
+ }
+ html = html + "<p>" + MSG.view_group_resConfig_table_msg1() + "</p>";
+ }
+ break;
+ }
+ }
+ return html;
+ }
+
+ class DataSource extends RPCDataSource<GroupResourceConfigurationUpdate> {
+
+ public class Field {
+ public static final String ID = "id";
+ public static final String DATECREATED = "dateCreated";
+ public static final String LASTUPDATED = "lastUpdated";
+ public static final String STATUS = "status";
+ public static final String USER = "user";
+ public static final String OBJECT = "object";
+ }
+
+ @Override
+ public GroupResourceConfigurationUpdate copyValues(Record from) {
+ return (GroupResourceConfigurationUpdate) from.getAttributeAsObject(DataSource.Field.OBJECT);
+ }
+
+ @Override
+ public ListGridRecord copyValues(GroupResourceConfigurationUpdate from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+ record.setAttribute(Field.USER, from.getSubjectName());
+
+ record.setAttribute(Field.OBJECT, from);
+
+ return record;
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+ GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();
+ ArrayList<Integer> groupList = new ArrayList<Integer>(1);
+ groupList.add(HistoryGroupResourceConfigurationTable.this.group.getId());
+ criteria.addFilterResourceGroupIds(groupList);
+
+ configurationService.findGroupResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<GroupResourceConfigurationUpdate>>() {
+
+ @Override
+ public void onSuccess(PageList<GroupResourceConfigurationUpdate> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_group_resConfig_table_failFetch(), caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationView.java
new file mode 100644
index 0000000..0d8b76a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationView.java
@@ -0,0 +1,86 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import com.smartgwt.client.widgets.Canvas;
+
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A view for group resource configuration history.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryGroupResourceConfigurationView extends LocatableVLayout implements BookmarkableView {
+ private final ResourceGroupComposite groupComposite;
+ private HistoryGroupResourceConfigurationTable groupHistoryTable;
+ private Canvas detailsCanvas = null;
+
+ public HistoryGroupResourceConfigurationView(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
+ this.groupComposite = groupComposite;
+
+ groupHistoryTable = new HistoryGroupResourceConfigurationTable(extendLocatorId("Table"), groupComposite);
+ addMember(groupHistoryTable);
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ if (viewPath.isEnd()) {
+ setVisibleMember(this.groupHistoryTable);
+ } else {
+ // the details view can be one of two: the "Settings" view which shows the group config properties themselves
+ // or "Members" view which shows a tabular set of data, one history row for each individual resource in the group
+ // the syntax is "/#####/{Settings,Members}" where ##### is the group history ID
+ int groupHistoryId = viewPath.getCurrentAsInt();
+ viewPath.next();
+ boolean configView = false;
+ if (viewPath.isEnd()) {
+ configView = true; // if nothing follows the ID, the default view to show is the config properties
+ } else {
+ String currentPath = viewPath.getCurrent().getPath();
+ if ("Settings".equals(currentPath)) { // do not i18n this string, its a URL fragment
+ configView = true;
+ } else if ("Members".equals(currentPath)) { // do not i18n this string, its a URL fragment
+ configView = false;
+ } else {
+ throw new IllegalArgumentException("Cannot render page - invalid URL: " + currentPath);
+ }
+ }
+
+ if (detailsCanvas != null) {
+ removeMember(detailsCanvas);
+ this.detailsCanvas.destroy();
+ }
+
+ if (configView) {
+ detailsCanvas = new HistoryGroupResourceConfigurationSettings(extendLocatorId("SettingsView"),
+ this.groupComposite, groupHistoryId);
+ } else {
+ detailsCanvas = new HistoryGroupResourceConfigurationMembers(extendLocatorId("MembersView"),
+ this.groupComposite, groupHistoryId);
+ }
+ addMember(detailsCanvas);
+ setVisibleMember(detailsCanvas);
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
index b7ca5fc..2af2fcf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
@@ -26,10 +26,6 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -46,6 +42,7 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
@@ -53,12 +50,10 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
- * Shows a table of individual resource members that belonged to the group when the group plugin configuration was updated.
+ * Shows a table of individual resource members that belonged to the group when the group configuration was updated.
*
* @author John Mazzitelli
*/
@@ -89,7 +84,7 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
super.onDraw();
}
- private class MembersTable extends Table {
+ private class MembersTable extends Table<MembersTable.DataSource> {
public MembersTable(String locatorId) {
super(locatorId, MSG.view_group_pluginConfig_members_title());
setDataSource(new DataSource());
@@ -97,17 +92,19 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
@Override
protected void configureTable() {
- ListGridField fieldResource = new ListGridField("resourceLink", MSG.common_title_resource());
- ListGridField fieldDateCreated = new ListGridField("dateCreated", MSG.common_title_dateCreated());
- ListGridField fieldLastUpdated = new ListGridField("lastUpdated", MSG.common_title_lastUpdated());
- ListGridField fieldUser = new ListGridField("user", MSG.common_title_user());
- ListGridField fieldStatus = new ListGridField("status", MSG.common_title_status());
+ ListGridField fieldResource = new ListGridField(DataSource.Field.RESOURCELINK, MSG.common_title_resource());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG
+ .common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG
+ .common_title_lastUpdated());
+ ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
+ ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
fieldResource.setWidth("*");
fieldDateCreated.setWidth("15%");
fieldLastUpdated.setWidth("15%");
- fieldUser.setWidth("10%");
fieldStatus.setWidth("10%");
+ fieldUser.setWidth("10%");
fieldResource.setType(ListGridFieldType.LINK);
fieldResource.setTarget("_self");
@@ -126,34 +123,8 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
fieldStatus.addRecordClickHandler(new RecordClickHandler() {
@Override
public void onRecordClick(RecordClickEvent event) {
- final Window winModal = new LocatableWindow(HistoryGroupPluginConfigurationMembers.this
- .extendLocatorId("statusDetailsWin"));
- winModal.setTitle(MSG.view_group_pluginConfig_members_statusDetails());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setShowMaximizeButton(true);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setAutoSize(true);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- LocatableHTMLPane htmlPane = new LocatableHTMLPane(HistoryGroupPluginConfigurationMembers.this
- .extendLocatorId("statusDetailsPane"));
- htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(500);
- htmlPane.setDefaultHeight(400);
- htmlPane.setContents("<pre>" + getStatusHtmlString(event.getRecord()) + "</pre>");
- winModal.addItem(htmlPane);
- winModal.show();
+ new ErrorMessageWindow("statusDetailsWin", MSG.view_group_pluginConfig_members_statusDetails(),
+ "<pre>" + getStatusHtmlString(event.getRecord()) + "</pre>").show();
}
});
fieldStatus.setShowHover(true);
@@ -171,15 +142,14 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
});
ListGrid listGrid = getListGrid();
- listGrid.setFields(fieldResource, fieldDateCreated, fieldLastUpdated, fieldUser, fieldStatus);
-
- listGrid.setLinkTextProperty("resourceName");
-
+ listGrid.setFields(fieldResource, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
+ listGrid.setLinkTextProperty(DataSource.Field.RESOURCENAME);
}
private String getStatusHtmlString(Record record) {
String html = null;
- AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record.getAttributeAsObject("object");
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record
+ .getAttributeAsObject(DataSource.Field.OBJECT);
switch (obj.getStatus()) {
case SUCCESS: {
html = MSG.view_group_pluginConfig_members_statusSuccess();
@@ -206,24 +176,35 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
private class DataSource extends RPCDataSource<PluginConfigurationUpdate> {
+ public class Field {
+ public static final String ID = "id";
+ public static final String RESOURCELINK = "resourceLink";
+ public static final String RESOURCENAME = "resourceName";
+ public static final String DATECREATED = "dateCreated";
+ public static final String LASTUPDATED = "lastUpdated";
+ public static final String STATUS = "status";
+ public static final String USER = "user";
+ public static final String OBJECT = "object";
+ }
+
@Override
public PluginConfigurationUpdate copyValues(Record from) {
- return (PluginConfigurationUpdate) from.getAttributeAsObject("object");
+ return (PluginConfigurationUpdate) from.getAttributeAsObject(Field.OBJECT);
}
@Override
public ListGridRecord copyValues(PluginConfigurationUpdate from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("resourceLink", LinkManager.getResourceLink(from.getResource().getId()));
- record.setAttribute("resourceName", from.getResource().getName());
- record.setAttribute("dateCreated", new Date(from.getCreatedTime()));
- record.setAttribute("lastUpdated", new Date(from.getModifiedTime()));
- record.setAttribute("user", from.getSubjectName());
- record.setAttribute("status", from.getStatus().name());
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.RESOURCELINK, LinkManager.getResourceLink(from.getResource().getId()));
+ record.setAttribute(Field.RESOURCENAME, from.getResource().getName());
+ record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(Field.USER, from.getSubjectName());
+ record.setAttribute(Field.STATUS, from.getStatus().name());
- record.setAttribute("object", from);
+ record.setAttribute(Field.OBJECT, from);
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
index e4d5c78..fe975f2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
@@ -28,10 +28,6 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -48,6 +44,7 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
@@ -57,15 +54,13 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* Table showing group plugin configuration history.
*
* @author John Mazzitelli
*/
-public class HistoryGroupPluginConfigurationTable extends Table {
+public class HistoryGroupPluginConfigurationTable extends Table<HistoryGroupPluginConfigurationTable.DataSource> {
private final ResourceGroup group;
private final ResourcePermission groupPerms;
@@ -79,17 +74,17 @@ public class HistoryGroupPluginConfigurationTable extends Table {
@Override
protected void configureTable() {
- ListGridField fieldId = new ListGridField("id", MSG.common_title_version());
- ListGridField fieldDateCreated = new ListGridField("dateCreated", MSG.common_title_dateCreated());
- ListGridField fieldLastUpdated = new ListGridField("lastUpdated", MSG.common_title_lastUpdated());
- ListGridField fieldUser = new ListGridField("user", MSG.common_title_user());
- ListGridField fieldStatus = new ListGridField("status", MSG.common_title_status());
+ ListGridField fieldId = new ListGridField(DataSource.Field.ID, MSG.common_title_version());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG.common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG.common_title_lastUpdated());
+ ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
+ ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
fieldId.setWidth("10%");
fieldDateCreated.setWidth("35%");
fieldLastUpdated.setWidth("35%");
- fieldUser.setWidth("*");
fieldStatus.setWidth("10%");
+ fieldUser.setWidth("*");
fieldStatus.setType(ListGridFieldType.ICON);
HashMap<String, String> statusIcons = new HashMap<String, String>(4);
@@ -105,34 +100,8 @@ public class HistoryGroupPluginConfigurationTable extends Table {
fieldStatus.addRecordClickHandler(new RecordClickHandler() {
@Override
public void onRecordClick(RecordClickEvent event) {
- final Window winModal = new LocatableWindow(HistoryGroupPluginConfigurationTable.this
- .extendLocatorId("statusDetailsWin"));
- winModal.setTitle(MSG.view_group_pluginConfig_table_statusDetails());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setShowMaximizeButton(true);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setAutoSize(true);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- LocatableHTMLPane htmlPane = new LocatableHTMLPane(HistoryGroupPluginConfigurationTable.this
- .extendLocatorId("statusDetailsPane"));
- htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(500);
- htmlPane.setDefaultHeight(400);
- htmlPane.setContents(getStatusHtmlString(event.getRecord()));
- winModal.addItem(htmlPane);
- winModal.show();
+ new ErrorMessageWindow("errWin", MSG.common_title_error(), getStatusHtmlString(event.getRecord()))
+ .show();
}
});
fieldStatus.setShowHover(true);
@@ -145,7 +114,7 @@ public class HistoryGroupPluginConfigurationTable extends Table {
});
ListGrid listGrid = getListGrid();
- listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldUser, fieldStatus);
+ listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
addTableAction(extendLocatorId("deleteAction"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
new AbstractTableAction(this.groupPerms.isInventory() ? TableActionEnablement.ANY
@@ -162,7 +131,7 @@ public class HistoryGroupPluginConfigurationTable extends Table {
Integer[] updateIds = new Integer[selection.length];
int i = 0;
for (ListGridRecord record : selection) {
- updateIds[i++] = record.getAttributeAsInt("id");
+ updateIds[i++] = record.getAttributeAsInt(DataSource.Field.ID);
}
service.deleteGroupPluginConfigurationUpdate(groupId, updateIds, new AsyncCallback<Void>() {
@@ -190,7 +159,7 @@ public class HistoryGroupPluginConfigurationTable extends Table {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
CoreGUI.goToView(LinkManager.getGroupPluginConfigurationUpdateHistoryLink(
HistoryGroupPluginConfigurationTable.this.group.getId(), null)
- + "/" + selection[0].getAttribute("id") + "/Settings");
+ + "/" + selection[0].getAttribute(DataSource.Field.ID) + "/Settings");
}
});
@@ -200,7 +169,7 @@ public class HistoryGroupPluginConfigurationTable extends Table {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
CoreGUI.goToView(LinkManager.getGroupPluginConfigurationUpdateHistoryLink(
HistoryGroupPluginConfigurationTable.this.group.getId(), null)
- + "/" + selection[0].getAttribute("id") + "/Members");
+ + "/" + selection[0].getAttribute(DataSource.Field.ID) + "/Members");
}
});
@@ -208,7 +177,8 @@ public class HistoryGroupPluginConfigurationTable extends Table {
private String getStatusHtmlString(Record record) {
String html = null;
- AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record.getAttributeAsObject("object");
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record
+ .getAttributeAsObject(DataSource.Field.OBJECT);
switch (obj.getStatus()) {
case SUCCESS: {
html = MSG.view_group_pluginConfig_table_statusSuccess();
@@ -244,24 +214,33 @@ public class HistoryGroupPluginConfigurationTable extends Table {
return html;
}
- private class DataSource extends RPCDataSource<GroupPluginConfigurationUpdate> {
+ class DataSource extends RPCDataSource<GroupPluginConfigurationUpdate> {
+
+ public class Field {
+ public static final String ID = "id";
+ public static final String DATECREATED = "dateCreated";
+ public static final String LASTUPDATED = "lastUpdated";
+ public static final String STATUS = "status";
+ public static final String USER = "user";
+ public static final String OBJECT = "object";
+ }
@Override
public GroupPluginConfigurationUpdate copyValues(Record from) {
- return (GroupPluginConfigurationUpdate) from.getAttributeAsObject("object");
+ return (GroupPluginConfigurationUpdate) from.getAttributeAsObject(DataSource.Field.OBJECT);
}
@Override
public ListGridRecord copyValues(GroupPluginConfigurationUpdate from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("dateCreated", new Date(from.getCreatedTime()));
- record.setAttribute("lastUpdated", new Date(from.getModifiedTime()));
- record.setAttribute("user", from.getSubjectName());
- record.setAttribute("status", from.getStatus().name());
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+ record.setAttribute(Field.USER, from.getSubjectName());
- record.setAttribute("object", from);
+ record.setAttribute(Field.OBJECT, from);
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index e30b1f1..336206b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -278,11 +278,31 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
@Override
+ public List<DisambiguationReport<ResourceConfigurationComposite>> findResourceConfigurationsForGroupUpdate(
+ int groupUpdateId) throws RuntimeException {
+ try {
+ Map<Integer, Configuration> configurations = this.configurationManager
+ .getResourceConfigurationMapForGroupUpdate(getSessionSubject(), groupUpdateId);
+ List<ResourceConfigurationComposite> configurationComposites = convertToCompositesList(configurations);
+
+ // Disambiguate - i.e. generate unambiguous Resource names for each of the Resource id's.
+ List<DisambiguationReport<ResourceConfigurationComposite>> disambiguatedConfigurationComposites = resourceManager
+ .disambiguate(configurationComposites, RESOURCE_CONFIGURATION_COMPOSITE_RESOURCE_ID_EXTRACTOR,
+ DefaultDisambiguationUpdateStrategies.getDefault());
+
+ return SerialUtility.prepare(disambiguatedConfigurationComposites,
+ "ConfigurationService.findResourceConfigurationsForGroupUpdate");
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ @Override
public List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroupUpdate(
int groupUpdateId) throws RuntimeException {
try {
Map<Integer, Configuration> configurations = this.configurationManager
- .getPluginConfigurationMapForGroupUpdate(groupUpdateId);
+ .getPluginConfigurationMapForGroupUpdate(getSessionSubject(), groupUpdateId);
List<ResourceConfigurationComposite> configurationComposites = convertToCompositesList(configurations);
// Disambiguate - i.e. generate unambiguous Resource names for each of the Resource id's.
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 f6d806d..d6db964 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
@@ -1733,6 +1733,32 @@ view_group_resConfig_edit_saveInitiated_full = The group configuration updates h
view_group_resConfig_edit_saveFailure = Failed to initiate group configuration update for [{0}] compatible group named [{1}]
view_group_resConfig_edit_valid = All configuration properties have valid values, so the configuration can now be saved
view_group_resConfig_edit_invalid = The following configuration properties have invalid values and must be corrected before the configuration can be saved: [{0}]
+
+view_group_resConfig_view_noperm = You do not have permissions to see the resource configuration settings
+view_group_resConfig_view_groupProperties = Group Properties
+view_group_resConfig_table_title = Group Resource Configuration History
+view_group_resConfig_table_statusDetails = Status Details
+view_group_resConfig_table_viewSettings = View Settings
+view_group_resConfig_table_viewMemberHistory = View Member History
+view_group_resConfig_table_msg1 = View Member History for status of each individual resource
+view_group_resConfig_table_failFetch = Failed to get group resource config history
+view_group_resConfig_table_deleteSuccessful = You have deleted [{0}] history items
+view_group_resConfig_table_deleteFailure = Failed to delete group resource config history
+view_group_resConfig_table_statusSuccess = This group configuration update was successful
+view_group_resConfig_table_statusInprogress = This group configuration update is still in progress
+view_group_resConfig_table_statusNochange = No changes were made to this group configuration
+view_group_resConfig_table_statusFailure = This group configuration update failed
+view_group_resConfig_table_clickStatusIcon = Click the status icon for full details
+view_group_resConfig_members_title = Group Resource Configuration Member Histories
+view_group_resConfig_members_fetchFailure = Failed to get resource config update history for members of group [{0}]
+view_group_resConfig_members_fetchFailureConfig = Failed to retrieve member resource configuration settings for [{0}]
+view_group_resConfig_members_fetchFailureConfigInProgress = A group resource configuration update is currently in progress. You must wait until the update is finished before you can view the group settings.
+view_group_resConfig_members_statusDetails = Status Details
+view_group_resConfig_members_statusSuccess = This configuration update was successful
+view_group_resConfig_members_statusInprogress = This configuration update is still in progress
+view_group_resConfig_members_statusNochange = No changes were made to this configuration
+view_group_resConfig_members_statusFailure = This configuration update failed for an unknown reason
+
view_group_pluginConfig_view_noperm = You do not have permissions to see the connection settings
view_group_pluginConfig_view_groupProperties = Group Properties
view_group_pluginConfig_table_failFetch = Failed to get group plugin config history
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java
index 5f3229d..dd463a3 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java
@@ -22,14 +22,14 @@ import java.util.Map;
import javax.faces.model.DataModel;
-import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.core.gui.configuration.propset.ConfigurationSet;
+import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.common.framework.PagedDataTableUIBean;
import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
@@ -39,7 +39,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class ViewGroupConnectionPropertyDetailsUIBean extends PagedDataTableUIBean {
public static final String MANAGED_BEAN_NAME = "ViewGroupConnectionPropertyDetailsUIBean";
- public static final String VIEW_ID = "/rhq/group/inventory/view-plugin-configuration-update-details.xhtml";
+ public static final String VIEW_ID = "/rhq/group/inventory/view-plugin-configuration-update-details.xhtml";
private ResourceGroup resourceGroup;
private Map<Integer, Configuration> pluginConfigurations;
@@ -63,8 +63,8 @@ public class ViewGroupConnectionPropertyDetailsUIBean extends PagedDataTableUIBe
ResourceGroup group = EnterpriseFacesContextUtility.getResourceGroup();
int groupPluginConfigurationUpdateId = getPluginResourceConfigurationUpdateId();
- this.pluginConfigurations = this.configurationManager
- .getPluginConfigurationMapForGroupUpdate(groupPluginConfigurationUpdateId);
+ this.pluginConfigurations = this.configurationManager.getPluginConfigurationMapForGroupUpdate(subject,
+ groupPluginConfigurationUpdateId);
this.configurationSet = GroupPluginConfigurationUtility.buildConfigurationSet(subject, group,
this.pluginConfigurations);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 1552162..41c2a58 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -1801,9 +1801,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
groupIdParameter);
}
- // TODO: THIS NEEDS AUTHZ CHECK!
@SuppressWarnings("unchecked")
- public Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Integer groupPluginConfigurationUpdateId) {
+ public Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Subject subject,
+ Integer groupPluginConfigurationUpdateId) {
+ // this method will perform the CONFIGURE_READ security check for us, no need to keep reference to result
+ getGroupPluginConfigurationUpdate(subject, groupPluginConfigurationUpdateId);
+
Tuple<String, Object> groupIdParameter = new Tuple<String, Object>("groupConfigurationUpdateId",
groupPluginConfigurationUpdateId);
return executeGetConfigurationMapQuery(Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_UPDATE_ID, 100,
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index 018b6eb..29e1cb1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -415,7 +415,8 @@ public interface ConfigurationManagerLocal {
Map<Integer, Configuration> getPluginConfigurationsForCompatibleGroup(Subject subject, int groupId)
throws ConfigurationUpdateStillInProgressException, Exception;
- Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Integer groupPluginConfigurationUpdateId);
+ Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Subject subject,
+ Integer groupPluginConfigurationUpdateId);
/**
* The purpose of this method is really to clean up requests when we detect
commit ef1a25db284b1ac680f611fbef4426b53e4b8d10
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 1 17:16:39 2011 -0500
Width Handling for Dashboards
- Fix a problem with Dashboard width specification. It seems there is a
Smartgwt javascript issue with, minimally, single String varargs array
handling. Accessing varargs[0] was unreliable. In dev mode this was
more tolerant but the javascript failed silently. Watch out for potential
issues using varargs.
- Added the ability to dragResize widths for dash columns
- Dashboard save() now persists column widths on each save operation
- Now allow independent scrolling of dash columns. This allows a user to
view any portlet combination across the columns.
- Added some null protection in Dashboard getColumns and getColumnWidths.
- played with borders, margins, etc to tweak reals estate and make drag
easier.
- Removed a bunch of debug message center notifications
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
index 622bd28..4c061fb 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
@@ -171,7 +171,7 @@ public class Dashboard implements Serializable {
}
public int getColumns() {
- return configuration.getSimple(CFG_COLUMNS).getIntegerValue();
+ return Integer.valueOf(configuration.getSimpleValue(CFG_COLUMNS, "1"));
}
public void setColumns(int columns) {
@@ -179,7 +179,7 @@ public class Dashboard implements Serializable {
}
public String[] getColumnWidths() {
- return configuration.getSimple(CFG_WIDTHS).getStringValue().split(",");
+ return configuration.getSimpleValue(CFG_WIDTHS, "").split(",");
}
public void setColumnWidths(String... columnWidths) {
@@ -187,11 +187,17 @@ public class Dashboard implements Serializable {
return;
}
- String widths = columnWidths[0];
+ // note - this impl is a little verbose but it avoids a smartgwt javascript problem with
+ // varargs handling. Not sure how bad the problem is but it definitely occured with SmartGwt 2.4
+ // when a single String was pssed as the varArg list. Be wary of directly using varargs array
+ // element 0...
+ StringBuilder sb = new StringBuilder();
+ sb.append(columnWidths[0]);
for (int i = 1; i < columnWidths.length; ++i) {
- widths += ("," + columnWidths[i]);
+ sb.append(",");
+ sb.append(columnWidths[i]);
}
- configuration.put(new PropertySimple(CFG_WIDTHS, widths));
+ configuration.put(new PropertySimple(CFG_WIDTHS, sb));
}
public Configuration getConfiguration() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index cd73f5d..f5f3fc8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -56,7 +56,6 @@ import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.form.ColorButtonItem;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
@@ -108,8 +107,6 @@ public class DashboardView extends LocatableVLayout {
@Override
protected void onInit() {
if (!isInitialized) {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.oninit()", Severity.Info)); // TODO
-
super.onInit();
this.setWidth100();
@@ -123,8 +120,6 @@ public class DashboardView extends LocatableVLayout {
}
public void rebuild() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.rebuild()", Severity.Info)); // TODO
-
// destroy all of the portlets and recreate from scratch
portalLayout.removeFromParent();
portalLayout.destroy();
@@ -133,48 +128,26 @@ public class DashboardView extends LocatableVLayout {
buildPortlets();
}
- public void redraw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.redraw()", Severity.Info)); // TODO
- super.redraw();
- }
-
- @Override
- public void draw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.draw()", Severity.Info)); // TODO
- super.draw();
- }
-
@Override
protected void onDraw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.onDraw()", Severity.Info)); // TODO
super.onDraw();
setEditMode(editMode);
}
public void buildPortlets() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(1)", Severity.Info)); // TODO
-
this.setBackgroundColor(storedDashboard.getConfiguration().getSimpleValue(Dashboard.CFG_BACKGROUND, "white"));
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(2)", Severity.Info)); // TODO
portalLayout = new PortalLayout(extendLocatorId("PortalLayout"), this, storedDashboard.getColumns(),
storedDashboard.getColumnWidths());
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(3)", Severity.Info)); // TODO
portalLayout.setOverflow(Overflow.AUTO);
portalLayout.setWidth100();
portalLayout.setHeight100();
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(4)", Severity.Info)); // TODO
-
loadPortletWindows();
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(5)", Severity.Info)); // TODO
-
addMember(portalLayout);
-
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(6)", Severity.Info)); // TODO
}
protected boolean canEditName() {
@@ -182,8 +155,6 @@ public class DashboardView extends LocatableVLayout {
}
private DynamicForm buildEditForm() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildEditForm(1)", Severity.Info)); // TODO
-
editForm = new LocatableDynamicForm(extendLocatorId("Editor"));
editForm.setMargin(5);
editForm.setAutoWidth();
@@ -192,8 +163,6 @@ public class DashboardView extends LocatableVLayout {
TextItem nameItem = null;
if (dashboardContainer.supportsDashboardNameEdit()) {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildEditForm(2)", Severity.Info)); // TODO
-
nameItem = new TextItem("name", MSG.common_title_dashboard_name());
nameItem.setValue(storedDashboard.getName());
nameItem.setWrapTitle(false);
@@ -374,23 +343,16 @@ public class DashboardView extends LocatableVLayout {
}
updateRefreshMenu();
this.refreshMenuButton.markForRedraw();
- //this.markForRedraw();
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildEditForm(2)", Severity.Info)); // TODO
return editForm;
}
private void loadPortletWindows() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.loadPortletWindows(1)", Severity.Info)); // TODO
-
for (int i = 0; i < storedDashboard.getColumns(); i++) {
for (DashboardPortlet storedPortlet : storedDashboard.getPortlets(i)) {
String locatorId = getPortletLocatorId(portalLayout, storedPortlet);
- CoreGUI.getMessageCenter().notify(
- new Message("------->> DashboardView.loadPortletWindows(" + locatorId + ")", Severity.Info)); // TODO
-
PortletWindow portletWindow = new PortletWindow(locatorId, this, storedPortlet);
portletWindow.setTitle(storedPortlet.getName());
portletWindow.setHeight(storedPortlet.getHeight());
@@ -400,8 +362,6 @@ public class DashboardView extends LocatableVLayout {
portalLayout.addPortletWindow(portletWindow, i);
}
}
-
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.loadPortletWindows(2)", Severity.Info)); // TODO
}
/**
@@ -503,7 +463,31 @@ public class DashboardView extends LocatableVLayout {
save((AsyncCallback<Dashboard>) null);
}
+ public String[] updatePortalColumnWidths() {
+ int numColumns = storedDashboard.getColumns();
+ int totalPixelWidth = 0;
+ int[] columnPixelWidths = new int[numColumns];
+ for (int i = 0; i < numColumns; ++i) {
+ PortalColumn col = portalLayout.getPortalColumn(i);
+ totalPixelWidth += col.getWidth();
+ columnPixelWidths[i] = col.getWidth();
+ }
+ String[] columnWidths = new String[numColumns];
+ columnWidths[numColumns - 1] = "*";
+ for (int i = 0; i < numColumns - 1; ++i) {
+ columnWidths[i] = String.valueOf(((int) columnPixelWidths[i] * 100 / totalPixelWidth)) + "%";
+ }
+
+ storedDashboard.setColumnWidths(columnWidths);
+
+ return columnWidths;
+ }
+
public void save(final AsyncCallback<Dashboard> callback) {
+ // a variety of edits (dragResize, add/remove column, etc) can cause column width changes. Update them
+ // prior to every save.
+ updatePortalColumnWidths();
+
// since we reset storedDashboard after the async update completes, block modification of the dashboard
// during that interval.
DashboardView.this.disable();
@@ -648,7 +632,7 @@ public class DashboardView extends LocatableVLayout {
}
this.editForm.markForRedraw();
this.portalLayout.show();
- this.portalLayout.markForRedraw(); // TODO
+ this.portalLayout.markForRedraw();
}
public class UpdatePortletRefreshCallback implements AsyncCallback<Subject> {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java
index 1eedc08..fcc65b4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.VStack;
@@ -31,14 +32,21 @@ public class PortalColumn extends VStack {
public PortalColumn() {
// leave some space between portlets
- setMembersMargin(6);
- this.setBorder("1px solid #999999");
+ setMembersMargin(4);
+
+ // Provide a visible border for framing of columns (especially when empty) and add padding to make
+ // the border easier to see for dragging
+ setBorder("2px solid #999999");
+
+ // Allow column specific vertical scrolling to see off-screen portlets. Takes up real estate but allows
+ // a user to see specific portlets in each column at the same time.
+ setOverflow(Overflow.AUTO);
// enable predefined component animation
setAnimateMembers(true);
setAnimateMemberTime(300);
- // enable drop handling
+ // enable drop handling for moving portlet windows within or between columns
setCanAcceptDrop(true);
// change appearance of drag placeholder and drop indicator
@@ -53,6 +61,19 @@ public class PortalColumn extends VStack {
Canvas placeHolderProperties = new Canvas();
placeHolderProperties.setBorder("2px solid #4A5D75");
setPlaceHolderProperties(placeHolderProperties);
+
+ // Allow column resizing (width only)
+ setCanDragResize(true);
+
+ // Use Left side drag resize because right side seems to conflict with vertical scroll bars.
+ setResizeFrom("L");
+
+ // Do not use the resize bar. It looks good but does not behave as well as the border dragging, and does
+ // not seem to play as well with the resize handlers. Maybe in the future...
+ // setShowResizeBar(true);
+
+ // True is the default, just capturing this call here for any future tweaking
+ // setRedrawOnResize(true);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
index 9a8b0dd..34775a2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
@@ -27,13 +27,15 @@ import java.util.Arrays;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.util.EventHandler;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.DragResizeStartEvent;
+import com.smartgwt.client.widgets.events.DragResizeStartHandler;
import com.smartgwt.client.widgets.events.DropEvent;
import com.smartgwt.client.widgets.events.DropHandler;
+import com.smartgwt.client.widgets.events.ResizedEvent;
+import com.smartgwt.client.widgets.events.ResizedHandler;
import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.dashboard.DashboardPortlet;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
@@ -44,6 +46,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
public class PortalLayout extends LocatableHLayout {
private DashboardView dashboardView;
+ private Integer dragResizeColumnCount;
/**
* @param locatorId
@@ -55,19 +58,24 @@ public class PortalLayout extends LocatableHLayout {
public PortalLayout(String locatorId, DashboardView dashboardView, int numColumns, String[] columnWidths) {
super(locatorId);
- CoreGUI.getMessageCenter().notify(
- new Message("------->> PortalLayout(numColumns=" + numColumns + ",columnWidths="
- + Arrays.toString(columnWidths) + ")")); // TODO
+ if (numColumns < 1) {
+ throw new IllegalArgumentException("Invalid number of columns [" + numColumns + "]");
+ }
+ if ((null != columnWidths && columnWidths.length > numColumns)) {
+ throw new IllegalArgumentException("Invalid column widths (more widths than columns) "
+ + Arrays.toString(columnWidths));
+ }
this.dashboardView = dashboardView;
- setMargin(5);
- setMembersMargin(6);
+ setMargin(4);
+ setMembersMargin(4);
+
for (int i = 0; i < numColumns; i++) {
final PortalColumn column = new PortalColumn();
if (null != columnWidths && i < columnWidths.length) {
column.setWidth(columnWidths[i]);
- } else if (i == 0) {
- column.setWidth("30%");
+ } else {
+ column.setWidth("*");
}
final int columnNumber = i;
@@ -129,7 +137,47 @@ public class PortalLayout extends LocatableHLayout {
}
});
- CoreGUI.getMessageCenter().notify(new Message("------->> PortalLayout() adding column " + i)); // TODO
+ column.addDragResizeStartHandler(new DragResizeStartHandler() {
+
+ @Override
+ public void onDragResizeStart(DragResizeStartEvent event) {
+
+ // When a drag resize starts activate a counter keeping track of the number of columns that
+ // have been resized. A resize of one column will force a resize of all columns. After the
+ // last column resize completes, persist the new column widths to the database.
+ dragResizeColumnCount = 0;
+ }
+ });
+
+ // This handler is called when the resizing is complete (the DragResizeStopHandler is called
+ // immediately on stop but before all resizing is complete.)
+ column.addResizedHandler(new ResizedHandler() {
+
+ @Override
+ public void onResized(ResizedEvent event) {
+
+ // ignore resizing not related to drag resize (presumable initial draw)
+ if (null == dragResizeColumnCount) {
+ return;
+ }
+
+ ++dragResizeColumnCount;
+ Canvas[] members = getMembers();
+
+ // ignore resizing prior to all columns being resized as a result of the drag operation
+ if (dragResizeColumnCount != members.length) {
+ return;
+ }
+
+ // one drag operation results in a save for each column, as they all get resized
+ // now that they are all resized, save the column widths (save updates these automatically)
+ save();
+
+ // reset the flag
+ dragResizeColumnCount = null;
+ }
+ });
+
addMember(column);
}
}
@@ -146,6 +194,10 @@ public class PortalLayout extends LocatableHLayout {
return portalColumn;
}
+ public void save() {
+ this.dashboardView.save();
+ }
+
public void save(AsyncCallback<Dashboard> callback) {
this.dashboardView.save(callback);
}
@@ -163,7 +215,6 @@ public class PortalLayout extends LocatableHLayout {
PortletWindow portlet = (PortletWindow) p;
portlet.setWidth(column.getWidth());
-
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
index 0f76e5b..2eac777 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
@@ -91,6 +91,7 @@ public class PortletWindow extends LocatableWindow {
};
private ClickHandler refreshHandler = new ClickHandler() {
+ @SuppressWarnings("unchecked")
public void onClick(ClickEvent clickEvent) {
if (PortletWindow.this.view instanceof Table) {
((Table) PortletWindow.this.view).refresh();
@@ -137,7 +138,7 @@ public class PortletWindow extends LocatableWindow {
setCanDrop(true);
setCanDragResize(true);
- // setResizeFrom("B");
+ setResizeFrom("T", "B");
setShowShadow(false);
@@ -166,7 +167,6 @@ public class PortletWindow extends LocatableWindow {
setSettingsClickHandler(settingsHandler);
setHelpClickHandler(helpHandler);
-
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index df8c9f4..38b4194 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -48,8 +48,6 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -89,17 +87,12 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
@Override
protected void onInit() {
if (!isInitialized()) {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.oninit()", Severity.Info)); // TODO
-
super.onInit();
// first async call to get global permissions
new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
public void onPermissionsLoaded(Set<Permission> permissions) {
- CoreGUI.getMessageCenter().notify(
- new Message("------->> ActivityView.oninit( gotGlobalPerms )", Severity.Info)); // TODO
-
globalPermissions = permissions;
// now make async call to look for customized dash for this user and entity
@@ -112,9 +105,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
}
public void onSuccess(final PageList<Dashboard> result) {
- CoreGUI.getMessageCenter().notify(
- new Message("------->> ActivityView.oninit( gotCriteriaResult )", Severity.Info)); // TODO
-
Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
setDashboard(dashboard);
@@ -131,65 +121,7 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
}
}
- @Override
- public void draw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.draw()", Severity.Info)); // TODO
- super.draw();
- }
-
- @Override
- public void redraw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.redraw()", Severity.Info)); // TODO
- super.redraw();
- }
-
- @Override
- protected void onDraw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.onDraw()", Severity.Info)); // TODO
- super.onDraw();
-
- /*
- * If we really had something to do here we'd want to wait until the async initialization was really over.
- *
- new Timer() {
- final long startTime = System.currentTimeMillis();
-
- public void run() {
- if (isInitialized) {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.onDraw( 1 )", Severity.Info)); // TODO
-
- ActivityView.super.onDraw();
- if (!dashboardView.isDrawn()) {
- dashboardView.draw();
- }
- if (!dashboardView.isVisible()) {
- dashboardView.show();
- }
- markForRedraw();
- dashboardView.markForRedraw();
-
- } else {
- long elapsedMillis = System.currentTimeMillis() - startTime;
- if (elapsedMillis < 10000) {
- CoreGUI.getMessageCenter().notify(
- new Message("------->> ActivityView.onDraw( 2 )", Severity.Info)); // TODO
- schedule(100); // Reschedule the timer.
- } else {
- // give up and just do the draw()
- CoreGUI.getMessageCenter().notify(
- new Message("------->> ActivityView.onDraw( 3 )", Severity.Info)); // TODO
- ActivityView.super.onDraw();
-
- }
- }
- }
- }.run(); // fire the timer immediately
- */
- }
-
private void setDashboard(Dashboard dashboard) {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.setDashboard()", Severity.Info)); // TODO
-
Canvas[] members = getMembers();
removeMembers(members);
@@ -237,23 +169,19 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
}
protected Dashboard getDefaultDashboard() {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.getDefaultDashboard", Severity.Info)); // TODO
-
Subject sessionSubject = UserSessionManager.getSessionSubject();
ResourceGroup group = groupComposite.getResourceGroup();
Dashboard dashboard = new Dashboard();
- //dashboard.getConfiguration().setProperties(new ArrayList<Property>()); // replace the LinkedHashMap...
-
dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + group.getId());
dashboard.setCategory(DashboardCategory.GROUP);
dashboard.setGroup(group);
dashboard.setColumns(2);
// TODO, add real portlets
- // set leftmost column and letthe rest be equally divided
- dashboard.setColumnWidths("40%", "*");
+ // set leftmost column and let the rest be equally divided
+ dashboard.setColumnWidths("40%");
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
// Left Column
commit c433f882c4d966a9e876d95bb08b5017459a4cc4
Merge: cc8fc60... 9fb84ad...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 16:04:20 2011 -0500
Merge commit 'origin/master' into group-config-history
commit 9fb84ad1ef8050bc76e7992bfcdf3945fd50c575
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Mar 1 15:34:23 2011 -0500
modify resource activity regions to enable on facet availability.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
index 2ec1bee..ccbe871 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
@@ -142,6 +142,7 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
ResourceGroup group = null;
GroupCategory groupCategory = null;
Set<ResourceTypeFacet> facets = null;
+ Set<ResourceTypeFacet> resourceFacets = null;
if ((groupComposite != null) && (groupComposite.getResourceGroup() != null)) {
group = groupComposite.getResourceGroup();
group = groupComposite.getResourceGroup();
@@ -150,6 +151,7 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
}
if (resourceComposite != null) {
resource = resourceComposite.getResource();
+ resourceFacets = this.resourceComposite.getResourceFacets().getFacets();
}
//recentMetrics.xhtml
@@ -183,7 +185,8 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
HLayout recentConfigUpdatesTitle = new TitleWithIcon("subsystems/configure/Configure_24.png",
RECENT_CONFIGURATIONS);
recentConfigurationContent.setHeight(20);
- if ((resource != null) || (displayGroupConfigurationUpdates(groupCategory, facets))) {//resource
+ if (((resource != null) && (resourceFacets.contains(ResourceTypeFacet.CONFIGURATION)))
+ || (displayGroupConfigurationUpdates(groupCategory, facets))) {//resource
rightPane.addMember(recentConfigUpdatesTitle);
rightPane.addMember(recentConfigurationContent);
firstRightPanePortletLoaded = true;
@@ -192,7 +195,8 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
//recentOperations.xhtml
HLayout recentOperationsTitle = new TitleWithIcon("subsystems/control/Operation_24.png", RECENT_OPERATIONS);
recentOperationsContent.setHeight(20);
- if ((resource != null) || (displayGroupOperations(groupCategory, facets))) {//resource
+ if (((resource != null) && (resourceFacets.contains(ResourceTypeFacet.OPERATION)))
+ || (displayGroupOperations(groupCategory, facets))) {//resource
if (firstRightPanePortletLoaded) {
rightPane.addMember(divider3);
}
@@ -203,7 +207,8 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
//recentEventCounts.xhtml
HLayout recentEventsTitle = new TitleWithIcon("subsystems/event/Events_24.png", RECENT_EVENTS);
recentEventsContent.setHeight(20);
- if ((resource != null) || displayGroupEvents(groupCategory, facets)) {//resource
+ if (((resource != null) && (resourceFacets.contains(ResourceTypeFacet.EVENT)))
+ || displayGroupEvents(groupCategory, facets)) {//resource
if (firstRightPanePortletLoaded) {
rightPane.addMember(divider4);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 54a9d93..1e37f9b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -48,6 +48,8 @@ import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowCo
import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.ResourceTypeFacet;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageControl;
@@ -86,21 +88,39 @@ public class ActivityView extends AbstractActivityView {
/**Initiates data request.
*/
protected void loadData() {
- getRecentAlerts();
- getRecentOperations();
- getRecentConfigurationUpdates();
- getRecentEventUpdates();
- getRecentOobs();
- getRecentPkgHistory();
- getRecentMetrics();
-
- //conditionally display Bundle Deployments region.
+
+ ResourceType type = null;
Resource resource = null;
- if (resourceComposite != null) {
+ Set<ResourceTypeFacet> facets = null;
+
+ if ((resourceComposite != null) && (resourceComposite.getResource() != null)) {
resource = resourceComposite.getResource();
- }
- if ((resource != null) && (displayBundlesForResource(resource))) {
- getRecentBundleDeployments();
+ type = this.resourceComposite.getResource().getResourceType();
+ facets = this.resourceComposite.getResourceFacets().getFacets();
+
+ //alerts
+ getRecentAlerts();
+ //operations
+ if (facets.contains(ResourceTypeFacet.OPERATION)) {
+ getRecentOperations();
+ }
+ //config updates
+ if (facets.contains(ResourceTypeFacet.CONFIGURATION)) {
+ getRecentConfigurationUpdates();
+ }
+ //events
+ if (facets.contains(ResourceTypeFacet.EVENT)) {
+ getRecentEventUpdates();
+ }
+ //measurements
+ getRecentOobs();
+ getRecentPkgHistory();
+ getRecentMetrics();
+
+ //conditionally display Bundle Deployments region.
+ if (displayBundlesForResource(resource)) {
+ getRecentBundleDeployments();
+ }
}
}
commit 3e54fc6f0a3698d5e24fec13de22ce2f64d695e7
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Mar 1 15:03:46 2011 -0500
modify group activity display to display with facet availability.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
index 0aa86cf..2ec1bee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
@@ -39,6 +39,7 @@ import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceTypeFacet;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
@@ -99,6 +100,7 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
private ResourceComposite resourceComposite = null;
private HLayout recentBundleDeployTitle;
private ToolStrip footer;
+ private boolean firstRightPanePortletLoaded = false;
public AbstractActivityView(String locatorId, ResourceGroupComposite groupComposite,
ResourceComposite resourceComposite) {
@@ -138,8 +140,13 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
Resource resource = null;
ResourceGroup group = null;
- if (groupComposite != null) {
+ GroupCategory groupCategory = null;
+ Set<ResourceTypeFacet> facets = null;
+ if ((groupComposite != null) && (groupComposite.getResourceGroup() != null)) {
+ group = groupComposite.getResourceGroup();
group = groupComposite.getResourceGroup();
+ groupCategory = groupComposite.getResourceGroup().getGroupCategory();
+ facets = groupComposite.getResourceFacets().getFacets();
}
if (resourceComposite != null) {
resource = resourceComposite.getResource();
@@ -147,7 +154,7 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
//recentMetrics.xhtml
HLayout recentMetricsTitle = new TitleWithIcon("subsystems/monitor/Monitor_24.png", RECENT_MEASUREMENTS);
- if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ if ((resource != null) || ((group != null) && (groupCategory.equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
leftPane.addMember(recentMetricsTitle);
leftPane.addMember(recentMeasurementsContent);
recentMeasurementsContent.setHeight(20);
@@ -160,45 +167,57 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
recentAlertsContent.setHeight(20);
//recentOOBs.xhtml
HLayout recentOobsTitle = new TitleWithIcon("subsystems/monitor/Monitor_failed_24.png", RECENT_OOB);
-
- if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ recentOobContent.setHeight(20);
+ if ((resource != null) || ((group != null) && (groupCategory.equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
leftPane.addMember(divider2);
leftPane.addMember(recentOobsTitle);
leftPane.addMember(recentOobContent);
- recentOobContent.setHeight(20);
}
//rightPane
rightPane.setWidth("50%");
rightPane.setPadding(5);
rightPane.setMembersMargin(5);
rightPane.setAutoHeight();
+ firstRightPanePortletLoaded = false;
//recentConfigUpdates.xhtml
HLayout recentConfigUpdatesTitle = new TitleWithIcon("subsystems/configure/Configure_24.png",
RECENT_CONFIGURATIONS);
- if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ recentConfigurationContent.setHeight(20);
+ if ((resource != null) || (displayGroupConfigurationUpdates(groupCategory, facets))) {//resource
rightPane.addMember(recentConfigUpdatesTitle);
rightPane.addMember(recentConfigurationContent);
- recentConfigurationContent.setHeight(20);
- rightPane.addMember(divider3);
+ firstRightPanePortletLoaded = true;
}
+
//recentOperations.xhtml
HLayout recentOperationsTitle = new TitleWithIcon("subsystems/control/Operation_24.png", RECENT_OPERATIONS);
- if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ recentOperationsContent.setHeight(20);
+ if ((resource != null) || (displayGroupOperations(groupCategory, facets))) {//resource
+ if (firstRightPanePortletLoaded) {
+ rightPane.addMember(divider3);
+ }
rightPane.addMember(recentOperationsTitle);
rightPane.addMember(recentOperationsContent);
- recentOperationsContent.setHeight(20);
- rightPane.addMember(divider4);
+ firstRightPanePortletLoaded = true;
}
//recentEventCounts.xhtml
HLayout recentEventsTitle = new TitleWithIcon("subsystems/event/Events_24.png", RECENT_EVENTS);
- rightPane.addMember(recentEventsTitle);
- rightPane.addMember(recentEventsContent);
recentEventsContent.setHeight(20);
+ if ((resource != null) || displayGroupEvents(groupCategory, facets)) {//resource
+ if (firstRightPanePortletLoaded) {
+ rightPane.addMember(divider4);
+ }
+ rightPane.addMember(recentEventsTitle);
+ rightPane.addMember(recentEventsContent);
+ firstRightPanePortletLoaded = true;
+ }
//recentPackageHistory.xhtml
HLayout recentPkgHistoryTitle = new TitleWithIcon("subsystems/content/Package_24.png", RECENT_PKG_HISTORY);
recentPkgHistoryContent.setHeight(20);
- if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
- rightPane.addMember(divider5);
+ if ((resource != null) || ((group != null) && (groupCategory.equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ if (firstRightPanePortletLoaded) {
+ rightPane.addMember(divider5);
+ }
rightPane.addMember(recentPkgHistoryTitle);
rightPane.addMember(recentPkgHistoryContent);
}
@@ -315,7 +334,9 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
HTMLFlow divider6 = new HTMLFlow("<hr/>");
divider6.setWidth("50%");
- rightPane.addMember(divider6);
+ if (firstRightPanePortletLoaded) {
+ rightPane.addMember(divider6);
+ }
rightPane.addMember(recentBundleDeployTitle);
rightPane.addMember(recentBundleDeployContent);
rightPane.markForRedraw();
@@ -428,4 +449,25 @@ public abstract class AbstractActivityView extends LocatableVLayout implements R
}
}
+ protected boolean displayGroupConfigurationUpdates(GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
+ if ((groupCategory == null) || facets == null) {
+ return false;
+ }
+ return (groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.CONFIGURATION));
+ }
+
+ protected boolean displayGroupOperations(GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
+ if ((groupCategory == null) || facets == null) {
+ return false;
+ }
+ return ((groupCategory == GroupCategory.COMPATIBLE) && facets.contains(ResourceTypeFacet.OPERATION));
+ }
+
+ protected boolean displayGroupEvents(GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
+ if ((groupCategory == null) || facets == null) {
+ return false;
+ }
+ return ((groupCategory == GroupCategory.MIXED) || (groupCategory == GroupCategory.COMPATIBLE && facets
+ .contains(ResourceTypeFacet.EVENT)));
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 14cd2b3..71a1bf8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -50,6 +50,7 @@ import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
import org.rhq.core.domain.operation.GroupOperationHistory;
+import org.rhq.core.domain.resource.ResourceTypeFacet;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
@@ -89,23 +90,36 @@ public class ActivityView2 extends AbstractActivityView {
/**Initiates data request.
*/
protected void loadData() {
- getRecentAlerts();
- getRecentEventUpdates();
- if ((groupComposite != null)
- && (groupComposite.getResourceGroup().getGroupCategory().equals(GroupCategory.COMPATIBLE))) {//CompatibleGroup
- //TODO: spinder should we drive these calls off of facet availability?
- getRecentOperations();
- getRecentConfigurationUpdates();
- getRecentOobs();
- getRecentPkgHistory();
- getRecentMetrics();
- }
- //conditionally display Bundle deployments for groups of platforms only
ResourceGroup group = null;
- if (groupComposite != null) {
+ GroupCategory groupCategory = null;
+ Set<ResourceTypeFacet> facets = null;
+ if ((groupComposite != null) && (groupComposite.getResourceGroup() != null)) {
group = groupComposite.getResourceGroup();
- }
- if (group != null) {
+ groupCategory = groupComposite.getResourceGroup().getGroupCategory();
+ //Load Facets to conditionally display relevant tabs
+ facets = groupComposite.getResourceFacets().getFacets();
+
+ getRecentAlerts();
+ //events
+ if (displayGroupEvents(groupCategory, facets)) {
+ getRecentEventUpdates();
+ }
+ //operations
+ if (displayGroupOperations(groupCategory, facets)) {
+ getRecentOperations();
+ }
+ //Config updates
+ if (displayGroupConfigurationUpdates(groupCategory, facets)) {
+ getRecentConfigurationUpdates();
+ }
+ //recentMetrics,oobs,pkghistory
+ if (groupCategory == GroupCategory.COMPATIBLE) {
+ getRecentOobs();
+ getRecentPkgHistory();
+ getRecentMetrics();
+ }
+
+ //conditionally display Bundle deployments for groups of platforms only
displayBundleDeploymentsForPlatformGroups(group);
}
}
commit 67fe9f776ddf21fcb2ee70f98fc345e184b15e43
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Mar 1 13:46:11 2011 -0500
hide button bar (i.e. Save button) on resource config edit view until the resource config has been successfully loaded (https://bugzilla.redhat.com/show_bug.cgi?id=561063)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 6f207ba..e3d6d50 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -62,10 +62,12 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
private Resource resource;
private ResourcePermission resourcePermission;
private ConfigurationEditor editor;
+ private ToolStrip buttonbar;
private IButton saveButton;
private boolean refreshing = false;
+
public ResourceConfigurationEditView(String locatorId, ResourceComposite resourceComposite) {
super(locatorId);
@@ -77,11 +79,11 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
protected void onDraw() {
super.onDraw();
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setWidth100();
- toolStrip.setExtraSpace(10);
- toolStrip.setMembersMargin(5);
- toolStrip.setLayoutMargin(5);
+ this.buttonbar = new ToolStrip();
+ buttonbar.setWidth100();
+ buttonbar.setExtraSpace(10);
+ buttonbar.setMembersMargin(5);
+ buttonbar.setLayoutMargin(5);
this.saveButton = new LocatableIButton(this.extendLocatorId("Save"), MSG.common_button_save());
this.saveButton.addClickHandler(new ClickHandler() {
@@ -89,9 +91,11 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
save();
}
});
- toolStrip.addMember(saveButton);
+ buttonbar.addMember(saveButton);
+ // The button bar will remain hidden until the configuration has been successfully loaded.
+ buttonbar.setVisible(false);
+ addMember(buttonbar);
- addMember(toolStrip);
refresh();
if (!this.resourcePermission.isConfigureWrite()) {
@@ -108,7 +112,7 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
}
this.refreshing = true;
- this.saveButton.disable();
+ this.buttonbar.setVisible(false);
GWTServiceLookup.getConfigurationService().getLatestResourceConfigurationUpdate(resource.getId(),
new AsyncCallback<ResourceConfigurationUpdate>() {
@@ -129,6 +133,9 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
editor.setReadOnly(!resourcePermission.isConfigureWrite());
addMember(editor);
+
+ saveButton.disable();
+ buttonbar.setVisible(true);
markForRedraw();
refreshing = false;
}
@@ -138,7 +145,7 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onFailure(Throwable caught) {
refreshing = false;
- CoreGUI.getErrorHandler().handleError("Cannot load resource config", caught);
+ CoreGUI.getErrorHandler().handleError("Failed to load configuration.", caught);
}
});
}
commit 4246288e0100247352a369d309e7e4a037c5d6e7
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Mar 1 13:33:33 2011 -0500
redirect to config history subtab after a successful resource config update, and also include the config update id (i.e. "version") in the success message (https://bugzilla.redhat.com/show_bug.cgi?id=640270)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 0f712a6..576f102 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -83,6 +83,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
public static class Tab {
public static final String OPERATIONS = "Operations";
+ public static final String CONFIGURATION = "Configuration";
// TODO: other tabs
}
@@ -91,6 +92,11 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
public static final String HISTORY = "History";
}
+ public static class ConfigurationSubTab {
+ public static final String CURRENT = "Current";
+ public static final String HISTORY = "History";
+ }
+
private Integer resourceId;
private ResourceComposite resourceComposite;
@@ -209,11 +215,13 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
operationsTab.registerSubTabs(this.operationsSchedules, this.operationsHistory);
tabs.add(operationsTab);
- configurationTab = new TwoLevelTab(getTabSet().extendLocatorId("Configuration"), new ViewName("Configuration",
+ configurationTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.CONFIGURATION), new ViewName(Tab.CONFIGURATION,
MSG.view_tabs_common_configuration()), "/images/icons/Configure_grey_16.png");
- this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), new ViewName("Current", MSG
+ this.configCurrent = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.CURRENT),
+ new ViewName(ConfigurationSubTab.CURRENT, MSG
.view_tabs_common_current()), null);
- this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), new ViewName("History", MSG
+ this.configHistory = new SubTab(configurationTab.extendLocatorId(ConfigurationSubTab.HISTORY),
+ new ViewName(ConfigurationSubTab.HISTORY, MSG
.view_tabs_common_history()), null);
configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
tabs.add(configurationTab);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 0700b78..6f207ba 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -35,11 +35,13 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository.MetadataType;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository.TypeLoadedCallback;
@@ -151,10 +153,14 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
}
public void onSuccess(ResourceConfigurationUpdate result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_configurationDetails_messageConcise(), MSG
- .view_configurationDetails_messageDetailed(resource.getName()), Message.Severity.Info));
- refresh();
+ String version = String.valueOf(result.getId());
+ Message message = new Message(MSG.view_configurationDetails_messageConcise(version), MSG
+ .view_configurationDetails_messageDetailed(version, resource.getName()),
+ Message.Severity.Info);
+ String configHistoryUrl = LinkManager.getResourceTabLink(resource.getId(),
+ ResourceDetailView.Tab.CONFIGURATION, ResourceDetailView.ConfigurationSubTab.HISTORY);
+ String configHistoryView = configHistoryUrl.substring(1);
+ CoreGUI.goToView(configHistoryView, message);
}
});
}
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 a4e822f..f6d806d 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
@@ -1798,8 +1798,8 @@ view_resourceResourceGroupList_message_updateSuccess = Group membership updated
#-------------------------------
view_configurationDetails_noPermission = You do not have permission to edit this Resource''s configuration.
view_configurationDetails_error_updateFailure = Failed to update configuration.
-view_configurationDetails_messageConcise = Configuration updated.
-view_configurationDetails_messageDetailed = Configuration updated for Resource [{0}].
+view_configurationDetails_messageConcise = Configuration updated - current version is {0}).
+view_configurationDetails_messageDetailed = Configuration updated to version {0} for Resource [{1}].
view_configurationDetails_allPropertiesValid = All configuration properties have valid values, so the configuration can now be saved.
view_configurationDetails_somePropertiesInvalid = The following configuration properties have invalid values: {0}. The values must be corrected before the configuration can be saved.
commit cc8fc603342b7b3acd9f69965c1934ea4d960cff
Merge: 68206c8... 8b3cd4e...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 13:12:06 2011 -0500
Merge commit 'origin/master' into group-config-history
commit 8b3cd4ebae3e0fc7d63e4595bc69a89c86f1e28d
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Mar 1 12:37:15 2011 -0500
add "reloadable" boolean flag to config editor, which is set to true only if the constructor which places the config editor in charge of loading the config and config def is used
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 181dda0..f2a2580 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -165,6 +165,8 @@ public class ConfigurationEditor extends LocatableVLayout {
private boolean readOnly = false;
private Set<String> invalidPropertyNames = new HashSet<String>();
private Set<PropertyValueChangeListener> propertyValueChangeListeners = new HashSet<PropertyValueChangeListener>();
+ private boolean loaded;
+ private boolean reloadable;
public static enum ConfigType {
plugin, resource
@@ -183,25 +185,26 @@ public class ConfigurationEditor extends LocatableVLayout {
private LoadHandler loadHandler = null;
- public ConfigurationEditor(String locatorId) {
- super(locatorId);
- }
-
- public ConfigurationEditor(String locatorId, int resourceId, int resourceTypeId) {
- this(locatorId, resourceId, resourceTypeId, ConfigType.resource);
- }
-
public ConfigurationEditor(String locatorId, int resourceId, int resourceTypeId, ConfigType configType) {
super(locatorId);
this.resourceId = resourceId;
this.resourceTypeId = resourceTypeId;
this.configType = configType;
setOverflow(Overflow.AUTO);
+ this.reloadable = true;
}
public ConfigurationEditor(String locatorId, ConfigurationDefinition configurationDefinition,
Configuration configuration) {
super(locatorId);
+
+ if (configuration == null) {
+ throw new IllegalArgumentException("Null configuration.");
+ }
+ if (configurationDefinition == null) {
+ throw new IllegalArgumentException("Null configurationDefinition.");
+ }
+
this.configuration = configuration;
this.configurationDefinition = configurationDefinition;
}
@@ -342,6 +345,10 @@ public class ConfigurationEditor extends LocatableVLayout {
}
public void reload() {
+ if (this.loaded && !this.reloadable) {
+ return;
+ }
+
if (configurationDefinition == null || configuration == null) {
// Wait for both to load.
return;
@@ -356,7 +363,13 @@ public class ConfigurationEditor extends LocatableVLayout {
if (configurationDefinition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED
|| configurationDefinition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW) {
Log.info("Building structured configuration editor...");
- LocatableVLayout structuredConfigLayout = buildStructuredPane();
+ LocatableVLayout structuredConfigLayout = null;
+ try {
+ structuredConfigLayout = buildStructuredPane();
+ } catch (RuntimeException e) {
+ e.printStackTrace();
+ throw e;
+ }
addMember(structuredConfigLayout);
} else {
Label label = new Label("Structured configuration is not supported.");
@@ -364,6 +377,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
this.markForRedraw();
+ this.loaded = true;
}
public void reset() {
@@ -1412,7 +1426,7 @@ public class ConfigurationEditor extends LocatableVLayout {
if (property instanceof PropertySimple) {
PropertySimple propertySimple = (PropertySimple) property;
if (propertyDefinition.isRequired() &&
- (propertySimple.getStringValue() == null) || propertySimple.getStringValue().equals("")) {
+ (propertySimple.getStringValue() == null) || "".equals(propertySimple.getStringValue())) {
// special case 2: required simple prop with no value - allow user to edit it even if it's a read-only prop,
// otherwise the user will have no way to give the property a new value and thereby get things to a valid state
return false;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 98949f6..0700b78 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -129,7 +129,6 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
addMember(editor);
markForRedraw();
refreshing = false;
- // TODO (ips): If editor != null, use editor.reload() instead.
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java
index 3ca884f..1195d1e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java
@@ -112,6 +112,8 @@ public class PluginConfigurationEditView extends LocatableVLayout implements Pro
editor.destroy();
removeMember(editor);
}
+ // TODO (ips): Load the config and config def ourselves, so we can remove that logic from the ConfigurationEditor,
+ // whose only purpose should be to render a config.
editor = new ConfigurationEditor(extendLocatorId("Editor"), resource.getId(), resource.getResourceType()
.getId(), ConfigurationEditor.ConfigType.plugin);
editor.setOverflow(Overflow.AUTO);
commit 090a0441d704d1e2166b63ee621cd85b0d61a70c
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Mar 1 12:26:58 2011 -0500
enable refresh for Resource/Group Activity pages.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
index ba1333e..0aa86cf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
@@ -23,12 +23,17 @@ import java.util.Set;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -46,12 +51,17 @@ import org.rhq.enterprise.gui.coregui.client.util.measurement.GwtMonitorUtils;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* @author Simeon Pinder
*/
-public abstract class AbstractActivityView extends LocatableHLayout implements RefreshableView {
+public abstract class AbstractActivityView extends LocatableVLayout implements RefreshableView {
+
+ //contains the activity display region
+ private LocatableHLayout columnSection = new LocatableHLayout("ActivityRegion");
//Locatable ui references
protected VLayout leftPane = new VLayout();
@@ -88,6 +98,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
private ResourceGroupComposite groupComposite = null;
private ResourceComposite resourceComposite = null;
private HLayout recentBundleDeployTitle;
+ private ToolStrip footer;
public AbstractActivityView(String locatorId, ResourceGroupComposite groupComposite,
ResourceComposite resourceComposite) {
@@ -98,6 +109,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
if (resourceComposite != null) {
this.resourceComposite = resourceComposite;
}
+ addMember(columnSection);
initializeUi();
}
@@ -112,13 +124,11 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
HTMLFlow divider3 = new HTMLFlow("<hr/>");
HTMLFlow divider4 = new HTMLFlow("<hr/>");
HTMLFlow divider5 = new HTMLFlow("<hr/>");
- // HTMLFlow divider6 = new HTMLFlow("<hr/>");
divider1.setWidth("50%");
divider2.setWidth("50%");
divider3.setWidth("50%");
divider4.setWidth("50%");
divider5.setWidth("50%");
- // divider6.setWidth("50%");
//leftPane
leftPane.setWidth("50%");
@@ -198,8 +208,24 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
recentBundleDeployTitle.setHeight(20);
deployBundleViewIfApplicable(resource, group);
- addMember(leftPane);
- addMember(rightPane);
+ columnSection.addMember(leftPane);
+ columnSection.addMember(rightPane);
+
+ //Add footer region
+ this.footer = new ToolStrip();
+ footer.setPadding(5);
+ footer.setWidth100();
+ footer.setMembersMargin(15);
+ footer.addMember(new LayoutSpacer());
+ IButton refreshButton = new LocatableIButton(extendLocatorId("Refresh"), MSG.common_button_refresh());
+ refreshButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ loadData();
+ refresh();
+ }
+ });
+ footer.addMember(refreshButton);
+ addMember(footer);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 07f0821..54a9d93 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -96,11 +96,9 @@ public class ActivityView extends AbstractActivityView {
//conditionally display Bundle Deployments region.
Resource resource = null;
- // ResourceGroup group = null;
if (resourceComposite != null) {
resource = resourceComposite.getResource();
}
- // if (deployBundleViewIfApplicable(resource, group)) {
if ((resource != null) && (displayBundlesForResource(resource))) {
getRecentBundleDeployments();
}
commit d27c97e986177b29e232d367da80fe0db6abc7d8
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Mar 1 11:42:03 2011 -0500
fix so unset checkboxes are disabled when editor is in read-only mode (https://bugzilla.redhat.com/show_bug.cgi?id=642546)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index ba1268e..181dda0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -1400,19 +1400,25 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private boolean isReadOnly(PropertyDefinition propertyDefinition, Property property) {
- boolean isInvalidRequiredProperty = false;
+ if (this.readOnly) {
+ return true;
+ }
+ String errorMessage = property.getErrorMessage();
+ if ((errorMessage != null) && (!errorMessage.trim().equals(""))) {
+ // special case 1: property has a plugin-set error message - allow user to edit it even if it's a read-only prop,
+ // otherwise the user will have no way to give the property a new value and thereby get things to a valid state
+ return false;
+ }
if (property instanceof PropertySimple) {
PropertySimple propertySimple = (PropertySimple) property;
- String errorMessage = propertySimple.getErrorMessage();
- if ((null == propertySimple.getStringValue()) || "".equals(propertySimple.getStringValue())
- || ((null != errorMessage) && (!"".equals(errorMessage.trim())))) {
- // Required properties with no value, or an invalid value (assumed if we see an error message) should
- // never be set to read-only, otherwise the user will have no way to give the property a new value and
- // thereby get things to a valid state.
- isInvalidRequiredProperty = true;
+ if (propertyDefinition.isRequired() &&
+ (propertySimple.getStringValue() == null) || propertySimple.getStringValue().equals("")) {
+ // special case 2: required simple prop with no value - allow user to edit it even if it's a read-only prop,
+ // otherwise the user will have no way to give the property a new value and thereby get things to a valid state
+ return false;
}
}
- return !isInvalidRequiredProperty && (propertyDefinition.isReadOnly() || this.readOnly);
+ return (propertyDefinition.isReadOnly());
}
protected List<Validator> buildValidators(PropertyDefinitionSimple propertyDefinition, Property property) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index a240e45..df8c9f4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -253,7 +253,7 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
// TODO, add real portlets
// set leftmost column and letthe rest be equally divided
- dashboard.setColumnWidths("40%");
+ dashboard.setColumnWidths("40%", "*");
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
// Left Column
commit 68206c8f090db0124c2be476442cc4f13f7e6a36
Merge: 41c1e1f... f1f4426...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 10:40:42 2011 -0500
Merge commit 'origin/master' into group-config-history
commit f1f4426c3e1ec3cc1c0cb86e753f3141817e90be
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Mar 1 08:40:05 2011 -0500
change images for package history items to be different from Bundle images an fix for bundle display region separator.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
index af79008..ba1333e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
@@ -112,13 +112,13 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
HTMLFlow divider3 = new HTMLFlow("<hr/>");
HTMLFlow divider4 = new HTMLFlow("<hr/>");
HTMLFlow divider5 = new HTMLFlow("<hr/>");
- HTMLFlow divider6 = new HTMLFlow("<hr/>");
+ // HTMLFlow divider6 = new HTMLFlow("<hr/>");
divider1.setWidth("50%");
divider2.setWidth("50%");
divider3.setWidth("50%");
divider4.setWidth("50%");
divider5.setWidth("50%");
- divider6.setWidth("50%");
+ // divider6.setWidth("50%");
//leftPane
leftPane.setWidth("50%");
@@ -185,7 +185,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
rightPane.addMember(recentEventsContent);
recentEventsContent.setHeight(20);
//recentPackageHistory.xhtml
- HLayout recentPkgHistoryTitle = new TitleWithIcon("subsystems/inventory/Inventory_24.png", RECENT_PKG_HISTORY);
+ HLayout recentPkgHistoryTitle = new TitleWithIcon("subsystems/content/Package_24.png", RECENT_PKG_HISTORY);
recentPkgHistoryContent.setHeight(20);
if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
rightPane.addMember(divider5);
@@ -200,6 +200,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
addMember(leftPane);
addMember(rightPane);
+
}
private void deployBundleViewIfApplicable(Resource resource, ResourceGroup group) {
@@ -291,6 +292,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
rightPane.addMember(divider6);
rightPane.addMember(recentBundleDeployTitle);
rightPane.addMember(recentBundleDeployContent);
+ rightPane.markForRedraw();
}
/**Creates the section top titles with icon for regions of Activity page.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 021a93b..14cd2b3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -458,7 +458,7 @@ public class ActivityView2 extends AbstractActivityView {
+ history.getPackageVersion().getVersion()));
row.setNumCols(3);
- StaticTextItem iconItem = newTextItemIcon("subsystems/inventory/Inventory_grey_16.png", null);
+ StaticTextItem iconItem = newTextItemIcon("subsystems/content/Package_16.png", null);
String title = history.getPackageVersion().getFileName() + ":";
String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId
+ "&selectedHistoryId=" + history.getId();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 27ebb8c..07f0821 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -433,8 +433,7 @@ public class ActivityView extends AbstractActivityView {
+ history.getPackageVersion().getVersion()));
row.setNumCols(3);
- StaticTextItem iconItem = newTextItemIcon("subsystems/inventory/Inventory_grey_16.png",
- null);
+ StaticTextItem iconItem = newTextItemIcon("subsystems/content/Package_16.png", null);
String title = history.getPackageVersion().getFileName() + ":";
String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + resourceId
+ "&selectedHistoryId=" + history.getId();
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Package_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Package_16.png
new file mode 100644
index 0000000..4034663
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Package_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Package_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Package_24.png
new file mode 100644
index 0000000..2cf069c
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/content/Package_24.png differ
commit bb2e6a68809730f3bf215fcb6a7244244baeca70
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Feb 28 20:39:07 2011 -0500
i)conditionally display recently deployed bundles for groups/resources of platforms.
ii)change icon for Pkg History to be different from Bundle icon.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceBundleDeploymentCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceBundleDeploymentCriteria.java
new file mode 100644
index 0000000..9414672
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceBundleDeploymentCriteria.java
@@ -0,0 +1,55 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.domain.criteria;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Simeon Pinder
+ */
+@XmlRootElement
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@SuppressWarnings("unused")
+public class ResourceBundleDeploymentCriteria extends BundleDeploymentCriteria {
+ private static final long serialVersionUID = 1L;
+
+ private List<Integer> filterResourceIds; // requires overrides
+
+ public ResourceBundleDeploymentCriteria() {
+ filterOverrides.put("resourceIds", "id IN " //
+ + "( SELECT ibd.id " //
+ + " FROM BundleDeployment ibd " //
+ + " JOIN ibd.resourceDeployments resourceDeployment " //
+ + " WHERE resourceDeployment.resource.id IN ( ? ) )");
+ }
+
+ public void addFilterResourceIds(Integer... filterResourceGroupIds) {
+ this.filterResourceIds = Arrays.asList(filterResourceGroupIds);
+ }
+
+ public List<Integer> getFilterIds() {
+ return filterResourceIds;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
index 13abdd5..af79008 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
@@ -18,6 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary;
+import java.util.Set;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
@@ -26,12 +30,17 @@ import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.RefreshableView;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
import org.rhq.enterprise.gui.coregui.client.util.measurement.GwtMonitorUtils;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
@@ -77,12 +86,18 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
protected String SEE_MORE = MSG.common_msg_see_more();
private ResourceGroupComposite groupComposite = null;
+ private ResourceComposite resourceComposite = null;
+ private HLayout recentBundleDeployTitle;
- public AbstractActivityView(String locatorId, ResourceGroupComposite groupComposite) {
+ public AbstractActivityView(String locatorId, ResourceGroupComposite groupComposite,
+ ResourceComposite resourceComposite) {
super(locatorId);
if (groupComposite != null) {
this.groupComposite = groupComposite;
}
+ if (resourceComposite != null) {
+ this.resourceComposite = resourceComposite;
+ }
initializeUi();
}
@@ -116,10 +131,13 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
if (groupComposite != null) {
group = groupComposite.getResourceGroup();
}
+ if (resourceComposite != null) {
+ resource = resourceComposite.getResource();
+ }
//recentMetrics.xhtml
HLayout recentMetricsTitle = new TitleWithIcon("subsystems/monitor/Monitor_24.png", RECENT_MEASUREMENTS);
- if ((group == null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
leftPane.addMember(recentMetricsTitle);
leftPane.addMember(recentMeasurementsContent);
recentMeasurementsContent.setHeight(20);
@@ -133,7 +151,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
//recentOOBs.xhtml
HLayout recentOobsTitle = new TitleWithIcon("subsystems/monitor/Monitor_failed_24.png", RECENT_OOB);
- if ((group == null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
leftPane.addMember(divider2);
leftPane.addMember(recentOobsTitle);
leftPane.addMember(recentOobContent);
@@ -147,7 +165,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
//recentConfigUpdates.xhtml
HLayout recentConfigUpdatesTitle = new TitleWithIcon("subsystems/configure/Configure_24.png",
RECENT_CONFIGURATIONS);
- if ((group == null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
rightPane.addMember(recentConfigUpdatesTitle);
rightPane.addMember(recentConfigurationContent);
recentConfigurationContent.setHeight(20);
@@ -155,7 +173,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
}
//recentOperations.xhtml
HLayout recentOperationsTitle = new TitleWithIcon("subsystems/control/Operation_24.png", RECENT_OPERATIONS);
- if ((group == null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
rightPane.addMember(recentOperationsTitle);
rightPane.addMember(recentOperationsContent);
recentOperationsContent.setHeight(20);
@@ -167,32 +185,83 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
rightPane.addMember(recentEventsContent);
recentEventsContent.setHeight(20);
//recentPackageHistory.xhtml
- HLayout recentPkgHistoryTitle = new TitleWithIcon("subsystems/content/Content_24.png", RECENT_PKG_HISTORY);
- if ((group == null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ HLayout recentPkgHistoryTitle = new TitleWithIcon("subsystems/inventory/Inventory_24.png", RECENT_PKG_HISTORY);
+ recentPkgHistoryContent.setHeight(20);
+ if ((resource != null) || ((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
rightPane.addMember(divider5);
rightPane.addMember(recentPkgHistoryTitle);
rightPane.addMember(recentPkgHistoryContent);
- recentPkgHistoryContent.setHeight(20);
}
- HLayout recentBundleDeployTitle = new TitleWithIcon("subsystems/content/Content_24.png", RECENT_BUNDLE_DEPLOY);
- // if (resource.type==Platform) || (Group(Mixed/Compat) of Platforms)
- // if ((group == null)&&())||((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {
- if (((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {
- rightPane.addMember(divider6);
- rightPane.addMember(recentBundleDeployTitle);
- rightPane.addMember(recentBundleDeployContent);
- recentBundleDeployTitle.setHeight(20);
- }
+ //recent bundle deployments
+ recentBundleDeployTitle = new TitleWithIcon("subsystems/content/Content_24.png", RECENT_BUNDLE_DEPLOY);
+ recentBundleDeployTitle.setHeight(20);
+ deployBundleViewIfApplicable(resource, group);
addMember(leftPane);
addMember(rightPane);
}
+ private void deployBundleViewIfApplicable(Resource resource, ResourceGroup group) {
+ if (displayBundlesForResource(resource)) {
+ enableBundleArea();
+ } else {//necessarily need to check group membership for platforms
+ if (group != null) {
+ //displays bundles region if group is compatible and contains platform resources
+ displayBundleDeploymentsForPlatformGroups(group);
+ }
+ }
+
+ }
+
+ protected boolean displayBundlesForResource(Resource resource) {
+ boolean display = false;
+ if ((resource != null) && (resource.getResourceType().getCategory().equals(ResourceCategory.PLATFORM))) {
+ display = true;
+ }
+ return display;
+ }
+
+ protected void displayBundleDeploymentsForPlatformGroups(final ResourceGroup group) {
+ if (group != null) {
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(group.getId());
+ criteria.fetchExplicitResources(true);
+ GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroup>>() {
+ @Override
+ public void onSuccess(PageList<ResourceGroup> results) {
+ if (!results.isEmpty()) {
+ ResourceGroup gp = results.get(0);
+ Set<Resource> explicitMembers = gp.getExplicitResources();
+ Resource[] currentResources = new Resource[explicitMembers.size()];
+ explicitMembers.toArray(currentResources);
+ if (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)) {
+ if (currentResources[0].getResourceType().getCategory().equals(
+ ResourceCategory.PLATFORM)) {
+ enableBundleArea();
+ getRecentBundleDeployments();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving information for group [" + group.getId() + "]:"
+ + caught.getMessage());
+ }
+ });
+
+ }
+ }
+
/** Implement to define calls to asynchronous calls out to UI display data.
*/
protected abstract void loadData();
+ protected abstract void getRecentBundleDeployments();
+
@Override
protected void onDraw() {
super.onDraw();
@@ -215,6 +284,15 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
BrowserUtility.graphSparkLines();
}
+ private void enableBundleArea() {
+ HTMLFlow divider6 = new HTMLFlow("<hr/>");
+ divider6.setWidth("50%");
+
+ rightPane.addMember(divider6);
+ rightPane.addMember(recentBundleDeployTitle);
+ rightPane.addMember(recentBundleDeployContent);
+ }
+
/**Creates the section top titles with icon for regions of Activity page.
*/
public class TitleWithIcon extends HLayout {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 98176d6..021a93b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -52,6 +52,7 @@ import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.group.GroupCategory;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
@@ -75,7 +76,7 @@ public class ActivityView2 extends AbstractActivityView {
private ResourceGroupComposite groupComposite;
public ActivityView2(String locatorId, ResourceGroupComposite groupComposite) {
- super(locatorId, groupComposite);
+ super(locatorId, groupComposite, null);
this.groupComposite = groupComposite;
}
@@ -98,7 +99,14 @@ public class ActivityView2 extends AbstractActivityView {
getRecentOobs();
getRecentPkgHistory();
getRecentMetrics();
- getRecentBundleDeployments();
+ }
+ //conditionally display Bundle deployments for groups of platforms only
+ ResourceGroup group = null;
+ if (groupComposite != null) {
+ group = groupComposite.getResourceGroup();
+ }
+ if (group != null) {
+ displayBundleDeploymentsForPlatformGroups(group);
}
}
@@ -450,7 +458,7 @@ public class ActivityView2 extends AbstractActivityView {
+ history.getPackageVersion().getVersion()));
row.setNumCols(3);
- StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
+ StaticTextItem iconItem = newTextItemIcon("subsystems/inventory/Inventory_grey_16.png", null);
String title = history.getPackageVersion().getFileName() + ":";
String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId
+ "&selectedHistoryId=" + history.getId();
@@ -627,7 +635,7 @@ public class ActivityView2 extends AbstractActivityView {
/** Fetches recent bundle deployment information and updates the DynamicForm instance with details.
*/
- private void getRecentBundleDeployments() {
+ protected void getRecentBundleDeployments() {
final int groupId = this.groupComposite.getResourceGroup().getId();
GroupBundleDeploymentCriteria criteria = new GroupBundleDeploymentCriteria();
PageControl pageControl = new PageControl(0, 5);
@@ -670,7 +678,7 @@ public class ActivityView2 extends AbstractActivityView {
column.addMember(row);
}
//insert see more link
- //TODO: spinder(add this later) no current view for seeing all bundle deployments
+ //TODO: spinder:2/25/11 (add this later) no current view for seeing all bundle deployments
// LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent.extendLocatorId("RecentBundleContentSeeMore"));
// addSeeMoreLink(row, LinkManager.getResourceGroupLink(groupId) + "/Events/History/", column);
} else {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 37b34f1..27ebb8c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -36,15 +36,18 @@ import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.content.InstalledPackageHistory;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.criteria.InstalledPackageCriteria;
+import org.rhq.core.domain.criteria.ResourceBundleDeploymentCriteria;
import org.rhq.core.domain.event.EventSeverity;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
+import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageControl;
@@ -70,7 +73,7 @@ public class ActivityView extends AbstractActivityView {
private ResourceComposite resourceComposite;
public ActivityView(String locatorId, ResourceComposite resourceComposite) {
- super(locatorId, null);
+ super(locatorId, null, resourceComposite);
this.resourceComposite = resourceComposite;
}
@@ -90,6 +93,17 @@ public class ActivityView extends AbstractActivityView {
getRecentOobs();
getRecentPkgHistory();
getRecentMetrics();
+
+ //conditionally display Bundle Deployments region.
+ Resource resource = null;
+ // ResourceGroup group = null;
+ if (resourceComposite != null) {
+ resource = resourceComposite.getResource();
+ }
+ // if (deployBundleViewIfApplicable(resource, group)) {
+ if ((resource != null) && (displayBundlesForResource(resource))) {
+ getRecentBundleDeployments();
+ }
}
/** Fetches alerts and updates the DynamicForm instance with the latest
@@ -116,7 +130,6 @@ public class ActivityView extends AbstractActivityView {
LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
.valueOf(rowNum++)));
row.setNumCols(3);
-
StaticTextItem iconItem = newTextItemIcon(ImageManager.getAlertIcon(alert.getAlertDefinition()
.getPriority()), alert.getAlertDefinition().getPriority().getDisplayName());
LinkItem link = newLinkItem(alert.getAlertDefinition().getName() + ": ",
@@ -420,7 +433,8 @@ public class ActivityView extends AbstractActivityView {
+ history.getPackageVersion().getVersion()));
row.setNumCols(3);
- StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
+ StaticTextItem iconItem = newTextItemIcon("subsystems/inventory/Inventory_grey_16.png",
+ null);
String title = history.getPackageVersion().getFileName() + ":";
String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + resourceId
+ "&selectedHistoryId=" + history.getId();
@@ -594,4 +608,69 @@ public class ActivityView extends AbstractActivityView {
recentMeasurementsContent.addChild(column);
recentMeasurementsContent.markForRedraw();
}
+
+ /** Fetches recent bundle deployment information and updates the DynamicForm instance with details.
+ */
+ protected void getRecentBundleDeployments() {
+ final int resourceId = this.resourceComposite.getResource().getId();
+ ResourceBundleDeploymentCriteria criteria = new ResourceBundleDeploymentCriteria();
+ PageControl pageControl = new PageControl(0, 5);
+ criteria.setPageControl(pageControl);
+ criteria.addFilterResourceIds(resourceId);
+ criteria.addSortStatus(PageOrdering.DESC);
+ criteria.fetchDestination(true);
+ criteria.fetchBundleVersion(true);
+ criteria.fetchResourceDeployments(true);
+
+ GWTServiceLookup.getBundleService().findBundleDeploymentsByCriteria(criteria,
+ new AsyncCallback<PageList<BundleDeployment>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving installed bundle deployments for resource [" + resourceId + "]:"
+ + caught.getMessage());
+ }
+
+ @Override
+ public void onSuccess(PageList<BundleDeployment> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (BundleDeployment deployment : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent
+ .extendLocatorId(deployment.getBundleVersion().getName()
+ + deployment.getBundleVersion().getVersion()));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
+ String title = deployment.getBundleVersion().getName() + "["
+ + deployment.getBundleVersion().getVersion() + "]:";
+
+ String destination = ReportDecorator.GWT_BUNDLE_URL
+ + deployment.getBundleVersion().getBundle().getId() + "/destinations/"
+ + deployment.getDestination().getId();
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter
+ .format(deployment.getCtime()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
+ }
+ //insert see more link
+ //TODO: spinder:2/25/11 (add this later) no current view for seeing all bundle deployments
+ // LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent.extendLocatorId("RecentBundleContentSeeMore"));
+ // addSeeMoreLink(row, LinkManager.getResourceGroupLink(groupId) + "/Events/History/", column);
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentBundleDeployContent
+ .extendLocatorId("None"), RECENT_BUNDLE_DEPLOY_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentBundleDeployContent.getChildren()) {
+ child.destroy();
+ }
+ recentBundleDeployContent.addChild(column);
+ recentBundleDeployContent.markForRedraw();
+ }
+ });
+ }
}
commit 41c1e1ff0358ba46be80defce3ede2bd5c385e3f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Feb 28 15:36:23 2011 -0500
rename view class so it is consistent with the names of the group/indiv resource/plugin config edit views
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 9b2ad10..a137250 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -55,7 +55,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
import org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventCompositeHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.GroupResourceConfigurationEditView;
-import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.CurrentGroupPluginConfigurationView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.GroupPluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.HistoryGroupPluginConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.MembersView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.schedules.SchedulesView;
@@ -337,7 +337,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
true, new ViewFactory() {
@Override
public Canvas createView() {
- return new CurrentGroupPluginConfigurationView(inventoryConn.extendLocatorId("View"),
+ return new GroupPluginConfigurationEditView(inventoryConn.extendLocatorId("View"),
groupComposite);
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
deleted file mode 100644
index f64b74e..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.DisambiguationReport;
-import org.rhq.core.domain.resource.composite.ResourcePermission;
-import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.RefreshableView;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
-import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-
-/**
- * A view for editing a group's current plugin configuration.
- *
- * @author Ian Springer
- * @author John Mazzitelli
- */
-public class CurrentGroupPluginConfigurationView extends LocatableVLayout implements PropertyValueChangeListener,
- RefreshableView {
- private final ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
-
- private ResourceGroup group;
- private ResourcePermission resourcePermission;
- private ConfigurationDefinition configurationDefinition;
- private List<GroupMemberConfiguration> memberConfigurations;
-
- private ConfigurationEditor editor;
- private IButton saveButton;
-
- private boolean refreshing = false;
-
- public CurrentGroupPluginConfigurationView(String locatorId, ResourceGroupComposite groupComposite) {
- super(locatorId);
-
- this.group = groupComposite.getResourceGroup();
- this.resourcePermission = groupComposite.getResourcePermission();
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setWidth100();
- toolStrip.setExtraSpace(10);
- toolStrip.setMembersMargin(5);
- toolStrip.setLayoutMargin(5);
-
- this.saveButton = new LocatableIButton(this.extendLocatorId("Save"), MSG.common_button_save());
- this.saveButton.setTooltip(MSG.view_group_pluginConfig_edit_saveTooltip());
- this.saveButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- save();
- }
- });
-
- toolStrip.addMember(saveButton);
-
- addMember(toolStrip);
- refresh();
-
- if (!this.resourcePermission.isInventory()) {
- Message message = new Message(MSG.view_group_pluginConfig_edit_noperm(), Message.Severity.Info, EnumSet.of(
- Message.Option.Transient, Message.Option.Sticky));
- CoreGUI.getMessageCenter().notify(message);
- }
- }
-
- @Override
- public void refresh() {
- if (this.refreshing) {
- return; // we are already in the process of refreshing, don't do it again
- }
-
- this.refreshing = true;
- this.saveButton.disable();
- if (editor != null) {
- editor.destroy();
- removeMember(editor);
- }
- // TODO (ips): If editor != null, use editor.reload() instead.
-
- loadConfigurationDefinition();
- loadConfigurations();
- }
-
- private void initEditor() {
- if (this.configurationDefinition != null && this.memberConfigurations != null) {
- this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
- this.memberConfigurations);
- this.editor.setEditorTitle(MSG.view_group_pluginConfig_edit_currentGroupProperties());
- this.editor.setOverflow(Overflow.AUTO);
- this.editor.addPropertyValueChangeListener(this);
- this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
- addMember(this.editor);
- this.refreshing = false;
- }
- }
-
- private void loadConfigurationDefinition() {
- if (this.configurationDefinition == null) {
- final ResourceType type = this.group.getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
- EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
- new ResourceTypeRepository.TypesLoadedCallback() {
- public void onTypesLoaded(Map<Integer, ResourceType> types) {
- configurationDefinition = types.get(type.getId()).getPluginConfigurationDefinition();
- if (configurationDefinition == null) {
- throw new IllegalStateException("Connection settings are not supported by this group.");
- }
- initEditor();
- }
- });
- }
- }
-
- private void loadConfigurations() {
- this.memberConfigurations = null;
- this.configurationService.findPluginConfigurationsForGroup(group.getId(),
- new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
- public void onFailure(Throwable caught) {
- refreshing = false;
- if (caught.getMessage().contains("ConfigurationUpdateStillInProgressException")) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_group_pluginConfig_members_fetchFailureConnInProgress(), caught,
- Severity.Info));
- } else {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_group_pluginConfig_members_fetchFailureConn(group.toString()), caught);
- }
- }
-
- public void onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results) {
- memberConfigurations = new ArrayList<GroupMemberConfiguration>(results.size());
- for (DisambiguationReport<ResourceConfigurationComposite> result : results) {
- int resourceId = result.getOriginal().getResourceId();
- String label = ReportDecorator.decorateDisambiguationReport(result, resourceId, false);
- Configuration configuration = result.getOriginal().getConfiguration();
- GroupMemberConfiguration memberConfiguration = new GroupMemberConfiguration(resourceId, label,
- configuration);
- if (configuration == null || configuration.getProperties().isEmpty()) {
- throw new RuntimeException(
- "One or more null or empty member connection settings was returned by the Server.");
- }
- memberConfigurations.add(memberConfiguration);
- }
- initEditor();
- }
- });
- }
-
- private void save() {
- List<ResourceConfigurationComposite> resourceConfigurations = convertToCompositeList();
- GWTServiceLookup.getConfigurationService().updatePluginConfigurationsForGroup(this.group.getId(),
- resourceConfigurations, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- String typeName = group.getResourceType().getName();
- CoreGUI.getErrorHandler().handleError(
- MSG.view_group_pluginConfig_edit_saveFailure(typeName, group.getName()), caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_group_pluginConfig_edit_saveInitiated_concise(), MSG
- .view_group_pluginConfig_edit_saveInitiated_full(group.getResourceType().getName(), group
- .getName()), Message.Severity.Info));
- refresh();
- }
- });
- }
-
- private List<ResourceConfigurationComposite> convertToCompositeList() {
- List<ResourceConfigurationComposite> resourceConfigurations = new ArrayList<ResourceConfigurationComposite>(
- this.memberConfigurations.size());
- for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
- resourceConfigurations.add(new ResourceConfigurationComposite(memberConfiguration.getId(),
- memberConfiguration.getConfiguration()));
- }
- return resourceConfigurations;
- }
-
- @Override
- public void propertyValueChanged(PropertyValueChangeEvent event) {
- MessageCenter messageCenter = CoreGUI.getMessageCenter();
- Message message;
- if (event.isValidationStateChanged()) {
- Set<String> invalidPropertyNames = event.getInvalidPropertyNames();
- if (invalidPropertyNames.isEmpty()) {
- this.saveButton.enable();
- message = new Message(MSG.view_group_pluginConfig_edit_valid(), Message.Severity.Info, EnumSet.of(
- Message.Option.Transient, Message.Option.Sticky));
- } else {
- this.saveButton.disable();
- message = new Message(MSG.view_group_pluginConfig_edit_invalid(invalidPropertyNames.toString()),
- Message.Severity.Error, EnumSet.of(Message.Option.Transient, Message.Option.Sticky));
- }
- messageCenter.notify(message);
- } else {
- this.saveButton.enable();
- }
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java
new file mode 100644
index 0000000..973c371
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java
@@ -0,0 +1,249 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A view for editing a group's current plugin configuration.
+ *
+ * @author Ian Springer
+ * @author John Mazzitelli
+ */
+public class GroupPluginConfigurationEditView extends LocatableVLayout implements PropertyValueChangeListener,
+ RefreshableView {
+ private final ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+ private ResourceGroup group;
+ private ResourcePermission resourcePermission;
+ private ConfigurationDefinition configurationDefinition;
+ private List<GroupMemberConfiguration> memberConfigurations;
+
+ private ConfigurationEditor editor;
+ private IButton saveButton;
+
+ private boolean refreshing = false;
+
+ public GroupPluginConfigurationEditView(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
+
+ this.group = groupComposite.getResourceGroup();
+ this.resourcePermission = groupComposite.getResourcePermission();
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
+ toolStrip.setExtraSpace(10);
+ toolStrip.setMembersMargin(5);
+ toolStrip.setLayoutMargin(5);
+
+ this.saveButton = new LocatableIButton(this.extendLocatorId("Save"), MSG.common_button_save());
+ this.saveButton.setTooltip(MSG.view_group_pluginConfig_edit_saveTooltip());
+ this.saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ save();
+ }
+ });
+
+ toolStrip.addMember(saveButton);
+
+ addMember(toolStrip);
+ refresh();
+
+ if (!this.resourcePermission.isInventory()) {
+ Message message = new Message(MSG.view_group_pluginConfig_edit_noperm(), Message.Severity.Info, EnumSet.of(
+ Message.Option.Transient, Message.Option.Sticky));
+ CoreGUI.getMessageCenter().notify(message);
+ }
+ }
+
+ @Override
+ public void refresh() {
+ if (this.refreshing) {
+ return; // we are already in the process of refreshing, don't do it again
+ }
+
+ this.refreshing = true;
+ this.saveButton.disable();
+ if (editor != null) {
+ editor.destroy();
+ removeMember(editor);
+ }
+ // TODO (ips): If editor != null, use editor.reload() instead.
+
+ loadConfigurationDefinition();
+ loadConfigurations();
+ }
+
+ private void initEditor() {
+ if (this.configurationDefinition != null && this.memberConfigurations != null) {
+ this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
+ this.memberConfigurations);
+ this.editor.setEditorTitle(MSG.view_group_pluginConfig_edit_currentGroupProperties());
+ this.editor.setOverflow(Overflow.AUTO);
+ this.editor.addPropertyValueChangeListener(this);
+ this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
+ addMember(this.editor);
+ this.refreshing = false;
+ }
+ }
+
+ private void loadConfigurationDefinition() {
+ if (this.configurationDefinition == null) {
+ final ResourceType type = this.group.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
+ EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(Map<Integer, ResourceType> types) {
+ configurationDefinition = types.get(type.getId()).getPluginConfigurationDefinition();
+ if (configurationDefinition == null) {
+ throw new IllegalStateException("Connection settings are not supported by this group.");
+ }
+ initEditor();
+ }
+ });
+ }
+ }
+
+ private void loadConfigurations() {
+ this.memberConfigurations = null;
+ this.configurationService.findPluginConfigurationsForGroup(group.getId(),
+ new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
+ public void onFailure(Throwable caught) {
+ refreshing = false;
+ if (caught.getMessage().contains("ConfigurationUpdateStillInProgressException")) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_pluginConfig_members_fetchFailureConnInProgress(), caught,
+ Severity.Info));
+ } else {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_pluginConfig_members_fetchFailureConn(group.toString()), caught);
+ }
+ }
+
+ public void onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results) {
+ memberConfigurations = new ArrayList<GroupMemberConfiguration>(results.size());
+ for (DisambiguationReport<ResourceConfigurationComposite> result : results) {
+ int resourceId = result.getOriginal().getResourceId();
+ String label = ReportDecorator.decorateDisambiguationReport(result, resourceId, false);
+ Configuration configuration = result.getOriginal().getConfiguration();
+ GroupMemberConfiguration memberConfiguration = new GroupMemberConfiguration(resourceId, label,
+ configuration);
+ if (configuration == null || configuration.getProperties().isEmpty()) {
+ throw new RuntimeException(
+ "One or more null or empty member connection settings was returned by the Server.");
+ }
+ memberConfigurations.add(memberConfiguration);
+ }
+ initEditor();
+ }
+ });
+ }
+
+ private void save() {
+ List<ResourceConfigurationComposite> resourceConfigurations = convertToCompositeList();
+ GWTServiceLookup.getConfigurationService().updatePluginConfigurationsForGroup(this.group.getId(),
+ resourceConfigurations, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ String typeName = group.getResourceType().getName();
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_pluginConfig_edit_saveFailure(typeName, group.getName()), caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_pluginConfig_edit_saveInitiated_concise(), MSG
+ .view_group_pluginConfig_edit_saveInitiated_full(group.getResourceType().getName(), group
+ .getName()), Message.Severity.Info));
+ refresh();
+ }
+ });
+ }
+
+ private List<ResourceConfigurationComposite> convertToCompositeList() {
+ List<ResourceConfigurationComposite> resourceConfigurations = new ArrayList<ResourceConfigurationComposite>(
+ this.memberConfigurations.size());
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ resourceConfigurations.add(new ResourceConfigurationComposite(memberConfiguration.getId(),
+ memberConfiguration.getConfiguration()));
+ }
+ return resourceConfigurations;
+ }
+
+ @Override
+ public void propertyValueChanged(PropertyValueChangeEvent event) {
+ MessageCenter messageCenter = CoreGUI.getMessageCenter();
+ Message message;
+ if (event.isValidationStateChanged()) {
+ Set<String> invalidPropertyNames = event.getInvalidPropertyNames();
+ if (invalidPropertyNames.isEmpty()) {
+ this.saveButton.enable();
+ message = new Message(MSG.view_group_pluginConfig_edit_valid(), Message.Severity.Info, EnumSet.of(
+ Message.Option.Transient, Message.Option.Sticky));
+ } else {
+ this.saveButton.disable();
+ message = new Message(MSG.view_group_pluginConfig_edit_invalid(invalidPropertyNames.toString()),
+ Message.Severity.Error, EnumSet.of(Message.Option.Transient, Message.Option.Sticky));
+ }
+ messageCenter.notify(message);
+ } else {
+ this.saveButton.enable();
+ }
+ }
+}
commit bdbdfb0e59676c0c7f4d2439f895b91e63ff3fcc
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Feb 28 14:55:30 2011 -0500
do not go to a different browser tab/window when clicking link
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
index bd68f55..b7ca5fc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
@@ -110,6 +110,7 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
fieldStatus.setWidth("10%");
fieldResource.setType(ListGridFieldType.LINK);
+ fieldResource.setTarget("_self");
fieldStatus.setType(ListGridFieldType.ICON);
HashMap<String, String> statusIcons = new HashMap<String, String>(4);
commit ca82e3d71551e34c7feed921992700662631d51a
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Feb 28 14:40:22 2011 -0500
BZ 680158 - if the canvas isn't visible yet, make it so via show()
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 70751b5..1d684ff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -319,6 +319,9 @@ public class SubTabLayout extends LocatableVLayout {
canvas.setOverflow(Overflow.SCROLL);
}
addMember(canvas);
+ if (!canvas.isVisible()) {
+ canvas.show();
+ }
}
markForRedraw();
this.currentlyDisplayed = currentSubTab;
commit 9733f31dbaa582bb63cabe42052d674c3744df86
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Feb 28 11:09:14 2011 -0500
BZ 680164 - you now see a info message rather than a ugly error/failure message
it basically asks that you wait while the update is still inprogress
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
index f6ace09..f64b74e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
@@ -52,6 +52,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -166,8 +167,14 @@ public class CurrentGroupPluginConfigurationView extends LocatableVLayout implem
new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
public void onFailure(Throwable caught) {
refreshing = false;
- CoreGUI.getErrorHandler().handleError(
- MSG.view_group_pluginConfig_members_fetchFailureConn(group.toString()), caught);
+ if (caught.getMessage().contains("ConfigurationUpdateStillInProgressException")) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_pluginConfig_members_fetchFailureConnInProgress(), caught,
+ Severity.Info));
+ } else {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_pluginConfig_members_fetchFailureConn(group.toString()), caught);
+ }
}
public void onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java
index b89f449..00af8dc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java
@@ -43,6 +43,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -117,8 +118,14 @@ public class HistoryGroupPluginConfigurationSettings extends LocatableVLayout {
GWTServiceLookup.getConfigurationService().findPluginConfigurationsForGroupUpdate(groupUpdateId,
new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_group_pluginConfig_members_fetchFailureConn(group.toString()), caught);
+ if (caught.getMessage().contains("ConfigurationUpdateStillInProgressException")) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_pluginConfig_members_fetchFailureConnInProgress(), caught,
+ Severity.Info));
+ } else {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_pluginConfig_members_fetchFailureConn(group.toString()), caught);
+ }
}
public void onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results) {
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 9fcd822..a4e822f 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
@@ -1756,6 +1756,7 @@ view_group_pluginConfig_members_statusNochange = No changes were made to this co
view_group_pluginConfig_members_statusFailure = This configuration update failed for an unknown reason
view_group_pluginConfig_members_fetchFailure = Failed to get plugin config update history for members of group [{0}]
view_group_pluginConfig_members_fetchFailureConn = Failed to retrieve member connection settings for [{0}]
+view_group_pluginConfig_members_fetchFailureConnInProgress = A group plugin configuration update is currently in progress. You must wait until the update is finished before you can view the group settings.
view_group_pluginConfig_edit_currentGroupProperties = Current Group Properties
view_group_pluginConfig_edit_saveTooltip = Update the connection settings of all group members
view_group_pluginConfig_edit_noperm = You do not have permission to edit this group connection settings
commit b81b8420079b94e99e7a2a4159f62717353d80f4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Feb 28 10:44:01 2011 -0500
I guess it would be good if I put the code in the correct close handler.
this now correctly cancels the timer when you close the stats window
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
index 9bebe99..5024c59 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
@@ -284,8 +284,6 @@ public class TestRemoteServiceStatisticsView extends Table {
addCloseClickHandler(new CloseClickHandler() {
@Override
public void onCloseClick(CloseClientEvent event) {
- refreshTimer.cancel();
- refreshOnPageChange = false;
markForDestroy();
}
});
@@ -298,6 +296,11 @@ public class TestRemoteServiceStatisticsView extends Table {
public StatisticsWindow(String locatorId) {
super(locatorId);
+
+ final TestRemoteServiceStatisticsView view;
+ view = new TestRemoteServiceStatisticsView(extendLocatorId("StatsViewInWin"));
+ view.window = this;
+
setTitle(TABLE_TITLE);
setShowMinimizeButton(true);
setShowMaximizeButton(true);
@@ -312,13 +315,13 @@ public class TestRemoteServiceStatisticsView extends Table {
addCloseClickHandler(new CloseClickHandler() {
@Override
public void onCloseClick(CloseClientEvent event) {
+ view.refreshTimer.cancel();
+ view.refreshOnPageChange = false;
+ view.markForDestroy();
markForDestroy();
}
});
- TestRemoteServiceStatisticsView view;
- view = new TestRemoteServiceStatisticsView(extendLocatorId("StatsViewInWin"));
- view.window = this;
addItem(view);
final String origColor = getBodyColor();
commit 7858c19bb57e15e718ac21c473fef8a68e642081
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Feb 26 00:31:22 2011 -0500
when the window is closed, make sure we stop auto-refresh by canceling the timer
however, for some reason, I'm not seeing the close click handler called, so this doesn't do anything althought the code looks right.
need to figure out why close click handler isn't called.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
index e83dc1c..9bebe99 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
@@ -71,13 +71,13 @@ public class TestRemoteServiceStatisticsView extends Table {
// if this is not null, this view is hosted by this standalone Window
private StatisticsWindow window = null;
- private Timer timer = null;
+ private Timer refreshTimer = null;
private boolean refreshOnPageChange = false;
public TestRemoteServiceStatisticsView(String locatorId) {
super(locatorId, TABLE_TITLE, null, defaultSorts, null, false);
- timer = new Timer() {
+ refreshTimer = new Timer() {
@Override
public void run() {
refresh();
@@ -186,7 +186,7 @@ public class TestRemoteServiceStatisticsView extends Table {
}
// cancel everything - will reinstate if user elected to do one of these
- timer.cancel();
+ refreshTimer.cancel();
refreshOnPageChange = false;
if (timeout.intValue() == -1) {
@@ -195,7 +195,7 @@ public class TestRemoteServiceStatisticsView extends Table {
refreshOnPageChange = true;
setTableTitle(TABLE_TITLE + " (refresh on page change)");
} else {
- timer.scheduleRepeating(timeout.intValue() * 1000);
+ refreshTimer.scheduleRepeating(timeout.intValue() * 1000);
setTableTitle(TABLE_TITLE + " (refresh every " + timeout + "s)");
}
}
@@ -273,6 +273,7 @@ public class TestRemoteServiceStatisticsView extends Table {
setShowMinimizeButton(false);
setShowMaximizeButton(true);
setShowCloseButton(true);
+ setDismissOnEscape(false); // force close button to be pressed to ensure our close handler is called
setIsModal(true);
setShowModalMask(true);
setAutoSize(true);
@@ -283,6 +284,8 @@ public class TestRemoteServiceStatisticsView extends Table {
addCloseClickHandler(new CloseClickHandler() {
@Override
public void onCloseClick(CloseClientEvent event) {
+ refreshTimer.cancel();
+ refreshOnPageChange = false;
markForDestroy();
}
});
commit 3c7a7fd6f8749eca0995d05eee2b723decb1af83
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Feb 26 00:15:35 2011 -0500
BZ 680167 - add load handler to config editor so we know when the config editor has fully loaded its config and config def
the view can now use this to be told when the config editor is done loading everything
this is used so we don't issue duplicate queries due to multiple refresh calls
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index b7c45d6..ba1268e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -170,6 +170,19 @@ public class ConfigurationEditor extends LocatableVLayout {
plugin, resource
}; // Need this extra semicolon for the qdox parser
+ /**
+ * This is the kind of handler that is called when this editor has loaded
+ * the configuration and configuration definition. If the load failed,
+ * the methods will still be called, but will be passed null.
+ */
+ public static interface LoadHandler {
+ void loadedConfiguration(Configuration config);
+
+ void loadedConfigurationDefinition(ConfigurationDefinition configDef);
+ }
+
+ private LoadHandler loadHandler = null;
+
public ConfigurationEditor(String locatorId) {
super(locatorId);
}
@@ -193,10 +206,18 @@ public class ConfigurationEditor extends LocatableVLayout {
this.configurationDefinition = configurationDefinition;
}
+ public void setLoadHandler(LoadHandler handler) {
+ this.loadHandler = handler;
+ }
+
public Configuration getConfiguration() {
return configuration;
}
+ public ConfigurationDefinition getConfigurationDefinition() {
+ return configurationDefinition;
+ }
+
public boolean isReadOnly() {
return readOnly;
}
@@ -248,12 +269,18 @@ public class ConfigurationEditor extends LocatableVLayout {
configurationService.getResourceConfiguration(resourceId, new AsyncCallback<Configuration>() {
public void onFailure(Throwable caught) {
showError(caught);
+ if (loadHandler != null) {
+ loadHandler.loadedConfiguration(null);
+ }
}
public void onSuccess(Configuration result) {
configuration = result;
Log.info("Config retrieved in: " + (System.currentTimeMillis() - start));
reload();
+ if (loadHandler != null) {
+ loadHandler.loadedConfiguration(configuration);
+ }
}
});
@@ -269,6 +296,9 @@ public class ConfigurationEditor extends LocatableVLayout {
showError(MSG.view_configEdit_error_1());
}
reload();
+ if (loadHandler != null) {
+ loadHandler.loadedConfigurationDefinition(configurationDefinition);
+ }
}
});
@@ -276,11 +306,17 @@ public class ConfigurationEditor extends LocatableVLayout {
configurationService.getPluginConfiguration(resourceId, new AsyncCallback<Configuration>() {
public void onFailure(Throwable caught) {
showError(caught);
+ if (loadHandler != null) {
+ loadHandler.loadedConfiguration(null);
+ }
}
public void onSuccess(Configuration result) {
configuration = result;
reload();
+ if (loadHandler != null) {
+ loadHandler.loadedConfiguration(configuration);
+ }
}
});
@@ -294,6 +330,9 @@ public class ConfigurationEditor extends LocatableVLayout {
showError(MSG.view_configEdit_error_2());
}
reload();
+ if (loadHandler != null) {
+ loadHandler.loadedConfigurationDefinition(configurationDefinition);
+ }
}
});
}
@@ -553,7 +592,7 @@ public class ConfigurationEditor extends LocatableVLayout {
// Note: This field spans 3 columns.
PropertyDefinitionMap memberDefinitionMap = (PropertyDefinitionMap) memberDefinition;
CanvasItem listOfMapsItem = buildListOfMapsField(locatorId, memberDefinitionMap, propertyDefinitionList,
- propertyList, oddRow);
+ propertyList, oddRow);
fields.add(listOfMapsItem);
} else if (memberDefinition instanceof PropertyDefinitionSimple) {
SpacerItem unsetItem = new SpacerItem();
@@ -812,9 +851,8 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private CanvasItem buildListOfMapsField(final String locatorId,
- final PropertyDefinitionMap memberPropertyDefinitionMap,
- PropertyDefinitionList propertyDefinitionList,
- final PropertyList propertyList, boolean oddRow) {
+ final PropertyDefinitionMap memberPropertyDefinitionMap, PropertyDefinitionList propertyDefinitionList,
+ final PropertyList propertyList, boolean oddRow) {
Log.debug("Building list-of-maps field for " + propertyList + "...");
final ListGrid summaryTable = new ListGrid();
@@ -1446,7 +1484,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private void displayMapEditor(String locatorId, final ListGrid summaryTable, final Record existingRecord,
- PropertyDefinitionMap definition, final PropertyList list, final PropertyMap map, boolean mapReadOnly) {
+ PropertyDefinitionMap definition, final PropertyList list, final PropertyMap map, boolean mapReadOnly) {
final List<PropertyDefinition> memberDefinitions = new ArrayList<PropertyDefinition>(definition
.getPropertyDefinitions().values());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java
index 76adc19..3ca884f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationEditView.java
@@ -29,6 +29,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
@@ -57,6 +58,10 @@ public class PluginConfigurationEditView extends LocatableVLayout implements Pro
private ConfigurationEditor editor;
private LocatableIButton saveButton;
+ // flags to indicate if the config editor is refreshing its internal config/configDef objects
+ private boolean refreshingConfig = false;
+ private boolean refreshingConfigDef = false;
+
public PluginConfigurationEditView(String locatorId, ResourceComposite resourceComposite) {
super(locatorId);
@@ -95,6 +100,12 @@ public class PluginConfigurationEditView extends LocatableVLayout implements Pro
@Override
public void refresh() {
+ if (this.refreshingConfig || this.refreshingConfigDef) {
+ return; // we are already in the process of refreshing, don't do it again
+ }
+
+ this.refreshingConfig = true;
+ this.refreshingConfigDef = true;
this.saveButton.disable();
if (editor != null) {
@@ -106,6 +117,18 @@ public class PluginConfigurationEditView extends LocatableVLayout implements Pro
editor.setOverflow(Overflow.AUTO);
editor.addPropertyValueChangeListener(this);
editor.setReadOnly(!this.resourcePermission.isInventory());
+ editor.setLoadHandler(new ConfigurationEditor.LoadHandler() {
+ @Override
+ public void loadedConfigurationDefinition(ConfigurationDefinition configDef) {
+ refreshingConfig = false; // finished loading the config
+ }
+
+ @Override
+ public void loadedConfiguration(Configuration config) {
+ refreshingConfigDef = false; // finished loading the config def
+ }
+ });
+
addMember(editor);
// TODO (ips): If editor != null, use editor.reload() instead.
}
commit e1424f702866a1f7609aaabdccc79e36aa2082fd
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 23:50:20 2011 -0500
BZ 680167 - do not perform multiple loads unnecessarily
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java
index e1c16de..ddab284 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java
@@ -54,6 +54,8 @@ public class ResourceResourceAgentView extends LocatableVLayout implements Refre
private StaticTextItem lastAvailReportValue;
private StaticTextItem endpointValue;
+ private boolean loading = false; // will be true if loadData is currently waiting for responses
+
public ResourceResourceAgentView(String locatorId, int resourceId) {
super(locatorId);
@@ -124,9 +126,15 @@ public class ResourceResourceAgentView extends LocatableVLayout implements Refre
}
private void loadData() {
+ if (loading) {
+ return; // we are already loading and waiting for data, no need to re-issue the same queries
+ }
+ loading = true;
+
GWTServiceLookup.getAgentService().getAgentForResource(this.resourceId, new AsyncCallback<Agent>() {
@Override
public void onFailure(Throwable caught) {
+ loading = false;
//Permissions failure, generate message to that effect
for (Canvas child : form.getChildren()) {
child.destroy();
@@ -147,6 +155,7 @@ public class ResourceResourceAgentView extends LocatableVLayout implements Refre
GWTServiceLookup.getAgentService().pingAgentForResource(resourceId, new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
+ loading = false;
CoreGUI.getErrorHandler().handleError(
MSG.view_inventory_summary_agent_error2() + " " + resourceId + ".", caught);
agentStatusIcon.setSrc(ImageManager.getAvailabilityLargeIcon(null));
@@ -155,6 +164,7 @@ public class ResourceResourceAgentView extends LocatableVLayout implements Refre
@Override
public void onSuccess(Boolean isUp) {
+ loading = false;
//update icon with correct status
agentStatusIcon.setSrc(ImageManager.getAvailabilityLargeIcon(isUp));
form.markForRedraw();
commit cd0f52d040eb50d790d6ec388bbd2a494a89ddfb
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Feb 25 18:14:45 2011 -0500
i18n all operations views
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java
index cfa4682..8ac85b5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java
@@ -31,6 +31,8 @@ import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.util.FormUtility;
import org.rhq.enterprise.gui.coregui.client.util.TypeConversionUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
@@ -48,6 +50,8 @@ import java.util.TreeSet;
*/
public class DurationItem extends CanvasItem {
+ private static final Messages MSG = CoreGUI.getMessages();
+
private static final String FIELD_VALUE = "value";
private static final String FIELD_UNITS = "units";
@@ -105,14 +109,13 @@ public class DurationItem extends CanvasItem {
ComboBoxItem unitsItem = new ComboBoxItem(FIELD_UNITS);
unitsItem.setShowTitle(false);
- // TODO: i18n valueMap values
LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
if (this.supportedUnitTypes.contains(UnitType.ITERATIONS)) {
- valueMap.put("times", "times");
+ valueMap.put("times", MSG.common_unit_times());
}
if (this.supportedUnitTypes.contains(UnitType.TIME)) {
for (TimeUnit unit : supportedUnits) {
- valueMap.put(unit.name().toLowerCase(), unit.name().toLowerCase());
+ valueMap.put(unit.name().toLowerCase(), unit.getDisplayName());
}
}
unitsItem.setValueMap(valueMap);
@@ -139,17 +142,17 @@ public class DurationItem extends CanvasItem {
public void setValue(Integer value, UnitType unitType) {
if (!this.supportedUnitTypes.contains(unitType)) {
- throw new IllegalArgumentException("Unit type [" + unitType + "] is not supported by this DurationItem.");
+ throw new IllegalArgumentException(MSG.widget_durationItem_unitTypeNotSupported(unitType.name()));
}
this.unitType = unitType;
String unitString = null;
switch (unitType) {
case TIME:
- unitString = this.valueUnit.name().toLowerCase();
+ unitString = this.valueUnit.getDisplayName();
break;
case ITERATIONS:
- unitString = "times";
+ unitString = MSG.common_unit_times();
}
if (this.isReadOnly) {
@@ -190,7 +193,7 @@ public class DurationItem extends CanvasItem {
} else {
this.unitType = UnitType.TIME;
if (unit.compareTo(this.valueUnit) < 0) {
- throw new IllegalStateException("Input unit is less than target unit.");
+ throw new IllegalStateException(MSG.widget_durationItem_inputUnitLessThanTargetUnit());
}
switch (unit) {
case MILLISECONDS:
@@ -402,7 +405,7 @@ public class DurationItem extends CanvasItem {
String string;
if (value != null) {
TimeUnit timeUnit = getInputTimeUnit();
- String unitString = (timeUnit != null) ? timeUnit.name().toLowerCase() : "times";
+ String unitString = (timeUnit != null) ? timeUnit.name().toLowerCase() : MSG.common_unit_times();
string = value + " " + unitString;
} else {
string = "";
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TimeUnit.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TimeUnit.java
index 0733712..c5a6fbb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TimeUnit.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TimeUnit.java
@@ -18,12 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.form;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.Messages;
+
/**
* A unit of time.
*
* @author Ian Springer
*/
public enum TimeUnit {
+
MILLISECONDS,
SECONDS,
MINUTES,
@@ -31,5 +35,41 @@ public enum TimeUnit {
DAYS,
WEEKS,
MONTHS,
- YEARS
+ YEARS;
+
+ private static final Messages MSG = CoreGUI.getMessages();
+
+ public String getDisplayName() {
+ String displayName;
+ switch (this) {
+ case MILLISECONDS:
+ displayName = MSG.common_unit_milliseconds();
+ break;
+ case SECONDS:
+ displayName = MSG.common_unit_seconds();
+ break;
+ case MINUTES:
+ displayName = MSG.common_unit_minutes();
+ break;
+ case HOURS:
+ displayName = MSG.common_unit_hours();
+ break;
+ case DAYS:
+ displayName = MSG.common_unit_days();
+ break;
+ case WEEKS:
+ displayName = MSG.common_unit_weeks();
+ break;
+ case MONTHS:
+ displayName = MSG.common_unit_months();
+ break;
+ case YEARS:
+ displayName = MSG.common_unit_years();
+ break;
+ default:
+ throw new IllegalStateException("Unsupported time unit: " + this);
+ }
+ return displayName;
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java
index b18c14e..13ebe7d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/trigger/JobTriggerEditor.java
@@ -183,10 +183,10 @@ public class JobTriggerEditor extends LocatableVLayout {
this.modeForm.setNumCols(3);
this.modeForm.setColWidths("140", "220", "*");
- RadioGroupItem modeItem = new RadioGroupItem(FIELD_MODE, "Schedule using");
+ RadioGroupItem modeItem = new RadioGroupItem(FIELD_MODE, MSG.widget_jobTriggerEditor_field_mode());
LinkedHashMap<String, String> modeValueMap = new LinkedHashMap<String, String>();
- modeValueMap.put("calendar", "Calendar");
- modeValueMap.put("cron", "Cron Expression");
+ modeValueMap.put("calendar", MSG.widget_jobTriggerEditor_value_calendar());
+ modeValueMap.put("cron", MSG.widget_jobTriggerEditor_value_cronExpression());
modeItem.setValueMap(modeValueMap);
modeItem.setVertical(false);
modeItem.setShowTitle(true);
@@ -203,10 +203,10 @@ public class JobTriggerEditor extends LocatableVLayout {
calendarTypeItem.setWidth(440);
calendarTypeItem.setShowTitle(false);
LinkedHashMap<String, String> calendarTypeValueMap = new LinkedHashMap<String, String>();
- calendarTypeValueMap.put("now", "Now");
- calendarTypeValueMap.put("nowAndRepeat", "Now & Repeat");
- calendarTypeValueMap.put("later", "Later");
- calendarTypeValueMap.put("laterAndRepeat", "Later & Repeat");
+ calendarTypeValueMap.put("now", MSG.widget_jobTriggerEditor_value_now());
+ calendarTypeValueMap.put("nowAndRepeat", MSG.widget_jobTriggerEditor_value_nowAndRepeat());
+ calendarTypeValueMap.put("later", MSG.widget_jobTriggerEditor_value_later());
+ calendarTypeValueMap.put("laterAndRepeat", MSG.widget_jobTriggerEditor_value_laterAndRepeat());
calendarTypeItem.setValueMap(calendarTypeValueMap);
calendarTypeItem.setVertical(false);
@@ -220,7 +220,8 @@ public class JobTriggerEditor extends LocatableVLayout {
this.cronForm = new LocatableDynamicForm(this.cronModeLayout.extendLocatorId("Form"));
- TextItem cronExpressionItem = new TextItem(FIELD_CRON_EXPRESSION, "Cron Expression");
+ TextItem cronExpressionItem = new TextItem(FIELD_CRON_EXPRESSION,
+ MSG.widget_jobTriggerEditor_field_cronExpression());
cronExpressionItem.setRequired(true);
cronExpressionItem.setWidth(340);
@@ -239,7 +240,7 @@ public class JobTriggerEditor extends LocatableVLayout {
});
cronHelpTabSet.setTabBarControls(closeIcon);
- Tab formatTab = new Tab("Format");
+ Tab formatTab = new Tab(MSG.widget_jobTriggerEditor_tab_format());
HTMLFlow formatPane = new HTMLFlow();
formatPane.setWidth100();
formatPane.setContents("<p>A cron expression is a string comprised of 6 or 7 fields separated by white space. Fields can contain any of the\n" +
@@ -405,7 +406,7 @@ public class JobTriggerEditor extends LocatableVLayout {
"</ul>");
formatTab.setPane(formatPane);
- Tab examplesTab = new Tab("Examples");
+ Tab examplesTab = new Tab(MSG.widget_jobTriggerEditor_tab_examples());
HTMLFlow examplesPane = new HTMLFlow();
examplesPane.setWidth100();
examplesPane.setContents("<table cellpadding=\"3\" cellspacing=\"1\">\n" +
@@ -566,7 +567,7 @@ public class JobTriggerEditor extends LocatableVLayout {
this.isRecurring = true;
FormItem repeatIntervalItem = repeatForm.getItem(FIELD_REPEAT_INTERVAL);
- repeatIntervalItem.setTitle("Run now and every");
+ repeatIntervalItem.setTitle(MSG.widget_jobTriggerEditor_field_repeatInterval_now());
repeatIntervalItem.redraw();
} else if (calendarType.equals("later")) {
this.isStartLater = true;
@@ -577,7 +578,7 @@ public class JobTriggerEditor extends LocatableVLayout {
this.isRecurring = true;
FormItem repeatIntervalItem = repeatForm.getItem(FIELD_REPEAT_INTERVAL);
- repeatIntervalItem.setTitle("Repeat every");
+ repeatIntervalItem.setTitle(MSG.widget_jobTriggerEditor_field_repeatInterval_later());
repeatIntervalItem.redraw();
}
laterForm.setVisibility(this.isStartLater ? Visibility.VISIBLE : Visibility.HIDDEN);
@@ -610,18 +611,19 @@ public class JobTriggerEditor extends LocatableVLayout {
supportedUnits.add(TimeUnit.WEEKS);
supportedUnits.add(TimeUnit.MONTHS);
supportedUnits.add(TimeUnit.YEARS);
- DurationItem repeatIntervalItem = new DurationItem(FIELD_REPEAT_INTERVAL, "Run now and every",
+ DurationItem repeatIntervalItem = new DurationItem(FIELD_REPEAT_INTERVAL,
+ MSG.widget_jobTriggerEditor_field_repeatInterval_now(),
supportedUnits, false, this.isReadOnly, repeatForm);
repeatIntervalItem.setRequired(true);
- repeatIntervalItem.setContextualHelp("how often the operation should be executed");
+ repeatIntervalItem.setContextualHelp(MSG.widget_jobTriggerEditor_fieldHelp_repeatInterval());
RadioGroupItem recurrenceTypeItem = new RadioGroupItem(FIELD_RECURRENCE_TYPE);
recurrenceTypeItem.setRequired(true);
recurrenceTypeItem.setShowTitle(false);
LinkedHashMap<String, String> recurrenceTypeValueMap = new LinkedHashMap<String, String>();
- recurrenceTypeValueMap.put("for", "For");
- recurrenceTypeValueMap.put("until", "Until");
- recurrenceTypeValueMap.put("indefinitely", "Indefinitely");
+ recurrenceTypeValueMap.put("for", MSG.widget_jobTriggerEditor_value_for());
+ recurrenceTypeValueMap.put("until", MSG.widget_jobTriggerEditor_value_until());
+ recurrenceTypeValueMap.put("indefinitely", MSG.widget_jobTriggerEditor_value_indefinitely());
recurrenceTypeItem.setValueMap(recurrenceTypeValueMap);
supportedUnits = new TreeSet<TimeUnit>();
@@ -636,7 +638,7 @@ public class JobTriggerEditor extends LocatableVLayout {
supportedUnits, true, this.isReadOnly, repeatForm);
repeatDurationItem.setShowTitle(false);
repeatDurationItem.setVisible(false);
- repeatDurationItem.setContextualHelp("keep running this operation this many times or until this amount of time has elapsed");
+ repeatDurationItem.setContextualHelp(MSG.widget_jobTriggerEditor_fieldHelp_repeatDuration());
final DateTimeItem endTimeItem = createDateTimeItem(FIELD_END_TIME);
endTimeItem.setShowTitle(false);
@@ -689,10 +691,10 @@ public class JobTriggerEditor extends LocatableVLayout {
laterForm.setNumCols(4);
laterForm.setColWidths(140, 130, 130);
- RadioGroupItem startTypeItem = new RadioGroupItem(FIELD_START_TYPE, "Run");
+ RadioGroupItem startTypeItem = new RadioGroupItem(FIELD_START_TYPE, MSG.widget_jobTriggerEditor_field_startType());
LinkedHashMap<String, String> startTypeValueMap = new LinkedHashMap<String, String>();
- startTypeValueMap.put("on", "on");
- startTypeValueMap.put("in", "in");
+ startTypeValueMap.put("on", MSG.widget_jobTriggerEditor_value_on());
+ startTypeValueMap.put("in", MSG.widget_jobTriggerEditor_value_in());
startTypeItem.setValueMap(startTypeValueMap);
startTypeItem.setShowTitle(true);
@@ -710,7 +712,7 @@ public class JobTriggerEditor extends LocatableVLayout {
supportedUnits, false, this.isReadOnly, laterForm);
startDelayItem.setShowTitle(false);
startDelayItem.setVisible(false);
- startDelayItem.setContextualHelp("start executing the operation after this amount of time has elapsed");
+ startDelayItem.setContextualHelp(MSG.widget_jobTriggerEditor_fieldHelp_startDelay());
SpacerItem spacerItem = new SpacerItem();
@@ -848,14 +850,16 @@ public class JobTriggerEditor extends LocatableVLayout {
isValid = isValid && this.laterForm.validate();
if (startTime != null) {
if (startTime.before(currentTime)) {
- Message message = new Message("Start time must be in the future.", Message.Severity.Error,
+ Message message = new Message(MSG.widget_jobTriggerEditor_message_startTimeMustBeInFuture(),
+ Message.Severity.Error,
EnumSet.of(Message.Option.Transient));
CoreGUI.getMessageCenter().notify(message);
isValid = false;
}
if (this.isRecurring && endTime != null) {
if (endTime.before(startTime)) {
- Message message = new Message("End time must be after start time.", Message.Severity.Error,
+ Message message = new Message(MSG.widget_jobTriggerEditor_message_endTimeMustBeAfterStartTime(),
+ Message.Severity.Error,
EnumSet.of(Message.Option.Transient));
CoreGUI.getMessageCenter().notify(message);
isValid = false;
@@ -867,7 +871,8 @@ public class JobTriggerEditor extends LocatableVLayout {
isValid = isValid && this.repeatForm.validate();
if (endTime != null) {
if (endTime.before(currentTime)) {
- Message message = new Message("End time must be in the future.", Message.Severity.Error,
+ Message message = new Message(MSG.widget_jobTriggerEditor_message_endTimeMustBeAfterStartTime(),
+ Message.Severity.Error,
EnumSet.of(Message.Option.Transient));
CoreGUI.getMessageCenter().notify(message);
isValid = false;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDataSource.java
index 6b8fcb4..c4f64a3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDataSource.java
@@ -79,29 +79,30 @@ public abstract class AbstractOperationHistoryDataSource<T extends OperationHist
}
@Override
- // TODO: i18n
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID, "ID");
+ DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID, MSG.common_title_id());
idField.setPrimaryKey(true);
fields.add(idField);
- DataSourceTextField nameField = new DataSourceTextField(Field.OPERATION_NAME, "Operation");
+ DataSourceTextField nameField = new DataSourceTextField(Field.OPERATION_NAME,
+ MSG.dataSource_operationHistory_field_operationName());
fields.add(nameField);
DataSourceTextField statusField = new DataSourceTextField(Field.STATUS, MSG.common_title_status());
fields.add(statusField);
DataSourceDateTimeField createdTimeField = new DataSourceDateTimeField(Field.CREATED_TIME,
- "Created Time");
+ MSG.dataSource_operationHistory_field_createdTime());
fields.add(createdTimeField);
DataSourceDateTimeField startedTimeField = new DataSourceDateTimeField(Field.STARTED_TIME,
- MSG.dataSource_operationHistory_startedTime());
+ MSG.dataSource_operationHistory_field_startedTime());
fields.add(startedTimeField);
- DataSourceTextField subjectField = new DataSourceTextField(Field.SUBJECT, "Requester");
+ DataSourceTextField subjectField = new DataSourceTextField(Field.SUBJECT,
+ MSG.dataSource_operationHistory_field_subject());
fields.add(subjectField);
return fields;
@@ -132,6 +133,4 @@ public abstract class AbstractOperationHistoryDataSource<T extends OperationHist
return record;
}
-
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java
index bb48230..c594103 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java
@@ -88,7 +88,8 @@ public abstract class AbstractOperationHistoryListView<T extends AbstractOperati
});
// TODO: i18n
- addTableAction(extendLocatorId("ForceDelete"), "Force Delete", getDeleteConfirmMessage(), new TableAction() {
+ addTableAction(extendLocatorId("ForceDelete"), MSG.view_operationHistoryList_button_forceDelete(),
+ getDeleteConfirmMessage(), new TableAction() {
public boolean isEnabled(ListGridRecord[] selection) {
int count = selection.length;
return (count >= 1 && hasControlPermission());
@@ -131,8 +132,6 @@ public abstract class AbstractOperationHistoryListView<T extends AbstractOperati
protected ListGridField createStartedTimeField() {
ListGridField startedTimeField = new ListGridField(AbstractOperationHistoryDataSource.Field.STARTED_TIME);
- //startedTimeField.setType(ListGridFieldType.DATE);
- //startedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
startedTimeField.setAlign(Alignment.LEFT);
startedTimeField.setCellAlign(Alignment.LEFT);
startedTimeField.setCellFormatter(new CellFormatter() {
@@ -141,7 +140,7 @@ public abstract class AbstractOperationHistoryListView<T extends AbstractOperati
Date date = (Date) value;
return DateTimeFormat.getMediumDateTimeFormat().format(date);
} else {
- return "<i>not yet started</i>";
+ return "<i>" + MSG.view_operationHistoryList_notYetStarted() + "</i>";
}
}
});
@@ -159,20 +158,21 @@ public abstract class AbstractOperationHistoryListView<T extends AbstractOperati
String statusStr = record.getAttribute(AbstractOperationHistoryDataSource.Field.STATUS);
OperationRequestStatus status = OperationRequestStatus.valueOf(statusStr);
switch (status) {
- case SUCCESS: {
- return MSG.common_status_success();
- }
- case FAILURE: {
- return MSG.common_status_failed();
- }
- case INPROGRESS: {
- return MSG.common_status_inprogress();
- }
- case CANCELED: {
- return MSG.common_status_canceled();
- }
+ case SUCCESS: {
+ return MSG.common_status_success();
+ }
+ case FAILURE: {
+ return MSG.common_status_failed();
+ }
+ case INPROGRESS: {
+ return MSG.common_status_inprogress();
+ }
+ case CANCELED: {
+ return MSG.common_status_canceled();
+ }
}
- return "unknown"; // should never get here
+ // should never get here
+ return MSG.common_status_unknown();
}
});
statusField.setCellFormatter(new CellFormatter() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDataSource.java
index 2e18af7..041c7db 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDataSource.java
@@ -92,13 +92,14 @@ public abstract class AbstractOperationScheduleDataSource<T extends OperationSch
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID, "Schedule ID");
+ DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID,
+ MSG.dataSource_operationSchedule_field_id());
idField.setPrimaryKey(true);
idField.setCanEdit(false);
fields.add(idField);
- DataSourceTextField operationNameField = createTextField(Field.OPERATION_NAME, "Operation", null, 100,
- true);
+ DataSourceTextField operationNameField = createTextField(Field.OPERATION_NAME,
+ MSG.dataSource_operationSchedule_field_operationName(), null, 100, true);
Set<OperationDefinition> operationDefinitions = this.resourceType.getOperationDefinitions();
LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
for (OperationDefinition operationDefinition : operationDefinitions) {
@@ -107,23 +108,26 @@ public abstract class AbstractOperationScheduleDataSource<T extends OperationSch
operationNameField.setValueMap(valueMap);
fields.add(operationNameField);
- DataSourceTextField operationDisplayNameField = createTextField(Field.OPERATION_DISPLAY_NAME, "Operation", null,
- 100, true);
+ DataSourceTextField operationDisplayNameField = createTextField(Field.OPERATION_DISPLAY_NAME,
+ MSG.dataSource_operationSchedule_field_operationDisplayName(), null, 100, true);
fields.add(operationDisplayNameField);
- DataSourceField subjectField = new DataSourceField(Field.SUBJECT, FieldType.ANY, "Owner");
+ DataSourceField subjectField = new DataSourceField(Field.SUBJECT, FieldType.ANY,
+ MSG.dataSource_operationSchedule_field_subject());
subjectField.setCanEdit(false);
fields.add(subjectField);
- DataSourceTextField descriptionField = createTextField(Field.DESCRIPTION, "Notes", null, 100, false);
+ DataSourceTextField descriptionField = createTextField(Field.DESCRIPTION,
+ MSG.dataSource_operationSchedule_field_description(), null, 100, false);
fields.add(descriptionField);
DataSourceDateTimeField nextFireTimeField = new DataSourceDateTimeField(Field.NEXT_FIRE_TIME,
- "Next Scheduled Execution");
+ MSG.dataSource_operationSchedule_field_nextFireTime());
nextFireTimeField.setCanEdit(false);
fields.add(nextFireTimeField);
- DataSourceIntegerField timeoutField = createIntegerField(Field.TIMEOUT, "Timeout (in seconds)", 30, null, false);
+ DataSourceIntegerField timeoutField = createIntegerField(Field.TIMEOUT,
+ MSG.dataSource_operationSchedule_field_timeout(), 30, null, false);
fields.add(timeoutField);
return fields;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
index 0600e5a..7dc0142 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
@@ -88,7 +88,7 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
public AbstractOperationScheduleDetailsView(String locatorId, AbstractOperationScheduleDataSource dataSource,
ResourceType resourceType, int scheduleId) {
- super(locatorId, dataSource, scheduleId, "Scheduled Operation", null);
+ super(locatorId, dataSource, scheduleId, MSG.view_operationScheduleDetails_operationSchedule(), null);
Set<OperationDefinition> operationDefinitions = resourceType.getOperationDefinitions();
for (OperationDefinition operationDefinition : operationDefinitions) {
@@ -144,11 +144,13 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
}
});
- this.operationDescriptionItem = new StaticTextItem(FIELD_OPERATION_DESCRIPTION, "Description");
+ this.operationDescriptionItem = new StaticTextItem(FIELD_OPERATION_DESCRIPTION,
+ MSG.view_operationScheduleDetails_field_description());
this.operationDescriptionItem.setShowTitle(false);
items.add(this.operationDescriptionItem);
- this.operationParametersItem = new StaticTextItem(FIELD_OPERATION_PARAMETERS, "Parameters");
+ this.operationParametersItem = new StaticTextItem(FIELD_OPERATION_PARAMETERS,
+ MSG.view_operationScheduleDetails_field_parameters());
this.operationParametersItem.setColSpan(2);
items.add(this.operationParametersItem);
@@ -180,22 +182,24 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
supportedUnits.add(TimeUnit.SECONDS);
supportedUnits.add(TimeUnit.MINUTES);
supportedUnits.add(TimeUnit.HOURS);
- DurationItem timeoutItem = new DurationItem(AbstractOperationScheduleDataSource.Field.TIMEOUT, "Timeout",
+ DurationItem timeoutItem = new DurationItem(AbstractOperationScheduleDataSource.Field.TIMEOUT,
+ MSG.view_operationScheduleDetails_field_timeout(),
supportedUnits, false, isReadOnly(), this.notesForm);
- timeoutItem.setContextualHelp("a time duration - if specified, if the duration elapses before a scheduled operation execution has completed, the RHQ Server will timeout the operation and consider it to have failed; note, it is usually not possible to abort the underlying managed resource operation if it was already initiated");
+ timeoutItem.setContextualHelp(MSG.view_operationScheduleDetails_fieldHelp_timeout());
notesFields.add(timeoutItem);
if (!isNewRecord()) {
StaticTextItem nextFireTimeItem = new StaticTextItem(AbstractOperationScheduleDataSource.Field.NEXT_FIRE_TIME,
- "Next Fire Time");
+ MSG.dataSource_operationSchedule_field_nextFireTime());
notesFields.add(nextFireTimeItem);
}
- TextAreaItem notesItem = new TextAreaItem(ResourceOperationScheduleDataSource.Field.DESCRIPTION, "Notes");
+ TextAreaItem notesItem = new TextAreaItem(ResourceOperationScheduleDataSource.Field.DESCRIPTION,
+ MSG.dataSource_operationSchedule_field_description());
notesItem.setWidth(450);
notesItem.setHeight(60);
notesItem.setShowTitle(true);
- FormUtility.addContextualHelp(notesItem, "an optional description of this scheduled operation (e.g. \"nightly maintenance app server restart\")");
+ FormUtility.addContextualHelp(notesItem, MSG.view_operationScheduleDetails_fieldHelp_description());
notesFields.add(notesItem);
this.notesForm.setFields(notesFields.toArray(new FormItem[notesFields.size()]));
@@ -306,7 +310,7 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
String operationName = getSelectedOperationName();
String value;
if (operationName == null) {
- value = "<i>Select an operation to see its description.</i>";
+ value = "<i>" + MSG.view_operationScheduleDetails_fieldDefault_description() + "</i>";
} else {
value = this.operationNameToDescriptionMap.get(operationName);
}
@@ -317,18 +321,18 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
String operationName = getSelectedOperationName();
String value;
if (operationName == null) {
- value = "<i>Select an operation to see its parameters.</i>";
+ value = "<i>" + MSG.view_operationScheduleDetails_fieldDefault_parameters() + "</i>";
} else {
ConfigurationDefinition parametersDefinition = this.operationNameToParametersDefinitionMap.get(operationName);
if (parametersDefinition == null || parametersDefinition.getPropertyDefinitions().isEmpty()) {
- value = "<i>" + MSG.view_operationCreateWizard_parametersStep_noParameters() + "</i>";
+ value = "<i>" + MSG.view_operationScheduleDetails_noParameters() + "</i>";
for (Canvas child : this.operationParametersConfigurationHolder.getChildren()) {
child.destroy();
}
this.operationParametersConfigurationHolder.hide();
} else {
- value = isNewRecord() ? "<i>Enter parameters below...</i>" : "";
+ value = isNewRecord() ? "<i>" + MSG.view_operationScheduleDetails_enterParametersBelow() + "</i>" : "";
for (Canvas child : this.operationParametersConfigurationHolder.getChildren()) {
child.destroy();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java
index 8d9e354..b2c80ba 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java
@@ -50,10 +50,8 @@ public abstract class AbstractOperationScheduleListView extends TableSection<Abs
ListGridField subjectField = new ListGridField(AbstractOperationScheduleDataSource.Field.SUBJECT, 110);
subjectField.setCellFormatter(new SubjectRecordCellFormatter());
- //ListGridField jobTriggerField = new ListGridField(OperationScheduleDataSource.Field.JOB_TRIGGER, 300);
-
ListGridField nextFireTimeField = new ListGridField(AbstractOperationScheduleDataSource.Field.NEXT_FIRE_TIME,
- "Next Scheduled Execution", 190);
+ 190);
ListGridField descriptionField = new ListGridField(AbstractOperationScheduleDataSource.Field.DESCRIPTION);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
index 250c2c9..8132abd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
@@ -32,7 +32,7 @@ public class GroupMemberResourceOperationHistoryListView
protected List<ListGridField> createFields() {
List<ListGridField> fields = new ArrayList<ListGridField>();
- ListGridField idField = new ListGridField(AbstractOperationHistoryDataSource.Field.ID, MSG.common_title_id());
+ ListGridField idField = new ListGridField(AbstractOperationHistoryDataSource.Field.ID);
idField.setWidth(38);
fields.add(idField);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java
index bfed707..832acfe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java
@@ -30,6 +30,8 @@ import java.util.List;
import java.util.Set;
/**
+ * The details view of the Group Operations>Schedules subtab.
+ *
* @author Ian Springer
*/
public class GroupOperationScheduleDetailsView extends AbstractOperationScheduleDetailsView {
@@ -64,7 +66,7 @@ public class GroupOperationScheduleDetailsView extends AbstractOperationSchedule
resourceDatasource.fetchData(criteria, new DSCallback() {
public void execute(DSResponse response, Object rawData, DSRequest request) {
if (response.getStatus() != DSResponse.STATUS_SUCCESS) {
- throw new RuntimeException("Failed to load group member Resources.");
+ throw new RuntimeException(MSG.view_group_operationScheduleDetails_failedToLoadMembers());
}
Record[] data = response.getData();
memberResourceRecords = new ListGridRecord[data.length];
@@ -92,15 +94,17 @@ public class GroupOperationScheduleDetailsView extends AbstractOperationSchedule
this.executionModeForm.setNumCols(2);
this.executionModeForm.setColWidths(FIRST_COLUMN_WIDTH, "*");
- RadioGroupItem executionModeItem = new RadioGroupItem(FIELD_EXECUTION_MODE, "Execute");
+ RadioGroupItem executionModeItem = new RadioGroupItem(FIELD_EXECUTION_MODE,
+ MSG.view_group_operationScheduleDetails_field_execute());
LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(2);
- valueMap.put(EXECUTION_ORDER_PARALLEL, "in parallel");
- valueMap.put(EXECUTION_ORDER_SEQUENTIAL, "in the order specified below (drag and drop member Resources to change order)");
+ valueMap.put(EXECUTION_ORDER_PARALLEL, MSG.view_group_operationScheduleDetails_value_parallel());
+ valueMap.put(EXECUTION_ORDER_SEQUENTIAL, MSG.view_group_operationScheduleDetails_value_sequential());
executionModeItem.setValueMap(valueMap);
executionModeItem.setDefaultValue(EXECUTION_ORDER_PARALLEL);
executionModeItem.setShowTitle(true);
- final CheckboxItem haltOnFailureItem = new CheckboxItem("haltOnFailure", "Halt on Failure?");
+ final CheckboxItem haltOnFailureItem = new CheckboxItem(GroupOperationScheduleDataSource.Field.HALT_ON_FAILURE,
+ MSG.view_group_operationScheduleDetails_field_haltOnFailure());
haltOnFailureItem.setDefaultValue(false);
haltOnFailureItem.setVisible(false);
haltOnFailureItem.setLabelAsTitle(true);
@@ -119,7 +123,7 @@ public class GroupOperationScheduleDetailsView extends AbstractOperationSchedule
this.memberExecutionOrderer = new ReorderableList(extendLocatorId("MemberExecutionOrderer"),
this.memberResourceRecords, null, memberIcon);
this.memberExecutionOrderer.setVisible(false);
- this.memberExecutionOrderer.setNameFieldTitle("Member Resource");
+ this.memberExecutionOrderer.setNameFieldTitle(MSG.view_group_operationScheduleDetails_memberResource());
hLayout.addMember(this.memberExecutionOrderer);
contentPane.addMember(hLayout);
@@ -148,7 +152,7 @@ public class GroupOperationScheduleDetailsView extends AbstractOperationSchedule
ListGridRecord[] resourceRecords = resourceDatasource.buildRecords(executionOrder);
this.memberExecutionOrderer.setRecords(resourceRecords);
this.memberExecutionOrderer.show();
- FormItem haltOnFailureItem = executionModeForm.getField("haltOnFailure");
+ FormItem haltOnFailureItem = executionModeForm.getField(GroupOperationScheduleDataSource.Field.HALT_ON_FAILURE);
haltOnFailureItem.show();
} else {
this.executionModeForm.setValue(FIELD_EXECUTION_MODE, EXECUTION_ORDER_PARALLEL);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java
index f2183af..7f9c2f1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java
@@ -24,6 +24,8 @@ import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.AbstractOperationScheduleListView;
/**
+ * The list view of the Group Operations>Schedules subtab.
+ *
* @author Ian Springer
*/
public class GroupOperationScheduleListView extends AbstractOperationScheduleListView {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java
index 22d89dd..bebe550 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java
@@ -4,6 +4,8 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.AbstractOperationScheduleDetailsView;
/**
+ * The details view of the Resource Operations>Schedules subtab.
+ *
* @author Ian Springer
*/
public class ResourceOperationScheduleDetailsView extends AbstractOperationScheduleDetailsView {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java
index eec89cc..221390c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java
@@ -25,7 +25,7 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.AbstractOperationScheduleListView;
/**
- * A table that displays all of the operation schedules for a particular Resource.
+ * The details view of the Resource Operations>Schedules subtab.
*
* @author Ian Springer
*/
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 940b293..9fcd822 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
@@ -69,6 +69,18 @@ common_label_week = week
common_label_weeks = weeks
common_label_yesterday=Yesterday
+# Common Units
+#-------------
+common_unit_times = times
+common_unit_milliseconds = milliseconds
+common_unit_seconds = seconds
+common_unit_minutes = minutes
+common_unit_hours = hours
+common_unit_days = days
+common_unit_weeks = weeks
+common_unit_months = months
+common_unit_years = years
+
# Common Titles
#--------------
common_title_address = Address
@@ -211,6 +223,7 @@ common_status_success = Success
common_status_failed = Failed
common_status_inprogress = In Progress
common_status_canceled = Canceled
+common_status_unknown = Unknown
# 1st, 2nd, 3rd, 4th, etc.
common_val_n1st = {0}st
@@ -313,8 +326,42 @@ widget_typeTree_badTypeId = Invalid URL. Bad resource type ID [{0}]
widget_typeTree_loadFail = Failed to load resource types
# Color Picker
+#--------------
widget_colorPicker_tooltip = Click to select a new color
+# Job Trigger Editor
+#--------------------
+widget_jobTriggerEditor_field_mode = Schedule using
+widget_jobTriggerEditor_value_calendar = Calendar
+widget_jobTriggerEditor_value_cronExpression = Cron Expression
+widget_jobTriggerEditor_value_now = Now
+widget_jobTriggerEditor_value_nowAndRepeat = Now & Repeat
+widget_jobTriggerEditor_value_later = Later
+widget_jobTriggerEditor_value_laterAndRepeat = Later & Repeat
+widget_jobTriggerEditor_field_cronExpression = Cron Expression
+widget_jobTriggerEditor_tab_format = Format
+widget_jobTriggerEditor_tab_examples = Examples
+widget_jobTriggerEditor_field_repeatInterval_now = Run now and every
+widget_jobTriggerEditor_field_repeatInterval_later = Repeat every
+widget_jobTriggerEditor_fieldHelp_repeatInterval = how often the operation should be executed
+widget_jobTriggerEditor_value_for = For
+widget_jobTriggerEditor_value_until = Until
+widget_jobTriggerEditor_value_indefinitely = Indefinitely
+widget_jobTriggerEditor_fieldHelp_repeatDuration = keep running this operation this many times or until this amount of time has elapsed
+widget_jobTriggerEditor_field_startType = Run
+widget_jobTriggerEditor_value_on = on
+widget_jobTriggerEditor_value_in = in
+widget_jobTriggerEditor_fieldHelp_startDelay = start executing the operation after this amount of time has elapsed
+widget_jobTriggerEditor_message_startTimeMustBeInFuture = Start time must be in the future.
+widget_jobTriggerEditor_message_endTimeMustBeAfterStartTime = End time must be after start time.
+widget_jobTriggerEditor_message_endTimeMustBeInFuture = End time must be in the future.
+
+# Duration Item
+#---------------
+widget_durationItem_inputUnitLessThanTargetUnit = Input unit is less than target unit.
+widget_durationItem_unitTypeNotSupported = Unit type [{0}] is not supported by this DurationItem.
+
+
#===================== Utils ======================
# Disambiguation Report Decorator
@@ -443,12 +490,10 @@ dataSource_schedules_updateSuccessful_concise = A new collection interval of [{0
dataSource_schedules_updateSuccessful_full_resource = A new collection interval of [{0}] seconds has been set on [{1}] measurements for resource with ID [{2}]. The updated measurements are: [{3}]
dataSource_schedules_updateSuccessful_full_group = A new collection interval of [{0}] seconds has been set on [{1}] measurements for resource group with ID [{2}]. The updated measurements are: [{3}]
-
# Resource Groups
#-----------------------
dataSource_resourceGroups_loadFailed = Failed to load Resource Groups
-
# Problem Resources
#------------------------------
dataSource_problemResources_field_resource = Resource
@@ -466,19 +511,31 @@ dataSource_recentOperations_field_time = Date/Time
dataSource_recentOperations_field_status = Status
dataSource_recentOperations_error_fetchFailure = Failed to load recently completed operations.
-# Scheduled Operations
-#---------------------------------
+# Scheduled Operations (ResourceOperationScheduleComposites)
+#------------------------------------------------------------
dataSource_scheduledOperations_field_resource = Resource
dataSource_scheduledOperations_field_location = Location
dataSource_scheduledOperations_field_operation = Operation
dataSource_scheduledOperations_field_time = Date/Time
dataSource_scheduledOperations_error_fetchFailure = Failed to load scheduled operations.
-# Operation History
-#---------------------------
+# Operation Schedules
+#--------------------
+dataSource_operationSchedule_field_id = Schedule ID
+dataSource_operationSchedule_field_operationName = Operation
+dataSource_operationSchedule_field_operationDisplayName = Operation
+dataSource_operationSchedule_field_subject = Owner
+dataSource_operationSchedule_field_description = Notes
+dataSource_operationSchedule_field_nextFireTime = Next Scheduled Execution
+dataSource_operationSchedule_field_timeout = Timeout (in seconds)
+
+# Operation Histories
+#--------------------
+dataSource_operationHistory_field_operationName = Operation Name
+dataSource_operationHistory_field_createdTime = Created Time
+dataSource_operationHistory_field_startedTime = Started Time
+dataSource_operationHistory_field_subject = Requester
dataSource_operationHistory_error_fetchFailure = Failure loading operation histories.
-dataSource_operationHistory_operationName = Operation Name
-dataSource_operationHistory_startedTime = Started Time
# Configuration History
#-------------------------------
@@ -1769,13 +1826,41 @@ view_configurationHistoryList_table_clickStatusIcon = Click the status icon for
#------------------------------------------
view_configurationHistoryDetails_error_loadFailure = Unable to load configuration history.
+
+# Operation Schedule List
+#------------------------
+xxx =
+
+# Operation Schedule Details
+#---------------------------
+view_operationScheduleDetails_operationSchedule = Operation Schedule
+view_operationScheduleDetails_field_description = Description
+view_operationScheduleDetails_field_parameters = Parameters
+view_operationScheduleDetails_field_timeout = Timeout
+view_operationScheduleDetails_fieldHelp_timeout = a time duration - if specified, if the duration elapses before a scheduled operation execution has completed, the RHQ Server will timeout the operation and consider it to have failed; note, it is usually not possible to abort the underlying managed resource operation if it was already initiated
+view_operationScheduleDetails_fieldHelp_description = an optional description of this scheduled operation (e.g. nightly maintenance app server restart)
+view_operationScheduleDetails_fieldDefault_description = Select an operation to see its description.
+view_operationScheduleDetails_fieldDefault_parameters = Select an operation to see its parameters.
+view_operationScheduleDetails_noParameters = This operation does not take any parameters.
+view_operationScheduleDetails_enterParametersBelow = Enter parameters below...
+
+view_group_operationScheduleDetails_failedToLoadMembers = Failed to load group member Resources.
+view_group_operationScheduleDetails_field_execute = Execute
+view_group_operationScheduleDetails_value_parallel = in parallel
+view_group_operationScheduleDetails_value_sequential = in the order specified below (drag and drop member Resources to change order)
+view_group_operationScheduleDetails_field_haltOnFailure = Halt on Failure?
+view_group_operationScheduleDetails_memberResource = Member Resource
+
+
# Operation History List
-#---------------------------------
+#-----------------------
view_operationHistoryList_title = Operation History
view_operationHistoryList_button_runOperation = Run Operation
+view_operationHistoryList_button_forceDelete = Force Delete
+view_operationHistoryList_notYetStarted = not yet started
# Operation History Details
-#--------------------------------------
+#--------------------------
view_operationHistoryDetails_error_fetchFailure = Failure loading operation history.
view_operationHistoryDetails_operation = Operation
view_operationHistoryDetails_dateSubmitted = Date Submitted
@@ -1785,55 +1870,6 @@ view_operationHistoryDetails_status = Status
view_operationHistoryDetails_parameters = Parameters
view_operationHistoryDetails_results = Results
-# Operation Create Wizard
-#-------------------------------------
-view_operationCreateWizard_title = Operation Wizard
-view_operationCreateWizard_header = Execute {0} on {1}
-view_operationCreateWizard_button_execute = Execute
-view_operationCreateWizard_button_executeImmediately = Execute Immediately
-view_operationCreateWizard_error_scheduleOperationFailure = Failed to schedule operation execution.
-view_operationCreateWizard_message_scheduleOperationSuccess_short = You have scheduled the operation [{0}] on this resource
-view_operationCreateWizard_message_scheduleOperationSuccess = You have scheduled the operation [{0}] on resource [{1}] with the schedule [{2}].
-view_operationCreateWizard_parametersStep_name = Operation Parameters
-view_operationCreateWizard_parametersStep_noParameters = This operation does not take any parameters.
-view_operationCreateWizard_schedulingStep_name = Schedule
-view_operationCreateWizard_schedulingStep_label_start = Start
-view_operationCreateWizard_schedulingStep_label_schedule = Schedule
-view_operationCreateWizard_schedulingStep_label_recurrence = Recurrence
-view_operationCreateWizard_schedulingStep_label_runAt = Run At
-view_operationCreateWizard_schedulingStep_label_nMinutes = n Minutes
-view_operationCreateWizard_schedulingStep_label_hourly = Hourly
-view_operationCreateWizard_schedulingStep_label_daily = Daily
-view_operationCreateWizard_schedulingStep_label_weekly = Weekly
-view_operationCreateWizard_schedulingStep_label_monthly = Monthly
-view_operationCreateWizard_schedulingStep_label_timePeriod = Time Period
-view_operationCreateWizard_schedulingStep_label_startDate = Start Date
-view_operationCreateWizard_schedulingStep_label_recurrenceEnd = Recurrence End
-view_operationCreateWizard_schedulingStep_label_endDate = End Date
-view_operationCreateWizard_schedulingStep_label_willExecuteImmediately = Will execute immediately
-view_operationCreateWizard_schedulingStep_label_onceAt = Once At
-view_operationCreateWizard_schedulingStep_label_date = Date
-view_operationCreateWizard_schedulingStep_label_time = Time
-view_operationCreateWizard_schedulingStep_label_everyNMinutes = Every n Minutes
-view_operationCreateWizard_schedulingStep_label_minuteInterval = Minute Interval
-view_operationCreateWizard_schedulingStep_label_hourlyAt = Hourly At
-view_operationCreateWizard_schedulingStep_label_minuteOfHour = Minute of Hour
-view_operationCreateWizard_schedulingStep_label_dailyAt = Daily At
-view_operationCreateWizard_schedulingStep_label_timeOfDay = Time of Day
-view_operationCreateWizard_schedulingStep_label_weeklyOn = Weekly On
-view_operationCreateWizard_schedulingStep_label_dayOfWeek = Day of Week
-view_operationCreateWizard_schedulingStep_label_monthlyOn = Monthly On
-view_operationCreateWizard_schedulingStep_label_dayOfMonth = Day of Month
-view_operationCreateWizard_executionSchedule_willExecuteOnce = Will execute {0}~.
-view_operationCreateWizard_executionSchedule_willExecuteRecurring = Will execute {0}, starting on {1}~.
-view_operationCreateWizard_executionSchedule_willExecuteRecurringWithEnd = Will execute {0}, starting on {1} and ending on {2}~.
-view_operationCreateWizard_executionSchedule_immediately = immediately
-view_operationCreateWizard_executionSchedule_onceAtGivenTime = once at {0}
-view_operationCreateWizard_executionSchedule_everyNMinutes = every {0} minutes
-view_operationCreateWizard_executionSchedule_everyHourOnNthMinute = every hour on the {0} minute
-view_operationCreateWizard_executionSchedule_everyDayAtGivenTime = every day at {0}
-view_operationCreateWizard_executionSchedule_everyWeekOnGivenDayAtGivenTime = every week on {0} at {1}
-view_operationCreateWizard_executionSchedule_everyMonthOnNthDayAtGivenTime = every month on the {0} day at {1}
# Summary Overview
#-----------------------------
commit a68a711863123bd05a4531e4607fca7b6db0dfb5
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 16:49:13 2011 -0500
Lazy Create SubTab Views
This means that for resource and group detail views we no longer create
the views for all active subtabs in advance. Instead, we create them when
they are navigated to. This means that construction/init/oninit/destroy/onDestroy
logis is avoided for non-rendered tabs. This should make things a bit
snappier overall and also protects against unwanted db round trips initiated
(perhaps unintentionally) from onInit (or even construction).
In short, supply SubTabs with ViewFactories as opposed to the view itself,
and generate the Canvas as needed. Note that once created we re-use the canvas
until the entire detail view is destroyed.
- also, move async db loads from construction to oninit in resource
ActivityView and group Activity2View. In general avoid async work
and db rts in the constructor. Wait for the widget to be attached to a
parent (oninit), or even better, when rendered (onDraw).
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
index 3492891..d257bec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.components.tab;
import com.smartgwt.client.widgets.Canvas;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableButton;
@@ -34,6 +35,7 @@ public class SubTab implements Locatable {
private String locatorId;
private ViewName viewName;
private Canvas canvas;
+ private ViewFactory viewFactory;
private LocatableButton button;
public SubTab(String locatorId, ViewName viewName, Canvas canvas) {
@@ -43,11 +45,22 @@ public class SubTab implements Locatable {
this.button = null;
}
+ public SubTab(String locatorId, ViewName viewName, Canvas initialCanvas, ViewFactory viewFactory) {
+ this.locatorId = locatorId;
+ this.viewName = viewName;
+ this.canvas = initialCanvas;
+ this.viewFactory = viewFactory;
+ this.button = null;
+ }
+
public String getLocatorId() {
return locatorId;
}
public Canvas getCanvas() {
+ if (null == canvas && null != viewFactory) {
+ canvas = viewFactory.createView();
+ }
return canvas;
}
@@ -55,6 +68,14 @@ public class SubTab implements Locatable {
this.canvas = canvas;
}
+ public ViewFactory getViewFactory() {
+ return viewFactory;
+ }
+
+ public void setViewFactory(ViewFactory viewFactory) {
+ this.viewFactory = viewFactory;
+ }
+
public LocatableButton getButton() {
return button;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 1611328..b722739 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -40,6 +40,7 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -115,12 +116,19 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
return (visible && enabled);
}
- protected void updateSubTab(TwoLevelTab tab, SubTab subTab, Canvas canvas, boolean visible, boolean enabled) {
+ protected void updateSubTab(TwoLevelTab tab, SubTab subTab, boolean visible, boolean enabled,
+ ViewFactory viewFactory) {
+ updateSubTab(tab, subTab, null, visible, enabled, viewFactory);
+ }
+
+ protected void updateSubTab(TwoLevelTab tab, SubTab subTab, Canvas canvas, boolean visible, boolean enabled,
+ ViewFactory viewFactory) {
tab.setVisible(subTab, visible);
if (visible) {
tab.setSubTabEnabled(subTab, enabled);
if (enabled) {
subTab.setCanvas(canvas);
+ subTab.setViewFactory(viewFactory);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 89079ac..9b2ad10 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -49,6 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
@@ -252,104 +253,180 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
private void updateSummaryTab() {
// Summary tab is always visible and enabled.
- updateSubTab(this.summaryTab, this.summaryActivity, new ActivityView(this.summaryActivity
- .extendLocatorId("View"), this.groupComposite), true, true);
- updateSubTab(this.summaryTab, this.summaryActivity2, new ActivityView2(this.summaryActivity2
- .extendLocatorId("View2"), this.groupComposite), true, true);
+ updateSubTab(this.summaryTab, this.summaryActivity, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ActivityView(summaryActivity.extendLocatorId("View"), groupComposite);
+ }
+ });
+ updateSubTab(this.summaryTab, this.summaryActivity2, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ActivityView2(summaryActivity2.extendLocatorId("View2"), groupComposite);
+ }
+ });
// TODO (ips): Add Timeline subtab?
}
- private void updateMonitoringTab(int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
+ private void updateMonitoringTab(final int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
boolean visible;
- Canvas canvas;
+ ViewFactory viewFactory;
if (updateTab(this.monitoringTab, groupCategory == GroupCategory.COMPATIBLE, true)) {
visible = hasMetricsOfType(this.groupComposite, DataType.MEASUREMENT);
- canvas = (visible) ? new FullHTMLPane(this.monitorGraphs.extendLocatorId("View"),
- "/rhq/group/monitor/graphs-plain.xhtml?groupId=" + groupId) : null;
- updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
-
- // visible = same test as above
- canvas = (visible) ? new FullHTMLPane(this.monitorTables.extendLocatorId("View"),
- "/rhq/group/monitor/tables-plain.xhtml?groupId=" + groupId) : null;
- updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorGraphs.extendLocatorId("View"),
+ "/rhq/group/monitor/graphs-plain.xhtml?groupId=" + groupId);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorGraphs, visible, true, viewFactory);
+
+ // visible = same test as above
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorTables.extendLocatorId("View"),
+ "/rhq/group/monitor/tables-plain.xhtml?groupId=" + groupId);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorTables, visible, true, viewFactory);
visible = hasMetricsOfType(this.groupComposite, DataType.TRAIT);
- canvas = (visible) ? new TraitsView(this.monitorTraits.extendLocatorId("View"), groupId) : null;
- updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new TraitsView(monitorTraits.extendLocatorId("View"), groupId);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorTraits, visible, true, viewFactory);
visible = hasMetricsOfType(this.groupComposite, null);
- canvas = (visible) ? new SchedulesView(this.monitorSched.extendLocatorId("View"), this.groupComposite) : null;
- updateSubTab(this.monitoringTab, this.monitorSched, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new SchedulesView(monitorSched.extendLocatorId("View"), groupComposite);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorSched, visible, true, viewFactory);
visible = facets.contains(ResourceTypeFacet.CALL_TIME);
- canvas = (visible) ? new FullHTMLPane(this.monitorCallTime.extendLocatorId("View"),
- "/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId) : null;
- updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorCallTime.extendLocatorId("View"),
+ "/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorCallTime, visible, true, viewFactory);
// TODO (ips): Add Availability subtab.
}
}
- private void updateInventoryTab(int groupId, Set<ResourceTypeFacet> facets) {
+ private void updateInventoryTab(final int groupId, Set<ResourceTypeFacet> facets) {
// Inventory tab is always visible and enabled.
- boolean canModifyMembers = (!isAutoGroup() && !isAutoCluster() && globalPermissions
+ final boolean canModifyMembers = (!isAutoGroup() && !isAutoCluster() && globalPermissions
.contains(Permission.MANAGE_INVENTORY));
- updateSubTab(this.inventoryTab, this.inventoryMembers, new MembersView(this.inventoryMembers
- .extendLocatorId("View"), groupId, canModifyMembers), true, true);
- updateSubTab(this.inventoryTab, this.inventoryConn, new CurrentGroupPluginConfigurationView(this.inventoryConn
- .extendLocatorId("View"), this.groupComposite), facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION),
- true);
- updateSubTab(this.inventoryTab, this.inventoryConnHistory, new HistoryGroupPluginConfigurationView(
- this.inventoryConnHistory.extendLocatorId("View"), this.groupComposite), facets
- .contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true);
+ updateSubTab(this.inventoryTab, this.inventoryMembers, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new MembersView(inventoryMembers.extendLocatorId("View"), groupId, canModifyMembers);
+ }
+ });
+ updateSubTab(this.inventoryTab, this.inventoryConn, facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION),
+ true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new CurrentGroupPluginConfigurationView(inventoryConn.extendLocatorId("View"),
+ groupComposite);
+ }
+ });
+ updateSubTab(this.inventoryTab, this.inventoryConnHistory, facets
+ .contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new HistoryGroupPluginConfigurationView(inventoryConnHistory.extendLocatorId("View"),
+ groupComposite);
+ }
+ });
}
private void updateOperationsTab(GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE
&& facets.contains(ResourceTypeFacet.OPERATION), true)) {
- updateSubTab(this.operationsTab, this.operationsSchedules, new GroupOperationScheduleListView(
- this.operationsSchedules.extendLocatorId("View"), this.groupComposite), true, true);
- updateSubTab(this.operationsTab, this.operationsHistory, new GroupOperationHistoryListView(
- this.operationsHistory.extendLocatorId("View"), this.groupComposite), true, true);
+ updateSubTab(this.operationsTab, this.operationsSchedules, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new GroupOperationScheduleListView(operationsSchedules.extendLocatorId("View"),
+ groupComposite);
+ }
+ });
+ updateSubTab(this.operationsTab, this.operationsHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new GroupOperationHistoryListView(operationsHistory.extendLocatorId("View"), groupComposite);
+ }
+ });
}
}
- private void updateAlertsTab(ResourceGroupComposite groupComposite, GroupCategory groupCategory) {
+ private void updateAlertsTab(final ResourceGroupComposite groupComposite, GroupCategory groupCategory) {
// alerts tab is always visible, even for mixed groups
if (updateTab(this.alertsTab, true, true)) {
// alert history is always available
- updateSubTab(this.alertsTab, this.alertHistory, GroupAlertHistoryView.get(this.alertHistory
- .extendLocatorId("View"), groupComposite), true, true);
+ updateSubTab(this.alertsTab, this.alertHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return GroupAlertHistoryView.get(alertHistory.extendLocatorId("View"), groupComposite);
+ }
+ });
// but alert definitions can only be created on compatible groups
boolean visible = (groupCategory == GroupCategory.COMPATIBLE);
- Canvas canvas = (visible) ? new GroupAlertDefinitionsView(alertDef.extendLocatorId("View"),
- this.groupComposite) : null;
- updateSubTab(this.alertsTab, this.alertDef, canvas, visible, true);
+ ViewFactory viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new GroupAlertDefinitionsView(alertDef.extendLocatorId("View"), groupComposite);
+ }
+ };
+ updateSubTab(this.alertsTab, this.alertDef, visible, true, viewFactory);
}
}
- private void updateConfigurationTab(int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
+ private void updateConfigurationTab(final int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
boolean visible = (groupCategory == GroupCategory.COMPATIBLE && facets
.contains(ResourceTypeFacet.CONFIGURATION));
Set<Permission> groupPermissions = this.groupComposite.getResourcePermission().getPermissions();
if (updateTab(this.configurationTab, visible, visible && groupPermissions.contains(Permission.CONFIGURE_READ))) {
//updateSubTab(this.configurationTab, this.configCurrent, new FullHTMLPane(
// "/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId), true, true);
- updateSubTab(this.configurationTab, this.configCurrent, new GroupResourceConfigurationEditView(
- this.configCurrent.extendLocatorId("View"), this.groupComposite), true, true);
- updateSubTab(this.configurationTab, this.configHistory, new FullHTMLPane(this.configHistory
- .extendLocatorId("View"), "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId), true,
- true);
+ updateSubTab(this.configurationTab, this.configCurrent, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new GroupResourceConfigurationEditView(configCurrent.extendLocatorId("View"), groupComposite);
+ }
+ });
+ updateSubTab(this.configurationTab, this.configHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(configHistory.extendLocatorId("View"),
+ "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId);
+ }
+ });
}
}
- private void updateEventsTab(ResourceGroupComposite groupComposite, GroupCategory groupCategory,
+ private void updateEventsTab(final ResourceGroupComposite groupComposite, GroupCategory groupCategory,
Set<ResourceTypeFacet> facets) {
// allow mixed groups to show events from supporting resources
boolean visible = (groupCategory == GroupCategory.MIXED || (groupCategory == GroupCategory.COMPATIBLE && facets
.contains(ResourceTypeFacet.EVENT)));
if (updateTab(this.eventsTab, visible, true)) {
- updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventHistory
- .extendLocatorId("View"), groupComposite), true, true);
+ updateSubTab(this.eventsTab, this.eventHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return EventCompositeHistoryView.get(eventHistory.extendLocatorId("View"), groupComposite);
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index a7c1b4f..98176d6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -77,6 +77,11 @@ public class ActivityView2 extends AbstractActivityView {
public ActivityView2(String locatorId, ResourceGroupComposite groupComposite) {
super(locatorId, groupComposite);
this.groupComposite = groupComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
loadData();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 4af193b..0f712a6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -48,6 +48,7 @@ import org.rhq.enterprise.gui.coregui.client.alert.definitions.ResourceAlertDefi
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
@@ -264,89 +265,167 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
markForRedraw();
}
- private void updateSummaryTabContent(Resource resource) {
- updateSubTab(this.summaryTab, this.summaryActivity, new ActivityView(this.summaryActivity
- .extendLocatorId("View"), this.resourceComposite), true, true);
+ private void updateSummaryTabContent(final Resource resource) {
+ updateSubTab(this.summaryTab, this.summaryActivity, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ActivityView(summaryActivity.extendLocatorId("View"), resourceComposite);
+ }
+ });
- updateSubTab(this.summaryTab, this.summaryTimeline, new FullHTMLPane(this.summaryTimeline
- .extendLocatorId("View"), "/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId()), true, true);
+ updateSubTab(this.summaryTab, this.summaryTimeline, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(summaryTimeline.extendLocatorId("View"),
+ "/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
+ }
+ });
}
// Inventory Tab (always enabled and visible)
- private void updateInventoryTabContent(ResourceComposite resourceComposite, Resource resource,
+ private void updateInventoryTabContent(final ResourceComposite resourceComposite, final Resource resource,
Set<ResourceTypeFacet> facets) {
ResourceType type = this.resourceComposite.getResource().getResourceType();
boolean visible = !type.getChildResourceTypes().isEmpty();
- Canvas canvas = (visible) ? ResourceCompositeSearchView.getChildrenOf(this.inventoryTab
- .extendLocatorId("ChildrenView"), resourceComposite) : null;
- updateSubTab(this.inventoryTab, this.inventoryChildren, canvas, visible, true);
-
- updateSubTab(this.inventoryTab, this.inventoryChildHistory, new Canvas(), visible, true);
+ ViewFactory viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return ResourceCompositeSearchView.getChildrenOf(inventoryTab.extendLocatorId("ChildrenView"),
+ resourceComposite);
+ }
+ };
+ updateSubTab(this.inventoryTab, this.inventoryChildren, visible, true, viewFactory);
+
+ updateSubTab(this.inventoryTab, this.inventoryChildHistory, visible, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ // TODO
+ return new Canvas();
+ }
+ });
visible = facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION);
- canvas = (visible) ? new PluginConfigurationEditView(this.inventoryTab.extendLocatorId("PluginConfigView"),
- resourceComposite) : null;
- updateSubTab(this.inventoryTab, this.inventoryConn, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new PluginConfigurationEditView(inventoryTab.extendLocatorId("PluginConfigView"),
+ resourceComposite);
+ }
+ };
+ updateSubTab(this.inventoryTab, this.inventoryConn, visible, true, viewFactory);
// same test, use above setting for 'visible'
- canvas = (visible) ? new PluginConfigurationHistoryView(this.inventoryConnHistory.extendLocatorId("View"),
- this.resourceComposite.getResourcePermission().isInventory(), this.resourceComposite.getResource().getId())
- : null;
- updateSubTab(this.inventoryTab, this.inventoryConnHistory, canvas, visible, true);
-
- boolean canModifyMembership = globalPermissions.contains(Permission.MANAGE_INVENTORY);
- updateSubTab(this.inventoryTab, this.inventoryGroups, ResourceGroupListView.getGroupsOf(this.inventoryTab
- .extendLocatorId("GroupsView"), resource.getId(), canModifyMembership), true, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new PluginConfigurationHistoryView(inventoryConnHistory.extendLocatorId("View"),
+ resourceComposite.getResourcePermission().isInventory(), resourceComposite.getResource().getId());
+ }
+ };
+ updateSubTab(this.inventoryTab, this.inventoryConnHistory, visible, true, viewFactory);
+
+ final boolean canModifyMembership = globalPermissions.contains(Permission.MANAGE_INVENTORY);
+ updateSubTab(this.inventoryTab, this.inventoryGroups, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return ResourceGroupListView.getGroupsOf(inventoryTab.extendLocatorId("GroupsView"), resource.getId(),
+ canModifyMembership);
+ }
+ });
boolean enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
- canvas = (enabled) ? new ResourceResourceAgentView(this.inventoryTab.extendLocatorId("AgentView"), resourceId)
- : null;
- updateSubTab(this.inventoryTab, this.inventoryAgent, canvas, true, enabled);
+ viewFactory = (!enabled) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceResourceAgentView(inventoryTab.extendLocatorId("AgentView"), resourceId);
+ }
+ };
+ updateSubTab(this.inventoryTab, this.inventoryAgent, true, enabled, viewFactory);
}
- private void updateAlertsTabContent(ResourceComposite resourceComposite) {
- updateSubTab(this.alertsTab, this.alertHistory, ResourceAlertHistoryView.get(this.alertHistory
- .extendLocatorId("View"), resourceComposite), true, true);
+ private void updateAlertsTabContent(final ResourceComposite resourceComposite) {
+ updateSubTab(this.alertsTab, this.alertHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return ResourceAlertHistoryView.get(alertHistory.extendLocatorId("View"), resourceComposite);
+ }
+ });
- updateSubTab(this.alertsTab, this.alertDef, new ResourceAlertDefinitionsView(alertsTab
- .extendLocatorId("AlertDefView"), this.resourceComposite), true, true);
+ updateSubTab(this.alertsTab, this.alertDef, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceAlertDefinitionsView(alertsTab.extendLocatorId("AlertDefView"), resourceComposite);
+ }
+ });
}
- private void updateMonitoringTabContent(Resource resource, Set<ResourceTypeFacet> facets) {
+ private void updateMonitoringTabContent(final Resource resource, Set<ResourceTypeFacet> facets) {
boolean visible = hasMetricsOfType(this.resourceComposite, DataType.MEASUREMENT);
- //canvas = (visible) ? new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource) : null;
- Canvas canvas = (visible) ? new FullHTMLPane(this.monitorGraphs.extendLocatorId("View"),
- "/rhq/resource/monitor/graphs-plain.xhtml?id=" + resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
+ ViewFactory viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorGraphs.extendLocatorId("View"),
+ "/rhq/resource/monitor/graphs-plain.xhtml?id=" + resource.getId());
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorGraphs, visible, true, viewFactory);
// visible = same test as above
- canvas = (visible) ? new MeasurementTableView(this.monitorTables.extendLocatorId("View"), resource.getId())
- : null;
- updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new MeasurementTableView(monitorTables.extendLocatorId("View"), resource.getId());
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorTables, visible, true, viewFactory);
visible = hasMetricsOfType(this.resourceComposite, DataType.TRAIT);
- canvas = (visible) ? new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
-
- updateSubTab(this.monitoringTab, this.monitorAvail, new FullHTMLPane(this.monitorAvail.extendLocatorId("View"),
- "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()), true, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new TraitsView(monitoringTab.extendLocatorId("TraitsView"), resource.getId());
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorTraits, visible, true, viewFactory);
+
+ updateSubTab(this.monitoringTab, this.monitorAvail, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorAvail.extendLocatorId("View"),
+ "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId());
+ }
+ });
- updateSubTab(this.monitoringTab, this.monitorSched, new SchedulesView(monitoringTab
- .extendLocatorId("SchedulesView"), this.resourceComposite), hasMetricsOfType(this.resourceComposite, null),
- true);
+ updateSubTab(this.monitoringTab, this.monitorSched, hasMetricsOfType(this.resourceComposite, null), true,
+ new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new SchedulesView(monitoringTab.extendLocatorId("SchedulesView"), resourceComposite);
+ }
+ });
visible = facets.contains(ResourceTypeFacet.CALL_TIME);
- canvas = (visible) ? new FullHTMLPane(this.monitorCallTime.extendLocatorId("View"),
- "/rhq/resource/monitor/response-plain.xhtml?id=" + resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorCallTime.extendLocatorId("View"),
+ "/rhq/resource/monitor/response-plain.xhtml?id=" + resource.getId());
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorCallTime, visible, true, viewFactory);
}
- private void updateEventsTabContent(ResourceComposite resourceComposite, Set<ResourceTypeFacet> facets) {
+ private void updateEventsTabContent(final ResourceComposite resourceComposite, Set<ResourceTypeFacet> facets) {
if (updateTab(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT), true)) {
- updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventsTab
- .extendLocatorId("CompositeHistoryView"), resourceComposite), true, true);
+ updateSubTab(this.eventsTab, this.eventHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return EventCompositeHistoryView.get(eventsTab.extendLocatorId("CompositeHistoryView"),
+ resourceComposite);
+ }
+ });
}
}
@@ -359,44 +438,81 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
// 4) user can navigate to the group operation that spawned this resource operation history, if appropriate
// note: enabled operation execution/schedules from left-nav, if it doesn't already exist
- updateSubTab(this.operationsTab, this.operationsSchedules, new ResourceOperationScheduleListView(
- operationsTab.extendLocatorId("SchedulesView"), this.resourceComposite), true, true);
+ updateSubTab(this.operationsTab, this.operationsSchedules, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceOperationScheduleListView(operationsTab.extendLocatorId("SchedulesView"),
+ resourceComposite);
+ }
+ });
- updateSubTab(this.operationsTab, this.operationsHistory, new ResourceOperationHistoryListView(operationsTab
- .extendLocatorId("HistoryView"), this.resourceComposite), true, true);
+ updateSubTab(this.operationsTab, this.operationsHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceOperationHistoryListView(operationsTab.extendLocatorId("HistoryView"),
+ resourceComposite);
+ }
+ });
}
}
- private void updateConfigurationTabContent(ResourceComposite resourceComposite, Resource resource,
+ private void updateConfigurationTabContent(final ResourceComposite resourceComposite, final Resource resource,
ResourcePermission resourcePermissions, Set<ResourceTypeFacet> facets) {
if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), resourcePermissions
.isConfigureRead())) {
- updateSubTab(this.configurationTab, this.configCurrent, new ResourceConfigurationEditView(this
- .extendLocatorId("ResourceConfigView"), resourceComposite), true, true);
+ updateSubTab(this.configurationTab, this.configCurrent, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceConfigurationEditView(configurationTab.extendLocatorId("ResourceConfigView"),
+ resourceComposite);
+ }
+ });
- updateSubTab(this.configurationTab, this.configHistory, new ConfigurationHistoryView(this
- .extendLocatorId("ConfigHistView"), this.resourceComposite.getResourcePermission().isConfigureWrite(),
- resource.getId()), true, true);
+ updateSubTab(this.configurationTab, this.configHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ConfigurationHistoryView(configurationTab.extendLocatorId("ConfigHistView"),
+ resourceComposite.getResourcePermission().isConfigureWrite(), resource.getId());
+ }
+ });
}
}
- private void updateContentTabContent(Resource resource, Set<ResourceTypeFacet> facets) {
+ private void updateContentTabContent(final Resource resource, Set<ResourceTypeFacet> facets) {
if (updateTab(this.contentTab, facets.contains(ResourceTypeFacet.CONTENT), true)) {
- updateSubTab(this.contentTab, this.contentDeployed, new FullHTMLPane(this.contentDeployed
- .extendLocatorId("View"), "/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()), true, true);
+ updateSubTab(this.contentTab, this.contentDeployed, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(contentDeployed.extendLocatorId("View"),
+ "/rhq/resource/content/view-plain.xhtml?id=" + resource.getId());
+ }
+ });
- updateSubTab(this.contentTab, this.contentNew, new FullHTMLPane(this.contentNew.extendLocatorId("View"),
- "/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId()), true, true);
+ updateSubTab(this.contentTab, this.contentNew, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(contentNew.extendLocatorId("View"),
+ "/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId());
+ }
+ });
- updateSubTab(this.contentTab, this.contentSubscrip, new FullHTMLPane(this.contentSubscrip
- .extendLocatorId("View"), "/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId()),
- true, true);
+ updateSubTab(this.contentTab, this.contentSubscrip, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(contentSubscrip.extendLocatorId("View"),
+ "/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId());
+ }
+ });
- updateSubTab(this.contentTab, this.contentHistory, new FullHTMLPane(this.configHistory
- .extendLocatorId("View"), "/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()), true,
- true);
+ updateSubTab(this.contentTab, this.contentHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(configHistory.extendLocatorId("View"),
+ "/rhq/resource/content/history-plain.xhtml?id=" + resource.getId());
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 452d85c..37b34f1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -72,6 +72,11 @@ public class ActivityView extends AbstractActivityView {
public ActivityView(String locatorId, ResourceComposite resourceComposite) {
super(locatorId, null);
this.resourceComposite = resourceComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
loadData();
}
commit a79237ec95405f86d6f2b8519ffa105368d8ad17
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 16:53:05 2011 -0500
now if you hit control-shift-S, you will get the statistics table window
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index fbcd0de..41af140 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -51,6 +51,7 @@ import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
import org.rhq.enterprise.gui.coregui.client.test.TestTopView;
+import org.rhq.enterprise.gui.coregui.client.test.i18n.TestRemoteServiceStatisticsView;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
import org.rhq.enterprise.gui.coregui.client.util.WidgetUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -133,6 +134,15 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
});
}
+ KeyIdentifier statisticsWindowKey = new KeyIdentifier();
+ statisticsWindowKey.setCtrlKey(true);
+ statisticsWindowKey.setKeyName("S");
+ Page.registerKey(statisticsWindowKey, new KeyCallback() {
+ public void execute(String keyName) {
+ TestRemoteServiceStatisticsView.showInWindow();
+ }
+ });
+
GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
public void onUncaughtException(Throwable e) {
getErrorHandler().handleError(MSG.view_core_uncaught(), e);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
index 0a6a0c2..e83dc1c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
@@ -51,6 +51,10 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
*/
public class TestRemoteServiceStatisticsView extends Table {
+ public static void showInWindow() {
+ new StatisticsWindow("StatisticsWindow").show();
+ }
+
public static final String TABLE_TITLE = "Remote Service Statistics";
// these are used both as the name of the fields, titles of the headers and the columns of the CSV output
@@ -286,7 +290,7 @@ public class TestRemoteServiceStatisticsView extends Table {
}
}
- class StatisticsWindow extends LocatableWindow {
+ static class StatisticsWindow extends LocatableWindow {
private Timer blinkTimer;
public StatisticsWindow(String locatorId) {
commit f35264dc9dd83f02ca1c38bc4171995ce3dbe3d3
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 16:38:17 2011 -0500
BZ 680167 forgot to reset the refreshing flag on load error, otherwise it would never refresh again on load failure
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
index c924352..cb789b5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
@@ -162,6 +162,7 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
this.configurationService.findResourceConfigurationsForGroup(group.getId(),
new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
public void onFailure(Throwable caught) {
+ refreshing = false;
CoreGUI.getErrorHandler().handleError(MSG.view_group_resConfig_edit_loadFail(group.toString()),
caught);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
index 9a124e5..f6ace09 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
@@ -165,6 +165,7 @@ public class CurrentGroupPluginConfigurationView extends LocatableVLayout implem
this.configurationService.findPluginConfigurationsForGroup(group.getId(),
new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
public void onFailure(Throwable caught) {
+ refreshing = false;
CoreGUI.getErrorHandler().handleError(
MSG.view_group_pluginConfig_members_fetchFailureConn(group.toString()), caught);
}
commit 1471bf460ce020fd91fcdf4c30f4d8e09b2640db
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 16:36:20 2011 -0500
BZ 680167 - this has the bug too - after adding the refreshing stuff, it is working better now (no dup queries)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 605ea83..98949f6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -62,6 +62,8 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
private ConfigurationEditor editor;
private IButton saveButton;
+ private boolean refreshing = false;
+
public ResourceConfigurationEditView(String locatorId, ResourceComposite resourceComposite) {
super(locatorId);
@@ -99,6 +101,11 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void refresh() {
+ if (this.refreshing) {
+ return; // we are already in the process of refreshing, don't do it again
+ }
+
+ this.refreshing = true;
this.saveButton.disable();
GWTServiceLookup.getConfigurationService().getLatestResourceConfigurationUpdate(resource.getId(),
@@ -121,6 +128,7 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
editor.setReadOnly(!resourcePermission.isConfigureWrite());
addMember(editor);
markForRedraw();
+ refreshing = false;
// TODO (ips): If editor != null, use editor.reload() instead.
}
});
@@ -128,6 +136,7 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onFailure(Throwable caught) {
+ refreshing = false;
CoreGUI.getErrorHandler().handleError("Cannot load resource config", caught);
}
});
commit 53bd82755c6fb065b66f6980e2f59459119f5e4e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 16:18:22 2011 -0500
BZ 680167 - this follows the same pattern as did GroupResourceConfigurationEditView
so I'm adding the "refreshing" check. however, in my testing, even though it used
the same pattern I did not see the same double querying. I don't know why this
is different, but to prevent this from happening anyway, I added the
refreshing check, it can't hurt.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
index e33773c..9a124e5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
@@ -73,6 +73,8 @@ public class CurrentGroupPluginConfigurationView extends LocatableVLayout implem
private ConfigurationEditor editor;
private IButton saveButton;
+ private boolean refreshing = false;
+
public CurrentGroupPluginConfigurationView(String locatorId, ResourceGroupComposite groupComposite) {
super(locatorId);
@@ -112,6 +114,11 @@ public class CurrentGroupPluginConfigurationView extends LocatableVLayout implem
@Override
public void refresh() {
+ if (this.refreshing) {
+ return; // we are already in the process of refreshing, don't do it again
+ }
+
+ this.refreshing = true;
this.saveButton.disable();
if (editor != null) {
editor.destroy();
@@ -132,6 +139,7 @@ public class CurrentGroupPluginConfigurationView extends LocatableVLayout implem
this.editor.addPropertyValueChangeListener(this);
this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
addMember(this.editor);
+ this.refreshing = false;
}
}
commit 1424976ad69ff143ae71651dbdc0cabb45bc567d
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 15:28:05 2011 -0500
add ability to set an auto-refresh timer.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
index dfab374..0a6a0c2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
@@ -18,8 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.test.i18n;
+import java.util.LinkedHashMap;
import java.util.List;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.Timer;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.RecordList;
import com.smartgwt.client.data.SortSpecifier;
@@ -46,6 +51,8 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
*/
public class TestRemoteServiceStatisticsView extends Table {
+ public static final String TABLE_TITLE = "Remote Service Statistics";
+
// these are used both as the name of the fields, titles of the headers and the columns of the CSV output
private static final String FIELD_SERVICENAME = "serviceName";
private static final String FIELD_METHODNAME = "methodName";
@@ -58,13 +65,23 @@ public class TestRemoteServiceStatisticsView extends Table {
private static final SortSpecifier[] defaultSorts = new SortSpecifier[] { new SortSpecifier("average",
SortDirection.DESCENDING) };
- // if this is true, this view is hosted by a standalone Window
- private boolean inWindow = false;
+ // if this is not null, this view is hosted by this standalone Window
+ private StatisticsWindow window = null;
+ private Timer timer = null;
+ private boolean refreshOnPageChange = false;
public TestRemoteServiceStatisticsView(String locatorId) {
- super(locatorId, "Remote Service Statistics", null, defaultSorts, null, false);
+ super(locatorId, TABLE_TITLE, null, defaultSorts, null, false);
+
+ timer = new Timer() {
+ @Override
+ public void run() {
+ refresh();
+ }
+ };
}
+ @SuppressWarnings("unchecked")
@Override
protected void configureTable() {
ListGridField serviceName = new ListGridField(FIELD_SERVICENAME, "Service Name");
@@ -101,14 +118,6 @@ public class TestRemoteServiceStatisticsView extends Table {
}
});
- addTableAction(extendLocatorId("refresh"), MSG.common_button_refresh(), new AbstractTableAction(
- TableActionEnablement.ALWAYS) {
- @Override
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- refresh();
- }
- });
-
addTableAction(extendLocatorId("export"), "Export To CSV",
new AbstractTableAction(TableActionEnablement.ALWAYS) {
@Override
@@ -140,7 +149,62 @@ public class TestRemoteServiceStatisticsView extends Table {
}
});
- if (!inWindow) {
+ if (window != null) {
+ LinkedHashMap<String, Integer> timerValues = new LinkedHashMap<String, Integer>();
+ timerValues.put("Now", Integer.valueOf("-2"));
+ timerValues.put(MSG.common_val_never(), Integer.valueOf("-1"));
+ timerValues.put("On Page Change", Integer.valueOf("0"));
+ timerValues.put("1", Integer.valueOf("1"));
+ timerValues.put("5", Integer.valueOf("5"));
+ timerValues.put("10", Integer.valueOf("10"));
+ timerValues.put("30", Integer.valueOf("30"));
+ timerValues.put("60", Integer.valueOf("60"));
+ History.addValueChangeHandler(new ValueChangeHandler<String>() {
+ @Override
+ public void onValueChange(ValueChangeEvent<String> event) {
+ if (refreshOnPageChange) {
+ refresh();
+ }
+ }
+ });
+
+ addTableAction(extendLocatorId("refreshTimer"), "Refresh", null, timerValues, new AbstractTableAction(
+ TableActionEnablement.ALWAYS) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+
+ Integer timeout = (Integer) actionValue;
+
+ // if being asked to refresh now, just refresh but don't touch our schedules
+ if (timeout == null || timeout.intValue() == -2) {
+ refresh();
+ return;
+ }
+
+ // cancel everything - will reinstate if user elected to do one of these
+ timer.cancel();
+ refreshOnPageChange = false;
+
+ if (timeout.intValue() == -1) {
+ setTableTitle(TABLE_TITLE);
+ } else if (timeout.intValue() == 0) {
+ refreshOnPageChange = true;
+ setTableTitle(TABLE_TITLE + " (refresh on page change)");
+ } else {
+ timer.scheduleRepeating(timeout.intValue() * 1000);
+ setTableTitle(TABLE_TITLE + " (refresh every " + timeout + "s)");
+ }
+ }
+ });
+ } else { // not in the standalone window
+ addTableAction(extendLocatorId("refresh"), MSG.common_button_refresh(), new AbstractTableAction(
+ TableActionEnablement.ALWAYS) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ refresh();
+ }
+ });
+
addTableAction(extendLocatorId("showInWin"), "Show In Window", new AbstractTableAction(
TableActionEnablement.ALWAYS) {
@Override
@@ -166,6 +230,9 @@ public class TestRemoteServiceStatisticsView extends Table {
public void refresh() {
super.refresh();
getListGrid().setRecords(transform(RemoteServiceStatistics.getAll()));
+ if (window != null) {
+ window.blink();
+ }
}
private ListGridRecord[] transform(List<Summary> stats) {
@@ -220,9 +287,11 @@ public class TestRemoteServiceStatisticsView extends Table {
}
class StatisticsWindow extends LocatableWindow {
+ private Timer blinkTimer;
+
public StatisticsWindow(String locatorId) {
super(locatorId);
- setTitle("Remote Service Statistics");
+ setTitle(TABLE_TITLE);
setShowMinimizeButton(true);
setShowMaximizeButton(true);
setShowCloseButton(true);
@@ -242,8 +311,28 @@ public class TestRemoteServiceStatisticsView extends Table {
TestRemoteServiceStatisticsView view;
view = new TestRemoteServiceStatisticsView(extendLocatorId("StatsViewInWin"));
- view.inWindow = true;
+ view.window = this;
addItem(view);
+
+ final String origColor = getBodyColor();
+ blinkTimer = new Timer() {
+ @Override
+ public void run() {
+ setBodyColor(origColor);
+ setTitle(TABLE_TITLE);
+ }
+ };
+ }
+
+ public void blink() {
+ // window.flash() isn't working so do it ourselves
+ if (getMinimized()) {
+ setTitle(TABLE_TITLE + " *");
+ } else {
+ setBodyColor(getHiliteBodyColor());
+ }
+ redraw();
+ blinkTimer.schedule(250);
}
}
}
commit 899277fc716afccc33bf413acaf0c513e20f6ad6
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Feb 25 13:51:46 2011 -0500
switch operations context menu on resource tree to link to operations>schedule subtab, rather than opening a wizard; delete the schedule-operation wizard classes, which are no longer used
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java
index b2a45b7..e4f061b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java
@@ -105,12 +105,7 @@ public abstract class AbstractRecordEditor<DS extends RPCDataSource> extends Loc
viewPath.next();
String parentViewPath = viewPath.getParentViewPath();
- if (!viewPath.isEnd()) {
- CoreGUI.getErrorHandler().handleError(MSG.widget_recordEditor_error_invalidViewPath(viewPath.toString()));
- CoreGUI.goToView(parentViewPath);
- } else {
- this.listViewPath = parentViewPath; // e.g. Administration/Security/Roles
- }
+ this.listViewPath = parentViewPath; // e.g. Administration/Security/Roles
}
/**
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDataSource.java
index e808b76..2e18af7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDataSource.java
@@ -99,18 +99,17 @@ public abstract class AbstractOperationScheduleDataSource<T extends OperationSch
DataSourceTextField operationNameField = createTextField(Field.OPERATION_NAME, "Operation", null, 100,
true);
- fields.add(operationNameField);
-
- DataSourceTextField operationDisplayNameField = createTextField(Field.OPERATION_DISPLAY_NAME, "Operation", null,
- 100, true);
- fields.add(operationDisplayNameField);
-
Set<OperationDefinition> operationDefinitions = this.resourceType.getOperationDefinitions();
LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
for (OperationDefinition operationDefinition : operationDefinitions) {
valueMap.put(operationDefinition.getName(), operationDefinition.getDisplayName());
}
- operationNameField.setValueMap(valueMap);
+ operationNameField.setValueMap(valueMap);
+ fields.add(operationNameField);
+
+ DataSourceTextField operationDisplayNameField = createTextField(Field.OPERATION_DISPLAY_NAME, "Operation", null,
+ 100, true);
+ fields.add(operationDisplayNameField);
DataSourceField subjectField = new DataSourceField(Field.SUBJECT, FieldType.ANY, "Owner");
subjectField.setCanEdit(false);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
index 807d6a9..0600e5a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
@@ -74,6 +74,7 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
protected static final int FIRST_COLUMN_WIDTH = 140;
+ private Map<Integer, String> operationIdToNameMap = new HashMap<Integer, String>();
private Map<String, String> operationNameToDescriptionMap = new HashMap<String, String>();
private Map<String, ConfigurationDefinition> operationNameToParametersDefinitionMap =
new HashMap<String, ConfigurationDefinition>();
@@ -83,6 +84,7 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
private JobTriggerEditor triggerEditor;
private Configuration parameters;
private EnhancedDynamicForm notesForm;
+ private Integer operationDefinitionId;
public AbstractOperationScheduleDetailsView(String locatorId, AbstractOperationScheduleDataSource dataSource,
ResourceType resourceType, int scheduleId) {
@@ -90,6 +92,7 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
Set<OperationDefinition> operationDefinitions = resourceType.getOperationDefinitions();
for (OperationDefinition operationDefinition : operationDefinitions) {
+ this.operationIdToNameMap.put(operationDefinition.getId(), operationDefinition.getName());
this.operationNameToDescriptionMap.put(operationDefinition.getName(), operationDefinition.getDescription());
this.operationNameToParametersDefinitionMap.put(operationDefinition.getName(),
operationDefinition.getParametersConfigurationDefinition());
@@ -102,6 +105,11 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
public void renderView(ViewPath viewPath) {
super.renderView(viewPath);
+ if (!viewPath.isEnd()) {
+ this.operationDefinitionId = viewPath.getCurrentAsInt();
+ viewPath.next();
+ }
+
// Existing schedules are not editable. This may change in the future.
boolean isReadOnly = (!hasControlPermission() || (getRecordId() != 0));
init(isReadOnly);
@@ -205,10 +213,17 @@ public abstract class AbstractOperationScheduleDetailsView extends AbstractRecor
@Override
protected Record createNewRecord() {
Record record = super.createNewRecord();
+
+ if (this.operationDefinitionId != null) {
+ String operationName = this.operationIdToNameMap.get(this.operationDefinitionId);
+ record.setAttribute(AbstractOperationScheduleDataSource.Field.OPERATION_NAME, operationName);
+ }
+
Subject sessionSubject = UserSessionManager.getSessionSubject();
AbstractOperationScheduleDataSource.SubjectRecord subjectRecord =
new AbstractOperationScheduleDataSource.SubjectRecord(sessionSubject);
record.setAttribute(ResourceOperationScheduleDataSource.Field.SUBJECT, subjectRecord);
+
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/ExecutionSchedule.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/ExecutionSchedule.java
deleted file mode 100644
index 26d53a8..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/ExecutionSchedule.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.HashSet;
-
-import com.google.gwt.i18n.client.DateTimeFormat;
-
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.Messages;
-
-/**
- * @author Greg Hinkle
- */
-public class ExecutionSchedule implements Serializable {
-
- private static final Messages MSG = CoreGUI.getMessages();
-
- public enum Start {
- Immediately, Future
- };
-
- public enum End {
- Never, EndOn
- };
-
- public enum Recurr {
- Once, EveryNMinutes, Hourly, Daily, Weekly, Monthly
- };
-
- public enum DayOfWeek {
- Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
- };
-
- private Start start = Start.Immediately;
-
- // start.Future
- private Recurr recurr = Recurr.Once;
-
- // Once
- private Date onceDateTime;
-
-
- // EveryNMinutes
- private Integer minuteInterval;
-
-
- // Hourly
- private Integer minuteInHour;
-
-
- // Daily
- private Date timeOfDay;
-
-
- // Weekly
- // Time of Day above
- private HashSet<DayOfWeek> daysOfWeek; // Can't use EnumSet because it doesn't have default instantiator
-
-
- // Monthly
- // Time of Day above
- private Integer dayOfMonth;
-
-
- // Used for all start.Future except for once
- private Date startDate;
-
- private Date endDate;
-
-
- public Start getStart() {
- return start;
- }
-
- public void setStart(Start start) {
- this.start = start;
- }
-
- public Recurr getRecurr() {
- return recurr;
- }
-
- public void setRecurr(Recurr recurr) {
- this.recurr = recurr;
- }
-
- public Date getOnceDateTime() {
- return onceDateTime;
- }
-
- public void setOnceDateTime(Date onceDateTime) {
- this.onceDateTime = onceDateTime;
- }
-
- public Integer getMinuteInterval() {
- return minuteInterval;
- }
-
- public void setMinuteInterval(Integer minuteInterval) {
- this.minuteInterval = minuteInterval;
- }
-
- public Integer getMinuteInHour() {
- return minuteInHour;
- }
-
- public void setMinuteInHour(Integer minuteInHour) {
- this.minuteInHour = minuteInHour;
- }
-
- public HashSet<DayOfWeek> getDaysOfWeek() {
- return daysOfWeek;
- }
-
- public void setDaysOfWeek(HashSet<DayOfWeek> daysOfWeek) {
- this.daysOfWeek = daysOfWeek;
- }
-
- public Integer getDayOfMonth() {
- return dayOfMonth;
- }
-
- public void setDayOfMonth(Integer dayOfMonth) {
- this.dayOfMonth = dayOfMonth;
- }
-
- public Date getStartDate() {
- return startDate;
- }
-
- public void setStartDate(Date startDate) {
- this.startDate = startDate;
- }
-
- public Date getEndDate() {
- return endDate;
- }
-
- public void setEndDate(Date endDate) {
- this.endDate = endDate;
- }
-
- public Date getTimeOfDay() {
- return timeOfDay;
- }
-
- public void setTimeOfDay(Date timeOfDay) {
- this.timeOfDay = timeOfDay;
- }
-
- public String getMessage() {
- DateTimeFormat dateFormat = DateTimeFormat.getMediumDateFormat();
- DateTimeFormat timeFormat = DateTimeFormat.getMediumTimeFormat();
-
- String message;
- switch (start) {
-
- case Immediately:
- message = MSG.view_operationCreateWizard_executionSchedule_willExecuteOnce(
- MSG.view_operationCreateWizard_executionSchedule_immediately());
- break;
-
- case Future:
- if (recurr == Recurr.Once) {
- message = MSG.view_operationCreateWizard_executionSchedule_willExecuteOnce(
- MSG.view_operationCreateWizard_executionSchedule_onceAtGivenTime(onceDateTime.toString()));
- } else {
- String recurrenceMessage;
- switch (recurr) {
- case EveryNMinutes:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyNMinutes(minuteInterval.toString());
- break;
- case Hourly:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyHourOnNthMinute(suffix(minuteInHour));
- break;
- case Daily:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyDayAtGivenTime(timeFormat.format(timeOfDay));
- break;
- case Weekly:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyWeekOnGivenDayAtGivenTime(daysOfWeek.toString(), timeFormat.format(timeOfDay));
- break;
- case Monthly:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyMonthOnNthDayAtGivenTime(suffix(dayOfMonth), timeFormat.format(timeOfDay));
- break;
- default:
- recurrenceMessage = "";
- }
-
- if (endDate != null) {
- message = MSG.view_operationCreateWizard_executionSchedule_willExecuteRecurringWithEnd(
- recurrenceMessage, dateFormat.format(startDate), dateFormat.format(endDate));
- } else {
- message = MSG.view_operationCreateWizard_executionSchedule_willExecuteRecurring(
- recurrenceMessage, dateFormat.format(startDate));
- }
- }
- break;
-
- default:
- message = "";
-
- }
-
- return message;
- }
-
-
- public String getCronString() {
-
- /* Cron fields
- 1. Seconds
- 2. Minutes
- 3. Hours
- 4. Day-of-Month
- 5. Month
- 6. Day-of-Week
- 7. Year (optional field)
- */
-
- String cseconds, cminutes = null, chours = null, cdayOfMonth = null, cmonth = null, cdayOfWeek = null;
-
- cseconds = "0";
-
- switch (start) {
-
- case Immediately:
- return null; // No cron string for immediate execution
-
- case Future:
-
- if (recurr == Recurr.Once) {
- return null; // No cron string for non recurring
- } else {
- switch (recurr) {
- case EveryNMinutes:
- cminutes = "0/" + minuteInterval;
- chours = cdayOfMonth = cmonth = "*";
- cdayOfWeek = "?";
- break;
- case Hourly:
- cminutes = "" + minuteInHour;
- chours = "*";
- cdayOfMonth = cmonth = cdayOfWeek = "*";
- break;
- case Daily:
- cminutes = "" + timeOfDay.getMinutes();
- chours = "" + timeOfDay.getHours();
- cdayOfMonth = cmonth = cdayOfWeek = "*";
- break;
- case Weekly:
- cminutes = "" + timeOfDay.getMinutes();
- chours = "" + timeOfDay.getHours();
- cdayOfMonth = "?";
- cmonth = "*";
- cdayOfWeek = daysOfWeek.toString();
- break;
- case Monthly:
- cminutes = "" + timeOfDay.getMinutes();
- chours = "" + timeOfDay.getHours();
- cdayOfMonth = "" + dayOfMonth;
- cmonth = "*";
- cdayOfWeek = "?";
- break;
- }
- }
- break;
- }
- return cseconds + " " + cminutes + " " + chours + " " + cdayOfMonth + " " + cmonth + " " + cdayOfWeek;
-
- }
-
- public static String suffix(int number) {
- String result;
- String numberAsString = String.valueOf(number);
- int last = number % 10;
- switch (last) {
- case 1:
- result = MSG.common_val_n1st(numberAsString);
- break;
- case 2:
- result = MSG.common_val_n2nd(numberAsString);
- break;
- case 3:
- result = MSG.common_val_n3rd(numberAsString);
- break;
- default:
- result = MSG.common_val_nth(numberAsString);
- }
- return result;
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationCreateWizard.java
deleted file mode 100644
index fc3c6f2..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationCreateWizard.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.operation.OperationDefinition;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizard;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
-/**
- * @author Greg Hinkle
- */
-public class OperationCreateWizard extends AbstractWizard {
-
- private Resource resource;
- private OperationDefinition operationDefinition;
-
- private OperationParametersStep parametersStep;
- private OperationSchedulingStep schedulingStep;
-
- private WizardView view;
-
- private IButton executeNowButton;
- private IButton executeButton;
-
- public OperationCreateWizard(Resource resource, OperationDefinition operationDefinition) {
- this.resource = resource;
- this.operationDefinition = operationDefinition;
- }
-
- public void startOperationWizard() {
-
- parametersStep = new OperationParametersStep(operationDefinition);
- schedulingStep = new OperationSchedulingStep();
-
- ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
- steps.add(parametersStep);
- steps.add(schedulingStep);
- setSteps(steps);
-
- executeNowButton = new IButton(MSG.view_operationCreateWizard_button_executeImmediately());
- executeNowButton.setAutoFit(true);
- executeNowButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- execute();
- }
- });
-
- executeButton = new IButton(MSG.view_operationCreateWizard_button_execute());
- executeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- execute();
- }
- });
-
- view = new WizardView(this);
- view.displayDialog();
- }
-
- public String getWindowTitle() {
- return MSG.view_operationCreateWizard_title();
- }
-
- public String getTitle() {
- return MSG.view_operationCreateWizard_header(operationDefinition.getDisplayName(), resource.getName());
- }
-
- public String getSubtitle() {
- return operationDefinition.getDescription();
- }
-
- public List<IButton> getCustomButtons(int step) {
- switch (step) {
- case 0:
- return Arrays.asList(executeNowButton);
- case 1:
- return Arrays.asList(executeButton);
- default:
- return Collections.emptyList();
- }
- }
-
- private void execute() {
- Configuration parameters = parametersStep.getParameterConfiguration();
- final ExecutionSchedule schedule = schedulingStep.getExecutionSchedule();
-
- // TODO: get the description and timeout from user input
- String description = "";
- int timeout = 0;
-
- AsyncCallback<Void> operationCallback = new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_operationCreateWizard_error_scheduleOperationFailure(),
- caught);
- }
-
- public void onSuccess(Void result) {
- String opName = operationDefinition.getDisplayName();
- String cron = schedule.getCronString();
- if (cron == null) {
- cron = MSG.common_val_na();
- }
- String concise = MSG.view_operationCreateWizard_message_scheduleOperationSuccess_short(opName);
- String message = MSG.view_operationCreateWizard_message_scheduleOperationSuccess(opName, String
- .valueOf(resource.getId()), cron);
-
- CoreGUI.getMessageCenter().notify(new Message(concise, message, Message.Severity.Info));
- }
- };
-
- if (schedule.getStart() == ExecutionSchedule.Start.Immediately) {
- GWTServiceLookup.getOperationService().invokeResourceOperation(resource.getId(),
- operationDefinition.getName(), parameters, description, timeout, operationCallback);
- } else {
- GWTServiceLookup.getOperationService().scheduleResourceOperation(resource.getId(),
- operationDefinition.getName(), parameters, description, timeout, schedule.getCronString(),
- operationCallback);
- }
-
- view.closeDialog();
- }
-
- public void cancel() {
- // TODO: revert back to original state
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationParametersStep.java
deleted file mode 100644
index 8ce2ada..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationParametersStep.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
-
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.operation.OperationDefinition;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
-
-/**
- * @author Greg Hinkle
- */
-public class OperationParametersStep extends AbstractWizardStep {
-
- private OperationDefinition definition;
-
- private ConfigurationEditor configurationEditor;
-
- public OperationParametersStep(OperationDefinition operationDefinition) {
- super();
- this.definition = operationDefinition;
- }
-
- public Canvas getCanvas(Locatable parent) {
- if (definition.getParametersConfigurationDefinition() != null) {
- if (configurationEditor == null) {
- ConfigurationDefinition configurationDefinition = definition.getParametersConfigurationDefinition();
- Configuration defaultConfiguration = configurationDefinition.getDefaultTemplate() != null ? configurationDefinition
- .getDefaultTemplate().createConfiguration()
- : new Configuration();
- if (parent != null) {
- configurationEditor = new ConfigurationEditor(parent.extendLocatorId("OperationParams"),
- configurationDefinition, defaultConfiguration);
- } else {
- configurationEditor = new ConfigurationEditor("OperationParams", configurationDefinition,
- defaultConfiguration);
- }
- }
- return configurationEditor;
- } else {
- return new HTMLFlow(MSG.view_operationCreateWizard_parametersStep_noParameters());
- }
- }
-
- public boolean nextPage() {
- return true; // TODO: Implement this method.
- }
-
- public String getName() {
- return MSG.view_operationCreateWizard_parametersStep_name();
- }
-
- public Configuration getParameterConfiguration() {
- return configurationEditor != null ? configurationEditor.getConfiguration() : null;
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationSchedulingStep.java
deleted file mode 100644
index 1db4791..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationSchedulingStep.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import com.smartgwt.client.types.FormErrorOrientation;
-import com.smartgwt.client.types.TimeFormatter;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.FormItemIfFunction;
-import com.smartgwt.client.widgets.form.ValuesManager;
-import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
-import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
-import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.form.fields.CheckboxItem;
-import com.smartgwt.client.widgets.form.fields.DateItem;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.HeaderItem;
-import com.smartgwt.client.widgets.form.fields.IntegerItem;
-import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
-import com.smartgwt.client.widgets.form.fields.SpacerItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.form.fields.TimeItem;
-import com.smartgwt.client.widgets.form.validator.CustomValidator;
-
-import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
-
-/**
- * @author Greg Hinkle
- */
-public class OperationSchedulingStep extends AbstractWizardStep implements ItemChangedHandler {
-
- private DynamicForm form;
- private ValuesManager valuesManager;
-
- private ExecutionSchedule executionSchedule = new ExecutionSchedule();
-
- public Canvas getCanvas(Locatable parent) {
-
- if (form == null) {
- valuesManager = new ValuesManager();
- if (parent != null) {
- form = new LocatableDynamicForm(parent.extendLocatorId("OperationScheduling"));
- } else {
- form = new LocatableDynamicForm("OperationScheduling");
- }
- form.setValuesManager(valuesManager);
- form.setWrapItemTitles(false);
- form.setErrorOrientation(FormErrorOrientation.RIGHT);
- form.setWidth100();
- form.setPadding(10);
- form.setNumCols(3);
- // form.setColWidths("15%", "35%", "15%", "*");
- form.setValidateOnChange(true);
-
- final RadioGroupItem start = new RadioGroupItem("start", MSG
- .view_operationCreateWizard_schedulingStep_name());
- start.setColSpan(3);
- start.setValueMap(enumValueMap(ExecutionSchedule.Start.class)); // "Immediately", "Future"
- start.setRedrawOnChange(true);
- start.setValue("Immediately");
-
- HeaderItem scheduleHeader = new HeaderItem("scheduleHeader");
- scheduleHeader.setValue(MSG.view_operationCreateWizard_schedulingStep_label_schedule());
- scheduleHeader.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"));
- }
- });
-
- RadioGroupItem recurr = new RadioGroupItem("recurr", MSG
- .view_operationCreateWizard_schedulingStep_label_recurrence());
- recurr.setValueMap(enumValueMap(ExecutionSchedule.Recurr.class)); // "Once", "EveryNMinutes", "Hourly", "Daily", "Weekly", "Monthly");
- recurr.setRedrawOnChange(true);
- recurr.setValue(ExecutionSchedule.Recurr.Once.name());
- recurr.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"));
- }
- });
-
- CanvasItem onceForm = new CanvasItem("once", MSG.view_operationCreateWizard_schedulingStep_label_onceAt());
- onceForm.setShowTitle(false);
- onceForm.setCanvas(getOnceForm());
- onceForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem everyNMinuteForm = new CanvasItem("everyNMinutesForm", MSG
- .view_operationCreateWizard_schedulingStep_label_everyNMinutes());
- everyNMinuteForm.setShowTitle(false);
- everyNMinuteForm.setCanvas(getEveryNMinutesForm());
- everyNMinuteForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.EveryNMinutes.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem hourlyForm = new CanvasItem("hourlyForm", MSG
- .view_operationCreateWizard_schedulingStep_label_hourly());
- hourlyForm.setShowTitle(false);
- hourlyForm.setCanvas(getHourlyForm());
- hourlyForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Hourly.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem dailyForm = new CanvasItem("daily", MSG.view_operationCreateWizard_schedulingStep_label_daily());
- dailyForm.setShowTitle(false);
- dailyForm.setCanvas(getDailyForm());
- dailyForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Daily.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem weeklyForm = new CanvasItem("weekly", MSG
- .view_operationCreateWizard_schedulingStep_label_weekly());
- weeklyForm.setShowTitle(false);
- weeklyForm.setCanvas(getWeeklyForm());
- weeklyForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Weekly.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem monthlyForm = new CanvasItem("monthly", MSG
- .view_operationCreateWizard_schedulingStep_label_monthly());
- monthlyForm.setShowTitle(false);
- monthlyForm.setCanvas(getMonthlyForm());
- monthlyForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Monthly.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- HeaderItem rangeHeader = new HeaderItem("timePeriod");
- rangeHeader.setValue(MSG.view_operationCreateWizard_schedulingStep_label_timePeriod());
- rangeHeader.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && !ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- DateItem startDate = new DateItem("startDate", MSG
- .view_operationCreateWizard_schedulingStep_label_startDate());
- startDate.setStartRow(true);
- startDate.setStartDate(new Date());
- startDate.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && !"Once".equals(form.getValueAsString("recurr"));
- }
- });
-
- final RadioGroupItem end = new RadioGroupItem("endType", MSG
- .view_operationCreateWizard_schedulingStep_label_endDate());
- end.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && !"Once".equals(form.getValueAsString("recurr"));
- }
- });
- end.setStartRow(true);
- // TODO: i18n
- end.setValueMap("Never", "End On");
- end.setRedrawOnChange(true);
- end.setValue("Never");
-
- DateItem endDate = new DateItem("endDate", MSG.view_operationCreateWizard_schedulingStep_label_endDate());
- endDate.setStartRow(true);
- endDate.setStartDate(new Date());
- endDate.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && !"Once".equals(form.getValueAsString("recurr"))
- && !"Never".equals(form.getValueAsString("endType"));
- }
- });
- endDate.setValidators(new CustomValidator() {
- @Override
- protected boolean condition(Object o) {
- return (((Date) form.getValue("startDate")).before((Date) o));
- }
- });
-
- StaticTextItem messageItem = new StaticTextItem("message");
- messageItem.setValue(MSG.view_operationCreateWizard_schedulingStep_label_willExecuteImmediately());
- messageItem.setStartRow(true);
- messageItem.setColSpan(3);
- messageItem.setShowTitle(false);
- messageItem.setCellStyle("HeaderLabel");
-
- form.setItems(start, scheduleHeader, recurr, onceForm, everyNMinuteForm, hourlyForm, dailyForm, weeklyForm,
- monthlyForm, rangeHeader, startDate, end, endDate, new SpacerItem(), messageItem);
-
- form.addItemChangedHandler(this);
- }
-
- return form;
- }
-
- private DynamicForm getOnceForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_onceAt());
- form.addItemChangedHandler(this);
-
- form.setWrapItemTitles(false);
- form.setNumCols(2);
-
- DateItem startDate = new DateItem("onceStartDate", MSG
- .view_operationCreateWizard_schedulingStep_label_startDate());
- startDate.setValue(new Date());
-
- TimeItem startTime = new TimeItem("onceStartDate", MSG
- .view_operationCreateWizard_schedulingStep_label_startDate());
- startTime.setValue(new Date());
- startTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- startTime.setUseMask(true);
- form.setItems(startDate, startTime);
- return form;
- }
-
- private DynamicForm getEveryNMinutesForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_everyNMinutes());
- form.addItemChangedHandler(this);
-
- form.setWrapItemTitles(false);
- form.setNumCols(2);
-
- IntegerItem everyNMinutes = new IntegerItem();
- everyNMinutes.setName("minuteInterval");
- everyNMinutes.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_minuteInterval());
- everyNMinutes.setValue(60);
-
- form.setItems(everyNMinutes);
- return form;
- }
-
- private DynamicForm getHourlyForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_hourly());
- form.addItemChangedHandler(this);
-
- form.setWrapItemTitles(false);
- form.setNumCols(2);
-
- IntegerItem minuteOfHour = new IntegerItem();
- minuteOfHour.setName("minuteOfHour");
- minuteOfHour.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_minuteOfHour());
- minuteOfHour.setValue(5);
-
- form.setItems(minuteOfHour);
- return form;
- }
-
- private DynamicForm getDailyForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setWrapItemTitles(false);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_daily());
- form.addItemChangedHandler(this);
-
- TimeItem timeOfDay = new TimeItem("timeOfDay", MSG.view_operationCreateWizard_schedulingStep_label_timeOfDay());
- timeOfDay.setValue(new Date());
- timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- timeOfDay.setUseMask(true);
-
- form.setItems(timeOfDay);
- return form;
- }
-
- private DynamicForm getWeeklyForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_weekly());
- form.addItemChangedHandler(this);
-
- form.setWrapItemTitles(false);
-
- TimeItem timeOfDay = new TimeItem("dayOfWeek", MSG.view_operationCreateWizard_schedulingStep_label_dayOfWeek());
- timeOfDay.setValue(new Date());
- timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- timeOfDay.setUseMask(true);
-
- ExecutionSchedule.DayOfWeek[] daysOfWeek = ExecutionSchedule.DayOfWeek.values();
- List<String> dayList = new ArrayList<String>();
- for (ExecutionSchedule.DayOfWeek dayOfWeek : daysOfWeek) {
- dayList.add(dayOfWeek.name());
- }
- FormItem[] items = new FormItem[8];
- items[0] = timeOfDay;
- int i = 1;
- for (String day : dayList) {
- CheckboxItem dayItem = new CheckboxItem(day);
- dayItem.setShowTitle(false);
- items[i++] = dayItem;
- }
- form.setItems(items);
- return form;
- }
-
- private DynamicForm getMonthlyForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setWrapItemTitles(false);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_monthly());
- form.addItemChangedHandler(this);
-
- IntegerItem dayItem = new IntegerItem();
- dayItem.setName("dayOfMonth");
- dayItem.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_dayOfMonth());
- dayItem.setValue(1);
-
- TimeItem timeOfDay = new TimeItem("timeOfDay", MSG.view_operationCreateWizard_schedulingStep_label_timeOfDay());
- timeOfDay.setValue(new Date());
- timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- timeOfDay.setUseMask(true);
-
- form.setItems(dayItem, timeOfDay);
- return form;
- }
-
- public boolean nextPage() {
- return true; // TODO: Implement this method.
- }
-
- public String getName() {
- return MSG.view_operationCreateWizard_schedulingStep_name();
- }
-
- public void onItemChanged(ItemChangedEvent itemChangeEvent) {
-
- executionSchedule.setStart(ExecutionSchedule.Start.valueOf(valuesManager.getValueAsString("start")));
- executionSchedule.setRecurr(ExecutionSchedule.Recurr.valueOf(valuesManager.getValueAsString("recurr")));
-
- Date onceDate = (Date) valuesManager.getValues().get("onceStartDate");
- executionSchedule.setOnceDateTime(onceDate);
-
- executionSchedule.setMinuteInterval(Integer.parseInt(valuesManager.getValueAsString("minuteInterval")));
-
- executionSchedule.setMinuteInHour(Integer.parseInt(valuesManager.getValueAsString("minuteOfHour")));
-
- executionSchedule.setTimeOfDay((Date) valuesManager.getValues().get("timeOfDay"));
-
- HashSet<ExecutionSchedule.DayOfWeek> selectedDays = new HashSet<ExecutionSchedule.DayOfWeek>(); //.noneOf(ExecutionSchedule.DayOfWeek.class);
- for (ExecutionSchedule.DayOfWeek d : EnumSet.allOf(ExecutionSchedule.DayOfWeek.class)) {
- if (valuesManager.getValues().containsKey(d.name())) {
- selectedDays.add(d);
- }
- }
- executionSchedule.setDaysOfWeek(selectedDays);
-
- executionSchedule.setDayOfMonth(Integer.parseInt(valuesManager.getValueAsString("dayOfMonth")));
-
- executionSchedule.setStartDate((Date) valuesManager.getValues().get("startDate"));
-
- if ("Never".equals(valuesManager.getValues().get("endType"))) {
- executionSchedule.setEndDate(null);
- } else {
- executionSchedule.setEndDate((Date) valuesManager.getValues().get("endDate"));
- }
-
- form.setValue("message", executionSchedule.getMessage());
- }
-
- private LinkedHashMap<String, String> enumValueMap(Class<? extends Enum> e) {
- LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
- for (Object o : EnumSet.allOf(e)) {
- Enum v = (Enum) o;
- map.put(v.name(), v.name()); // localize
- }
- return map;
- }
-
- public ExecutionSchedule getExecutionSchedule() {
- return executionSchedule;
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 89a87fb..4af193b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -80,6 +80,16 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
private static final String BASE_VIEW_PATH = "Resource";
+ public static class Tab {
+ public static final String OPERATIONS = "Operations";
+ // TODO: other tabs
+ }
+
+ public static class OperationsSubTab {
+ public static final String SCHEDULES = "Schedules";
+ public static final String HISTORY = "History";
+ }
+
private Integer resourceId;
private ResourceComposite resourceComposite;
@@ -189,13 +199,12 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
.view_tabs_common_history()), null);
eventsTab.registerSubTabs(eventHistory);
tabs.add(eventsTab);
-
- operationsTab = new TwoLevelTab(getTabSet().extendLocatorId("Operations"), new ViewName("Operations", MSG
+ operationsTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.OPERATIONS), new ViewName(Tab.OPERATIONS, MSG
.view_tabs_common_operations()), "/images/icons/Operation_grey_16.png");
- this.operationsSchedules = new SubTab(operationsTab.extendLocatorId("Schedules"), new ViewName("Schedules", MSG
- .view_tabs_common_schedules()), null);
- this.operationsHistory = new SubTab(operationsTab.extendLocatorId("History"), new ViewName("History", MSG
- .view_tabs_common_history()), null);
+ this.operationsSchedules = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.SCHEDULES),
+ new ViewName(OperationsSubTab.SCHEDULES, MSG.view_tabs_common_schedules()), null);
+ this.operationsHistory = new SubTab(operationsTab.extendLocatorId(OperationsSubTab.HISTORY),
+ new ViewName(OperationsSubTab.HISTORY, MSG.view_tabs_common_history()), null);
operationsTab.registerSubTabs(this.operationsSchedules, this.operationsHistory);
tabs.add(operationsTab);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 98e5755..cf34caf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -77,7 +77,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
-import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupContextMenu;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.AutoGroupTreeNode;
@@ -413,7 +412,7 @@ public class ResourceTreeView extends LocatableVLayout {
// Operations Menu
MenuItem operations = new MenuItem(MSG.view_tree_common_contextMenu_operations());
- enabled = (resourcePermission.isControl() && null == resourceType.getOperationDefinitions() && !resourceType
+ enabled = (resourcePermission.isControl() && (resourceType.getOperationDefinitions() != null) && !resourceType
.getOperationDefinitions().isEmpty());
operations.setEnabled(enabled);
if (enabled) {
@@ -422,7 +421,8 @@ public class ResourceTreeView extends LocatableVLayout {
MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
operationItem.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
- new OperationCreateWizard(resource, operationDefinition).startOperationWizard();
+ CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(), ResourceDetailView.Tab.OPERATIONS,
+ ResourceDetailView.OperationsSubTab.SCHEDULES) + "/0/" + operationDefinition.getId());
}
});
opSubMenu.addItem(operationItem);
commit fbe4a6b41ac9f60f013b4de67fb05b59594c16d5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 13:48:04 2011 -0500
show stats in window so you can navigate around and see the stats
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
index 40fae1f..dfab374 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
@@ -26,7 +26,6 @@ import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.SortDirection;
-import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.events.CloseClickHandler;
import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -59,6 +58,9 @@ public class TestRemoteServiceStatisticsView extends Table {
private static final SortSpecifier[] defaultSorts = new SortSpecifier[] { new SortSpecifier("average",
SortDirection.DESCENDING) };
+ // if this is true, this view is hosted by a standalone Window
+ private boolean inWindow = false;
+
public TestRemoteServiceStatisticsView(String locatorId) {
super(locatorId, "Remote Service Statistics", null, defaultSorts, null, false);
}
@@ -68,16 +70,25 @@ public class TestRemoteServiceStatisticsView extends Table {
ListGridField serviceName = new ListGridField(FIELD_SERVICENAME, "Service Name");
ListGridField methodName = new ListGridField(FIELD_METHODNAME, "Method Name");
ListGridField count = new ListGridField(FIELD_COUNT, "Count");
- count.setAlign(Alignment.CENTER);
ListGridField slowest = new ListGridField(FIELD_SLOWEST, "Slowest (ms)");
- slowest.setAlign(Alignment.RIGHT);
ListGridField average = new ListGridField(FIELD_AVERAGE, "Average (ms)");
- average.setAlign(Alignment.RIGHT);
ListGridField fastest = new ListGridField(FIELD_FASTEST, "Fastest (ms)");
- fastest.setAlign(Alignment.RIGHT);
ListGridField stddev = new ListGridField(FIELD_STDDEV, "Std Dev");
+
+ count.setAlign(Alignment.CENTER);
+ slowest.setAlign(Alignment.RIGHT);
+ average.setAlign(Alignment.RIGHT);
+ fastest.setAlign(Alignment.RIGHT);
stddev.setAlign(Alignment.RIGHT);
+ serviceName.setWidth("20%");
+ methodName.setWidth("*");
+ count.setWidth("8%");
+ slowest.setWidth("13%");
+ average.setWidth("13%");
+ fastest.setWidth("13%");
+ stddev.setWidth("8%");
+
getListGrid().setFields(serviceName, methodName, count, slowest, average, fastest, stddev);
refresh();
@@ -128,6 +139,17 @@ public class TestRemoteServiceStatisticsView extends Table {
.show();
}
});
+
+ if (!inWindow) {
+ addTableAction(extendLocatorId("showInWin"), "Show In Window", new AbstractTableAction(
+ TableActionEnablement.ALWAYS) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ new StatisticsWindow(extendLocatorId("statsWin")).show();
+ }
+ });
+ }
+
}
@Override
@@ -172,17 +194,14 @@ public class TestRemoteServiceStatisticsView extends Table {
LocatableHTMLPane htmlPane = new LocatableHTMLPane(extendLocatorId("winDetailsPane"));
htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(500);
+ htmlPane.setDefaultWidth(600);
htmlPane.setDefaultHeight(400);
htmlPane.setContents(message);
- setupWindow(title, htmlPane);
- }
-
- private void setupWindow(String title, Canvas item) {
setTitle(title);
setShowMinimizeButton(false);
setShowMaximizeButton(true);
+ setShowCloseButton(true);
setIsModal(true);
setShowModalMask(true);
setAutoSize(true);
@@ -196,7 +215,35 @@ public class TestRemoteServiceStatisticsView extends Table {
markForDestroy();
}
});
- addItem(item);
+ addItem(htmlPane);
+ }
+ }
+
+ class StatisticsWindow extends LocatableWindow {
+ public StatisticsWindow(String locatorId) {
+ super(locatorId);
+ setTitle("Remote Service Statistics");
+ setShowMinimizeButton(true);
+ setShowMaximizeButton(true);
+ setShowCloseButton(true);
+ setIsModal(false);
+ setShowModalMask(false);
+ setWidth(700);
+ setHeight(300);
+ setShowResizer(true);
+ setCanDragResize(true);
+ centerInPage();
+ addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ markForDestroy();
+ }
+ });
+
+ TestRemoteServiceStatisticsView view;
+ view = new TestRemoteServiceStatisticsView(extendLocatorId("StatsViewInWin"));
+ view.inWindow = true;
+ addItem(view);
}
}
}
commit 35f855ac5fcd9491b2a3c98a31e391cc7ddbdd60
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 12:53:04 2011 -0500
take spaces out of remote stats view url
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
index 5e69c1b..8aae428 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
@@ -65,7 +65,7 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
// view IDs for Misc section
private static final ViewName MISC_SECTION_VIEW_ID = new ViewName("Misc");
private static final ViewName PAGE_PLURALIZATION_TEST = new ViewName("PluralizationTest");
- private static final ViewName PAGE_REMOTE_SERVICE_STATISTICS = new ViewName("Remote Service Statistics");
+ private static final ViewName PAGE_REMOTE_SERVICE_STATISTICS = new ViewName("RemoteServiceStatistics");
public TestTopView() {
// This is a top level view, so our locator id can simply be our view id.
@@ -124,11 +124,12 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
}
});
- NavigationItem readOnlyConfigEditorItem = new NavigationItem(PAGE_READONLY_CONFIG_EDITOR, null, new ViewFactory() {
- public Canvas createView() {
- return new TestReadOnlyConfigurationView(extendLocatorId(PAGE_READONLY_CONFIG_EDITOR.getName()));
- }
- });
+ NavigationItem readOnlyConfigEditorItem = new NavigationItem(PAGE_READONLY_CONFIG_EDITOR, null,
+ new ViewFactory() {
+ public Canvas createView() {
+ return new TestReadOnlyConfigurationView(extendLocatorId(PAGE_READONLY_CONFIG_EDITOR.getName()));
+ }
+ });
NavigationItem groupConfigEditorItem = new NavigationItem(PAGE_GROUP_CONFIG_EDITOR, null, new ViewFactory() {
public Canvas createView() {
@@ -136,14 +137,16 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
}
});
- NavigationItem readOnlyGroupConfigEditorItem = new NavigationItem(PAGE_READONLY_GROUP_CONFIG_EDITOR, null, new ViewFactory() {
- public Canvas createView() {
- return new TestReadOnlyGroupConfigurationView(extendLocatorId(PAGE_READONLY_GROUP_CONFIG_EDITOR.getName()));
- }
- });
+ NavigationItem readOnlyGroupConfigEditorItem = new NavigationItem(PAGE_READONLY_GROUP_CONFIG_EDITOR, null,
+ new ViewFactory() {
+ public Canvas createView() {
+ return new TestReadOnlyGroupConfigurationView(extendLocatorId(PAGE_READONLY_GROUP_CONFIG_EDITOR
+ .getName()));
+ }
+ });
return new NavigationSection(CONFIGURATION_SECTION_VIEW_ID, configEditorItem, readOnlyConfigEditorItem,
- groupConfigEditorItem, readOnlyGroupConfigEditorItem);
+ groupConfigEditorItem, readOnlyGroupConfigEditorItem);
}
private NavigationSection buildMiscSection() {
commit af1289322da7f4173229e8920407e9002965e492
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 12:24:56 2011 -0500
be able to export the stats as CSV text. pops up the text in a window so you can copy-n-paste into your favorite spreadsheet software
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
index 4757ff4..40fae1f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
@@ -20,10 +20,15 @@ package org.rhq.enterprise.gui.coregui.client.test.i18n;
import java.util.List;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.RecordList;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.SortDirection;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -32,6 +37,8 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.util.rpc.RemoteServiceStatistics;
import org.rhq.enterprise.gui.coregui.client.util.rpc.RemoteServiceStatistics.Record.Summary;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* A view that gives a display of statistics for all remote services executed since the application was loaded.
@@ -40,6 +47,15 @@ import org.rhq.enterprise.gui.coregui.client.util.rpc.RemoteServiceStatistics.Re
*/
public class TestRemoteServiceStatisticsView extends Table {
+ // these are used both as the name of the fields, titles of the headers and the columns of the CSV output
+ private static final String FIELD_SERVICENAME = "serviceName";
+ private static final String FIELD_METHODNAME = "methodName";
+ private static final String FIELD_COUNT = "count";
+ private static final String FIELD_SLOWEST = "slowest";
+ private static final String FIELD_AVERAGE = "average";
+ private static final String FIELD_FASTEST = "fastest";
+ private static final String FIELD_STDDEV = "stddev";
+
private static final SortSpecifier[] defaultSorts = new SortSpecifier[] { new SortSpecifier("average",
SortDirection.DESCENDING) };
@@ -49,23 +65,23 @@ public class TestRemoteServiceStatisticsView extends Table {
@Override
protected void configureTable() {
- ListGridField serviceName = new ListGridField("serviceName", "Service Name");
- ListGridField methodName = new ListGridField("methodName", "Method Name");
- ListGridField count = new ListGridField("count", "Count");
+ ListGridField serviceName = new ListGridField(FIELD_SERVICENAME, "Service Name");
+ ListGridField methodName = new ListGridField(FIELD_METHODNAME, "Method Name");
+ ListGridField count = new ListGridField(FIELD_COUNT, "Count");
count.setAlign(Alignment.CENTER);
- ListGridField slowest = new ListGridField("slowest", "Slowest (ms)");
+ ListGridField slowest = new ListGridField(FIELD_SLOWEST, "Slowest (ms)");
slowest.setAlign(Alignment.RIGHT);
- ListGridField average = new ListGridField("average", "Average (ms)");
+ ListGridField average = new ListGridField(FIELD_AVERAGE, "Average (ms)");
average.setAlign(Alignment.RIGHT);
- ListGridField fastest = new ListGridField("fastest", "Fastest (ms)");
+ ListGridField fastest = new ListGridField(FIELD_FASTEST, "Fastest (ms)");
fastest.setAlign(Alignment.RIGHT);
- ListGridField stddev = new ListGridField("stddev", "Std Dev");
+ ListGridField stddev = new ListGridField(FIELD_STDDEV, "Std Dev");
stddev.setAlign(Alignment.RIGHT);
getListGrid().setFields(serviceName, methodName, count, slowest, average, fastest, stddev);
refresh();
- addTableAction(extendLocatorId("delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ addTableAction(extendLocatorId("deleteAll"), MSG.common_button_delete_all(), MSG.common_msg_areYouSure(),
new AbstractTableAction(TableActionEnablement.ALWAYS) {
@Override
public void executeAction(ListGridRecord[] selection, Object actionValue) {
@@ -81,6 +97,37 @@ public class TestRemoteServiceStatisticsView extends Table {
refresh();
}
});
+
+ addTableAction(extendLocatorId("export"), "Export To CSV",
+ new AbstractTableAction(TableActionEnablement.ALWAYS) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ StringBuilder csv = new StringBuilder();
+ csv.append(FIELD_SERVICENAME).append(',') //
+ .append(FIELD_METHODNAME).append(',') //
+ .append(FIELD_COUNT).append(',') //
+ .append(FIELD_SLOWEST).append(',') //
+ .append(FIELD_AVERAGE).append(',') //
+ .append(FIELD_FASTEST).append(',') //
+ .append(FIELD_STDDEV).append('\n');
+
+ RecordList records = getListGrid().getDataAsRecordList();
+ int recordsSize = records.getLength();
+ for (int i = 0; i < recordsSize; i++) {
+ Record record = records.get(i);
+ csv.append(record.getAttribute(FIELD_SERVICENAME)).append(',') //
+ .append(record.getAttribute(FIELD_METHODNAME)).append(',') //
+ .append(record.getAttribute(FIELD_COUNT)).append(',') //
+ .append(record.getAttribute(FIELD_SLOWEST)).append(',') //
+ .append(record.getAttribute(FIELD_AVERAGE)).append(',') //
+ .append(record.getAttribute(FIELD_FASTEST)).append(',') //
+ .append(record.getAttribute(FIELD_STDDEV)).append('\n');
+ }
+
+ new MessageWindow(extendLocatorId("csv"), "Export To CSV", "<pre>" + csv.toString() + "</pre>")
+ .show();
+ }
+ });
}
@Override
@@ -109,14 +156,47 @@ public class TestRemoteServiceStatisticsView extends Table {
private ListGridRecord transform(Summary stat) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("serviceName", stat.serviceName);
- record.setAttribute("methodName", stat.methodName);
- record.setAttribute("count", stat.count);
- record.setAttribute("slowest", stat.slowest);
- record.setAttribute("average", stat.average);
- record.setAttribute("fastest", stat.fastest);
- record.setAttribute("stddev", stat.stddev);
+ record.setAttribute(FIELD_SERVICENAME, stat.serviceName);
+ record.setAttribute(FIELD_METHODNAME, stat.methodName);
+ record.setAttribute(FIELD_COUNT, stat.count);
+ record.setAttribute(FIELD_SLOWEST, stat.slowest);
+ record.setAttribute(FIELD_AVERAGE, stat.average);
+ record.setAttribute(FIELD_FASTEST, stat.fastest);
+ record.setAttribute(FIELD_STDDEV, stat.stddev);
return record;
}
+ class MessageWindow extends LocatableWindow {
+ public MessageWindow(String locatorId, String title, String message) {
+ super(locatorId);
+
+ LocatableHTMLPane htmlPane = new LocatableHTMLPane(extendLocatorId("winDetailsPane"));
+ htmlPane.setMargin(10);
+ htmlPane.setDefaultWidth(500);
+ htmlPane.setDefaultHeight(400);
+ htmlPane.setContents(message);
+
+ setupWindow(title, htmlPane);
+ }
+
+ private void setupWindow(String title, Canvas item) {
+ setTitle(title);
+ setShowMinimizeButton(false);
+ setShowMaximizeButton(true);
+ setIsModal(true);
+ setShowModalMask(true);
+ setAutoSize(true);
+ setAutoCenter(true);
+ setShowResizer(true);
+ setCanDragResize(true);
+ centerInPage();
+ addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ markForDestroy();
+ }
+ });
+ addItem(item);
+ }
+ }
}
commit 20155e8d267c81294f4c68ab35d70c19313d9766
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 11:25:31 2011 -0500
add back refresh protection for message bar clearing
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 4a55504..fbcd0de 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -357,12 +357,14 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
public void renderView(final ViewPath viewPath) {
Window.setTitle(getViewPathTitle(viewPath));
- // when navigating, clear any message, the user is probably no longer interested
- coreGUI.footer.getMessageBar().clearMessage(true);
-
// keep our CoreGUI session alive by refreshing the session timer each time the user performs navigation
UserSessionManager.refresh();
+ // clear any message when navigating to a new view (not refreshing), the user is probably no longer interested
+ if (!viewPath.isRefresh()) {
+ coreGUI.footer.getMessageBar().clearMessage(true);
+ }
+
if (viewPath.isEnd()) {
// default view
History.newItem(DEFAULT_VIEW_PATH);
commit fda2701eca023f5590acdb54c97dfd6ab6a31d62
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 11:00:11 2011 -0500
be able to clear the gwt rpc statistics and to refresh the page
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
index 57cb200..4757ff4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/i18n/TestRemoteServiceStatisticsView.java
@@ -22,11 +22,14 @@ import java.util.List;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.util.rpc.RemoteServiceStatistics;
import org.rhq.enterprise.gui.coregui.client.util.rpc.RemoteServiceStatistics.Record.Summary;
@@ -60,6 +63,39 @@ public class TestRemoteServiceStatisticsView extends Table {
stddev.setAlign(Alignment.RIGHT);
getListGrid().setFields(serviceName, methodName, count, slowest, average, fastest, stddev);
+ refresh();
+
+ addTableAction(extendLocatorId("delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ new AbstractTableAction(TableActionEnablement.ALWAYS) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ RemoteServiceStatistics.clearAll();
+ refresh();
+ }
+ });
+
+ addTableAction(extendLocatorId("refresh"), MSG.common_button_refresh(), new AbstractTableAction(
+ TableActionEnablement.ALWAYS) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ refresh();
+ }
+ });
+ }
+
+ @Override
+ protected SelectionStyle getDefaultSelectionStyle() {
+ return SelectionStyle.NONE;
+ }
+
+ @Override
+ public boolean isShowFooterRefresh() {
+ return false;
+ }
+
+ @Override
+ public void refresh() {
+ super.refresh();
getListGrid().setRecords(transform(RemoteServiceStatistics.getAll()));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RemoteServiceStatistics.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RemoteServiceStatistics.java
index 204be10..e2abe2a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RemoteServiceStatistics.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RemoteServiceStatistics.java
@@ -169,4 +169,8 @@ public class RemoteServiceStatistics {
return stats;
}
+
+ public static void clearAll() {
+ statistics.clear();
+ }
}
commit d7b642c7565faf98880781b0bd0406f9cf33f5cb
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 10:54:28 2011 -0500
Fix merge problems
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 24bbb81..4a55504 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -367,12 +367,7 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
// default view
History.newItem(DEFAULT_VIEW_PATH);
} else {
- if (!viewPath.isRefresh()) {
- messageBar.clearMessage(true);
- }
-
- if (
- pendingMessage != null) {
+ if (pendingMessage != null) {
getMessageCenter().notify(pendingMessage);
pendingMessage = null;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index e57484b..cd73f5d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -53,6 +53,7 @@ import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
+import org.rhq.enterprise.gui.coregui.client.components.form.ColorButtonItem;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
commit dee7679746cc14917e38a776bd9f7b931e726bff
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 10:34:39 2011 -0500
Combine the footer and the message bar such that all of the info is now
in one place. This hopefully makes better use of real estate, giving our
LHS and RHS panes about 30 more pixels vertically, while also improving
look and usability.
- Also, allow navigation changes to clear the message bar, on the asumption
that if the user is navigating he probably no longer needs the message
displayed.
- Also, get rid of the annoying labels that used to spew in the footer for each
messageCenter message. The messageBar and the MessageCenter button is
sufficient.
This checkin also has embedded a change such that InitializableView handling
(in renderView) is no tied to BookmarkableViews. The interfaces are handled
separately.
NOTE: It's still currently called the footer even though it's no longer
at the bottom. If accepted it will be renamed, probably to InfoBar.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 2edcf48..24bbb81 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -54,7 +54,6 @@ import org.rhq.enterprise.gui.coregui.client.test.TestTopView;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
import org.rhq.enterprise.gui.coregui.client.util.WidgetUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.MessageBar;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
@@ -86,8 +85,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
private static ErrorHandler errorHandler = new ErrorHandler();
- private static MessageBar messageBar;
-
private static MessageCenter messageCenter;
private static String currentPath;
@@ -95,8 +92,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
// @SuppressWarnings("unused")
// private static Canvas content;
- private RootCanvas rootCanvas;
-
private static ViewPath currentViewPath;
private static CoreGUI coreGUI;
@@ -109,6 +104,10 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
// while also changing the main content. Typically we refresh only when the path is not changed.
private static boolean pendingRefresh = false;
+ private RootCanvas rootCanvas;
+ private MenuBarView menuBarView;
+ private Footer footer;
+
public void onModuleLoad() {
String hostPageBaseURL = GWT.getHostPageBaseURL();
if (hostPageBaseURL.indexOf("/coregui/") == -1) {
@@ -162,10 +161,9 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
public void buildCoreUI() {
// If the core gui is already built (eg. from previous login) skip the build and just refire event
if (rootCanvas == null) {
- MenuBarView menuBarView = new MenuBarView("TopMenu");
+ menuBarView = new MenuBarView("TopMenu");
menuBarView.setWidth("100%");
-
- messageBar = new MessageBar();
+ footer = new Footer();
Canvas canvas = new Canvas(CONTENT_CANVAS_ID);
canvas.setWidth100();
@@ -173,12 +171,11 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
rootCanvas = new RootCanvas();
rootCanvas.setOverflow(Overflow.HIDDEN);
- rootCanvas.addMember(menuBarView);
- rootCanvas.addMember(messageBar);
- //rootCanvas.addMember(breadCrumbTrailPane);
+ rootCanvas.addMember(menuBarView);
+ rootCanvas.addMember(footer);
rootCanvas.addMember(canvas);
- rootCanvas.addMember(new Footer());
+
rootCanvas.draw();
History.addValueChangeHandler(this);
@@ -360,6 +357,9 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
public void renderView(final ViewPath viewPath) {
Window.setTitle(getViewPathTitle(viewPath));
+ // when navigating, clear any message, the user is probably no longer interested
+ coreGUI.footer.getMessageBar().clearMessage(true);
+
// keep our CoreGUI session alive by refreshing the session timer each time the user performs navigation
UserSessionManager.refresh();
@@ -405,25 +405,31 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
contentCanvas.markForRedraw();
}
- if (this.currentCanvas instanceof BookmarkableView) {
- if (this.currentCanvas instanceof InitializableView) {
- final InitializableView initializableView = (InitializableView) this.currentCanvas;
- new Timer() {
- final long startTime = System.currentTimeMillis();
+ if (this.currentCanvas instanceof InitializableView) {
+ final InitializableView initializableView = (InitializableView) this.currentCanvas;
+ new Timer() {
+ final long startTime = System.currentTimeMillis();
- public void run() {
- if (initializableView.isInitialized()) {
- ((BookmarkableView) currentCanvas).renderView(viewPath.next());
+ public void run() {
+ if (initializableView.isInitialized()) {
+ if (RootCanvas.this.currentCanvas instanceof BookmarkableView) {
+ ((BookmarkableView) RootCanvas.this.currentCanvas).renderView(viewPath.next());
} else {
- long elapsedMillis = System.currentTimeMillis() - startTime;
- if (elapsedMillis < 10000) {
- schedule(100); // Reschedule the timer.
- }
+ RootCanvas.this.currentCanvas.markForRedraw();
+ }
+ } else {
+ long elapsedMillis = System.currentTimeMillis() - startTime;
+ if (elapsedMillis < 10000) {
+ schedule(100); // Reschedule the timer.
}
}
- }.run(); // fire the timer immediately
+ }
+ }.run(); // fire the timer immediately
+ } else {
+ if (this.currentCanvas instanceof BookmarkableView) {
+ ((BookmarkableView) this.currentCanvas).renderView(viewPath.next());
} else {
- ((BookmarkableView) currentCanvas).renderView(viewPath.next());
+ this.currentCanvas.markForRedraw();
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
index a2b773f..1cfdd50 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -21,10 +21,11 @@ package org.rhq.enterprise.gui.coregui.client;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.toolbar.ToolStripSeparator;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.criteria.AlertCriteria;
@@ -34,24 +35,27 @@ import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.footer.FavoritesButton;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
+import org.rhq.enterprise.gui.coregui.client.util.message.MessageBar;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenterView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
/**
* @author Greg Hinkle
* @author Joseph Marques
*/
-public class Footer extends LocatableToolStrip {
+public class Footer extends LocatableHLayout {
private static final String LOCATOR_ID = "CoreFooter";
+ private MessageBar messageBar;
+
public Footer() {
super(LOCATOR_ID);
setHeight(30);
- setAlign(VerticalAlignment.CENTER);
+ setAlign(Alignment.LEFT);
setWidth100();
- setMembersMargin(10);
- setLayoutRightMargin(5);
+ setMembersMargin(5);
+ setBackgroundColor("#F1F2F3");
}
@Override
@@ -61,16 +65,25 @@ public class Footer extends LocatableToolStrip {
final MessageCenterView messageCenter = new MessageCenterView(extendLocatorId(MessageCenterView.LOCATOR_ID));
final FavoritesButton favoritesButton = new FavoritesButton(extendLocatorId("Favorites"));
final AlertsMessage alertsMessage = new AlertsMessage(extendLocatorId("Alerts"));
+ messageBar = new MessageBar();
- addMember(messageCenter);
-
- addMember(new ToolStripSeparator());
+ // leave space for the RPC Activity Spinner
+ addMember(createHSpacer(16));
addMember(alertsMessage);
- addMember(new ToolStripSeparator());
+ addMember(messageBar);
+
+ VLayout favoritesLayout = new VLayout();
+ favoritesLayout.setHeight100();
+ favoritesLayout.setAutoWidth();
+ favoritesLayout.setAlign(Alignment.CENTER);
+ favoritesLayout.addMember(favoritesButton);
+ addMember(favoritesLayout);
+
+ addMember(messageCenter);
- addMember(favoritesButton);
+ addMember(createHSpacer(0));
alertsMessage.schedule(60000);
}
@@ -115,7 +128,7 @@ public class Footer extends LocatableToolStrip {
public static class AlertsMessage extends RefreshableLabel {
public AlertsMessage(String locatorId) {
super(locatorId);
- setHeight(30);
+ setHeight100();
setPadding(5);
setIcon("subsystems/alert/Alert_LOW_16.png");
@@ -154,4 +167,14 @@ public class Footer extends LocatableToolStrip {
}
}
+ public MessageBar getMessageBar() {
+ return messageBar;
+ }
+
+ private HLayout createHSpacer(int width) {
+ HLayout spacer = new HLayout();
+ spacer.setWidth(width);
+ return spacer;
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
index fe6c3b6..3ded730 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
@@ -48,7 +48,7 @@ public class TitleBar extends LocatableToolStrip {
super(parent.extendLocatorId("TitleBar"));
setWidth100();
- setHeight(37);
+ setHeight(30);
LocatableVLayout vLayout = new LocatableVLayout(extendLocatorId("VLayout"));
vLayout.setAlign(VerticalAlignment.CENTER);
@@ -62,7 +62,7 @@ public class TitleBar extends LocatableToolStrip {
this.label.setIcon(icon);
this.label.setIconWidth(24);
this.label.setIconHeight(24);
- this.label.setAutoHeight();
+ this.label.setAutoHeight();
hLayout.addMember(this.label);
setVisible(false);
@@ -98,8 +98,8 @@ public class TitleBar extends LocatableToolStrip {
contents = "<span class='HeaderLabel'>" + title + "</span>";
windowTitle = "RHQ: " + title;
}
- this.label.setContents(contents);
+ this.label.setContents(contents);
Window.setTitle(windowTitle);
}
-
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
index 03f29e1..b255002 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -56,14 +56,17 @@ public class FavoritesButton extends LocatableIMenuButton {
// this is the main menu - the "favorites" button shown in the UI the user initially clicks
final Menu favoritesMenu = new Menu();
+ favoritesMenu.setSubmenuDirection("left");
setMenu(favoritesMenu);
- setShowMenuBelow(false);
setAutoFit(true);
// these are the child menus directly under the main favorites button
final Menu favoriteResourcesMenu = new Menu();
final Menu favoriteGroupsMenu = new Menu();
final Menu recentlyViewedMenu = new Menu();
+ favoriteResourcesMenu.setSubmenuDirection("left");
+ favoriteGroupsMenu.setSubmenuDirection("left");
+ recentlyViewedMenu.setSubmenuDirection("left");
MenuItem favoriteResourcesMenuItem = new MenuItem(MSG.favorites_resources(), "Favorite_Resource_16.png");
favoriteResourcesMenuItem.setSubmenu(favoriteResourcesMenu);
favoriteResourcesMenu.setEmptyMessage(MSG.common_val_none());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
index b28c6ce..29d7b75 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
@@ -34,6 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
* The message will be displayed for 30 seconds and then will be automatically cleared.
*
* @author Ian Springer
+ * @author Jay Shaughnessy
*/
public class MessageBar extends LocatableHLayout implements MessageCenter.MessageListener {
private static final String LOCATOR_ID = "MessageBar";
@@ -59,7 +60,7 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
label.setAlign(Alignment.CENTER);
label.setWidth("600px");
- label.setHeight("25px");
+ label.setHeight("30px");
setLabelEmpty();
addMember(label);
@@ -121,6 +122,9 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
String styleName = (contents != null) ? message.getSeverity().getStyle() : null;
label.setStyleName(styleName);
+ // TODO: perhaps just set the text to green/orange/red along with the proper icon and not have the defined
+ // color block...
+
// TODO: Create some custom edge images in green, yellow, red, etc. so we can add nice rounded corners to the
// label.
//label.setShowEdges(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index f9e7ec4..2564e1f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -21,14 +21,8 @@ package org.rhq.enterprise.gui.coregui.client.util.message;
import java.util.List;
import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.user.client.Timer;
import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.AnimationEffect;
-import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.TitleOrientation;
-import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.AnimationCallback;
-import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -36,8 +30,6 @@ import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.menu.IMenuButton;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
@@ -45,24 +37,23 @@ import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* @author Greg Hinkle
*/
-public class MessageCenterView extends LocatableHLayout implements MessageCenter.MessageListener {
+public class MessageCenterView extends LocatableVLayout implements MessageCenter.MessageListener {
public static final String LOCATOR_ID = "MessageCenter";
public MessageCenterView(String locatorId) {
super(locatorId, 5);
setHeight100();
- //setAlign(Alignment.RIGHT);
- setAlign(VerticalAlignment.CENTER);
- setOverflow(Overflow.HIDDEN);
+ setAlign(Alignment.CENTER);
+ setAutoWidth();
}
@Override
@@ -74,10 +65,7 @@ public class MessageCenterView extends LocatableHLayout implements MessageCenter
IMenuButton recentEventsButton = new LocatableIMenuButton(extendLocatorId("RecentEvents"), MSG
.view_messageCenter_messageTitle(), recentEventsMenu);
- recentEventsButton.setTop(5);
- recentEventsButton.setShowMenuBelow(false);
recentEventsButton.setAutoFit(true);
- recentEventsButton.setValign(VerticalAlignment.CENTER);
recentEventsButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -103,14 +91,7 @@ public class MessageCenterView extends LocatableHLayout implements MessageCenter
}
});
- VLayout vl = new VLayout();
- vl.setAutoWidth();
- vl.setAlign(Alignment.LEFT);
- vl.setAlign(VerticalAlignment.CENTER);
- vl.addMember(recentEventsButton);
-
- addMember(new LayoutSpacer());
- addMember(vl);
+ addMember(recentEventsButton);
}
private void showDetails(Message message) {
@@ -161,39 +142,6 @@ public class MessageCenterView extends LocatableHLayout implements MessageCenter
public void onMessage(final Message message) {
if (!message.isTransient()) {
logMessage(message);
-
- final Label label = new Label(message.conciseMessage);
- label.setMargin(5);
- label.setAutoFit(true);
- label.setHeight(25);
- label.setWrap(false);
-
- String iconSrc = getSeverityIcon(message.severity);
-
- label.setIcon(iconSrc);
-
- label.setTooltip(message.detailedMessage);
-
- label.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- showDetails(message);
- }
- });
-
- addMember(label, 1);
- redraw();
-
- Timer hideTimer = new Timer() {
- @Override
- public void run() {
- label.animateHide(AnimationEffect.FADE, new AnimationCallback() {
- public void execute(boolean b) {
- label.destroy();
- }
- });
- }
- };
- hideTimer.schedule(10000);
}
}
commit 889e4fc6975de868e910e1b80a6cd6ea194ef78a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 10:19:51 2011 -0500
fix some jdoc links
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index 822f817..57f3c6f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -108,13 +108,13 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
}
}
- /*
- * The default implementation wraps the @{link getDetailsLinkColumnCellFormatter()} column with the
- * @{link getDetailsLinkColumnCellFormatter()}. This is typically the 'name' column linking to the detail
+ /**
+ * The default implementation wraps the {@link getDetailsLinkColumnCellFormatter()} column with the
+ * {@link getDetailsLinkColumnCellFormatter()}. This is typically the 'name' column linking to the detail
* view, given the 'id'. Also, establishes a double click handler for the row which invokes
- * @{link showDetails()}</br>
+ * {@link showDetails()}</br>
* </br>
- * In general, in overrides, call super.configureTable *after* manipulating the ListGrid fields.
+ * In general, in overrides, call super.configureTable *after* manipulating the ListGrid fields.
*
* @see org.rhq.enterprise.gui.coregui.client.components.table.Table#configureTable()
*/
commit c7bcef231eb74c9e7e50f699f574bee38fecb8c1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 10:19:23 2011 -0500
Infrastructure for Dashboard-based group and resource summary pages.
- Domain changes to support subject/resource/group relations for dashboards.
(subject was already there but added FK)
- Uses cascade delete for dashboard cleanup
- db-upgrade work, schema version 2.103
- added Criteria querying for Dashboards, removed now obsolete slsb calls
- fixed issues with portal column width configuration
1) no longer ignored
2) stored values were corrupt, now stored as expected
3) added underlying support for (future) ability to change column widths
- [Bug 661515] detach edit dash form from portlet layout so it it doesn't
scroll when on screen.
- A couple of small domain class changes for clarity or things I thought may help
smartgwt.
- tweak dash look+feel
NOTE: There is a bunch of temporary MessageCenter messaging for debugging.
This will be removed in a future commit...
NOTE: The actual group dash portlets still need definition. Currently
just using placeholders.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index a2ae0c7..bf65ffb 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.102</db.schema.version>
+ <db.schema.version>2.103</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml
index 48c95a5..e6dd210 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml
@@ -8,7 +8,10 @@
<table name="RHQ_DASHBOARD">
<column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
<column name="NAME" type="VARCHAR2" size="200" required="true"/>
- <column name="SUBJECT_ID" type="INTEGER" required="true"/>
+ <column name="SUBJECT_ID" type="INTEGER" required="true" references="RHQ_SUBJECT"/>
+ <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/>
+ <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/>
+ <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/>
<column name="SHARED" type="BOOLEAN" required="true"/>
<column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/>
</table>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 975c778..e9b78a8 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3296,6 +3296,50 @@
</schema-directSQL>
</schemaSpec>
+ <schemaSpec version="2.103">
+ <!-- add FK for owning Subject -->
+ <schema-directSQL>
+ <statement desc="Creating RHQ_DASHBOARD foreign key relation to RHQ_SUBJECT for resource dashboards">
+ ALTER TABLE RHQ_DASHBOARD
+ ADD CONSTRAINT RHQ_DB_SUBJECT_ID_FK
+ FOREIGN KEY (SUBJECT_ID)
+ REFERENCES RHQ_SUBJECT (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Support resource specific dashboards -->
+ <schema-addColumn table="RHQ_DASHBOARD" column="RESOURCE_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_DASHBOARD foreign key relation to RHQ_RESOURCE for resource dashboards">
+ ALTER TABLE RHQ_DASHBOARD
+ ADD CONSTRAINT RHQ_DB_RESOURCE_ID_FK
+ FOREIGN KEY (RESOURCE_ID)
+ REFERENCES RHQ_RESOURCE (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Support group specific dashboards -->
+ <schema-addColumn table="RHQ_DASHBOARD" column="GROUP_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_DASHBOARD foreign key relation to RHQ_RESOURCE_GROUP for group dashboards">
+ ALTER TABLE RHQ_DASHBOARD
+ ADD CONSTRAINT RHQ_DB_RG_ID_FK
+ FOREIGN KEY (GROUP_ID)
+ REFERENCES RHQ_RESOURCE_GROUP (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Add category for distinguishing what kind of dashboard this is -->
+ <schema-addColumn table="RHQ_DASHBOARD" column="CATEGORY" columnType="VARCHAR2" precision="20"/>
+ <schema-directSQL>
+ <statement desc="Set dashboard category for existing dashboards to INVENTORY">
+ UPDATE RHQ_DASHBOARD
+ SET CATEGORY = 'INVENTORY'
+ </statement>
+ </schema-directSQL>
+ <schema-alterColumn table="RHQ_DASHBOARD" column="CATEGORY" nullable="FALSE" />
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
index 182b74b..dd66c1b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
@@ -50,6 +50,7 @@ import org.jetbrains.annotations.NotNull;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.resource.group.ResourceGroup;
/**
@@ -305,10 +306,14 @@ public class Subject implements Serializable {
@ManyToMany
private java.util.Set<Role> ldapRoles;
- // When a subject is removed any owned groups should also be removed
+ // When a subject is removed any owned groups are removed manually, no cascade delete for groups
@OneToMany(mappedBy = "subject", fetch = FetchType.LAZY)
private List<ResourceGroup> ownedGroups = null;
+ // When a subject is removed any owned dashboards are removed automatically
+ @OneToMany(mappedBy = "owner", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
+ private List<Dashboard> ownedDashboards = null;
+
@Transient
private Integer sessionId = null;
@@ -503,6 +508,14 @@ public class Subject implements Serializable {
this.ownedGroups = ownedGroups;
}
+ protected List<Dashboard> getOwnedDashboards() {
+ return ownedDashboards;
+ }
+
+ protected void setOwnedDashboards(List<Dashboard> ownedDashboards) {
+ this.ownedDashboards = ownedDashboards;
+ }
+
@Override
public String toString() {
return "Subject[id=" + id + ",name=" + name + "]";
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
new file mode 100644
index 0000000..e1ef74a
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
@@ -0,0 +1,126 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.criteria;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.util.PageOrdering;
+
+/**
+ * The criteria for fetching {@link Dashboard}s.
+ *
+ * @author Jay Shaughnessy
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@SuppressWarnings("unused")
+public class DashboardCriteria extends Criteria {
+ private static final long serialVersionUID = 1L;
+
+ private Integer filterId;
+ private DashboardCategory filterCategory = DashboardCategory.INVENTORY;
+ private Integer filterGroupId; // needs overrides
+ private String filterName;
+ private Integer filterOwnerId; // needs overrides
+ private Integer filterResourceId; // needs overrides
+ private Boolean filterShared;
+
+ private boolean fetchConfiguration;
+ private boolean fetchOwner;
+
+ private PageOrdering sortName;
+
+ /**
+ * Note: Default Criteria Settings:<br/>
+ * ownerId = sessionSubject (i.e. the caller)<br/>
+ * category = INVENTORY<br/>
+ */
+ public DashboardCriteria() {
+ filterOverrides.put("groupId", "group.id = ?");
+ filterOverrides.put("ownerId", "owner.id = ?");
+ filterOverrides.put("resourceId", "resource.id = ?");
+ }
+
+ @Override
+ public Class<Dashboard> getPersistentClass() {
+ return Dashboard.class;
+ }
+
+ public void addFilterId(Integer filterId) {
+ this.filterId = filterId;
+ }
+
+ /**
+ * If not set explicitly this defaults to {@link DashboardCategory.INVENTORY}.
+ * @param category
+ */
+ public void addFilterCategory(DashboardCategory category) {
+ this.filterCategory = category;
+ }
+
+ public DashboardCategory getFilterCategory() {
+ return this.filterCategory;
+ }
+
+ public void addFilterGroupId(Integer filterGroupId) {
+ this.filterGroupId = filterGroupId;
+ }
+
+ public void addFilterName(String filterName) {
+ this.filterName = filterName;
+ }
+
+ /**
+ * Requires MANAGE_INVENTORY to set. When not set defaults to dashboards owned by the current user.
+ * @param filterOwnerId set to 0 for dashboards owned by anyone
+ */
+ public void addFilterOwnerId(Integer filterOwnerId) {
+ this.filterOwnerId = filterOwnerId;
+ }
+
+ public Integer getFilterOwnerId() {
+ return filterOwnerId;
+ }
+
+ public void addFilterResourceId(Integer filterResourceId) {
+ this.filterResourceId = filterResourceId;
+ }
+
+ public void addFilterShared(Boolean filterShared) {
+ this.filterShared = filterShared;
+ }
+
+ public void addSortName(PageOrdering sortName) {
+ addSortField("name");
+ this.sortName = sortName;
+ }
+
+ @Override
+ public boolean isInventoryManagerRequired() {
+ // presently only inventory managers can view/manage other people's dashboards
+ return this.filterOwnerId != null;
+ }
+
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
index 2c2482e..622bd28 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
@@ -35,6 +35,8 @@ import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@@ -54,9 +56,12 @@ import org.hibernate.annotations.Cascade;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ResourceGroup;
/**
* @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
@Entity
@SequenceGenerator(name = "RHQ_DASHBOARD_ID_SEQ", sequenceName = "RHQ_DASHBOARD_ID_SEQ")
@@ -70,11 +75,16 @@ public class Dashboard implements Serializable {
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "RHQ_DASHBOARD_ID_SEQ")
@Id
- private int id;
+ private int id = 0;
@Column(name = "NAME", nullable = false)
private String name;
+ @Column(name = "CATEGORY", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private DashboardCategory category;
+
+ // currently unused
@Column(name = "SHARED", nullable = false)
private boolean shared = false;
@@ -86,6 +96,14 @@ public class Dashboard implements Serializable {
@ManyToOne(fetch = FetchType.LAZY)
private Subject owner;
+ @JoinColumn(name = "RESOURCE_ID", nullable = true)
+ @ManyToOne(fetch = FetchType.LAZY)
+ private Resource resource;
+
+ @JoinColumn(name = "GROUP_ID", nullable = true)
+ @ManyToOne(fetch = FetchType.LAZY)
+ private ResourceGroup group;
+
@OneToMany(mappedBy = "dashboard", fetch = FetchType.EAGER)
@Cascade( { org.hibernate.annotations.CascadeType.PERSIST, org.hibernate.annotations.CascadeType.MERGE,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
@@ -128,6 +146,30 @@ public class Dashboard implements Serializable {
this.owner = owner;
}
+ public DashboardCategory getCategory() {
+ return category;
+ }
+
+ public void setCategory(DashboardCategory category) {
+ this.category = category;
+ }
+
+ protected Resource getResource() {
+ return resource;
+ }
+
+ protected void setResource(Resource resource) {
+ this.resource = resource;
+ }
+
+ public ResourceGroup getGroup() {
+ return group;
+ }
+
+ public void setGroup(ResourceGroup group) {
+ this.group = group;
+ }
+
public int getColumns() {
return configuration.getSimple(CFG_COLUMNS).getIntegerValue();
}
@@ -141,7 +183,15 @@ public class Dashboard implements Serializable {
}
public void setColumnWidths(String... columnWidths) {
- configuration.put(new PropertySimple(CFG_WIDTHS, columnWidths));
+ if (null == columnWidths || columnWidths.length == 0) {
+ return;
+ }
+
+ String widths = columnWidths[0];
+ for (int i = 1; i < columnWidths.length; ++i) {
+ widths += ("," + columnWidths[i]);
+ }
+ configuration.put(new PropertySimple(CFG_WIDTHS, widths));
}
public Configuration getConfiguration() {
@@ -158,7 +208,7 @@ public class Dashboard implements Serializable {
public List<DashboardPortlet> getPortlets(int column) {
- List<DashboardPortlet> columnPortlets = new ArrayList<DashboardPortlet>();
+ ArrayList<DashboardPortlet> columnPortlets = new ArrayList<DashboardPortlet>();
for (DashboardPortlet p : this.portlets) {
if (p.getColumn() == column) {
columnPortlets.add(p);
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardCategory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardCategory.java
new file mode 100644
index 0000000..ed4a0ef
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardCategory.java
@@ -0,0 +1,68 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.dashboard;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * A Dashboard category.
+ * <pre>
+ * INVENTORY : A dashboard for resources across a user's inventory.
+ * RESOURCE : A dashboard for a specific resource.
+ * GROUP : A dashboard for a specific resource group.
+ * </pre>
+ *
+ * @author Jay Shaughnessy
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement
+public enum DashboardCategory {
+ INVENTORY("Inventory"), RESOURCE("Resource"), GROUP("Group");
+
+ private final String displayName;
+
+ DashboardCategory(String displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * A Java bean style getter to allow us to access the enum name from JSP or Facelets pages (e.g.
+ * ${Resource.resourceType.category.name}).
+ *
+ * @return the enum name
+ */
+ public String getName() {
+ return name();
+ }
+
+ public String getDisplayName() {
+ return this.displayName;
+ }
+
+ @Override
+ public String toString() {
+ return this.displayName;
+ }
+}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java
index a83b061..b2906aa 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java
@@ -57,7 +57,7 @@ public class DashboardPortlet implements Serializable {
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "RHQ_DASHBOARD_PORTLET_ID_SEQ")
@Id
- private int id;
+ private int id = 0;
// A non-displayed, persisted identifier for the portlet.
@Column(name = "PORTLET_KEY")
@@ -68,10 +68,10 @@ public class DashboardPortlet implements Serializable {
private String name;
@Column(name = "COL")
- private int column;
+ private int column = 0;
@Column(name = "COL_INDEX")
- private int index;
+ private int index = 0;
@Column(name = "HEIGHT")
private int height = 300;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index dd14c13..b83f44c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -68,6 +68,7 @@ import org.rhq.core.domain.content.InstalledPackage;
import org.rhq.core.domain.content.InstalledPackageHistory;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.content.ResourceRepo;
+import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.event.EventSource;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.MeasurementSchedule;
@@ -1058,6 +1059,10 @@ public class Resource implements Comparable<Resource>, Serializable {
@OneToMany(mappedBy = "autoGroupParentResource", fetch = FetchType.LAZY)
private List<ResourceGroup> autoGroupBackingGroups = null;
+ // When a group is removed any owned dashboards are removed automatically
+ @OneToMany(mappedBy = "resource", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
+ private Set<Dashboard> dashboards = null;
+
public Resource() {
}
@@ -1664,6 +1669,14 @@ public class Resource implements Comparable<Resource>, Serializable {
this.autoGroupBackingGroups = autoGroupBackingGroups;
}
+ protected Set<Dashboard> getDashboards() {
+ return dashboards;
+ }
+
+ protected void setDashboards(Set<Dashboard> dashboards) {
+ this.dashboards = dashboards;
+ }
+
public int compareTo(Resource that) {
return this.name.compareTo(that.getName());
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
index 0a34e0c..58f6b48 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
@@ -59,6 +59,7 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.bundle.BundleDestination;
import org.rhq.core.domain.configuration.group.AbstractGroupConfigurationUpdate;
+import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
@@ -472,6 +473,10 @@ public class ResourceGroup extends Group {
@ManyToMany(mappedBy = "resourceGroups", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
private Set<Tag> tags;
+ // When a group is removed any owned dashboards are removed automatically
+ @OneToMany(mappedBy = "group", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
+ private Set<Dashboard> dashboards = null;
+
/* no-arg constructor required by EJB spec */
protected ResourceGroup() {
}
@@ -719,6 +724,14 @@ public class ResourceGroup extends Group {
}
}
+ protected Set<Dashboard> getDashboards() {
+ return dashboards;
+ }
+
+ protected void setDashboards(Set<Dashboard> dashboards) {
+ this.dashboards = dashboards;
+ }
+
@PrePersist
@PreUpdate
void onPersist() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardContainer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardContainer.java
new file mode 100644
index 0000000..d072595
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardContainer.java
@@ -0,0 +1,15 @@
+package org.rhq.enterprise.gui.coregui.client.dashboard;
+
+import java.util.Set;
+
+import org.rhq.core.domain.authz.Permission;
+
+public interface DashboardContainer {
+
+ public Set<Permission> getGlobalPermissions();
+
+ public boolean supportsDashboardNameEdit();
+
+ public void updateDashboardNames();
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index 3520afc..e57484b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -53,10 +53,9 @@ import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
-import org.rhq.enterprise.gui.coregui.client.components.form.ColorButtonItem;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
@@ -64,11 +63,12 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
+ * @author Jay Shaughnessy
* @author Greg Hinkle
* @author Simeon Pinder
*/
public class DashboardView extends LocatableVLayout {
- private DashboardsView dashboardsView;
+ private DashboardContainer dashboardContainer;
private Dashboard storedDashboard;
boolean editMode = false;
@@ -77,15 +77,15 @@ public class DashboardView extends LocatableVLayout {
LocatableDynamicForm editForm;
IMenuButton addPortlet;
- Set<PortletWindow> portletWindows = new HashSet<PortletWindow>();
+ HashSet<PortletWindow> portletWindows = new HashSet<PortletWindow>();
private static String STOP = MSG.view_dashboards_portlets_refresh_none();
private static String REFRESH1 = MSG.view_dashboards_portlets_refresh_one_min();
private static String REFRESH5 = MSG.view_dashboards_portlets_refresh_multiple_min(String.valueOf(5));
private static String REFRESH10 = MSG.view_dashboards_portlets_refresh_multiple_min(String.valueOf(10));
private static Integer STOP_VALUE = 0;
- private static Integer REFRESH1_VALUE = 1 * Long.valueOf(MeasurementUtility.MINUTES).intValue();
- private static Integer REFRESH5_VALUE = 5 * Long.valueOf(MeasurementUtility.MINUTES).intValue();
- private static Integer REFRESH10_VALUE = 10 * Long.valueOf(MeasurementUtility.MINUTES).intValue();
+ private static Integer REFRESH1_VALUE = 1 * 60000;
+ private static Integer REFRESH5_VALUE = 5 * 60000;
+ private static Integer REFRESH10_VALUE = 10 * 60000;
private HashMap<Integer, String> refreshMenuMappings;
private MenuItem[] refreshMenuItems;
@@ -97,26 +97,33 @@ public class DashboardView extends LocatableVLayout {
// the view is set to a Tab's pane.
private boolean isInitialized = false;
- public DashboardView(String locatorId, DashboardsView dashboardsView, Dashboard storedDashboard) {
+ public DashboardView(String locatorId, DashboardContainer dashboardContainer, Dashboard storedDashboard) {
super(locatorId);
- this.dashboardsView = dashboardsView;
+ this.dashboardContainer = dashboardContainer;
this.storedDashboard = storedDashboard;
- setOverflow(Overflow.AUTO);
- setPadding(5);
}
@Override
protected void onInit() {
-
if (!isInitialized) {
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.oninit()", Severity.Info)); // TODO
+
super.onInit();
- addMember(buildEditForm());
+
+ this.setWidth100();
+ this.setHeight100();
+
+ this.addMember(buildEditForm());
+ buildPortlets();
+
isInitialized = true;
}
}
- public void redraw() {
+ public void rebuild() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.rebuild()", Severity.Info)); // TODO
+
// destroy all of the portlets and recreate from scratch
portalLayout.removeFromParent();
portalLayout.destroy();
@@ -125,53 +132,89 @@ public class DashboardView extends LocatableVLayout {
buildPortlets();
}
+ public void redraw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.redraw()", Severity.Info)); // TODO
+ super.redraw();
+ }
+
+ @Override
+ public void draw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.draw()", Severity.Info)); // TODO
+ super.draw();
+ }
+
@Override
protected void onDraw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.onDraw()", Severity.Info)); // TODO
super.onDraw();
- buildPortlets();
+
+ setEditMode(editMode);
}
public void buildPortlets() {
- setWidth100();
- setHeight100();
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(1)", Severity.Info)); // TODO
+
+ this.setBackgroundColor(storedDashboard.getConfiguration().getSimpleValue(Dashboard.CFG_BACKGROUND, "white"));
- setBackgroundColor(storedDashboard.getConfiguration().getSimpleValue(Dashboard.CFG_BACKGROUND, "white"));
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(2)", Severity.Info)); // TODO
+ portalLayout = new PortalLayout(extendLocatorId("PortalLayout"), this, storedDashboard.getColumns(),
+ storedDashboard.getColumnWidths());
- portalLayout = new PortalLayout(extendLocatorId("PortalLayout"), this, storedDashboard.getColumns());
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(3)", Severity.Info)); // TODO
+ portalLayout.setOverflow(Overflow.AUTO);
portalLayout.setWidth100();
portalLayout.setHeight100();
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(4)", Severity.Info)); // TODO
+
loadPortletWindows();
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(5)", Severity.Info)); // TODO
+
addMember(portalLayout);
+
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(6)", Severity.Info)); // TODO
+ }
+
+ protected boolean canEditName() {
+ return true;
}
private DynamicForm buildEditForm() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildEditForm(1)", Severity.Info)); // TODO
+
editForm = new LocatableDynamicForm(extendLocatorId("Editor"));
+ editForm.setMargin(5);
editForm.setAutoWidth();
- editForm.setNumCols(12);
-
- TextItem nameItem = new TextItem("name", MSG.common_title_dashboard_name());
- nameItem.setValue(storedDashboard.getName());
- nameItem.setWrapTitle(false);
- nameItem.addBlurHandler(new BlurHandler() {
- public void onBlur(BlurEvent blurEvent) {
- String val = (String) blurEvent.getItem().getValue();
- val = (null == val) ? "" : val.trim();
- if (!("".equals(val) || val.equals(storedDashboard.getName()))) {
- storedDashboard.setName(val);
- save();
- dashboardsView.updateNames();
+ editForm.setNumCols(canEditName() ? 12 : 10);
+
+ TextItem nameItem = null;
+
+ if (dashboardContainer.supportsDashboardNameEdit()) {
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildEditForm(2)", Severity.Info)); // TODO
+
+ nameItem = new TextItem("name", MSG.common_title_dashboard_name());
+ nameItem.setValue(storedDashboard.getName());
+ nameItem.setWrapTitle(false);
+ nameItem.addBlurHandler(new BlurHandler() {
+ public void onBlur(BlurEvent blurEvent) {
+ String val = (String) blurEvent.getItem().getValue();
+ val = (null == val) ? "" : val.trim();
+ if (!("".equals(val) || val.equals(storedDashboard.getName()))) {
+ storedDashboard.setName(val);
+ save();
+ dashboardContainer.updateDashboardNames();
+ }
}
- }
- });
+ });
+ }
final StaticTextItem numColItem = new StaticTextItem();
numColItem.setTitle(MSG.common_title_columns());
numColItem.setValue(storedDashboard.getColumns());
ButtonItem addColumn = new ButtonItem("addColumn", MSG.common_title_add_column());
- // addColumn.setIcon("silk/application_side_expand.png");
+
addColumn.setAutoFit(true);
addColumn.setStartRow(false);
addColumn.setEndRow(false);
@@ -323,29 +366,41 @@ public class DashboardView extends LocatableVLayout {
refreshCanvas.setStartRow(false);
refreshCanvas.setEndRow(false);
- editForm.setItems(nameItem, addCanvas, numColItem, addColumn, removeColumn, picker, refreshCanvas);
+ if (null != nameItem) {
+ editForm.setItems(nameItem, addCanvas, numColItem, addColumn, removeColumn, picker, refreshCanvas);
+ } else {
+ editForm.setItems(addCanvas, numColItem, addColumn, removeColumn, picker, refreshCanvas);
+ }
updateRefreshMenu();
this.refreshMenuButton.markForRedraw();
- markForRedraw();
+ //this.markForRedraw();
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildEditForm(2)", Severity.Info)); // TODO
return editForm;
}
private void loadPortletWindows() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.loadPortletWindows(1)", Severity.Info)); // TODO
+
for (int i = 0; i < storedDashboard.getColumns(); i++) {
for (DashboardPortlet storedPortlet : storedDashboard.getPortlets(i)) {
String locatorId = getPortletLocatorId(portalLayout, storedPortlet);
- final PortletWindow portletWindow = new PortletWindow(locatorId, this, storedPortlet);
- portletWindows.add(portletWindow);
- portletWindow.setTitle(storedPortlet.getName());
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->> DashboardView.loadPortletWindows(" + locatorId + ")", Severity.Info)); // TODO
+
+ PortletWindow portletWindow = new PortletWindow(locatorId, this, storedPortlet);
+ portletWindow.setTitle(storedPortlet.getName());
portletWindow.setHeight(storedPortlet.getHeight());
portletWindow.setVisible(true);
+ portletWindows.add(portletWindow);
portalLayout.addPortletWindow(portletWindow, i);
}
}
+
+ CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.loadPortletWindows(2)", Severity.Info)); // TODO
}
/**
@@ -374,7 +429,7 @@ public class DashboardView extends LocatableVLayout {
return portalLayout.extendLocatorId(locatorId.toString());
}
- private void addPortlet(String portletKey, String portletName) {
+ protected void addPortlet(String portletKey, String portletName) {
DashboardPortlet storedPortlet = new DashboardPortlet(portletName, portletKey, 250);
storedDashboard.addPortlet(storedPortlet);
@@ -420,17 +475,17 @@ public class DashboardView extends LocatableVLayout {
storedDashboard.removePortlet(portlet);
// portlet remove means the portlet locations may have changed. The selenium testing locators include
- // positioning info. So, in this case we have to take the hit and completely redraw the dash.
+ // positioning info. So, in this case we have to take the hit and completely refresh the dash.
AsyncCallback<Dashboard> callback = SeleniumUtility.getUseDefaultIds() ? null : new AsyncCallback<Dashboard>() {
@Override
public void onFailure(Throwable caught) {
- redraw();
+ rebuild();
}
@Override
public void onSuccess(Dashboard result) {
- redraw();
+ rebuild();
}
};
save(callback);
@@ -489,15 +544,16 @@ public class DashboardView extends LocatableVLayout {
}
}
for (PortletWindow portletWindow : portletWindows) {
- for (DashboardPortlet portlet : result.getPortlets()) {
- if (equalsDashboardPortlet(portletWindow.getStoredPortlet(), portlet)) {
- portletWindow.setStoredPortlet(portlet);
+ for (DashboardPortlet updatedPortlet : result.getPortlets()) {
+ if (equalsDashboardPortlet(portletWindow.getStoredPortlet(), updatedPortlet)) {
+ portletWindow.setStoredPortlet(updatedPortlet);
- //restarting portlet auto-refresh with newest settings
+ // restarting portlet auto-refresh with newest settings
Portlet view = portletWindow.getView();
if (view instanceof AutoRefreshPortlet) {
((AutoRefreshPortlet) view).startRefreshCycle();
}
+ break;
}
}
}
@@ -507,35 +563,46 @@ public class DashboardView extends LocatableVLayout {
/**
* This is an enhanced equals for portlets that allows equality for unpersisted portlets. At times (like addPortlet)
* a portlet may have been associated with its window prior to being persisted. In this case we can consider
- * it equal if it is associated with the same dashboard and has the same positioning. Note that key-name pairing
+ * it equal if it is associated with the same dashboard(1) and has the same positioning. Note that key-name pairing
* can not be used for equality as a dashboard is allowed to have the same portlet multiple times, with a default
* name. But they can not hold the same position.
+ * <pre>
+ * (1) Even the dashboard comparison has been made flexible. To allow for lazy persist of the dashboard (to
+ * allow for the default group or resource dashboard to not be persisted) we allow the dash comparison
+ * to be done by name if an entity id is 0. This should be safe as dashboard names are set prior to
+ * persist, and should be unique for the session user.
*
- * @param portlet1
- * @param portlet2
+ * @param storedPortlet
+ * @param updatedPortlet
* @return
*/
- private boolean equalsDashboardPortlet(DashboardPortlet portlet1, DashboardPortlet portlet2) {
+ private boolean equalsDashboardPortlet(DashboardPortlet storedPortlet, DashboardPortlet updatedPortlet) {
- if (portlet1.equals(portlet2)) {
+ if (storedPortlet.equals(updatedPortlet)) {
return true;
}
- // make sure at least one portlet is not persisted
- if (portlet1.getId() > 0 && portlet2.getId() > 0) {
+ // make sure at least one portlet is not persisted for pseudo-equality
+ if (storedPortlet.getId() > 0 && updatedPortlet.getId() > 0) {
return false;
}
- // must match dash and position for psuedo-equality
- if (portlet1.getDashboard().getId() != portlet2.getDashboard().getId()) {
+ // must match position for pseudo-equality
+ if (storedPortlet.getColumn() != updatedPortlet.getColumn()) {
return false;
}
- if (portlet1.getColumn() != portlet2.getColumn()) {
+ if (storedPortlet.getIndex() != updatedPortlet.getIndex()) {
return false;
}
- if (portlet1.getIndex() != portlet2.getIndex()) {
+ // must match dash (ids if persisted, otherwise name) for pseudo-equality
+ boolean unpersistedDash = (storedPortlet.getDashboard().getId() == 0 || updatedPortlet.getDashboard().getId() == 0);
+ boolean dashMatchId = (!unpersistedDash && (storedPortlet.getDashboard().getId() == updatedPortlet
+ .getDashboard().getId()));
+ boolean dashMatchName = (unpersistedDash && storedPortlet.getDashboard().getName().equals(
+ updatedPortlet.getDashboard().getName()));
+ if (!(dashMatchId || dashMatchName)) {
return false;
}
@@ -568,7 +635,7 @@ public class DashboardView extends LocatableVLayout {
}
public Set<Permission> getGlobalPermissions() {
- return dashboardsView.getGlobalPermissions();
+ return dashboardContainer.getGlobalPermissions();
}
public void setEditMode(boolean editMode) {
@@ -578,7 +645,9 @@ public class DashboardView extends LocatableVLayout {
} else {
this.editForm.hide();
}
- markForRedraw();
+ this.editForm.markForRedraw();
+ this.portalLayout.show();
+ this.portalLayout.markForRedraw(); // TODO
}
public class UpdatePortletRefreshCallback implements AsyncCallback<Subject> {
@@ -614,7 +683,8 @@ public class DashboardView extends LocatableVLayout {
retrievedRefreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
}
String currentSelection = refreshMenuMappings.get(retrievedRefreshInterval);
- if (currentSelection != null) {//iterate over menu items and update icon details
+ if (currentSelection != null) {
+ //iterate over menu items and update icon details
for (int i = 0; i < refreshMenuItems.length; i++) {
MenuItem menu = refreshMenuItems[i];
if (currentSelection.equals(menu.getTitle())) {
@@ -632,4 +702,8 @@ public class DashboardView extends LocatableVLayout {
this.refreshMenuButton.markForRedraw();
}
}
+
+ public Dashboard getStoredDashboard() {
+ return storedDashboard;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
index 9a4970e..f3d1c69 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
@@ -24,6 +24,7 @@ package org.rhq.enterprise.gui.coregui.client.dashboard;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -45,8 +46,11 @@ import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+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.InitializableView;
@@ -72,9 +76,10 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
+ * @author Jay Shaughnessy
* @author Greg Hinkle
*/
-public class DashboardsView extends LocatableVLayout implements BookmarkableView, InitializableView {
+public class DashboardsView extends LocatableVLayout implements DashboardContainer, BookmarkableView, InitializableView {
public static final ViewName VIEW_ID = new ViewName("Dashboards", MSG.view_dashboards_title());
@@ -100,7 +105,7 @@ public class DashboardsView extends LocatableVLayout implements BookmarkableView
private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
// Capture the user's global permissions for use by any dashboard or portlet that may need it for rendering.
- private Set<Permission> globalPermissions;
+ private HashSet<Permission> globalPermissions;
private boolean initialized = false;
@@ -116,17 +121,18 @@ public class DashboardsView extends LocatableVLayout implements BookmarkableView
protected void onInit() {
super.onInit();
- dashboardService.findDashboardsForSubject(new AsyncCallback<List<Dashboard>>() {
+ DashboardCriteria criteria = new DashboardCriteria();
+ dashboardService.findDashboardsByCriteria(criteria, new AsyncCallback<PageList<Dashboard>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
}
- public void onSuccess(final List<Dashboard> result) {
+ public void onSuccess(final PageList<Dashboard> result) {
// now, a second async call to load global perms
new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
public void onPermissionsLoaded(Set<Permission> permissions) {
- globalPermissions = permissions;
+ globalPermissions = new HashSet<Permission>(permissions);
if (result.isEmpty()) {
// if the user has no dashboards persist a default dashboard for him to work with. In
@@ -292,8 +298,10 @@ public class DashboardsView extends LocatableVLayout implements BookmarkableView
Dashboard dashboard = new Dashboard();
dashboard.setName(MSG.common_title_default());
+ dashboard.setCategory(DashboardCategory.INVENTORY);
dashboard.setColumns(2);
- dashboard.setColumnWidths("32%", "68%");
+ // only leftmost column width is currently settable, the rest are equally divided
+ dashboard.setColumnWidths("32%");
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
// Left Column
@@ -355,10 +363,11 @@ public class DashboardsView extends LocatableVLayout implements BookmarkableView
}
Dashboard dashboard = new Dashboard();
+ dashboard.setCategory(DashboardCategory.INVENTORY);
dashboard.setName(availableDashboardName);
-
dashboard.setColumns(2);
- dashboard.setColumnWidths("30%", "70%");
+ // only leftmost column width is currently settable, the rest are equally divided
+ dashboard.setColumnWidths("32%");
dashboardService.storeDashboard(dashboard, new AsyncCallback<Dashboard>() {
public void onFailure(Throwable caught) {
@@ -385,13 +394,6 @@ public class DashboardsView extends LocatableVLayout implements BookmarkableView
});
}
- public void updateNames() {
- for (Tab t : tabSet.getTabs()) {
- DashboardView view = (DashboardView) t.getPane();
- t.setTitle(view.getDashboard().getName());
- }
- }
-
public void renderView(ViewPath viewPath) {
// make sure we have at least a default dashboard tab
if (null == tabSet || 0 == tabSet.getTabs().length) {
@@ -428,8 +430,19 @@ public class DashboardsView extends LocatableVLayout implements BookmarkableView
return initialized;
}
- public Set<Permission> getGlobalPermissions() {
+ public HashSet<Permission> getGlobalPermissions() {
return globalPermissions;
}
+ public boolean supportsDashboardNameEdit() {
+ return true;
+ }
+
+ public void updateDashboardNames() {
+ for (Tab t : tabSet.getTabs()) {
+ DashboardView view = (DashboardView) t.getPane();
+ t.setTitle(view.getDashboard().getName());
+ }
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
index 87c3328..9a8b0dd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
@@ -22,6 +22,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard;
+import java.util.Arrays;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.util.EventHandler;
import com.smartgwt.client.widgets.Canvas;
@@ -30,28 +32,43 @@ import com.smartgwt.client.widgets.events.DropHandler;
import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
public class PortalLayout extends LocatableHLayout {
private DashboardView dashboardView;
- public PortalLayout(String locatorId, DashboardView dashboardView, int numColumns) {
+ /**
+ * @param locatorId
+ * @param dashboardView
+ * @param numColumns
+ * @param columnWidths Currently only the first column width is set, others are ignored and share the remaining space
+ * evenly. If null column 0 defaults to 30%.
+ */
+ public PortalLayout(String locatorId, DashboardView dashboardView, int numColumns, String[] columnWidths) {
super(locatorId);
- this.dashboardView = dashboardView;
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->> PortalLayout(numColumns=" + numColumns + ",columnWidths="
+ + Arrays.toString(columnWidths) + ")")); // TODO
+ this.dashboardView = dashboardView;
+ setMargin(5);
setMembersMargin(6);
for (int i = 0; i < numColumns; i++) {
final PortalColumn column = new PortalColumn();
- if (i == 0) {
+ if (null != columnWidths && i < columnWidths.length) {
+ column.setWidth(columnWidths[i]);
+ } else if (i == 0) {
column.setWidth("30%");
}
- addMember(column);
final int columnNumber = i;
column.addDropHandler(new DropHandler() {
@@ -85,13 +102,13 @@ public class PortalLayout extends LocatableHLayout {
}
// drop means the portlet location has changed. The selenium testing locators include positioning
- // info. So, in this case we have to take the hit and completely redraw the dash.
+ // info. So, in this case we have to take the hit and completely rebuild the dash.
AsyncCallback<Dashboard> callback = SeleniumUtility.getUseDefaultIds() ? null
: new AsyncCallback<Dashboard>() {
@Override
public void onFailure(Throwable caught) {
- redraw();
+ rebuild();
}
@Override
@@ -103,7 +120,7 @@ public class PortalLayout extends LocatableHLayout {
target.removeFromParent();
target.destroy();
- redraw();
+ rebuild();
}
};
save(callback);
@@ -111,6 +128,9 @@ public class PortalLayout extends LocatableHLayout {
com.allen_sauer.gwt.log.client.Log.info("Rearranged column indexes");
}
});
+
+ CoreGUI.getMessageCenter().notify(new Message("------->> PortalLayout() adding column " + i)); // TODO
+ addMember(column);
}
}
@@ -130,8 +150,8 @@ public class PortalLayout extends LocatableHLayout {
this.dashboardView.save(callback);
}
- public void redraw() {
- this.dashboardView.redraw();
+ public void rebuild() {
+ this.dashboardView.rebuild();
}
public void resize() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
index 664b234..0f76e5b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
@@ -45,6 +45,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
public class PortletWindow extends LocatableWindow {
@@ -121,17 +122,18 @@ public class PortletWindow extends LocatableWindow {
extendLocatorId("Settings"), HeaderControl.SETTINGS, settingsHandler), new LocatableHeaderControl(
extendLocatorId("Help"), HeaderControl.HELP, helpHandler), HeaderControls.CLOSE_BUTTON);
- // show either a shadow, or translucency, when dragging a portlet
- // (could do both at the same time, but these are not visually compatible effects)
- // setShowDragShadow(true);
- setDragOpacity(30);
-
// enable predefined component animation
setAnimateMinimize(true);
// Window is draggable with "outline" appearance by default.
// "target" is the solid appearance.
+ setCanDrag(true);
setDragAppearance(DragAppearance.TARGET);
+ // show either a shadow, or translucency, when dragging a portlet
+ // (could do both at the same time, but these are not visually compatible effects)
+ // setShowDragShadow(true);
+ setDragOpacity(30);
+ // can be dropped on a column
setCanDrop(true);
setCanDragResize(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java
index f56b97a..5d5efff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java
@@ -22,23 +22,20 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
-import java.util.List;
-
import com.google.gwt.user.client.rpc.RemoteService;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.util.PageList;
/**
- * @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
public interface DashboardGWTService extends RemoteService {
- List<Dashboard> findDashboardsForSubject() throws RuntimeException;
-
- List<Dashboard> findSharedDashboards() throws RuntimeException;
+ PageList<Dashboard> findDashboardsByCriteria(DashboardCriteria criteria) throws RuntimeException;
Dashboard storeDashboard(Dashboard dashboard) throws RuntimeException;
void removeDashboard(int dashboardId) throws RuntimeException;
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
index 29c6590..65d4c88 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
@@ -23,7 +23,6 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
import java.util.EnumSet;
-import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.menu.Menu;
@@ -33,6 +32,7 @@ import com.smartgwt.client.widgets.menu.events.ClickHandler;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.dashboard.DashboardPortlet;
@@ -265,65 +265,68 @@ public class ResourceGroupContextMenu extends LocatableMenu {
MenuItem measurements = new MenuItem(MSG.view_tree_common_contextMenu_measurements());
final Menu measurementsSubMenu = new Menu();
- GWTServiceLookup.getDashboardService().findDashboardsForSubject(new AsyncCallback<List<Dashboard>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFail_dashboards(), caught);
- }
+ DashboardCriteria criteria = new DashboardCriteria();
+ GWTServiceLookup.getDashboardService().findDashboardsByCriteria(criteria,
+ new AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFail_dashboards(),
+ caught);
+ }
- public void onSuccess(List<Dashboard> result) {
-
- if (type.getMetricDefinitions() != null) {
- for (final MeasurementDefinition def : type.getMetricDefinitions()) {
-
- MenuItem defItem = new MenuItem(def.getDisplayName());
- measurementsSubMenu.addItem(defItem);
- Menu defSubItem = new Menu();
- defItem.setSubmenu(defSubItem);
-
- for (final Dashboard d : result) {
- MenuItem addToDBItem = new MenuItem(MSG.view_tree_common_contextMenu_addChartToDashboard(d
- .getName()));
- defSubItem.addItem(addToDBItem);
-
- addToDBItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent menuItemClickEvent) {
-
- DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " "
- + MSG.view_tree_common_contextMenu_chart(), GraphPortlet.KEY, 250);
- p.getConfiguration().put(
- new PropertySimple(GraphPortlet.CFG_RESOURCE_GROUP_ID, group.getId()));
- p.getConfiguration().put(
- new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
-
- d.addPortlet(p);
-
- GWTServiceLookup.getDashboardService().storeDashboard(d,
- new AsyncCallback<Dashboard>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
- caught);
- }
-
- public void onSuccess(Dashboard result) {
- String msg = MSG
- .view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
- .getName());
- CoreGUI.getMessageCenter().notify(
- new Message(msg, Message.Severity.Info));
- }
- });
-
- }
- });
+ public void onSuccess(PageList<Dashboard> result) {
- }
+ if (type.getMetricDefinitions() != null) {
+ for (final MeasurementDefinition def : type.getMetricDefinitions()) {
+
+ MenuItem defItem = new MenuItem(def.getDisplayName());
+ measurementsSubMenu.addItem(defItem);
+ Menu defSubItem = new Menu();
+ defItem.setSubmenu(defSubItem);
+
+ for (final Dashboard d : result) {
+ MenuItem addToDBItem = new MenuItem(MSG
+ .view_tree_common_contextMenu_addChartToDashboard(d.getName()));
+ defSubItem.addItem(addToDBItem);
+
+ addToDBItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+
+ DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " "
+ + MSG.view_tree_common_contextMenu_chart(), GraphPortlet.KEY, 250);
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_RESOURCE_GROUP_ID, group.getId()));
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
+
+ d.addPortlet(p);
+ GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
+ caught);
+ }
+
+ public void onSuccess(Dashboard result) {
+ String msg = MSG
+ .view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
+ .getName());
+ CoreGUI.getMessageCenter().notify(
+ new Message(msg, Message.Severity.Info));
+ }
+ });
+
+ }
+ });
+
+ }
+
+ }
}
- }
- }
- });
+ }
+ });
measurements.setSubmenu(measurementsSubMenu);
return measurements;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index b42297b..89079ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -469,7 +469,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
if ("AutoCluster".equals(viewPath.getCurrent().getPath())) {
super.renderView(viewPath.next());
} else {
- // we are traversing to to the Members subtab. Assume this is happening after a save
+ // if we are traversing to the Members subtab assume this is happening after a save,
// which means the group type and membership may have changed - get it so we refresh everything.
if ((null != this.groupId) && this.inventoryTab.getName().equals(currentTabName)
&& this.inventoryMembers.getName().equals(currentSubTabName)) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index 8b34662..a240e45 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -18,22 +18,69 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
-import com.smartgwt.client.widgets.Label;
+import java.util.Set;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.enterprise.gui.coregui.client.RefreshableView;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.InitializableView;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardContainer;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
+import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
- * The content pane for the group Summary>Activity subtab.
+ * The content pane for the group Summary>Dashboard subtab.
*
- * @author Ian Springer
+ * @author Jay Shaughnessy
*/
-// TODO: Implement this.
-public class ActivityView extends LocatableVLayout implements RefreshableView {
+
+public class ActivityView extends LocatableVLayout implements DashboardContainer, InitializableView {
+
+ private static final String DASHBOARD_NAME_PREFIX = "GroupDashboard_";
private ResourceGroupComposite groupComposite;
+ private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
+
+ private DashboardView dashboardView;
+
+ private LocatableToolStrip footer;
+ private IButton editButton;
+ private IButton resetButton;
+
+ // Capture the user's global permissions for use by any dashboard or portlet that may need it for rendering.
+ private Set<Permission> globalPermissions;
+
+ private boolean editMode = false;
+
+ private boolean isInitialized = false;
+
public ActivityView(String locatorId, ResourceGroupComposite groupComposite) {
super(locatorId);
this.groupComposite = groupComposite;
@@ -41,15 +88,206 @@ public class ActivityView extends LocatableVLayout implements RefreshableView {
@Override
protected void onInit() {
- super.onInit();
+ if (!isInitialized()) {
+ CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.oninit()", Severity.Info)); // TODO
+
+ super.onInit();
+
+ // first async call to get global permissions
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->> ActivityView.oninit( gotGlobalPerms )", Severity.Info)); // TODO
+
+ globalPermissions = permissions;
+
+ // now make async call to look for customized dash for this user and entity
+ DashboardCriteria criteria = new DashboardCriteria();
+ criteria.addFilterCategory(DashboardCategory.GROUP);
+ criteria.addFilterGroupId(groupComposite.getResourceGroup().getId());
+ dashboardService.findDashboardsByCriteria(criteria, new AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
+ }
+
+ public void onSuccess(final PageList<Dashboard> result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->> ActivityView.oninit( gotCriteriaResult )", Severity.Info)); // TODO
- Label label = new Label("<h3>Coming soon...</h3>");
- addMember(label);
+ Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
+ setDashboard(dashboard);
+
+ isInitialized = true;
+
+ // draw() may be done since onInit finishes asynchronously, if so redraw
+ if (isDrawn()) {
+ markForRedraw();
+ }
+ }
+ });
+ }
+ });
+ }
+ }
+
+ @Override
+ public void draw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.draw()", Severity.Info)); // TODO
+ super.draw();
+ }
+
+ @Override
+ public void redraw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.redraw()", Severity.Info)); // TODO
+ super.redraw();
}
@Override
- public void refresh() {
- // TODO: Reload the data.
+ protected void onDraw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.onDraw()", Severity.Info)); // TODO
+ super.onDraw();
+
+ /*
+ * If we really had something to do here we'd want to wait until the async initialization was really over.
+ *
+ new Timer() {
+ final long startTime = System.currentTimeMillis();
+
+ public void run() {
+ if (isInitialized) {
+ CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.onDraw( 1 )", Severity.Info)); // TODO
+
+ ActivityView.super.onDraw();
+ if (!dashboardView.isDrawn()) {
+ dashboardView.draw();
+ }
+ if (!dashboardView.isVisible()) {
+ dashboardView.show();
+ }
+ markForRedraw();
+ dashboardView.markForRedraw();
+
+ } else {
+ long elapsedMillis = System.currentTimeMillis() - startTime;
+ if (elapsedMillis < 10000) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->> ActivityView.onDraw( 2 )", Severity.Info)); // TODO
+ schedule(100); // Reschedule the timer.
+ } else {
+ // give up and just do the draw()
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->> ActivityView.onDraw( 3 )", Severity.Info)); // TODO
+ ActivityView.super.onDraw();
+
+ }
+ }
+ }
+ }.run(); // fire the timer immediately
+ */
+ }
+
+ private void setDashboard(Dashboard dashboard) {
+ CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.setDashboard()", Severity.Info)); // TODO
+
+ Canvas[] members = getMembers();
+ removeMembers(members);
+
+ dashboardView = new DashboardView(extendLocatorId(dashboard.getName()), this, dashboard);
+ addMember(dashboardView);
+
+ footer = new LocatableToolStrip(extendLocatorId("Footer"));
+ footer.setPadding(5);
+ footer.setWidth100();
+ footer.setMembersMargin(15);
+
+ editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
+ .common_title_edit_mode());
+ editButton.setAutoFit(true);
+ editButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ editMode = !editMode;
+ editButton.setTitle(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
+ dashboardView.setEditMode(editMode);
+ }
+ });
+
+ resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
+ resetButton.setAutoFit(true);
+ resetButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ String message = MSG.view_summaryDashboard_resetConfirm();
+
+ SC.ask(message, new BooleanCallback() {
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ dashboardView.delete();
+ setDashboard(getDefaultDashboard());
+ markForRedraw();
+ }
+ }
+ });
+ }
+ });
+
+ footer.addMember(editButton);
+ footer.addMember(resetButton);
+
+ addMember(footer);
+ }
+
+ protected Dashboard getDefaultDashboard() {
+ CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.getDefaultDashboard", Severity.Info)); // TODO
+
+ Subject sessionSubject = UserSessionManager.getSessionSubject();
+ ResourceGroup group = groupComposite.getResourceGroup();
+
+ Dashboard dashboard = new Dashboard();
+
+ //dashboard.getConfiguration().setProperties(new ArrayList<Property>()); // replace the LinkedHashMap...
+
+ dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + group.getId());
+ dashboard.setCategory(DashboardCategory.GROUP);
+ dashboard.setGroup(group);
+ dashboard.setColumns(2);
+
+ // TODO, add real portlets
+ // set leftmost column and letthe rest be equally divided
+ dashboard.setColumnWidths("40%");
+ dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
+
+ // Left Column
+ DashboardPortlet dummyLeft = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyLeft.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyLeft, 0, 0);
+
+ // right Column
+ DashboardPortlet dummyRight = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 220);
+ dummyRight.getConfiguration().put(new PropertySimple("message", "<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyRight, 1, 0);
+
+ return dashboard;
+ }
+
+ @Override
+ public boolean isInitialized() {
+ return isInitialized;
+ }
+
+ public Set<Permission> getGlobalPermissions() {
+ return globalPermissions;
+ }
+
+ /**
+ * name update not supported because the name is derived from the entity id.
+ * @return
+ */
+ public boolean supportsDashboardNameEdit() {
+ return false;
+ }
+
+ public void updateDashboardNames() {
+ return;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 24ccac1..98e5755 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -51,6 +51,7 @@ import com.smartgwt.client.widgets.tree.events.NodeContextClickEvent;
import com.smartgwt.client.widgets.tree.events.NodeContextClickHandler;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
@@ -522,60 +523,67 @@ public class ResourceTreeView extends LocatableVLayout {
MenuItem measurements = new MenuItem(MSG.view_tree_common_contextMenu_measurements());
final Menu measurementsSubMenu = new Menu();
- GWTServiceLookup.getDashboardService().findDashboardsForSubject(new AsyncCallback<List<Dashboard>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFailed_dashboard(), caught);
- }
+ DashboardCriteria criteria = new DashboardCriteria();
+ GWTServiceLookup.getDashboardService().findDashboardsByCriteria(criteria,
+ new AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFailed_dashboard(),
+ caught);
+ }
- public void onSuccess(List<Dashboard> result) {
-
- for (final MeasurementDefinition def : type.getMetricDefinitions()) {
-
- MenuItem defItem = new MenuItem(def.getDisplayName());
- measurementsSubMenu.addItem(defItem);
- Menu defSubItem = new Menu();
- defItem.setSubmenu(defSubItem);
-
- for (final Dashboard d : result) {
- MenuItem addToDBItem = new MenuItem(MSG.view_tree_common_contextMenu_addChartToDashboard(d
- .getName()));
- defSubItem.addItem(addToDBItem);
-
- addToDBItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent menuItemClickEvent) {
- DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " Chart",
- GraphPortlet.KEY, 250);
- p.getConfiguration().put(
- new PropertySimple(GraphPortlet.CFG_RESOURCE_ID, resource.getId()));
- p.getConfiguration().put(
- new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
-
- d.addPortlet(p);
-
- GWTServiceLookup.getDashboardService().storeDashboard(d,
- new AsyncCallback<Dashboard>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(), caught);
- }
-
- public void onSuccess(Dashboard result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG
- .view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
- .getName()), Message.Severity.Info));
- }
- });
+ public void onSuccess(PageList<Dashboard> result) {
+
+ for (final MeasurementDefinition def : type.getMetricDefinitions()) {
+
+ MenuItem defItem = new MenuItem(def.getDisplayName());
+ measurementsSubMenu.addItem(defItem);
+ Menu defSubItem = new Menu();
+ defItem.setSubmenu(defSubItem);
+
+ for (final Dashboard d : result) {
+ MenuItem addToDBItem = new MenuItem(MSG.view_tree_common_contextMenu_addChartToDashboard(d
+ .getName()));
+ defSubItem.addItem(addToDBItem);
+
+ addToDBItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+ DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " Chart",
+ GraphPortlet.KEY, 250);
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_RESOURCE_ID, resource.getId()));
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
+
+ d.addPortlet(p);
+
+ GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
+ caught);
+ }
+
+ public void onSuccess(Dashboard result) {
+ CoreGUI
+ .getMessageCenter()
+ .notify(
+ new Message(
+ MSG
+ .view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
+ .getName()), Message.Severity.Info));
+ }
+ });
- }
- });
+ }
+ });
+
+ }
}
}
-
- }
- });
+ });
measurements.setSubmenu(measurementsSubMenu);
return measurements;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java
index c45ca10..3aa0910 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java
@@ -22,9 +22,9 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
-import java.util.List;
-
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
@@ -40,19 +40,10 @@ public class DashboardGWTServiceImpl extends AbstractGWTServiceImpl implements D
private DashboardManagerLocal dashboardManager = LookupUtil.getDashboardManagerLocal();
- public List<Dashboard> findDashboardsForSubject() throws RuntimeException {
- try {
- return SerialUtility.prepare(dashboardManager.findDashboardsForSubject(getSessionSubject()),
- "DashboardManager.findDashboardsForSubject");
- } catch (Throwable t) {
- throw new RuntimeException(ThrowableUtil.getAllMessages(t));
- }
- }
-
- public List<Dashboard> findSharedDashboards() throws RuntimeException {
+ public PageList<Dashboard> findDashboardsByCriteria(DashboardCriteria criteria) throws RuntimeException {
try {
- return SerialUtility.prepare(dashboardManager.findSharedDashboards(getSessionSubject()),
- "DashboardManager.findSharedDashboards");
+ return SerialUtility.prepare(dashboardManager.findDashboardsByCriteria(getSessionSubject(), criteria),
+ "DashboardManager.findDashboardsByCriteria");
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
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 2d4f866..940b293 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
@@ -1859,6 +1859,10 @@ view_summaryOverviewForm_message_descriptionChangeSuccess = Description of Resou
view_summaryOverviewForm_error_locationChangeFailure = Failed to change location of Resource with id {0} from [{1}] to [{2}].
view_summaryOverviewForm_message_locationChangeSuccess = Location of Resource with id {0} was changed from [{1}] to [{2}].
+# Summary Dashboard
+#-----------------------------
+view_summaryDashboard_resetConfirm = Reset to default summary dashboard (lose local changes)?
+
# Group Inventory>Members subtab
#-----------------------------------------
view_groupInventoryMembers_button_updateMembership = Update Membership...
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java
index db4c6b6..c4a007e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java
@@ -22,31 +22,33 @@
*/
package org.rhq.enterprise.server.dashboard;
-import java.util.List;
-
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerBean;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
import org.rhq.enterprise.server.authz.PermissionException;
+import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
+import org.rhq.enterprise.server.util.CriteriaQueryRunner;
/**
- *
+ * @author Jay Shaughnessy
* @author Greg Hinkle
*/
@Stateless
-public class DashboardManagerBean implements DashboardManagerLocal, DashboardManagerRemote{
+public class DashboardManagerBean implements DashboardManagerLocal, DashboardManagerRemote {
@SuppressWarnings("unused")
private final Log log = LogFactory.getLog(SubjectManagerBean.class);
@@ -57,20 +59,30 @@ public class DashboardManagerBean implements DashboardManagerLocal, DashboardMan
@EJB
private AuthorizationManagerLocal authorizationManager;
+ public PageList<Dashboard> findDashboardsByCriteria(Subject subject, DashboardCriteria criteria) {
+ if (criteria.isInventoryManagerRequired()) {
+ if (!authorizationManager.isInventoryManager(subject)) {
+ throw new PermissionException("Subject [" + subject.getName()
+ + "] requires InventoryManager permission for requested query criteria.");
+ }
- public List<Dashboard> findDashboardsForSubject(Subject subject) {
- Query query = entityManager.createQuery("SELECT d FROM Dashboard d WHERE d.owner.id = :subjectId");
-
- query.setParameter("subjectId", subject.getId());
-
- return query.getResultList();
+ Integer ownerId = criteria.getFilterOwnerId();
+ if (null != ownerId && 0 == ownerId.intValue()) {
+ criteria.addFilterOwnerId(null);
+ }
+ } else {
+ criteria.addFilterOwnerId(subject.getId());
+ }
- }
+ if (null == criteria.getFilterCategory()) {
+ criteria.addFilterCategory(DashboardCategory.INVENTORY);
+ }
- public List<Dashboard> findSharedDashboards(Subject subject) {
- Query query = entityManager.createQuery("SELECT d FROM Dashboard d WHERE d.shared = true");
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
- return query.getResultList();
+ CriteriaQueryRunner<Dashboard> queryRunner = new CriteriaQueryRunner<Dashboard>(criteria, generator,
+ entityManager);
+ return queryRunner.execute();
}
public Dashboard storeDashboard(Subject subject, Dashboard dashboard) {
@@ -80,7 +92,8 @@ public class DashboardManagerBean implements DashboardManagerLocal, DashboardMan
entityManager.persist(dashboard);
return dashboard;
} else {
- if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SETTINGS) && d.getOwner().getId() != subject.getId()) {
+ if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SETTINGS)
+ && d.getOwner().getId() != subject.getId()) {
throw new PermissionException("You may only alter dashboards you own.");
}
return entityManager.merge(dashboard);
@@ -89,9 +102,10 @@ public class DashboardManagerBean implements DashboardManagerLocal, DashboardMan
public void removeDashboard(Subject subject, int dashboardId) {
- Dashboard toDelete = entityManager.find(Dashboard.class,dashboardId);
+ Dashboard toDelete = entityManager.find(Dashboard.class, dashboardId);
- if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SETTINGS) && toDelete.getOwner().getId() != subject.getId()) {
+ if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SETTINGS)
+ && toDelete.getOwner().getId() != subject.getId()) {
throw new PermissionException("You may only delete dashboards you own.");
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java
index c915e5b..9a03ecb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java
@@ -25,7 +25,7 @@ package org.rhq.enterprise.server.dashboard;
import javax.ejb.Local;
/**
- * @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
@Local
public interface DashboardManagerLocal extends DashboardManagerRemote {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java
index c51a9a5..2e42293 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java
@@ -22,29 +22,22 @@
*/
package org.rhq.enterprise.server.dashboard;
-import java.util.List;
-import java.util.Set;
-
import javax.ejb.Remote;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.util.PageList;
/**
- * @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
@Remote
public interface DashboardManagerRemote {
-
- public List<Dashboard> findDashboardsForSubject(Subject subject);
-
- public List<Dashboard> findSharedDashboards(Subject subject);
+ public PageList<Dashboard> findDashboardsByCriteria(Subject subject, DashboardCriteria criteria);
public Dashboard storeDashboard(Subject subject, Dashboard dashboard);
public void removeDashboard(Subject subject, int dashboardId);
-
-
-
}
commit adbe97386a3046eef0a1e0d79765ca73050e7ecc
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 25 09:57:29 2011 -0500
part of BZ 680167 - this illustrates how to fix this RefreshableView bug for those views that have this bug.
just track whether you are currently refreshing, if you are, abort the current call to refresh()
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
index 862c8c4..c924352 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
@@ -72,6 +72,8 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
private ConfigurationEditor editor;
private IButton saveButton;
+ private boolean refreshing = false;
+
public GroupResourceConfigurationEditView(String locatorId, ResourceGroupComposite groupComposite) {
super(locatorId);
@@ -110,6 +112,11 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
@Override
public void refresh() {
+ if (this.refreshing) {
+ return; // we are already in the process of refreshing, don't do it again
+ }
+
+ this.refreshing = true;
this.saveButton.disable();
if (editor != null) {
editor.destroy();
@@ -129,6 +136,7 @@ public class GroupResourceConfigurationEditView extends LocatableVLayout impleme
this.editor.addPropertyValueChangeListener(this);
this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
addMember(this.editor);
+ this.refreshing = false; // when we get here, we know we are done the refresh
}
}
commit 9a26c11106e6a100e22da87d691f412832253cf7
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Feb 25 08:25:07 2011 -0500
enable 'see more...' links for Resource/Group Activity pages where applicable.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
index 2cdc766..13abdd5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
@@ -27,6 +27,7 @@ import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
@@ -73,6 +74,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
protected String RECENT_PKG_HISTORY_NONE = MSG.view_resource_inventory_activity_no_recent_pkg_history();
protected String RECENT_BUNDLE_DEPLOY = MSG.common_title_recent_bundle_deployments();
protected String RECENT_BUNDLE_DEPLOY_NONE = MSG.view_resource_inventory_activity_no_recent_bundle_deploy();
+ protected String SEE_MORE = MSG.common_msg_see_more();
private ResourceGroupComposite groupComposite = null;
@@ -109,6 +111,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
leftPane.setMembersMargin(5);
leftPane.setAutoHeight();
+ Resource resource = null;
ResourceGroup group = null;
if (groupComposite != null) {
group = groupComposite.getResourceGroup();
@@ -173,7 +176,9 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
}
HLayout recentBundleDeployTitle = new TitleWithIcon("subsystems/content/Content_24.png", RECENT_BUNDLE_DEPLOY);
- if (((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ // if (resource.type==Platform) || (Group(Mixed/Compat) of Platforms)
+ // if ((group == null)&&())||((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {
+ if (((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {
rightPane.addMember(divider6);
rightPane.addMember(recentBundleDeployTitle);
rightPane.addMember(recentBundleDeployContent);
@@ -302,4 +307,19 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
return item;
}
+ /** Generates a "See more.." link item, using the locatable dynamic form passed in and appends to the VLayout passed in.
+ *
+ * @param form
+ * @param linkDestination
+ * @param column
+ */
+ protected void addSeeMoreLink(LocatableDynamicForm form, String linkDestination, VLayout column) {
+ if ((form != null) && (column != null)) {
+ form.setNumCols(1);
+ LinkItem link = newLinkItem(SEE_MORE, linkDestination);
+ form.setItems(link);
+ column.addMember(form);
+ }
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index bacbb8d..a7c1b4f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -57,7 +57,6 @@ import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
@@ -132,14 +131,17 @@ public class ActivityView2 extends AbstractActivityView {
StaticTextItem iconItem = newTextItemIcon(ImageManager.getAlertIcon(alert.getAlertDefinition()
.getPriority()), alert.getAlertDefinition().getPriority().getDisplayName());
- LinkItem link = newLinkItem(alert.getAlertDefinition().getName() + ": ", LinkManager
- .getResourceGroupLink(groupId)
- + "/Alerts/History/" + alert.getId());
+ LinkItem link = newLinkItem(alert.getAlertDefinition().getName() + ": ",
+ ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/" + alert.getId());
StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(alert.getCtime()));
row.setItems(iconItem, link, time);
column.addMember(row);
}
+ //link to more details
+ LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
+ .valueOf(rowNum++)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Alerts/History/", column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentAlertsContent.extendLocatorId("None"),
RECENT_ALERTS_NONE);
@@ -206,6 +208,10 @@ public class ActivityView2 extends AbstractActivityView {
column.addMember(row);
}
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Operations/History/", column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentOperationsContent
.extendLocatorId("None"), RECENT_OPERATIONS_NONE);
@@ -271,6 +277,10 @@ public class ActivityView2 extends AbstractActivityView {
row.setItems(iconItem, link, time);
column.addMember(row);
}
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Configuration/History/", column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentConfigurationContent
.extendLocatorId("None"), RECENT_CONFIGURATIONS_NONE);
@@ -337,6 +347,10 @@ public class ActivityView2 extends AbstractActivityView {
column.addMember(row);
}
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent.extendLocatorId(String
+ .valueOf(rowNum)));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Events/History/", column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentEventsContent.extendLocatorId("None"),
RECENT_EVENTS_NONE);
@@ -385,6 +399,7 @@ public class ActivityView2 extends AbstractActivityView {
row.setItems(link, time);
column.addMember(row);
}
+ //insert see more link spinder(2/24/11): no page that displays all oobs... See More not possible.
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentOobContent.extendLocatorId("None"),
RECENT_OOB_NONE);
@@ -440,6 +455,11 @@ public class ActivityView2 extends AbstractActivityView {
row.setItems(iconItem, link, time);
column.addMember(row);
}
+ // //insert see more link
+ // LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
+ // .extendLocatorId("PkgHistoryContentSeeMore"));
+ // String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId;
+ // addSeeMoreLink(row, destination, column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentPkgHistoryContent.extendLocatorId("None"),
RECENT_PKG_HISTORY_NONE);
@@ -576,6 +596,11 @@ public class ActivityView2 extends AbstractActivityView {
LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
.extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
column.addMember(row);
+ } else {
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
+ .extendLocatorId("RecentMeasurementsContentSeeMore"));
+ addSeeMoreLink(row, ReportDecorator.GWT_GROUP_URL + groupId + "/Monitoring/Graphs/", column);
}
//call out to 3rd party javascript lib
BrowserUtility.graphSparkLines();
@@ -639,6 +664,10 @@ public class ActivityView2 extends AbstractActivityView {
row.setItems(iconItem, link, time);
column.addMember(row);
}
+ //insert see more link
+ //TODO: spinder(add this later) no current view for seeing all bundle deployments
+ // LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent.extendLocatorId("RecentBundleContentSeeMore"));
+ // addSeeMoreLink(row, LinkManager.getResourceGroupLink(groupId) + "/Events/History/", column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentBundleDeployContent
.extendLocatorId("None"), RECENT_BUNDLE_DEPLOY_NONE);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 46bb87b..452d85c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -51,13 +51,13 @@ import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
import org.rhq.enterprise.gui.coregui.client.util.GwtTuple;
-import org.rhq.enterprise.gui.coregui.client.util.measurement.GwtMonitorUtils;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
@@ -121,6 +121,10 @@ public class ActivityView extends AbstractActivityView {
column.addMember(row);
}
+ //link to more details
+ LocatableDynamicForm row = new LocatableDynamicForm(recentAlertsContent.extendLocatorId(String
+ .valueOf(rowNum++)));
+ addSeeMoreLink(row, ReportDecorator.GWT_RESOURCE_URL + resourceId + "/Alerts/History/", column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentAlertsContent.extendLocatorId("None"),
RECENT_ALERTS_NONE);
@@ -173,15 +177,20 @@ public class ActivityView extends AbstractActivityView {
StaticTextItem iconItem = newTextItemIcon(ImageManager.getOperationResultsIcon(report
.getOriginal().getOperationStatus()), report.getOriginal().getOperationStatus()
.getDisplayName());
- LinkItem link = newLinkItem(report.getOriginal().getOperationName() + ": ",
- ReportDecorator.GWT_RESOURCE_URL + resourceId + "/Operations/History/"
- + report.getOriginal().getOperationHistoryId());
+ LinkItem link = newLinkItem(report.getOriginal().getOperationName() + ": ", LinkManager
+ .getResourceLink(resourceId)
+ + "/Operations/History/" + report.getOriginal().getOperationHistoryId());
StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(report.getOriginal()
.getOperationStartTime()));
row.setItems(iconItem, link, time);
column.addMember(row);
}
+ //link to more details
+ LocatableDynamicForm row = new LocatableDynamicForm(recentOperationsContent
+ .extendLocatorId(String.valueOf(rowNum++)));
+ addSeeMoreLink(row, ReportDecorator.GWT_RESOURCE_URL + resourceId + "/Operations/History/",
+ column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentOperationsContent
.extendLocatorId("None"), RECENT_OPERATIONS_NONE);
@@ -234,7 +243,7 @@ public class ActivityView extends AbstractActivityView {
if ((update.getSubjectName() == null) || (update.getSubjectName().trim().isEmpty())) {
linkTitle = MSG.common_msg_changeAutoDetected();
}
- LinkItem link = newLinkItem(linkTitle, ReportDecorator.GWT_RESOURCE_URL + resourceId
+ LinkItem link = newLinkItem(linkTitle, LinkManager.getResourceLink(resourceId)
+ "/Configuration/History/" + update.getId());
StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(update
.getCreatedTime()));
@@ -242,6 +251,11 @@ public class ActivityView extends AbstractActivityView {
row.setItems(iconItem, link, time);
column.addMember(row);
}
+ //link to more details
+ LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
+ .extendLocatorId(String.valueOf(rowNum++)));
+ addSeeMoreLink(row, ReportDecorator.GWT_RESOURCE_URL + resourceId + "/Configuration/History/",
+ column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentConfigurationContent
.extendLocatorId("None"), RECENT_CONFIGURATIONS_NONE);
@@ -308,6 +322,9 @@ public class ActivityView extends AbstractActivityView {
column.addMember(row);
}
+ LocatableDynamicForm row = new LocatableDynamicForm(recentEventsContent.extendLocatorId(String
+ .valueOf(rowNum++)));
+ addSeeMoreLink(row, ReportDecorator.GWT_RESOURCE_URL + resourceId + "/Events/History/", column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentEventsContent.extendLocatorId("None"),
RECENT_EVENTS_NONE);
@@ -409,6 +426,11 @@ public class ActivityView extends AbstractActivityView {
row.setItems(iconItem, link, time);
column.addMember(row);
}
+ // //insert see more link
+ // LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
+ // .extendLocatorId("RecentPkgHistorySeeMore"));
+ // String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + resourceId;
+ // addSeeMoreLink(row, destination, column);
} else {
LocatableDynamicForm row = createEmptyDisplayRow(recentPkgHistoryContent
.extendLocatorId("None"), RECENT_PKG_HISTORY_NONE);
@@ -543,6 +565,12 @@ public class ActivityView extends AbstractActivityView {
LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
.extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
column.addMember(row);
+ } else {
+ //insert see more link
+ LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
+ .extendLocatorId("RecentMeasurementsContentSeeMore"));
+ addSeeMoreLink(row, ReportDecorator.GWT_RESOURCE_URL + resourceId + "/Monitoring/Graphs/",
+ column);
}
//call out to 3rd party javascript lib
BrowserUtility.graphSparkLines();
@@ -561,21 +589,4 @@ public class ActivityView extends AbstractActivityView {
recentMeasurementsContent.addChild(column);
recentMeasurementsContent.markForRedraw();
}
-
- /** Takes last double value returned and the relevant MeasurementDefinition and formats
- * the results for display in the UI. 'Formatting' refers to relevant rounding,
- * number format for significant digits depending upon the measurement definition
- * details.
- *
- * @param lastValue
- * @param md MeasurementDefinition
- * @return formatted String representation of the last value retrieved.
- */
- protected String convertLastValueForDisplay(double lastValue, MeasurementDefinition md) {
- String convertedValue = "";
- String[] convertedValues = GwtMonitorUtils.formatSimpleMetrics(new double[] { lastValue }, md);
- convertedValue = convertedValues[0];
-
- return convertedValue;
- }
}
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 33d344c..2d4f866 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
@@ -193,6 +193,7 @@ common_msg_emphasizedNotePrefix = NOTE:
common_msg_loading = Loading...
common_msg_noItemsToShow = No items to show
common_msg_notYetImplemented = Not Yet Implemented
+common_msg_see_more = see more...
# Common Values
#--------------
commit 6fd55ba202029187ee76b3a81a7e96b60c2ba2b4
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Feb 24 13:57:12 2011 -0500
enable Bundles view for Group Activity page. Include new criteria.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
index 9e613c6..3ad25b8 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleDeploymentStatus;
+import org.rhq.core.domain.util.PageOrdering;
/**
* @author Jay Shaughnessy
@@ -44,6 +45,7 @@ public class BundleDeploymentCriteria extends TaggedCriteria {
private Integer filterDestinationId; // needs override
private String filterDestinationName; // needs override
private BundleDeploymentStatus filterStatus;
+ private PageOrdering sortStatus;
private String filterSubjectName;
private boolean fetchBundleVersion;
@@ -124,4 +126,9 @@ public class BundleDeploymentCriteria extends TaggedCriteria {
this.fetchResourceDeployments = fetchResourceDeployments;
}
+ public void addSortStatus(PageOrdering sortStatus) {
+ addSortField("sort");
+ this.sortStatus = sortStatus;
+ }
+
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GroupBundleDeploymentCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GroupBundleDeploymentCriteria.java
new file mode 100644
index 0000000..4678483
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GroupBundleDeploymentCriteria.java
@@ -0,0 +1,55 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.domain.criteria;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Simeon Pinder
+ */
+@XmlRootElement
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@SuppressWarnings("unused")
+public class GroupBundleDeploymentCriteria extends BundleDeploymentCriteria {
+ private static final long serialVersionUID = 1L;
+
+ private List<Integer> filterResourceGroupIds; // requires overrides
+
+ public GroupBundleDeploymentCriteria() {
+ filterOverrides.put("resourceGroupIds", "destination.group.id IN " //
+ + "( SELECT rg.id " //
+ + " FROM ResourceGroup rg " //
+ + " JOIN rg.bundleDestinations bds " //
+ + " WHERE rg.id = ? )");
+ }
+
+ public void addFilterResourceGroupIds(Integer... filterResourceGroupIds) {
+ this.filterResourceGroupIds = Arrays.asList(filterResourceGroupIds);
+ }
+
+ public List<Integer> getFilterGroupIds() {
+ return filterResourceGroupIds;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
index 5d06ee1..2cdc766 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/summary/AbstractActivityView.java
@@ -54,6 +54,7 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
protected LocatableCanvas recentOperationsContent = new LocatableCanvas(extendLocatorId("RecentOperations"));
protected LocatableCanvas recentEventsContent = new LocatableCanvas(extendLocatorId("RecentEvents"));
protected LocatableCanvas recentPkgHistoryContent = new LocatableCanvas(extendLocatorId("RecentPkgHistory"));
+ protected LocatableCanvas recentBundleDeployContent = new LocatableCanvas(extendLocatorId("RecentBundleDeploy"));
//retrieve localized text
protected String RECENT_MEASUREMENTS = MSG.common_title_recent_measurements();
@@ -70,6 +71,8 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
protected String RECENT_EVENTS_NONE = MSG.view_resource_inventory_activity_no_recent_events();
protected String RECENT_PKG_HISTORY = MSG.common_title_recent_pkg_history();
protected String RECENT_PKG_HISTORY_NONE = MSG.view_resource_inventory_activity_no_recent_pkg_history();
+ protected String RECENT_BUNDLE_DEPLOY = MSG.common_title_recent_bundle_deployments();
+ protected String RECENT_BUNDLE_DEPLOY_NONE = MSG.view_resource_inventory_activity_no_recent_bundle_deploy();
private ResourceGroupComposite groupComposite = null;
@@ -92,11 +95,13 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
HTMLFlow divider3 = new HTMLFlow("<hr/>");
HTMLFlow divider4 = new HTMLFlow("<hr/>");
HTMLFlow divider5 = new HTMLFlow("<hr/>");
+ HTMLFlow divider6 = new HTMLFlow("<hr/>");
divider1.setWidth("50%");
divider2.setWidth("50%");
divider3.setWidth("50%");
divider4.setWidth("50%");
divider5.setWidth("50%");
+ divider6.setWidth("50%");
//leftPane
leftPane.setWidth("50%");
@@ -167,6 +172,14 @@ public abstract class AbstractActivityView extends LocatableHLayout implements R
recentPkgHistoryContent.setHeight(20);
}
+ HLayout recentBundleDeployTitle = new TitleWithIcon("subsystems/content/Content_24.png", RECENT_BUNDLE_DEPLOY);
+ if (((group != null) && (group.getGroupCategory().equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
+ rightPane.addMember(divider6);
+ rightPane.addMember(recentBundleDeployTitle);
+ rightPane.addMember(recentBundleDeployContent);
+ recentBundleDeployTitle.setHeight(20);
+ }
+
addMember(leftPane);
addMember(rightPane);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 2262d36..bacbb8d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -37,9 +37,11 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
import org.rhq.core.domain.content.InstalledPackageHistory;
import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.criteria.GroupBundleDeploymentCriteria;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
@@ -86,12 +88,13 @@ public class ActivityView2 extends AbstractActivityView {
getRecentEventUpdates();
if ((groupComposite != null)
&& (groupComposite.getResourceGroup().getGroupCategory().equals(GroupCategory.COMPATIBLE))) {//CompatibleGroup
- //TODO: spinder need to drive these calls off off facet availability
+ //TODO: spinder should we drive these calls off of facet availability?
getRecentOperations();
getRecentConfigurationUpdates();
getRecentOobs();
getRecentPkgHistory();
getRecentMetrics();
+ getRecentBundleDeployments();
}
}
@@ -591,4 +594,63 @@ public class ActivityView2 extends AbstractActivityView {
recentMeasurementsContent.addChild(column);
recentMeasurementsContent.markForRedraw();
}
+
+ /** Fetches recent bundle deployment information and updates the DynamicForm instance with details.
+ */
+ private void getRecentBundleDeployments() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ GroupBundleDeploymentCriteria criteria = new GroupBundleDeploymentCriteria();
+ PageControl pageControl = new PageControl(0, 5);
+ criteria.setPageControl(pageControl);
+ criteria.addFilterResourceGroupIds(groupId);
+ criteria.addSortStatus(PageOrdering.DESC);
+ criteria.fetchDestination(true);
+ criteria.fetchBundleVersion(true);
+
+ GWTServiceLookup.getBundleService().findBundleDeploymentsByCriteria(criteria,
+ new AsyncCallback<PageList<BundleDeployment>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving installed bundle deployments for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
+
+ @Override
+ public void onSuccess(PageList<BundleDeployment> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (BundleDeployment deployment : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentBundleDeployContent
+ .extendLocatorId(deployment.getBundleVersion().getName()
+ + deployment.getBundleVersion().getVersion()));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
+ String title = deployment.getBundleVersion().getName() + "["
+ + deployment.getBundleVersion().getVersion() + "]:";
+ String destination = ReportDecorator.GWT_BUNDLE_URL
+ + deployment.getBundleVersion().getBundle().getId() + "/destinations/"
+ + deployment.getDestination().getId();
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter
+ .format(deployment.getCtime()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
+ }
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentBundleDeployContent
+ .extendLocatorId("None"), RECENT_BUNDLE_DEPLOY_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentBundleDeployContent.getChildren()) {
+ child.destroy();
+ }
+ recentBundleDeployContent.addChild(column);
+ recentBundleDeployContent.markForRedraw();
+ }
+ });
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
index 8c7cc05..4e40077 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
@@ -24,6 +24,7 @@ public class ReportDecorator {
//TODO: pull value from more bookmarking/history definition
public final static String GWT_RESOURCE_URL = "#Resource/";
public final static String GWT_GROUP_URL = "#ResourceGroup/";
+ public final static String GWT_BUNDLE_URL = "#Bundles/Bundle/";
public static final String DEFAULT_SEPARATOR = " > ";
/**
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 2caa83d..33d344c 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
@@ -137,6 +137,7 @@ common_title_port = Port
common_title_portlet_auto_refresh=Portlet Auto-Refresh Interval
common_title_providers = Providers
common_title_recent_alerts = Recent Alerts
+common_title_recent_bundle_deployments = Recent Bundle Deployments
common_title_recent_configuration_updates = Recent Configuration Updates
common_title_recent_event_counts = Recent Event Counts
common_title_recent_measurements = Recent Measurements
@@ -1463,6 +1464,7 @@ view_inventory_resources_title_children = Child Resources
view_inventory_resources_title_members = Member Resources
view_resource_inventory_activity_changed_by=Changed by
view_resource_inventory_activity_no_recent_alerts=No recent alerts
+view_resource_inventory_activity_no_recent_bundle_deploy=No recent bundle deployments
view_resource_inventory_activity_no_recent_config_history=No configuration change history
view_resource_inventory_activity_no_recent_events =No events in the last 24 hours
view_resource_inventory_activity_no_recent_metrics=This resource has no recent metrics
commit abb0a4e4572f19cf995108d4adee7bf5aa9fdfcd
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Feb 23 15:07:49 2011 -0500
enable Pkg History for Group Activity page. Added new InstalledPackageHistoryCriteria class.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageHistoryCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageHistoryCriteria.java
new file mode 100644
index 0000000..e640369
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageHistoryCriteria.java
@@ -0,0 +1,110 @@
+package org.rhq.core.domain.criteria;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+import org.rhq.core.domain.content.InstalledPackageHistory;
+import org.rhq.core.domain.util.PageOrdering;
+
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@SuppressWarnings("unused")
+public class InstalledPackageHistoryCriteria extends Criteria {
+ private static final long serialVersionUID = 1L;
+
+ private Integer filterId;
+ private Long filterInstallationTimeMinimum; // requires overrides
+ private Long filterInstallationTimeMaximum; // requires overrides
+ private Integer filterPackageVersionId; // requires overrides
+ private Integer filterResourceId; // requires overrides
+ private List<Integer> filterResourceGroupIds; // requires overrides
+ private Integer filterUserId; // requires overrides
+
+ private boolean fetchPackageVersion;
+ private boolean fetchResource;
+ private boolean fetchUser;
+
+ private PageOrdering sortInstallationDate;
+ private PageOrdering sortStatus;
+
+ public InstalledPackageHistoryCriteria() {
+ super();
+ filterOverrides.put("installationTimeMinimum", "installationDate >= ?");
+ filterOverrides.put("installationTimeMaximum", "installationDate <= ?");
+ filterOverrides.put("packageVersionId", "packageVersion.id = ? ");
+ filterOverrides.put("resourceId", "resource.id = ? ");
+ filterOverrides.put("groupId", "resource.explicitGroups.id = ? ");
+ filterOverrides.put("resourceGroupIds", "resource.id IN " //
+ + "( SELECT res.id " //
+ + " FROM ResourceGroup rg " //
+ + " JOIN rg.explicitResources res " //
+ + " WHERE rg.id = ? )");
+ filterOverrides.put("userId", "user.id = ? ");
+ }
+
+ @Override
+ public Class<InstalledPackageHistory> getPersistentClass() {
+ return InstalledPackageHistory.class;
+ }
+
+ public void addFilterId(Integer filterId) {
+ this.filterId = filterId;
+ }
+
+ public void addFilterPackageVersionId(Integer filterPackageVersionId) {
+ this.filterPackageVersionId = filterPackageVersionId;
+ }
+
+ public void addFilterResourceId(Integer filterResourceId) {
+ this.filterResourceId = filterResourceId;
+ }
+
+ public void addFilterResourceGroupIds(Integer... filterResourceGroupIds) {
+ this.filterResourceGroupIds = Arrays.asList(filterResourceGroupIds);
+ }
+
+ public Integer getFilterResourceId() {
+ return filterResourceId;
+ }
+
+ public List<Integer> getFilterGroupIds() {
+ return filterResourceGroupIds;
+ }
+
+ public void addFilterSubjectId(Integer filterSubjectId) {
+ this.filterUserId = filterSubjectId;
+ }
+
+ public void addFilterInstallationTimeMinimum(Long filterInstallationTimeMinimum) {
+ this.filterInstallationTimeMinimum = filterInstallationTimeMinimum;
+ }
+
+ public void addFilterInstallationTimeMaximum(Long filterInstallationTimeMaximum) {
+ this.filterInstallationTimeMaximum = filterInstallationTimeMaximum;
+ }
+
+ public void fetchResource(boolean fetchResource) {
+ this.fetchResource = fetchResource;
+ }
+
+ public void fetchPackageVersion(boolean fetchPackageVersion) {
+ this.fetchPackageVersion = fetchPackageVersion;
+ }
+
+ public void fetchSubject(boolean fetchSubject) {
+ this.fetchUser = fetchSubject;
+ }
+
+ public void addSortInstallationTime(PageOrdering sortInstallationDate) {
+ addSortField("installationDate");
+ this.sortInstallationDate = sortInstallationDate;
+ }
+
+ public void addSortStatus(PageOrdering sortStatus) {
+ addSortField("sort");
+ this.sortStatus = sortStatus;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java
index 7cd0f55..080d749 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java
@@ -30,6 +30,7 @@ import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.InstalledPackageHistory;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
+import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
import org.rhq.core.domain.util.PageList;
@@ -44,6 +45,8 @@ public interface ContentGWTService extends RemoteService {
PageList<InstalledPackageHistory> getInstalledPackageHistoryForResource(int resourceId, int count);
+ PageList<InstalledPackageHistory> findInstalledPackageHistoryByCriteria(InstalledPackageHistoryCriteria criteria);
+
List<Architecture> getArchitectures() throws RuntimeException;
PackageType getResourceCreationPackageType(int resourceTypeId) throws RuntimeException;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 625c139..2262d36 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -38,9 +38,11 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
+import org.rhq.core.domain.content.InstalledPackageHistory;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
import org.rhq.core.domain.event.EventSeverity;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
@@ -88,7 +90,7 @@ public class ActivityView2 extends AbstractActivityView {
getRecentOperations();
getRecentConfigurationUpdates();
getRecentOobs();
- // getRecentPkgHistory();
+ getRecentPkgHistory();
getRecentMetrics();
}
}
@@ -395,63 +397,60 @@ public class ActivityView2 extends AbstractActivityView {
});
}
- // /** Fetches recent package history information and updates the DynamicForm instance with details.
- // */
- // private void getRecentPkgHistory() {
- // // final int resourceId = this.resourceComposite.getResource().getId();
- // final int groupId = this.groupComposite.getResourceGroup().getId();
- // InstalledPackageCriteria criteria = new InstalledPackageCriteria();
- // // criteria.addFilterResourceId(resourceId);
- //// criteria.addFilterResourceId(groupId);
- // criteria.addFilter(groupId);
- // PageControl pageControl = new PageControl(0, 5);
- // criteria.setPageControl(pageControl);
- //
- // // GWTServiceLookup.getContentService().getInstalledPackageHistoryForResource(resourceId, 5,
- // GWTServiceLookup.getContentService().getInstalledPackageHistoryForResource(resourceId, 5,
- // new AsyncCallback<PageList<InstalledPackageHistory>>() {
- // @Override
- // public void onFailure(Throwable caught) {
- // Log.debug("Error retrieving installed package history for resource [" + resourceId + "]:"
- // + caught.getMessage());
- // }
- //
- // @Override
- // public void onSuccess(PageList<InstalledPackageHistory> result) {
- // VLayout column = new VLayout();
- // column.setHeight(10);
- // if (!result.isEmpty()) {
- // for (InstalledPackageHistory history : result) {
- // LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
- // .extendLocatorId(history.getPackageVersion().getFileName()
- // + history.getPackageVersion().getVersion()));
- // row.setNumCols(3);
- //
- // StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
- // String title = history.getPackageVersion().getFileName() + ":";
- // String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + resourceId
- // + "&selectedHistoryId=" + history.getId();
- // LinkItem link = newLinkItem(title, destination);
- // StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(history
- // .getTimestamp()));
- //
- // row.setItems(iconItem, link, time);
- // column.addMember(row);
- // }
- // } else {
- // LocatableDynamicForm row = createEmptyDisplayRow(recentPkgHistoryContent
- // .extendLocatorId("None"), RECENT_PKG_HISTORY_NONE);
- // column.addMember(row);
- // }
- // //cleanup
- // for (Canvas child : recentPkgHistoryContent.getChildren()) {
- // child.destroy();
- // }
- // recentPkgHistoryContent.addChild(column);
- // recentPkgHistoryContent.markForRedraw();
- // }
- // });
- // }
+ /** Fetches recent package history information and updates the DynamicForm instance with details.
+ */
+ private void getRecentPkgHistory() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+ InstalledPackageHistoryCriteria criteria = new InstalledPackageHistoryCriteria();
+ PageControl pageControl = new PageControl(0, 5);
+ criteria.setPageControl(pageControl);
+ criteria.addFilterResourceGroupIds(groupId);
+ criteria.addSortStatus(PageOrdering.DESC);
+
+ GWTServiceLookup.getContentService().findInstalledPackageHistoryByCriteria(criteria,
+
+ new AsyncCallback<PageList<InstalledPackageHistory>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving installed package history for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
+
+ @Override
+ public void onSuccess(PageList<InstalledPackageHistory> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (InstalledPackageHistory history : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentPkgHistoryContent
+ .extendLocatorId(history.getPackageVersion().getFileName()
+ + history.getPackageVersion().getVersion()));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon("subsystems/content/Content_16.png", null);
+ String title = history.getPackageVersion().getFileName() + ":";
+ String destination = "/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId
+ + "&selectedHistoryId=" + history.getId();
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(history.getTimestamp()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
+ }
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentPkgHistoryContent.extendLocatorId("None"),
+ RECENT_PKG_HISTORY_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentPkgHistoryContent.getChildren()) {
+ child.destroy();
+ }
+ recentPkgHistoryContent.addChild(column);
+ recentPkgHistoryContent.markForRedraw();
+ }
+ });
+ }
/** Fetches recent metric information and updates the DynamicForm instance with i)sparkline information,
* ii) link to recent metric graph for more details and iii) last metric value formatted to show significant
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java
index caee06b..603288e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java
@@ -28,6 +28,7 @@ import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.InstalledPackageHistory;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
+import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
@@ -39,6 +40,7 @@ import org.rhq.enterprise.server.content.ContentUIManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
/**
+ * @author Simeon Pinder
* @author Greg Hinkle
*/
public class ContentGWTServiceImpl extends AbstractGWTServiceImpl implements ContentGWTService {
@@ -68,6 +70,18 @@ public class ContentGWTServiceImpl extends AbstractGWTServiceImpl implements Con
}
}
+ public PageList<InstalledPackageHistory> findInstalledPackageHistoryByCriteria(
+ InstalledPackageHistoryCriteria criteria) throws RuntimeException {
+ try {
+ PageList<InstalledPackageHistory> results = SerialUtility.prepare(contentUiManager
+ .findInstalledPackageHistoryByCriteria(getSessionSubject(), criteria),
+ "ContentService.findInstalledPackageHistoryByCriteria");
+ return results;
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
public PageList<InstalledPackageHistory> getInstalledPackageHistoryForResource(int resourceId, int count)
throws RuntimeException {
try {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerBean.java
index a3a377a..c54f6eb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerBean.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -48,12 +49,16 @@ import org.rhq.core.domain.content.composite.AdvisoryDetailsComposite;
import org.rhq.core.domain.content.composite.LoadedPackageBitsComposite;
import org.rhq.core.domain.content.composite.PackageListItemComposite;
import org.rhq.core.domain.content.composite.PackageVersionComposite;
+import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
import org.rhq.core.domain.util.OrderingField;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.core.server.PersistenceUtility;
import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
+import org.rhq.enterprise.server.util.CriteriaQueryRunner;
/**
* @author Jason Dobies
@@ -68,6 +73,9 @@ public class ContentUIManagerBean implements ContentUIManagerLocal {
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
private EntityManager entityManager;
+ @EJB
+ private AuthorizationManagerLocal authorizationManager;
+
// ContentUIManagerLocal Implementation --------------------------------------------
public LoadedPackageBitsComposite getLoadedPackageBitsComposite(int packageVersionId) {
@@ -497,4 +505,24 @@ public class ContentUIManagerBean implements ContentUIManagerLocal {
return new PageList<InstalledPackageHistory>(packages, (int) totalCount, pc);
}
+
+ @SuppressWarnings("unchecked")
+ public PageList<InstalledPackageHistory> findInstalledPackageHistoryByCriteria(Subject subject,
+ InstalledPackageHistoryCriteria criteria) {
+
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
+ ;
+
+ if (!authorizationManager.isInventoryManager(subject)) {
+ // Ensure we limit to packages installed to viewable resources
+ generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.RESOURCE,
+ "resource", subject.getId());
+ }
+
+ CriteriaQueryRunner<InstalledPackageHistory> queryRunner = new CriteriaQueryRunner(criteria, generator,
+ entityManager);
+
+ return queryRunner.execute();
+
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerLocal.java
index 6b9d2f8..6ef67d9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerLocal.java
@@ -35,6 +35,7 @@ import org.rhq.core.domain.content.composite.AdvisoryDetailsComposite;
import org.rhq.core.domain.content.composite.LoadedPackageBitsComposite;
import org.rhq.core.domain.content.composite.PackageListItemComposite;
import org.rhq.core.domain.content.composite.PackageVersionComposite;
+import org.rhq.core.domain.criteria.InstalledPackageHistoryCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
@@ -243,6 +244,16 @@ public interface ContentUIManagerLocal {
PageList<InstalledPackageHistory> getInstalledPackageHistoryForResource(int resourceId, PageControl pc);
/**
+ * Returns a pagable list of all package events that have taken place on the given resource.
+ *
+ * @param resourceId must refer to a valid resource in the database
+ * @param pc pagination controller
+ * @return pagable list of package change items; will not be <code>null</code>
+ */
+ PageList<InstalledPackageHistory> findInstalledPackageHistoryByCriteria(Subject subject,
+ InstalledPackageHistoryCriteria criteria);
+
+ /**
* Retrieves Advisory Details by its ID. One and only one must exist for the ID;
* @param user user who wants to see the information
* @param id identifier for advisory
commit 643ac4be5a53f4a457874b52310debf9dddc379d
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Feb 24 21:30:22 2011 -0500
disable enable/disable/set-interval controls on metric schedule views if logged-in user does not have the required permissions (https://bugzilla.redhat.com/show_bug.cgi?id=536281)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/TemplateSchedulesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/TemplateSchedulesView.java
index bb702ba..c9a4226 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/TemplateSchedulesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/TemplateSchedulesView.java
@@ -20,24 +20,47 @@ package org.rhq.enterprise.gui.coregui.client.admin.templates;
import com.smartgwt.client.data.Criteria;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementScheduleListView;
+import java.util.EnumSet;
+import java.util.Set;
+
/**
* A view for viewing and updating the default metric schedules ("metric templates") for a particular ResourceType.
*
* @author Ian Springer
*/
public class TemplateSchedulesView extends AbstractMeasurementScheduleListView {
- private static final String TITLE = MSG.view_admin_measTemplates_title();
+ private static final String TITLE = MSG.view_admin_measTemplates_title();
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_TYPE_ID };
private boolean updateExistingSchedules = true;
+ private Set<Permission> globalPermissions;
public TemplateSchedulesView(String locatorId, int resourceTypeId) {
super(locatorId, TITLE, new TemplateSchedulesDataSource(resourceTypeId), createCriteria(resourceTypeId),
EXCLUDED_FIELD_NAMES);
+
+ this.globalPermissions = EnumSet.noneOf(Permission.class);
+ loadGlobalPermissions();
+ }
+
+ public boolean hasManageMeasurementsPermission() {
+ loadGlobalPermissions();
+ return globalPermissions.contains(Permission.MANAGE_INVENTORY);
+ }
+
+ private void loadGlobalPermissions() {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ globalPermissions = permissions;
+ }
+ });
}
private static Criteria createCriteria(int resourceTypeId) {
@@ -60,4 +83,5 @@ public class TemplateSchedulesView extends AbstractMeasurementScheduleListView {
public void setUpdateExistingSchedules(boolean updateExistingSchedules) {
this.updateExistingSchedules = updateExistingSchedules;
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
index e1479af..43f130f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
@@ -27,10 +27,9 @@ import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
-import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.BooleanCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
/**
* A view that displays a non-paginated table of {@link org.rhq.core.domain.measurement.MeasurementSchedule measurement
@@ -39,8 +38,10 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablem
* @author Ian Springer
*/
public abstract class AbstractMeasurementScheduleListView extends Table {
- private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[] { new SortSpecifier(
- MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME, SortDirection.ASCENDING) };
+
+ private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[] {
+ new SortSpecifier(MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME, SortDirection.ASCENDING)
+ };
public AbstractMeasurementScheduleListView(String locatorId, String title,
AbstractMeasurementScheduleCompositeDataSource dataSource, Criteria criteria, String[] excludedFieldNames) {
@@ -48,6 +49,8 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
setDataSource(dataSource);
}
+ public abstract boolean hasManageMeasurementsPermission();
+
@Override
public AbstractMeasurementScheduleCompositeDataSource getDataSource() {
return (AbstractMeasurementScheduleCompositeDataSource) super.getDataSource();
@@ -68,20 +71,25 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
intervalField.setWidth("25%");
// Add action buttons and widgets.
- addTableAction(extendLocatorId("Enable"), MSG.common_button_enable(), null, new AbstractTableAction(
- TableActionEnablement.ANY) {
+ addTableAction(extendLocatorId("Enable"), MSG.common_button_enable(), null, new TableAction() {
+ public boolean isEnabled(ListGridRecord[] selection) {
+ return ((selection.length >= 1) && hasManageMeasurementsPermission());
+ }
+
public void executeAction(ListGridRecord[] selection, Object actionValue) {
getDataSource().enableSchedules(AbstractMeasurementScheduleListView.this);
}
});
- addTableAction(extendLocatorId("Disable"), MSG.common_button_disable(), null, new AbstractTableAction(
- TableActionEnablement.ANY) {
+ addTableAction(extendLocatorId("Disable"), MSG.common_button_disable(), null, new TableAction() {
+ public boolean isEnabled(ListGridRecord[] selection) {
+ return ((selection.length >= 1) && hasManageMeasurementsPermission());
+ }
+
public void executeAction(ListGridRecord[] selection, Object actionValue) {
getDataSource().disableSchedules(AbstractMeasurementScheduleListView.this);
}
});
addExtraWidget(new UpdateCollectionIntervalWidget(this.getLocatorId(), this), true);
-
}
protected class CollectionEnabledCellFormatter extends BooleanCellFormatter {
@@ -93,6 +101,7 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
}
protected class CollectionIntervalCellFormatter implements CellFormatter {
+
public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
if (value == null) {
return MSG.view_inventory_mixed();
@@ -139,4 +148,5 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
}
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/UpdateCollectionIntervalWidget.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/UpdateCollectionIntervalWidget.java
index debc8be..76378f0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/UpdateCollectionIntervalWidget.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/UpdateCollectionIntervalWidget.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -110,6 +110,11 @@ public class UpdateCollectionIntervalWidget extends LocatableHLayout implements
}
});
+ if (!schedulesView.hasManageMeasurementsPermission()) {
+ intervalItem.setDisabled(true);
+ unitsItem.setDisabled(true);
+ }
+
this.form.setFields(intervalItem, unitsItem);
addMember(this.form);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index fd52d17..b42297b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -278,7 +278,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
visible = hasMetricsOfType(this.groupComposite, null);
- canvas = (visible) ? new SchedulesView(this.monitorSched.extendLocatorId("View"), groupId) : null;
+ canvas = (visible) ? new SchedulesView(this.monitorSched.extendLocatorId("View"), this.groupComposite) : null;
updateSubTab(this.monitoringTab, this.monitorSched, canvas, visible, true);
visible = facets.contains(ResourceTypeFacet.CALL_TIME);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java
index 0f59f7d..bd8d36d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring
import com.smartgwt.client.data.Criteria;
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementScheduleListView;
/**
@@ -29,13 +30,21 @@ import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasuremen
* @author Ian Springer
*/
public class SchedulesView extends AbstractMeasurementScheduleListView {
- private static final String TITLE = MSG.view_group_meas_schedules_title();
+ private static final String TITLE = MSG.view_group_meas_schedules_title();
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_GROUP_ID };
- public SchedulesView(String locatorId, int resourceGroupId) {
- super(locatorId, TITLE, new SchedulesDataSource(resourceGroupId), createCriteria(resourceGroupId),
- EXCLUDED_FIELD_NAMES);
+ private ResourceGroupComposite resourceGroupComposite;
+
+ public SchedulesView(String locatorId, ResourceGroupComposite resourceGroupComposite) {
+ super(locatorId, TITLE, new SchedulesDataSource(resourceGroupComposite.getResourceGroup().getId()),
+ createCriteria(resourceGroupComposite.getResourceGroup().getId()), EXCLUDED_FIELD_NAMES);
+
+ this.resourceGroupComposite = resourceGroupComposite;
+ }
+
+ public boolean hasManageMeasurementsPermission() {
+ return this.resourceGroupComposite.getResourcePermission().isMeasure();
}
private static Criteria createCriteria(int resourceGroupId) {
@@ -43,4 +52,5 @@ public class SchedulesView extends AbstractMeasurementScheduleListView {
criteria.addCriteria(MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_GROUP_ID, resourceGroupId);
return criteria;
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index e0504d6..89a87fb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -324,7 +324,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
"/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()), true, true);
updateSubTab(this.monitoringTab, this.monitorSched, new SchedulesView(monitoringTab
- .extendLocatorId("SchedulesView"), resource.getId()), hasMetricsOfType(this.resourceComposite, null), true);
+ .extendLocatorId("SchedulesView"), this.resourceComposite), hasMetricsOfType(this.resourceComposite, null),
+ true);
visible = facets.contains(ResourceTypeFacet.CALL_TIME);
canvas = (visible) ? new FullHTMLPane(this.monitorCallTime.extendLocatorId("View"),
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java
index 813ac07..46ef463 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitori
import com.smartgwt.client.data.Criteria;
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementScheduleListView;
/**
@@ -31,11 +32,19 @@ import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasuremen
public class SchedulesView extends AbstractMeasurementScheduleListView {
private static final String TITLE = MSG.view_resource_monitor_schedules_title();
-
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_ID };
- public SchedulesView(String locatorId, int resourceId) {
- super(locatorId, TITLE, new SchedulesDataSource(resourceId), createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
+ private ResourceComposite resourceComposite;
+
+ public SchedulesView(String locatorId, ResourceComposite resourceComposite) {
+ super(locatorId, TITLE, new SchedulesDataSource(resourceComposite.getResource().getId()),
+ createCriteria(resourceComposite.getResource().getId()), EXCLUDED_FIELD_NAMES);
+
+ this.resourceComposite = resourceComposite;
+ }
+
+ public boolean hasManageMeasurementsPermission() {
+ return resourceComposite.getResourcePermission().isMeasure();
}
private static Criteria createCriteria(int resourceId) {
@@ -43,4 +52,5 @@ public class SchedulesView extends AbstractMeasurementScheduleListView {
criteria.addCriteria(MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_ID, resourceId);
return criteria;
}
+
}
commit fc373c2646c3700df778c76d1720e366a5907e85
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 20:49:08 2011 -0500
fix some plugin config history things
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java
index 3b462c2..15e0fb1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java
@@ -38,6 +38,7 @@ import org.rhq.core.domain.configuration.AbstractPropertyMap;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
@@ -173,14 +174,23 @@ public class ConfigurationComparisonView extends VLayout {
}
public static void displayComparisonDialog(final ArrayList<? extends AbstractResourceConfigurationUpdate> configs) {
- int resourceId = configs.get(0).getResource().getResourceType().getId();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceId,
- EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ AbstractResourceConfigurationUpdate theFirstUpdateItem = configs.get(0);
+ int resourceId = theFirstUpdateItem.getResource().getResourceType().getId();
+ final boolean isResourceConfig = theFirstUpdateItem instanceof ResourceConfigurationUpdate;
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ resourceId,
+ isResourceConfig ? EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition)
+ : EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
new ResourceTypeRepository.TypeLoadedCallback() {
public void onTypesLoaded(ResourceType type) {
- ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
+ ConfigurationDefinition definition;
+ if (isResourceConfig) {
+ definition = type.getResourceConfigurationDefinition();
+ } else {
+ definition = type.getPluginConfigurationDefinition();
+ }
ArrayList<Configuration> configurations = new ArrayList<Configuration>();
ArrayList<String> titles = new ArrayList<String>();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDetailView.java
deleted file mode 100644
index 926fa76..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDetailView.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
-
-import java.util.EnumSet;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ViewPath;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-
-/**
- * @author Greg Hinkle
- */
-public class AbstractConfigurationHistoryDetailView extends LocatableVLayout implements BookmarkableView {
-
- public AbstractConfigurationHistoryDetailView(String locatorId) {
- super(locatorId);
-
- setWidth100();
- setHeight100();
- }
-
- private void displayHistory(final ResourceConfigurationUpdate update) {
-
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(update.getResource().getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
-
- public void onTypesLoaded(ResourceType type) {
- ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
- ConfigurationEditor editor = new ConfigurationEditor("ResConfigHist-"
- + update.getResource().getName(), definition, update.getConfiguration());
- editor.setReadOnly(true);
- addMember(editor);
- markForRedraw();
- }
- });
- }
-
- @Override
- public void renderView(ViewPath viewPath) {
-
- int updateId = viewPath.getCurrentAsInt();
-
- ResourceConfigurationUpdateCriteria criteria = new ResourceConfigurationUpdateCriteria();
- criteria.fetchConfiguration(true);
- criteria.fetchResource(true);
- criteria.addFilterId(updateId);
-
- GWTServiceLookup.getConfigurationService().findResourceConfigurationUpdatesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_configurationHistoryDetails_error_loadFailure(),
- caught);
- }
-
- public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
-
- ResourceConfigurationUpdate update = result.get(0);
- displayHistory(update);
- }
- });
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryView.java
index d72af99..c8041fe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryView.java
@@ -29,7 +29,6 @@ import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
-import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
@@ -123,9 +122,9 @@ public abstract class AbstractConfigurationHistoryView<T extends AbstractConfigu
addTableAction(extendLocatorId("Compare"), MSG.common_button_compare(), null, new AbstractTableAction(
TableActionEnablement.MULTIPLE) {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
- ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
+ ArrayList<AbstractResourceConfigurationUpdate> configs = new ArrayList<AbstractResourceConfigurationUpdate>();
for (ListGridRecord record : selection) {
- ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record
+ AbstractResourceConfigurationUpdate update = (AbstractResourceConfigurationUpdate) record
.getAttributeAsObject(AbstractConfigurationHistoryDataSource.Field.OBJECT);
configs.add(update);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
index a71c133..47dc9a0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -106,6 +107,7 @@ public class ConfigurationHistoryDataSource extends AbstractConfigurationHistory
@Override
public void onFailure(Throwable caught) {
// should we show an error message? this just means we can't show any item as the "current" one
+ Log.error("cannot get latest resource config", caught);
finish();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
index 2ea63c4..420732c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
@@ -58,6 +58,7 @@ public class ConfigurationHistoryDetailView extends LocatableVLayout implements
ConfigurationEditor editor = new ConfigurationEditor("ResConfigHist-"
+ update.getResource().getName(), definition, update.getConfiguration());
editor.setReadOnly(true);
+ editor.setEditorTitle(MSG.common_title_version() + " - " + update.getId());
addMember(editor);
markForRedraw();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDataSource.java
index 77a3bcc..b6831a5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDataSource.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -107,6 +108,7 @@ public class PluginConfigurationHistoryDataSource extends
@Override
public void onFailure(Throwable caught) {
// should we show an error message? this just means we can't show any item as the "current" one
+ Log.error("cannot get latest plugin config", caught);
finish();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDetailView.java
index f3d48f5..3d10722 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDetailView.java
@@ -50,7 +50,7 @@ public class PluginConfigurationHistoryDetailView extends LocatableVLayout imple
private void displayHistory(final PluginConfigurationUpdate update) {
ResourceTypeRepository.Cache.getInstance().getResourceTypes(update.getResource().getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
new ResourceTypeRepository.TypeLoadedCallback() {
public void onTypesLoaded(ResourceType type) {
@@ -58,6 +58,7 @@ public class PluginConfigurationHistoryDetailView extends LocatableVLayout imple
ConfigurationEditor editor = new ConfigurationEditor("PluginConfigHist-"
+ update.getResource().getName(), definition, update.getConfiguration());
editor.setReadOnly(true);
+ editor.setEditorTitle(MSG.common_title_version() + " - " + update.getId());
addMember(editor);
markForRedraw();
}
commit 7e2ebf9f4ffd489cdb5b19d5b2b2ed4f2971e081
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 19:05:35 2011 -0500
fix genrics compile problem
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 18d5b60..aba8fdf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -93,7 +93,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
* @author Greg Hinkle
* @author Ian Springer
*/
-public class Table<DS extends RPCDataSource<?>> extends LocatableHLayout implements RefreshableView {
+public class Table<DS extends RPCDataSource> extends LocatableHLayout implements RefreshableView {
protected static final String FIELD_ID = "id";
protected static final String FIELD_NAME = "name";
commit 24b5e060106db8a791cd2e7de2f78ef3a7fb579b
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Feb 24 17:20:49 2011 -0500
several small authz-related fixes to user edit view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 314d279..4ce9950 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -58,7 +58,7 @@ public class UserEditView extends AbstractRecordEditor<UsersDataSource> {
private SubjectRoleSelector roleSelector;
- private boolean hasManageSecurityPermission;
+ private boolean loggedInUserHasManageSecurityPermission;
public UserEditView(String locatorId, int subjectId) {
super(locatorId, new UsersDataSource(), subjectId, MSG.common_label_user(), HEADER_ICON);
@@ -72,10 +72,10 @@ public class UserEditView extends AbstractRecordEditor<UsersDataSource> {
@Override
public void onPermissionsLoaded(Set<Permission> permissions) {
if (permissions != null) {
- UserEditView.this.hasManageSecurityPermission = permissions.contains(Permission.MANAGE_SECURITY);
+ UserEditView.this.loggedInUserHasManageSecurityPermission = permissions.contains(Permission.MANAGE_SECURITY);
Subject sessionSubject = UserSessionManager.getSessionSubject();
boolean isEditingSelf = (sessionSubject.getId() == getRecordId());
- boolean isReadOnly = (!UserEditView.this.hasManageSecurityPermission && !isEditingSelf);
+ boolean isReadOnly = (!UserEditView.this.loggedInUserHasManageSecurityPermission && !isEditingSelf);
init(isReadOnly);
}
}
@@ -95,23 +95,17 @@ public class UserEditView extends AbstractRecordEditor<UsersDataSource> {
protected void editRecord(Record record) {
super.editRecord(record);
- // Don't allow the rhqadmin account to be disabled.
- if (getRecordId() == SUBJECT_ID_RHQADMIN) {
- FormItem activeField = getForm().getField(UsersDataSource.Field.FACTIVE);
- activeField.disable();
- }
+ Subject sessionSubject = UserSessionManager.getSessionSubject();
+ boolean userBeingEditedIsLoggedInUser = (getRecordId() == sessionSubject.getId());
// A user can always view their own assigned roles, but only users with MANAGE_SECURITY can view or update
// other users' assigned roles.
- Subject whoami = UserSessionManager.getSessionSubject();
- String username = record.getAttribute(UsersDataSource.Field.NAME);
- if (this.hasManageSecurityPermission || whoami.getName().equals(username)) {
+ if (this.loggedInUserHasManageSecurityPermission || userBeingEditedIsLoggedInUser) {
Record[] roleRecords = record.getAttributeAsRecordArray(UsersDataSource.Field.ROLES);
ListGridRecord[] roleListGridRecords = toListGridRecordArray(roleRecords);
+ boolean rolesAreReadOnly = areRolesReadOnly(record);
- boolean isReadOnly = areRolesReadOnly(record);
-
- this.roleSelector = new SubjectRoleSelector(this.extendLocatorId("Roles"), roleListGridRecords, isReadOnly);
+ this.roleSelector = new SubjectRoleSelector(this.extendLocatorId("Roles"), roleListGridRecords, rolesAreReadOnly);
this.roleSelector.addAssignedItemsChangedHandler(new AssignedItemsChangedHandler() {
public void onSelectionChanged(AssignedItemsChangedEvent event) {
UserEditView.this.onItemChanged();
@@ -130,7 +124,7 @@ public class UserEditView extends AbstractRecordEditor<UsersDataSource> {
//
private boolean areRolesReadOnly(Record record) {
boolean isLdap = Boolean.valueOf(record.getAttribute(UsersDataSource.Field.LDAP));
- return (!this.hasManageSecurityPermission || (getRecordId() == SUBJECT_ID_RHQADMIN) || isLdap);
+ return (!this.loggedInUserHasManageSecurityPermission || (getRecordId() == SUBJECT_ID_RHQADMIN) || isLdap);
}
@Override
@@ -152,11 +146,13 @@ public class UserEditView extends AbstractRecordEditor<UsersDataSource> {
boolean isLdap = Boolean.valueOf(form.getValueAsString(UsersDataSource.Field.LDAP));
// Only display the password fields for non-LDAP users (i.e. users that have an associated RHQ Principal).
- if (!isLdap) {
+ if (!this.isReadOnly() && !isLdap) {
PasswordItem passwordItem = new PasswordItem(UsersDataSource.Field.PASSWORD);
+ passwordItem.setShowTitle(true);
items.add(passwordItem);
final PasswordItem verifyPasswordItem = new PasswordItem(UsersDataSource.Field.PASSWORD_VERIFY);
+ verifyPasswordItem.setShowTitle(true);
final boolean[] initialPasswordChange = { true };
passwordItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
@@ -166,17 +162,19 @@ public class UserEditView extends AbstractRecordEditor<UsersDataSource> {
}
}
});
-
items.add(verifyPasswordItem);
}
TextItem firstNameItem = new TextItem(UsersDataSource.Field.FIRST_NAME);
+ firstNameItem.setShowTitle(true);
items.add(firstNameItem);
TextItem lastNameItem = new TextItem(UsersDataSource.Field.LAST_NAME);
+ lastNameItem.setShowTitle(true);
items.add(lastNameItem);
TextItem emailAddressItem = new TextItem(UsersDataSource.Field.EMAIL_ADDRESS);
+ emailAddressItem.setShowTitle(true);
items.add(emailAddressItem);
TextItem phoneNumberItem = new TextItem(UsersDataSource.Field.PHONE_NUMBER);
@@ -185,8 +183,15 @@ public class UserEditView extends AbstractRecordEditor<UsersDataSource> {
TextItem departmentItem = new TextItem(UsersDataSource.Field.DEPARTMENT);
items.add(departmentItem);
- RadioGroupItem activeItem = new RadioGroupItem(UsersDataSource.Field.FACTIVE);
- activeItem.setVertical(false);
+ boolean userBeingEditedIsRhqadmin = (getRecordId() == SUBJECT_ID_RHQADMIN);
+ FormItem activeItem;
+ if (!this.loggedInUserHasManageSecurityPermission || userBeingEditedIsRhqadmin) {
+ activeItem = new StaticTextItem(UsersDataSource.Field.FACTIVE);
+ } else {
+ RadioGroupItem activeRadioGroupItem = new RadioGroupItem(UsersDataSource.Field.FACTIVE);
+ activeRadioGroupItem.setVertical(false);
+ activeItem = activeRadioGroupItem;
+ }
items.add(activeItem);
return items;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
index 06403ad..59c8b9d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
@@ -144,7 +144,11 @@ public class EnhancedDynamicForm extends LocatableDynamicForm {
}
for (FormItem item : itemsList) {
- item.setValidateOnExit(true);
+ if (item instanceof StaticTextItem) {
+ item.setRequired(false);
+ } else {
+ item.setValidateOnExit(true);
+ }
//item.setWidth("*"); // this causes a JavaScript exception ... :-(
item.setWidth(195);
commit 9cf8a15457284b44deea1fc7f7bd5b095f3b7bdb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 17:19:34 2011 -0500
refactor the config history views to abstract out the parts that are reusable for plugin config views
create plugin config views
we now have the plugin config history views and they look pretty much the same as the config history views (due to the use of the abstracted classes for both)
still have some work to do to finish, mainly in the area of deleting/rolling back and other operations like that
the data that you can view seems correct
still needs testing
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractResourceConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractResourceConfigurationUpdate.java
index aa073a6..1e01f08 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractResourceConfigurationUpdate.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractResourceConfigurationUpdate.java
@@ -34,6 +34,7 @@ import javax.persistence.InheritanceType;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
+import org.rhq.core.domain.configuration.group.AbstractGroupConfigurationUpdate;
import org.rhq.core.domain.resource.Resource;
/**
@@ -61,6 +62,8 @@ public abstract class AbstractResourceConfigurationUpdate extends AbstractConfig
public abstract Resource getResource();
+ public abstract AbstractGroupConfigurationUpdate getAbstractGroupConfigurationUpdate();
+
protected AbstractResourceConfigurationUpdate() {
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java
index d7e7af4..e7c5845 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java
@@ -34,6 +34,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
+import org.rhq.core.domain.configuration.group.AbstractGroupConfigurationUpdate;
import org.rhq.core.domain.configuration.group.GroupPluginConfigurationUpdate;
import org.rhq.core.domain.resource.Resource;
@@ -163,6 +164,11 @@ public class PluginConfigurationUpdate extends AbstractResourceConfigurationUpda
this.resource = resource;
}
+ @Override
+ public AbstractGroupConfigurationUpdate getAbstractGroupConfigurationUpdate() {
+ return getGroupConfigurationUpdate();
+ }
+
public GroupPluginConfigurationUpdate getGroupConfigurationUpdate() {
return groupConfigurationUpdate;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
index b814ea4..f7f4bee 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
@@ -32,6 +32,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
+import org.rhq.core.domain.configuration.group.AbstractGroupConfigurationUpdate;
import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
import org.rhq.core.domain.resource.Resource;
@@ -216,6 +217,11 @@ public class ResourceConfigurationUpdate extends AbstractResourceConfigurationUp
this.resource = resource;
}
+ @Override
+ public AbstractGroupConfigurationUpdate getAbstractGroupConfigurationUpdate() {
+ return getGroupConfigurationUpdate();
+ }
+
public GroupResourceConfigurationUpdate getGroupConfigurationUpdate() {
return groupConfigurationUpdate;
}
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 d010c41..5770cd3 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
@@ -87,12 +87,21 @@ public class LinkManager {
return getResourceLink(groupId) + "/Inventory/ConnectionSettingsHistory";
}
- public static String getGroupPluginConfigurationUpdateHistoryLink(int groupId) {
- return getResourceGroupLink(groupId) + "/Inventory/ConnectionSettingsHistory";
+ public static String getGroupPluginConfigurationUpdateHistoryLink(int groupId, Integer groupUpdateHistoryId) {
+ if (groupUpdateHistoryId != null) {
+ return getResourceGroupLink(groupId) + "/Inventory/ConnectionSettingsHistory/" + groupUpdateHistoryId
+ + "/Members";
+ } else {
+ return getResourceGroupLink(groupId) + "/Inventory/ConnectionSettingsHistory";
+ }
}
- public static String getGroupResourceConfigurationUpdateHistoryLink(int groupId, int groupUpdateHistoryId) {
- return getResourceGroupLink(groupId) + "/Configuration/History/" + groupUpdateHistoryId;
+ public static String getGroupResourceConfigurationUpdateHistoryLink(int groupId, Integer groupUpdateHistoryId) {
+ if (groupUpdateHistoryId != null) {
+ return getResourceGroupLink(groupId) + "/Configuration/History/" + groupUpdateHistoryId;
+ } else {
+ return getResourceGroupLink(groupId) + "/Configuration/History";
+ }
}
public static String getGroupOperationHistoryLink(int groupId, int groupOperationHistoryId) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index c2403c6..18d5b60 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -93,7 +93,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
* @author Greg Hinkle
* @author Ian Springer
*/
-public class Table<DS extends RPCDataSource> extends LocatableHLayout implements RefreshableView {
+public class Table<DS extends RPCDataSource<?>> extends LocatableHLayout implements RefreshableView {
protected static final String FIELD_ID = "id";
protected static final String FIELD_NAME = "name";
@@ -801,11 +801,11 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
private static class TableFilter extends DynamicForm implements KeyPressHandler, ChangedHandler,
com.google.gwt.event.dom.client.KeyPressHandler {
- private Table table;
+ private Table<?> table;
private SearchBarItem searchBarItem;
private HiddenItem hiddenItem;
- public TableFilter(Table table) {
+ public TableFilter(Table<?> table) {
super();
setWidth100();
setPadding(5);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index 171a28e..e1757b8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -36,6 +36,8 @@ public interface ConfigurationGWTService extends RemoteService {
ResourceConfigurationUpdate getLatestResourceConfigurationUpdate(int resourceId) throws RuntimeException;
+ PluginConfigurationUpdate getLatestPluginConfigurationUpdate(int resourceId) throws RuntimeException;
+
Configuration getPluginConfiguration(int resourceId) throws RuntimeException;
ConfigurationDefinition getPluginConfigurationDefinition(int resourceTypeId) throws RuntimeException;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
index 7567f58..bd68f55 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
@@ -75,7 +75,7 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
setMargin(5);
setMembersMargin(5);
- String backPath = LinkManager.getGroupPluginConfigurationUpdateHistoryLink(this.group.getId());
+ String backPath = LinkManager.getGroupPluginConfigurationUpdateHistoryLink(this.group.getId(), null);
BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
backPath);
addMember(backButton);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java
index fed4f63..b89f449 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java
@@ -67,7 +67,7 @@ public class HistoryGroupPluginConfigurationSettings extends LocatableVLayout {
setMargin(5);
setMembersMargin(5);
- String backPath = LinkManager.getGroupPluginConfigurationUpdateHistoryLink(this.group.getId());
+ String backPath = LinkManager.getGroupPluginConfigurationUpdateHistoryLink(this.group.getId(), null);
BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
backPath);
addMember(backButton);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
index df2c56f..e4d5c78 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
@@ -188,9 +188,8 @@ public class HistoryGroupPluginConfigurationTable extends Table {
new AbstractTableAction(TableActionEnablement.SINGLE) {
@Override
public void executeAction(ListGridRecord[] selection, Object actionValue) {
- CoreGUI.goToView(LinkManager
- .getGroupPluginConfigurationUpdateHistoryLink(HistoryGroupPluginConfigurationTable.this.group
- .getId())
+ CoreGUI.goToView(LinkManager.getGroupPluginConfigurationUpdateHistoryLink(
+ HistoryGroupPluginConfigurationTable.this.group.getId(), null)
+ "/" + selection[0].getAttribute("id") + "/Settings");
}
});
@@ -199,9 +198,8 @@ public class HistoryGroupPluginConfigurationTable extends Table {
.view_group_pluginConfig_table_viewMemberHistory(), new AbstractTableAction(TableActionEnablement.SINGLE) {
@Override
public void executeAction(ListGridRecord[] selection, Object actionValue) {
- CoreGUI.goToView(LinkManager
- .getGroupPluginConfigurationUpdateHistoryLink(HistoryGroupPluginConfigurationTable.this.group
- .getId())
+ CoreGUI.goToView(LinkManager.getGroupPluginConfigurationUpdateHistoryLink(
+ HistoryGroupPluginConfigurationTable.this.group.getId(), null)
+ "/" + selection[0].getAttribute("id") + "/Members");
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index a1b2fc3..e0504d6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -58,8 +58,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceComposit
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ResourceConfigurationEditView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.HistoryPluginConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.ResourceResourceAgentView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.table.MeasurementTableView;
@@ -147,7 +147,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
inventoryConn = new SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), new ViewName(
"ConnectionSettings", MSG.view_tabs_common_connectionSettings()), null);
inventoryConnHistory = new SubTab(inventoryTab.extendLocatorId("ConnSetHist"),
- HistoryPluginConfigurationView.VIEW_ID, null);
+ PluginConfigurationHistoryView.VIEW_ID, null);
inventoryGroups = new SubTab(inventoryTab.extendLocatorId("Groups"), new ViewName("Groups", MSG
.view_tabs_common_groups()), null);
inventoryAgent = new SubTab(inventoryTab.extendLocatorId("Agent"), new ViewName("Agent", MSG
@@ -281,8 +281,9 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.inventoryTab, this.inventoryConn, canvas, visible, true);
// same test, use above setting for 'visible'
- canvas = (visible) ? new HistoryPluginConfigurationView(this.inventoryConnHistory.extendLocatorId("View"),
- this.resourceComposite) : null;
+ canvas = (visible) ? new PluginConfigurationHistoryView(this.inventoryConnHistory.extendLocatorId("View"),
+ this.resourceComposite.getResourcePermission().isInventory(), this.resourceComposite.getResource().getId())
+ : null;
updateSubTab(this.inventoryTab, this.inventoryConnHistory, canvas, visible, true);
boolean canModifyMembership = globalPermissions.contains(Permission.MANAGE_INVENTORY);
@@ -364,7 +365,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.configurationTab, this.configCurrent, new ResourceConfigurationEditView(this
.extendLocatorId("ResourceConfigView"), resourceComposite), true, true);
- updateSubTab(this.configurationTab, this.configHistory, ConfigurationHistoryView.getHistoryOf(this
+ updateSubTab(this.configurationTab, this.configHistory, new ConfigurationHistoryView(this
.extendLocatorId("ConfigHistView"), this.resourceComposite.getResourcePermission().isConfigureWrite(),
resource.getId()), true, true);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
new file mode 100644
index 0000000..a50e8a8
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
@@ -0,0 +1,290 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.DateDisplayFormat;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
+import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
+
+/**
+ * A superclass data source that loads information about all the plugin/resource configuration changes that happened
+ * for a resource or across all inventory.
+ *
+ * @author Greg Hinkle
+ * @author John Mazzitelli
+ */
+public abstract class AbstractConfigurationHistoryDataSource<T extends AbstractResourceConfigurationUpdate> extends
+ RPCDataSource<T> {
+
+ public static abstract class Field {
+ public static final String ID = "id";
+ public static final String RESOURCE = "resource";
+ public static final String CREATED_TIME = "createdTime";
+ public static final String STATUS = "status";
+ public static final String SUBJECT = "subject";
+ public static final String RESOURCE_TYPE_ID = "resourceTypeId";
+ public static final String CONFIGURATION = "configuration";
+ public static final String GROUP_CONFIG_UPDATE_ID = "groupConfigUpdateId";
+ public static final String GROUP_ID = "groupId"; // will only be non-null if group config update id is non-null
+ public static final String DURATION = "duration";
+ public static final String ERROR_MESSAGE = "errorMessage";
+ public static final String MODIFIED_TIME = "modifiedTime";
+ public static final String CURRENT_CONFIG = "currentConfig"; // will be true if the history item represents the current config
+ public static final String OBJECT = "object"; // the full entity object is stored in this attribute
+ }
+
+ public static abstract class CriteriaField {
+ public static final String RESOURCE_ID = "resourceId";
+ }
+
+ private ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+ protected ConfigurationGWTServiceAsync getConfigurationService() {
+ return this.configurationService;
+ }
+
+ public AbstractConfigurationHistoryDataSource() {
+ super();
+ List<DataSourceField> fields = addDataSourceFields();
+ addFields(fields);
+ }
+
+ protected String getStatusHtmlString(Record record) {
+ String html = null;
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record.getAttributeAsObject(Field.OBJECT);
+ switch (obj.getStatus()) {
+ case SUCCESS: {
+ html = MSG.view_configurationHistoryList_table_statusSuccess();
+ break;
+ }
+ case INPROGRESS: {
+ html = "<p>" + MSG.view_configurationHistoryList_table_statusInprogress() + "</p>";
+ break;
+ }
+ case NOCHANGE: {
+ html = MSG.view_configurationHistoryList_table_statusNochange();
+ break;
+ }
+ case FAILURE: {
+ html = obj.getErrorMessage();
+ if (html == null) {
+ html = "<p>" + MSG.view_configurationHistoryList_table_statusFailure() + "</p>";
+ } else {
+ if (html.length() > 80) {
+ // this was probably an error stack trace, snip it so the tooltip isn't too big
+ html = "<pre>" + html.substring(0, 80) + "...</pre><p>"
+ + MSG.view_configurationHistoryList_table_clickStatusIcon() + "</p>";
+ } else {
+ html = "<pre>" + html + "</pre>";
+ }
+ }
+ break;
+ }
+ }
+ return html;
+ }
+
+ /**
+ * Views that use this data source can call this method to get a list of fields
+ * that can be used in a list grid to show the data for this data source.
+ *
+ * @param includeResourceFields if true, the list of fields that are returned will
+ * include fields to show individual resource data.
+ * Pass in false if you are only collecting data on a
+ * single resource, since you don't need every row to
+ * show the same data on the same resource.
+ * @return fields
+ */
+ public ArrayList<ListGridField> getListGridFields(boolean includeResourceFields) {
+ ArrayList<ListGridField> fields = new ArrayList<ListGridField>();
+
+ ListGridField idField = new ListGridField(Field.ID, MSG.common_title_version());
+ idField.setShowHover(true);
+ idField.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ if (Boolean.parseBoolean(record.getAttribute(Field.CURRENT_CONFIG))) {
+ return MSG.dataSource_configurationHistory_currentConfig();
+ }
+ return null;
+ }
+ });
+ fields.add(idField);
+
+ ListGridField submittedTimeField = new ListGridField(Field.CREATED_TIME, MSG
+ .dataSource_configurationHistory_dateSubmitted());
+ submittedTimeField.setType(ListGridFieldType.DATE);
+ submittedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+ fields.add(submittedTimeField);
+
+ ListGridField completedTimeField = new ListGridField(Field.MODIFIED_TIME, MSG
+ .dataSource_configurationHistory_dateCompleted());
+ completedTimeField.setType(ListGridFieldType.DATE);
+ completedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+ fields.add(completedTimeField);
+
+ ListGridField statusField = new ListGridField(Field.STATUS, MSG.common_title_status());
+ statusField.setAlign(Alignment.CENTER);
+ statusField.setCellFormatter(new CellFormatter() {
+ public String format(Object value, ListGridRecord listGridRecord, int i, int i1) {
+ ConfigurationUpdateStatus status = ConfigurationUpdateStatus.valueOf(value.toString());
+ return Canvas.imgHTML(getConfigurationUpdateStatusIcon(status), 16, 16);
+ }
+ });
+ statusField.setShowHover(true);
+ statusField.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String html = getStatusHtmlString(record);
+ return html;
+ }
+ });
+ statusField.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ String err = event.getRecord().getAttribute(Field.ERROR_MESSAGE);
+ if (err != null && err.length() > 0) {
+ err = "<pre>" + err + "</pre>";
+ new ErrorMessageWindow("errWin", MSG.common_title_error(), err).show();
+ }
+ }
+ });
+ fields.add(statusField);
+
+ ListGridField subjectField = new ListGridField(Field.SUBJECT, MSG.common_title_user());
+ fields.add(subjectField);
+
+ ListGridField updateTypeField = new ListGridField(Field.GROUP_CONFIG_UPDATE_ID, MSG
+ .dataSource_configurationHistory_updateType());
+ updateTypeField.setCellFormatter(new CellFormatter() {
+ @Override
+ public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+ if (value == null) {
+ return MSG.dataSource_configurationHistory_updateType_individual();
+ }
+ Integer groupId = record.getAttributeAsInt(Field.GROUP_ID);
+ return "<a href=\"" + getGroupConfigurationUpdateHistoryLink(groupId, (Number) value) + "\">"
+ + MSG.dataSource_configurationHistory_updateType_group() + "</a>";
+ }
+ });
+ fields.add(updateTypeField);
+
+ // determine the widths of our columns
+ if (includeResourceFields) {
+ ListGridField resourceField = new ListGridField(Field.RESOURCE, MSG.common_title_resource());
+ resourceField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ if (listGridRecord == null) {
+ return "unknown";
+ }
+ Resource res = (Resource) listGridRecord.getAttributeAsObject(Field.RESOURCE);
+ String url = LinkManager.getResourceLink(res.getId());
+ // TODO disambiguate the resource name
+ return SeleniumUtility.getLocatableHref(url, res.getName(), null);
+ }
+ });
+ fields.add(resourceField);
+
+ idField.setWidth("10%");
+ submittedTimeField.setWidth("20%");
+ completedTimeField.setWidth("20%");
+ statusField.setWidth("10%");
+ subjectField.setWidth("10%");
+ updateTypeField.setWidth("10%");
+ resourceField.setWidth("*");
+ } else {
+ idField.setWidth("10%");
+ submittedTimeField.setWidth("20%");
+ completedTimeField.setWidth("20%");
+ statusField.setWidth("10%");
+ subjectField.setWidth("10%");
+ updateTypeField.setWidth("*");
+ }
+
+ return fields;
+ }
+
+ @Override
+ protected List<DataSourceField> addDataSourceFields() {
+ List<DataSourceField> fields = super.addDataSourceFields();
+ DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID, MSG.common_title_version());
+ idField.setPrimaryKey(true);
+ fields.add(idField);
+ return fields;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public T copyValues(Record from) {
+ return (T) from.getAttributeAsObject(Field.OBJECT);
+ }
+
+ @Override
+ public ListGridRecord copyValues(T from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.RESOURCE, from.getResource());
+ record.setAttribute(Field.RESOURCE_TYPE_ID, from.getResource().getResourceType().getId());
+ record.setAttribute(Field.SUBJECT, from.getSubjectName());
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+ record.setAttribute(Field.CONFIGURATION, from.getConfiguration());
+ record.setAttribute(Field.DURATION, from.getDuration());
+ record.setAttribute(Field.ERROR_MESSAGE, from.getErrorMessage());
+ record.setAttribute(Field.CREATED_TIME, new Date(from.getCreatedTime()));
+ // if it is still in progress, the modified time (which we label as "date completed") is meaningless since it isn't completed yet
+ if (from.getStatus() != ConfigurationUpdateStatus.INPROGRESS) {
+ record.setAttribute(Field.MODIFIED_TIME, new Date(from.getModifiedTime()));
+ }
+ if (from.getAbstractGroupConfigurationUpdate() != null) {
+ record.setAttribute(Field.GROUP_CONFIG_UPDATE_ID, from.getAbstractGroupConfigurationUpdate().getId());
+ record.setAttribute(Field.GROUP_ID, from.getAbstractGroupConfigurationUpdate().getGroup().getId()); // note group must be eagerly loaded here
+ }
+ record.setAttribute(Field.OBJECT, from);
+ return record;
+ }
+
+ protected abstract String getConfigurationUpdateStatusIcon(ConfigurationUpdateStatus status);
+
+ protected abstract String getGroupConfigurationUpdateHistoryLink(Integer groupId, Number value);
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDetailView.java
new file mode 100644
index 0000000..926fa76
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDetailView.java
@@ -0,0 +1,91 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+
+import java.util.EnumSet;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * @author Greg Hinkle
+ */
+public class AbstractConfigurationHistoryDetailView extends LocatableVLayout implements BookmarkableView {
+
+ public AbstractConfigurationHistoryDetailView(String locatorId) {
+ super(locatorId);
+
+ setWidth100();
+ setHeight100();
+ }
+
+ private void displayHistory(final ResourceConfigurationUpdate update) {
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(update.getResource().getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
+ ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
+ ConfigurationEditor editor = new ConfigurationEditor("ResConfigHist-"
+ + update.getResource().getName(), definition, update.getConfiguration());
+ editor.setReadOnly(true);
+ addMember(editor);
+ markForRedraw();
+ }
+ });
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+
+ int updateId = viewPath.getCurrentAsInt();
+
+ ResourceConfigurationUpdateCriteria criteria = new ResourceConfigurationUpdateCriteria();
+ criteria.fetchConfiguration(true);
+ criteria.fetchResource(true);
+ criteria.addFilterId(updateId);
+
+ GWTServiceLookup.getConfigurationService().findResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_configurationHistoryDetails_error_loadFailure(),
+ caught);
+ }
+
+ public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
+
+ ResourceConfigurationUpdate update = result.get(0);
+ displayHistory(update);
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryView.java
new file mode 100644
index 0000000..d72af99
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryView.java
@@ -0,0 +1,177 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.SortDirection;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
+import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
+
+/**
+ * The superclass to the main plugin/resource views that lists all configuration history items.
+ *
+ * @author Greg Hinkle
+ * @author John Mazzitelli
+ */
+public abstract class AbstractConfigurationHistoryView<T extends AbstractConfigurationHistoryDataSource<? extends AbstractResourceConfigurationUpdate>>
+ extends TableSection<T> {
+
+ private Integer resourceId;
+ private boolean hasWritePerm; // can delete history or rollback to a previous config
+
+ /**
+ * Use this constructor to view config histories for all viewable Resources.
+ */
+ public AbstractConfigurationHistoryView(String locatorId, String title, boolean hasWritePerm) {
+ super(locatorId, title);
+ this.hasWritePerm = hasWritePerm;
+ this.resourceId = null;
+ }
+
+ /**
+ * Use this constructor to view the config history for the Resource with the specified ID.
+ *
+ * @param resourceId a Resource ID
+ */
+ public AbstractConfigurationHistoryView(String locatorId, String title, boolean hasWritePerm, int resourceId) {
+ super(locatorId, title, createCriteria(resourceId));
+ this.hasWritePerm = hasWritePerm;
+ this.resourceId = resourceId;
+ }
+
+ private static Criteria createCriteria(int resourceId) {
+ Criteria criteria = new Criteria();
+ criteria.addCriteria(AbstractConfigurationHistoryDataSource.CriteriaField.RESOURCE_ID, resourceId);
+ return criteria;
+ }
+
+ public Integer getResourceId() {
+ return resourceId;
+ }
+
+ public boolean hasWritePermission() {
+ return hasWritePerm;
+ }
+
+ @Override
+ protected void configureTable() {
+ List<ListGridField> fields = getDataSource().getListGridFields(this.resourceId == null);
+ setListGridFields(true, fields.toArray(new ListGridField[fields.size()])); // true = always show the ID field
+ getListGrid().sort(AbstractConfigurationHistoryDataSource.Field.ID, SortDirection.DESCENDING);
+
+ addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ new AbstractTableAction(hasWritePerm ? TableActionEnablement.ANY : TableActionEnablement.NEVER) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ if (selection != null && selection.length > 0) {
+ int[] doomedIds = new int[selection.length];
+ int i = 0;
+ for (ListGridRecord selected : selection) {
+ doomedIds[i] = selected.getAttributeAsInt(AbstractConfigurationHistoryDataSource.Field.ID);
+ if (selected
+ .getAttribute(AbstractConfigurationHistoryDataSource.Field.GROUP_CONFIG_UPDATE_ID) != null) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_configurationHistoryList_cannotDeleteGroupItems(),
+ Severity.Warning));
+ return; // abort
+ }
+ if (Boolean.parseBoolean(selected
+ .getAttribute(AbstractConfigurationHistoryDataSource.Field.CURRENT_CONFIG))) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_configurationHistoryList_cannotDeleteCurrent(),
+ Severity.Warning));
+ return; // abort
+ }
+ }
+ delete(doomedIds);
+ }
+ }
+ });
+
+ addTableAction(extendLocatorId("Compare"), MSG.common_button_compare(), null, new AbstractTableAction(
+ TableActionEnablement.MULTIPLE) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
+ for (ListGridRecord record : selection) {
+ ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record
+ .getAttributeAsObject(AbstractConfigurationHistoryDataSource.Field.OBJECT);
+ configs.add(update);
+ }
+ ConfigurationComparisonView.displayComparisonDialog(configs);
+ }
+ });
+
+ if (getResourceId() != null) {
+ addTableAction(extendLocatorId("Rollback"), MSG.view_configurationHistoryList_rollback(), MSG
+ .common_msg_areYouSure(), new AbstractTableAction(hasWritePerm ? TableActionEnablement.SINGLE
+ : TableActionEnablement.NEVER) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ if (selection != null && selection.length == 1) {
+ ListGridRecord record = selection[0];
+ rollback(record.getAttributeAsInt(AbstractConfigurationHistoryDataSource.Field.ID).intValue());
+ }
+ }
+ });
+ }
+
+ super.configureTable();
+ }
+
+ @Override
+ protected String getDetailsLinkColumnName() {
+ return AbstractConfigurationHistoryDataSource.Field.ID;
+ }
+
+ @Override
+ protected CellFormatter getDetailsLinkColumnCellFormatter() {
+ return new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int i, int i1) {
+ Integer recordId = getId(record);
+ String detailsUrl = "#" + getBasePath() + "/" + recordId;
+ String cellHtml = SeleniumUtility.getLocatableHref(detailsUrl, value.toString(), null);
+ String isCurrentConfig = record
+ .getAttribute(AbstractConfigurationHistoryDataSource.Field.CURRENT_CONFIG);
+ if (Boolean.parseBoolean(isCurrentConfig)) {
+ cellHtml = Canvas.imgHTML(ImageManager.getApproveIcon()) + cellHtml;
+ }
+ return cellHtml;
+ }
+ };
+ }
+
+ protected abstract void rollback(int configHistoryIdToRollbackTo);
+
+ protected abstract void delete(int[] doomedIds);
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
index 579083e..a71c133 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -18,40 +18,18 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.data.fields.DataSourceIntegerField;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.DateDisplayFormat;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.HoverCustomizer;
-import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* A data source that loads information about all the configuration changes that happened
@@ -60,190 +38,20 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
* @author Greg Hinkle
* @author John Mazzitelli
*/
-public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfigurationUpdate> {
-
- public static abstract class Field {
- public static final String ID = "id";
- public static final String RESOURCE = "resource";
- public static final String CREATED_TIME = "createdTime";
- public static final String STATUS = "status";
- public static final String SUBJECT = "subject";
- public static final String RESOURCE_TYPE_ID = "resourceTypeId";
- public static final String CONFIGURATION = "configuration";
- public static final String GROUP_CONFIG_UPDATE_ID = "groupConfigUpdateId";
- public static final String GROUP_ID = "groupId"; // will only be non-null if group config update id is non-null
- public static final String DURATION = "duration";
- public static final String ERROR_MESSAGE = "errorMessage";
- public static final String MODIFIED_TIME = "modifiedTime";
- public static final String CURRENT_CONFIG = "currentConfig"; // will be true if the history item represents the current config
- public static final String OBJECT = "object"; // the full entity object is stored in this attribute
- }
-
- public static abstract class CriteriaField {
- public static final String RESOURCE_ID = "resourceId";
- }
-
- private ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+public class ConfigurationHistoryDataSource extends AbstractConfigurationHistoryDataSource<ResourceConfigurationUpdate> {
public ConfigurationHistoryDataSource() {
super();
- List<DataSourceField> fields = addDataSourceFields();
- addFields(fields);
}
- /**
- * Views that use this data source can call this method to get a list of fields
- * that can be used in a list grid to show the data for this data source.
- *
- * @param includeResourceFields if true, the list of fields that are returned will
- * include fields to show individual resource data.
- * Pass in false if you are only collecting data on a
- * single resource, since you don't need every row to
- * show the same data on the same resource.
- * @return fields
- */
- public ArrayList<ListGridField> getListGridFields(boolean includeResourceFields) {
- ArrayList<ListGridField> fields = new ArrayList<ListGridField>();
-
- ListGridField idField = new ListGridField(Field.ID, MSG.common_title_version());
- idField.setShowHover(true);
- idField.setHoverCustomizer(new HoverCustomizer() {
- @Override
- public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
- if (Boolean.parseBoolean(record.getAttribute(Field.CURRENT_CONFIG))) {
- return MSG.dataSource_configurationHistory_currentConfig();
- }
- return null;
- }
- });
- fields.add(idField);
-
- ListGridField submittedTimeField = new ListGridField(Field.CREATED_TIME, MSG
- .dataSource_configurationHistory_dateSubmitted());
- submittedTimeField.setType(ListGridFieldType.DATE);
- submittedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
- fields.add(submittedTimeField);
-
- ListGridField completedTimeField = new ListGridField(Field.MODIFIED_TIME, MSG
- .dataSource_configurationHistory_dateCompleted());
- completedTimeField.setType(ListGridFieldType.DATE);
- completedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
- fields.add(completedTimeField);
-
- ListGridField statusField = new ListGridField(Field.STATUS, MSG.common_title_status());
- statusField.setAlign(Alignment.CENTER);
- statusField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord listGridRecord, int i, int i1) {
- ConfigurationUpdateStatus status = ConfigurationUpdateStatus.valueOf(value.toString());
- return Canvas.imgHTML(ImageManager.getResourceConfigurationIcon(status), 16, 16);
- }
- });
- statusField.setShowHover(true);
- statusField.setHoverCustomizer(new HoverCustomizer() {
- @Override
- public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
- String html = null;
- String err = record.getAttribute(Field.ERROR_MESSAGE);
- if (err != null && err.length() > 0) {
- html = MSG.dataSource_configurationHistory_clickToSeeError();
- } else {
- ConfigurationUpdateStatus status = ConfigurationUpdateStatus.valueOf(record
- .getAttribute(Field.STATUS));
- switch (status) {
- case SUCCESS: {
- html = MSG.common_status_success();
- break;
- }
- case FAILURE: {
- html = MSG.common_status_failed();
- break;
- }
- case INPROGRESS: {
- html = MSG.common_status_inprogress();
- break;
- }
- case NOCHANGE: {
- html = MSG.common_status_success();
- break;
- }
- }
- }
- return html;
- }
- });
- statusField.addRecordClickHandler(new RecordClickHandler() {
- @Override
- public void onRecordClick(RecordClickEvent event) {
- String err = event.getRecord().getAttribute(Field.ERROR_MESSAGE);
- if (err != null && err.length() > 0) {
- err = "<pre>" + err + "</pre>";
- new ErrorMessageWindow("errWin", MSG.common_title_error(), err).show();
- }
- }
- });
- fields.add(statusField);
-
- ListGridField subjectField = new ListGridField(Field.SUBJECT, MSG.common_title_user());
- fields.add(subjectField);
-
- ListGridField updateTypeField = new ListGridField(Field.GROUP_CONFIG_UPDATE_ID, MSG
- .dataSource_configurationHistory_updateType());
- updateTypeField.setCellFormatter(new CellFormatter() {
- @Override
- public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
- if (value == null) {
- return MSG.dataSource_configurationHistory_updateType_individual();
- }
- Integer groupId = record.getAttributeAsInt(Field.GROUP_ID);
- return "<a href=\""
- + LinkManager.getGroupResourceConfigurationUpdateHistoryLink(groupId, ((Number) value).intValue())
- + "\">" + MSG.dataSource_configurationHistory_updateType_group() + "</a>";
- }
- });
- fields.add(updateTypeField);
-
- // determine the widths of our columns
- if (includeResourceFields) {
- ListGridField resourceField = new ListGridField(Field.RESOURCE, MSG.common_title_resource());
- resourceField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- if (listGridRecord == null) {
- return "unknown";
- }
- Resource res = (Resource) listGridRecord.getAttributeAsObject(Field.RESOURCE);
- String url = LinkManager.getResourceLink(res.getId());
- // TODO disambiguate the resource name
- return SeleniumUtility.getLocatableHref(url, res.getName(), null);
- }
- });
- fields.add(resourceField);
-
- idField.setWidth("10%");
- submittedTimeField.setWidth("20%");
- completedTimeField.setWidth("20%");
- statusField.setWidth("10%");
- subjectField.setWidth("10%");
- updateTypeField.setWidth("10%");
- resourceField.setWidth("*");
- } else {
- idField.setWidth("10%");
- submittedTimeField.setWidth("20%");
- completedTimeField.setWidth("20%");
- statusField.setWidth("10%");
- subjectField.setWidth("10%");
- updateTypeField.setWidth("*");
- }
-
- return fields;
+ @Override
+ protected String getConfigurationUpdateStatusIcon(ConfigurationUpdateStatus status) {
+ return ImageManager.getResourceConfigurationIcon(status);
}
@Override
- protected List<DataSourceField> addDataSourceFields() {
- List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID, MSG.common_title_version());
- idField.setPrimaryKey(true);
- fields.add(idField);
- return fields;
+ protected String getGroupConfigurationUpdateHistoryLink(Integer groupId, Number value) {
+ return LinkManager.getGroupResourceConfigurationUpdateHistoryLink(groupId, value.intValue());
}
@Override
@@ -261,7 +69,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
criteria.addFilterResourceIds(resourceId);
}
- configurationService.findResourceConfigurationUpdatesByCriteria(criteria,
+ getConfigurationService().findResourceConfigurationUpdatesByCriteria(criteria,
new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.dataSource_configurationHistory_error_fetchFailure(),
@@ -281,7 +89,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
// we are obtaining a single resource's history items. Let's find out which is
// its latest, current config item so we can mark it as such
- configurationService.getLatestResourceConfigurationUpdate(resourceId.intValue(),
+ getConfigurationService().getLatestResourceConfigurationUpdate(resourceId.intValue(),
new AsyncCallback<ResourceConfigurationUpdate>() {
@Override
public void onSuccess(ResourceConfigurationUpdate latestResult) {
@@ -310,33 +118,4 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
}
});
}
-
- @Override
- public ResourceConfigurationUpdate copyValues(Record from) {
- return (ResourceConfigurationUpdate) from.getAttributeAsObject(Field.OBJECT);
- }
-
- @Override
- public ListGridRecord copyValues(ResourceConfigurationUpdate from) {
- ListGridRecord record = new ListGridRecord();
- record.setAttribute(Field.ID, from.getId());
- record.setAttribute(Field.RESOURCE, from.getResource());
- record.setAttribute(Field.RESOURCE_TYPE_ID, from.getResource().getResourceType().getId());
- record.setAttribute(Field.SUBJECT, from.getSubjectName());
- record.setAttribute(Field.STATUS, from.getStatus().name());
- record.setAttribute(Field.CONFIGURATION, from.getConfiguration());
- record.setAttribute(Field.DURATION, from.getDuration());
- record.setAttribute(Field.ERROR_MESSAGE, from.getErrorMessage());
- record.setAttribute(Field.CREATED_TIME, new Date(from.getCreatedTime()));
- // if it is still in progress, the modified time (which we label as "date completed") is meaningless since it isn't completed yet
- if (from.getStatus() != ConfigurationUpdateStatus.INPROGRESS) {
- record.setAttribute(Field.MODIFIED_TIME, new Date(from.getModifiedTime()));
- }
- if (from.getGroupConfigurationUpdate() != null) {
- record.setAttribute(Field.GROUP_CONFIG_UPDATE_ID, from.getGroupConfigurationUpdate().getId());
- record.setAttribute(Field.GROUP_ID, from.getGroupConfigurationUpdate().getGroup().getId()); // note group must be eagerly loaded here
- }
- record.setAttribute(Field.OBJECT, from);
- return record;
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
index 136ba94..2ea63c4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
@@ -82,7 +82,6 @@ public class ConfigurationHistoryDetailView extends LocatableVLayout implements
}
public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
-
ResourceConfigurationUpdate update = result.get(0);
displayHistory(update);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index cf83667..c445d32 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -18,30 +18,14 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
-import java.util.ArrayList;
-import java.util.List;
-
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
-import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryDataSource.Field;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* The main view that lists all resource configuration history items.
@@ -49,20 +33,15 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
* @author Greg Hinkle
* @author John Mazzitelli
*/
-public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryDataSource> {
- public static final ViewName VIEW_ID = new ViewName("RecentConfigurationChanges", MSG
+public class ConfigurationHistoryView extends AbstractConfigurationHistoryView<ConfigurationHistoryDataSource> {
+ public static final ViewName VIEW_ID = new ViewName("ConfigurationHistoryView", MSG
.view_configurationHistoryList_title());
- private Integer resourceId;
- private boolean hasWritePerm; // can delete history or rollback to a previous config
-
/**
* Use this constructor to view config histories for all viewable Resources.
*/
public ConfigurationHistoryView(String locatorId, boolean hasWritePerm) {
- super(locatorId, VIEW_ID.getTitle());
- this.hasWritePerm = hasWritePerm;
- this.resourceId = null;
+ super(locatorId, VIEW_ID.getTitle(), hasWritePerm);
ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
setDataSource(datasource);
}
@@ -73,101 +52,20 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
* @param resourceId a Resource ID
*/
public ConfigurationHistoryView(String locatorId, boolean hasWritePerm, int resourceId) {
- super(locatorId, VIEW_ID.getTitle(), createCriteria(resourceId));
- this.hasWritePerm = hasWritePerm;
- this.resourceId = resourceId;
+ super(locatorId, VIEW_ID.getTitle(), hasWritePerm, resourceId);
ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
setDataSource(datasource);
}
- private static Criteria createCriteria(int resourceId) {
- Criteria criteria = new Criteria();
- criteria.addCriteria(ConfigurationHistoryDataSource.CriteriaField.RESOURCE_ID, resourceId);
- return criteria;
- }
-
- @Override
- protected void configureTable() {
- List<ListGridField> fields = getDataSource().getListGridFields(this.resourceId == null);
- setListGridFields(true, fields.toArray(new ListGridField[fields.size()])); // true = always show the ID field
- getListGrid().sort(Field.ID, SortDirection.DESCENDING);
-
- addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
- new AbstractTableAction(hasWritePerm ? TableActionEnablement.ANY : TableActionEnablement.NEVER) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- if (selection != null && selection.length > 0) {
- int[] doomedIds = new int[selection.length];
- int i = 0;
- for (ListGridRecord selected : selection) {
- doomedIds[i] = selected.getAttributeAsInt(Field.ID);
- if (selected.getAttribute(Field.GROUP_CONFIG_UPDATE_ID) != null) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_configurationHistoryList_cannotDeleteGroupItems(),
- Severity.Warning));
- return; // abort
- }
- }
- delete(doomedIds);
- }
- }
- });
-
- addTableAction(extendLocatorId("Compare"), MSG.common_button_compare(), null, new AbstractTableAction(
- TableActionEnablement.MULTIPLE) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
- for (ListGridRecord record : selection) {
- ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record
- .getAttributeAsObject(ConfigurationHistoryDataSource.Field.OBJECT);
- configs.add(update);
- }
- ConfigurationComparisonView.displayComparisonDialog(configs);
- }
- });
-
- addTableAction(extendLocatorId("Rollback"), MSG.view_configurationHistoryList_rollback(), MSG
- .common_msg_areYouSure(), new AbstractTableAction(hasWritePerm ? TableActionEnablement.SINGLE
- : TableActionEnablement.NEVER) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- if (selection != null && selection.length == 1) {
- ListGridRecord record = selection[0];
- rollback(record.getAttributeAsInt(Field.ID).intValue());
- }
- }
- });
-
- super.configureTable();
- }
-
- @Override
- protected String getDetailsLinkColumnName() {
- return Field.ID;
- }
-
- @Override
- protected CellFormatter getDetailsLinkColumnCellFormatter() {
- return new CellFormatter() {
- public String format(Object value, ListGridRecord record, int i, int i1) {
- Integer recordId = getId(record);
- String detailsUrl = "#" + getBasePath() + "/" + recordId;
- String cellHtml = SeleniumUtility.getLocatableHref(detailsUrl, value.toString(), null);
- String isCurrentConfig = record.getAttribute(Field.CURRENT_CONFIG);
- if (Boolean.parseBoolean(isCurrentConfig)) {
- cellHtml = Canvas.imgHTML(ImageManager.getApproveIcon()) + cellHtml;
- }
- return cellHtml;
- }
- };
- }
-
@Override
public Canvas getDetailsView(int id) {
ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView(this.getLocatorId());
return detailView;
}
- private void rollback(int configHistoryIdToRollbackTo) {
- GWTServiceLookup.getConfigurationService().rollbackResourceConfiguration(this.resourceId.intValue(),
+ @Override
+ protected void rollback(int configHistoryIdToRollbackTo) {
+ GWTServiceLookup.getConfigurationService().rollbackResourceConfiguration(getResourceId().intValue(),
configHistoryIdToRollbackTo, new AsyncCallback<Void>() {
@Override
public void onSuccess(Void result) {
@@ -183,7 +81,8 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
});
}
- private void delete(int[] doomedIds) {
+ @Override
+ protected void delete(int[] doomedIds) {
GWTServiceLookup.getConfigurationService().purgeResourceConfigurationUpdates(doomedIds, true,
new AsyncCallback<Void>() {
@Override
@@ -199,11 +98,4 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
}
});
}
-
- // -------- Static Utility loaders ------------
-
- public static ConfigurationHistoryView getHistoryOf(String locatorId, boolean hasWritePerm, int resourceId) {
- return new ConfigurationHistoryView(locatorId, hasWritePerm, resourceId);
- }
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationSettings.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationSettings.java
deleted file mode 100644
index 506e130..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationSettings.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
-
-import java.util.EnumSet;
-import java.util.Map;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Overflow;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.core.domain.resource.composite.ResourcePermission;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-
-/**
- * Read only view that shows resource plugin configuration properties.
- *
- * @author John Mazzitelli
- */
-public class HistoryPluginConfigurationSettings extends LocatableVLayout {
- private final Resource resource;
- private final ResourcePermission resourcePerms;
- private final int resourceUpdateId;
- private ConfigurationDefinition configurationDefinition;
- private Configuration resourceConfiguration;
- private ConfigurationEditor editor;
-
- public HistoryPluginConfigurationSettings(String locatorId, ResourceComposite composite, int updateId) {
- super(locatorId);
- this.resource = composite.getResource();
- this.resourcePerms = composite.getResourcePermission();
- this.resourceUpdateId = updateId;
-
- setMargin(5);
- setMembersMargin(5);
- String backPath = LinkManager.getResourcePluginConfigurationUpdateHistoryLink(this.resource.getId());
- BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
- backPath);
- addMember(backButton);
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
- if (this.resourcePerms.isInventory()) {
- loadConfigurationDefinition();
- loadConfiguration();
- } else {
- CoreGUI.getMessageCenter().notify(new Message(MSG.view_connectionSettingsHistory_view_noperm()));
- }
- }
-
- private void initEditor() {
- if (this.configurationDefinition != null && this.resourceConfiguration != null) {
- this.editor = new ConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
- this.resourceConfiguration);
- this.editor.setEditorTitle(MSG.view_connectionSettingsHistory_view_connProperties() + " - "
- + this.resourceUpdateId);
- this.editor.setOverflow(Overflow.AUTO);
- this.editor.setReadOnly(true);
- addMember(this.editor);
- }
- }
-
- private void loadConfigurationDefinition() {
- if (this.configurationDefinition == null) {
- final ResourceType type = this.resource.getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
- EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
- new ResourceTypeRepository.TypesLoadedCallback() {
- public void onTypesLoaded(Map<Integer, ResourceType> types) {
- configurationDefinition = types.get(type.getId()).getPluginConfigurationDefinition();
- if (configurationDefinition == null) {
- throw new IllegalStateException("Connection settings are not supported by this group.");
- }
- initEditor();
- }
- });
- }
- }
-
- private void loadConfiguration() {
- this.resourceConfiguration = null;
-
- PluginConfigurationUpdateCriteria criteria = new PluginConfigurationUpdateCriteria();
- criteria.addFilterId(resourceUpdateId);
- criteria.fetchConfiguration(true);
-
- GWTServiceLookup.getConfigurationService().findPluginConfigurationUpdatesByCriteria(criteria,
- new AsyncCallback<PageList<PluginConfigurationUpdate>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_connectionSettingsHistory_settings_fetchFailure(resource.getName()), caught);
- }
-
- public void onSuccess(PageList<PluginConfigurationUpdate> results) {
- if (results != null && results.size() > 0) {
- resourceConfiguration = results.get(0).getConfiguration();
- initEditor();
- } else {
- // should never really happen
- CoreGUI.getErrorHandler().handleError(
- MSG.view_connectionSettingsHistory_settings_fetchFailure(resource.getName()),
- new Throwable("bad results"));
- }
- }
- });
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
deleted file mode 100644
index 9a43379..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.EnumSet;
-import java.util.HashMap;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
-import com.smartgwt.client.widgets.grid.HoverCustomizer;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-
-import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
-import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
-import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
-import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.core.domain.resource.composite.ResourcePermission;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
-import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
-import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
-import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryDataSource.Field;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
-
-/**
- * Table showing resource plugin configuration history.
- *
- * @author John Mazzitelli
- */
-public class HistoryPluginConfigurationView extends TableSection<HistoryPluginConfigurationView.DataSource> {
- public static final ViewName VIEW_ID = new ViewName("ConnectionSettings", MSG
- .view_tabs_common_connectionSettingsHistory());
-
- private final Resource resource;
- private final ResourcePermission resourcePerms;
-
- public HistoryPluginConfigurationView(String locatorId, ResourceComposite composite) {
- super(locatorId, VIEW_ID.getTitle());
- this.resource = composite.getResource();
- this.resourcePerms = composite.getResourcePermission();
-
- setDataSource(new DataSource());
- }
-
- @Override
- protected String getDetailsLinkColumnName() {
- return DataSource.ID;
- }
-
- @Override
- protected void configureTable() {
- ListGridField fieldId = new ListGridField(DataSource.ID, MSG.common_title_version());
- ListGridField fieldDateCreated = new ListGridField(DataSource.DATE_CREATED, MSG.common_title_dateCreated());
- ListGridField fieldLastUpdated = new ListGridField(DataSource.LAST_UPDATED, MSG.common_title_lastUpdated());
- ListGridField fieldStatus = new ListGridField(DataSource.STATUS, MSG.common_title_status());
- ListGridField fieldUser = new ListGridField(DataSource.USER, MSG.common_title_user());
-
- fieldId.setWidth("10%");
- fieldDateCreated.setWidth("35%");
- fieldLastUpdated.setWidth("35%");
- fieldStatus.setWidth("10%");
- fieldUser.setWidth("*");
-
- fieldStatus.setType(ListGridFieldType.ICON);
- HashMap<String, String> statusIcons = new HashMap<String, String>(4);
- statusIcons.put(ConfigurationUpdateStatus.SUCCESS.name(), ImageManager
- .getPluginConfigurationIcon(ConfigurationUpdateStatus.SUCCESS));
- statusIcons.put(ConfigurationUpdateStatus.FAILURE.name(), ImageManager
- .getPluginConfigurationIcon(ConfigurationUpdateStatus.FAILURE));
- statusIcons.put(ConfigurationUpdateStatus.INPROGRESS.name(), ImageManager
- .getPluginConfigurationIcon(ConfigurationUpdateStatus.INPROGRESS));
- statusIcons.put(ConfigurationUpdateStatus.NOCHANGE.name(), ImageManager
- .getPluginConfigurationIcon(ConfigurationUpdateStatus.NOCHANGE));
- fieldStatus.setValueIcons(statusIcons);
- fieldStatus.addRecordClickHandler(new RecordClickHandler() {
- @Override
- public void onRecordClick(RecordClickEvent event) {
- final Window winModal = new LocatableWindow(HistoryPluginConfigurationView.this
- .extendLocatorId("statusDetailsWin"));
- winModal.setTitle(MSG.view_connectionSettingsHistory_table_statusDetails());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setShowMaximizeButton(true);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setAutoSize(true);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- LocatableHTMLPane htmlPane = new LocatableHTMLPane(HistoryPluginConfigurationView.this
- .extendLocatorId("statusDetailsPane"));
- htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(500);
- htmlPane.setDefaultHeight(400);
- htmlPane.setContents(getStatusHtmlString(event.getRecord()));
- winModal.addItem(htmlPane);
- winModal.show();
- }
- });
- fieldStatus.setShowHover(true);
- fieldStatus.setHoverCustomizer(new HoverCustomizer() {
- @Override
- public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
- String html = getStatusHtmlString(record);
- return html;
- }
- });
-
- ListGrid listGrid = getListGrid();
- listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
-
- addTableAction(extendLocatorId("deleteAction"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
- new AbstractTableAction(this.resourcePerms.isInventory() ? TableActionEnablement.ANY
- : TableActionEnablement.NEVER) {
-
- @Override
- public void executeAction(final ListGridRecord[] selection, Object actionValue) {
- if (selection == null || selection.length == 0) {
- return;
- }
-
- ConfigurationGWTServiceAsync service = GWTServiceLookup.getConfigurationService();
- int[] updateIds = new int[selection.length];
- int i = 0;
- for (ListGridRecord record : selection) {
- updateIds[i++] = record.getAttributeAsInt(DataSource.ID).intValue();
- }
-
- service.purgePluginConfigurationUpdates(updateIds, true, new AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- refresh();
- Message message = new Message(
- MSG.view_connectionSettingsHistory_table_deleteSuccessful(String
- .valueOf(selection.length)), Message.Severity.Info, EnumSet.of(
- Message.Option.Transient, Message.Option.Sticky));
- CoreGUI.getMessageCenter().notify(message);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_connectionSettingsHistory_table_deleteFailure(), caught);
- }
- });
- }
- });
-
- addTableAction(extendLocatorId("Compare"), MSG.common_button_compare(), null, new AbstractTableAction(
- TableActionEnablement.MULTIPLE) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- ArrayList<PluginConfigurationUpdate> configs = new ArrayList<PluginConfigurationUpdate>();
- for (ListGridRecord record : selection) {
- PluginConfigurationUpdate update = (PluginConfigurationUpdate) record
- .getAttributeAsObject(DataSource.OBJECT);
- configs.add(update);
- }
- ConfigurationComparisonView.displayComparisonDialog(configs);
- }
- });
-
- addTableAction(extendLocatorId("Rollback"), MSG.view_connectionSettingsHistory_table_rollback(), MSG
- .common_msg_areYouSure(), new AbstractTableAction(
- this.resourcePerms.isInventory() ? TableActionEnablement.SINGLE : TableActionEnablement.NEVER) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- if (selection != null && selection.length == 1) {
- ListGridRecord record = selection[0];
- GWTServiceLookup.getConfigurationService().rollbackPluginConfiguration(resource.getId(),
- record.getAttributeAsInt(Field.ID).intValue(), new AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_connectionSettingsHistory_table_rollback_success(),
- Severity.Info));
- refresh();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_connectionSettingsHistory_table_rollback_failure(), caught);
- }
- });
- }
- }
- });
-
- }
-
- private String getStatusHtmlString(Record record) {
- String html = null;
- AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record.getAttributeAsObject(DataSource.OBJECT);
- switch (obj.getStatus()) {
- case SUCCESS: {
- html = MSG.view_connectionSettingsHistory_table_statusSuccess();
- break;
- }
- case INPROGRESS: {
- html = "<p>" + MSG.view_connectionSettingsHistory_table_statusInprogress() + "</p>";
- break;
- }
- case NOCHANGE: {
- html = MSG.view_connectionSettingsHistory_table_statusNochange();
- break;
- }
- case FAILURE: {
- html = obj.getErrorMessage();
- if (html == null) {
- html = "<p>" + MSG.view_connectionSettingsHistory_table_statusFailure() + "</p>";
- } else {
- if (html.length() > 80) {
- // this was probably an error stack trace, snip it so the tooltip isn't too big
- html = "<pre>" + html.substring(0, 80) + "...</pre><p>"
- + MSG.view_connectionSettingsHistory_table_clickStatusIcon() + "</p>";
- } else {
- html = "<pre>" + html + "</pre>";
- }
- }
- break;
- }
- }
- return html;
- }
-
- class DataSource extends RPCDataSource<PluginConfigurationUpdate> {
-
- public static final String ID = "id";
- public static final String DATE_CREATED = "dateCreated";
- public static final String LAST_UPDATED = "lastUpdated";
- public static final String USER = "user";
- public static final String STATUS = "status";
- public static final String OBJECT = "object";
-
- @Override
- public PluginConfigurationUpdate copyValues(Record from) {
- return (PluginConfigurationUpdate) from.getAttributeAsObject(DataSource.OBJECT);
- }
-
- @Override
- public ListGridRecord copyValues(PluginConfigurationUpdate from) {
- ListGridRecord record = new ListGridRecord();
-
- record.setAttribute(DataSource.ID, from.getId());
- record.setAttribute(DataSource.DATE_CREATED, new Date(from.getCreatedTime()));
- record.setAttribute(DataSource.LAST_UPDATED, new Date(from.getModifiedTime()));
- record.setAttribute(DataSource.USER, from.getSubjectName());
- record.setAttribute(DataSource.STATUS, from.getStatus().name());
-
- record.setAttribute(DataSource.OBJECT, from);
-
- return record;
- }
-
- @Override
- protected void executeFetch(final DSRequest request, final DSResponse response) {
- ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
-
- PluginConfigurationUpdateCriteria criteria = new PluginConfigurationUpdateCriteria();
- criteria.addFilterResourceIds(HistoryPluginConfigurationView.this.resource.getId());
-
- configurationService.findPluginConfigurationUpdatesByCriteria(criteria,
- new AsyncCallback<PageList<PluginConfigurationUpdate>>() {
-
- @Override
- public void onSuccess(PageList<PluginConfigurationUpdate> result) {
- response.setData(buildRecords(result));
- response.setTotalRows(result.getTotalSize());
- processResponse(request.getRequestId(), response);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_connectionSettingsHistory_table_failFetch(),
- caught);
- response.setStatus(DSResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
- });
- }
- }
-
- @Override
- public Canvas getDetailsView(int id) {
- // TODO Auto-generated method stub
- return null;
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDataSource.java
new file mode 100644
index 0000000..77a3bcc
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDataSource.java
@@ -0,0 +1,122 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
+import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.AbstractConfigurationHistoryDataSource;
+
+/**
+ * A data source that loads information about all the plugin configuration changes that happened
+ * for a resource or across all inventory.
+ *
+ * @author John Mazzitelli
+ */
+public class PluginConfigurationHistoryDataSource extends
+ AbstractConfigurationHistoryDataSource<PluginConfigurationUpdate> {
+
+ public PluginConfigurationHistoryDataSource() {
+ super();
+ }
+
+ @Override
+ protected String getConfigurationUpdateStatusIcon(ConfigurationUpdateStatus status) {
+ return ImageManager.getPluginConfigurationIcon(status);
+ }
+
+ @Override
+ protected String getGroupConfigurationUpdateHistoryLink(Integer groupId, Number value) {
+ return LinkManager.getGroupPluginConfigurationUpdateHistoryLink(groupId, value.intValue());
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ PluginConfigurationUpdateCriteria criteria = new PluginConfigurationUpdateCriteria();
+ criteria.fetchConfiguration(true);
+ criteria.fetchResource(true);
+ criteria.fetchGroupConfigurationUpdate(true);
+
+ criteria.setPageControl(getPageControl(request));
+
+ final Integer resourceId = (Integer) request.getCriteria().getValues().get(CriteriaField.RESOURCE_ID);
+ if (resourceId != null) {
+ criteria.addFilterResourceIds(resourceId);
+ }
+
+ getConfigurationService().findPluginConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<PluginConfigurationUpdate>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.dataSource_configurationHistory_error_fetchFailure(),
+ caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(final PageList<PluginConfigurationUpdate> result) {
+ final ListGridRecord[] records = buildRecords(result);
+ if (resourceId == null) {
+ response.setData(records);
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ return; // we can finish now, we don't need any additional information
+ }
+
+ // we are obtaining a single resource's history items. Let's find out which is
+ // its latest, current config item so we can mark it as such
+ getConfigurationService().getLatestPluginConfigurationUpdate(resourceId.intValue(),
+ new AsyncCallback<PluginConfigurationUpdate>() {
+ @Override
+ public void onSuccess(PluginConfigurationUpdate latestResult) {
+ if (latestResult != null) {
+ for (ListGridRecord record : records) {
+ boolean latest = record.getAttributeAsInt(Field.ID).intValue() == latestResult
+ .getId();
+ record.setAttribute(Field.CURRENT_CONFIG, latest);
+ }
+ }
+ finish();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ // should we show an error message? this just means we can't show any item as the "current" one
+ finish();
+ }
+
+ private void finish() {
+ response.setData(records);
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDetailView.java
new file mode 100644
index 0000000..f3d48f5
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryDetailView.java
@@ -0,0 +1,90 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
+
+import java.util.EnumSet;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * @author John Mazzitelli
+ */
+public class PluginConfigurationHistoryDetailView extends LocatableVLayout implements BookmarkableView {
+
+ public PluginConfigurationHistoryDetailView(String locatorId) {
+ super(locatorId);
+
+ setWidth100();
+ setHeight100();
+ }
+
+ private void displayHistory(final PluginConfigurationUpdate update) {
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(update.getResource().getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
+ ConfigurationDefinition definition = type.getPluginConfigurationDefinition();
+ ConfigurationEditor editor = new ConfigurationEditor("PluginConfigHist-"
+ + update.getResource().getName(), definition, update.getConfiguration());
+ editor.setReadOnly(true);
+ addMember(editor);
+ markForRedraw();
+ }
+ });
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+
+ int updateId = viewPath.getCurrentAsInt();
+
+ PluginConfigurationUpdateCriteria criteria = new PluginConfigurationUpdateCriteria();
+ criteria.fetchConfiguration(true);
+ criteria.fetchResource(true);
+ criteria.addFilterId(updateId);
+
+ GWTServiceLookup.getConfigurationService().findPluginConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<PluginConfigurationUpdate>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_configurationHistoryDetails_error_loadFailure(),
+ caught);
+ }
+
+ public void onSuccess(PageList<PluginConfigurationUpdate> result) {
+ PluginConfigurationUpdate update = result.get(0);
+ displayHistory(update);
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryView.java
new file mode 100644
index 0000000..fdd6657
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryView.java
@@ -0,0 +1,103 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.AbstractConfigurationHistoryView;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+
+/**
+ * The main view that lists all plugin configuration history items.
+ *
+ * @author Greg Hinkle
+ * @author John Mazzitelli
+ */
+public class PluginConfigurationHistoryView extends
+ AbstractConfigurationHistoryView<PluginConfigurationHistoryDataSource> {
+ public static final ViewName VIEW_ID = new ViewName("PluginConfigurationHistoryView", MSG
+ .view_tabs_common_connectionSettingsHistory());
+
+ /**
+ * Use this constructor to view plugin config histories for all viewable Resources.
+ */
+ public PluginConfigurationHistoryView(String locatorId, boolean hasWritePerm) {
+ super(locatorId, VIEW_ID.getTitle(), hasWritePerm);
+ PluginConfigurationHistoryDataSource datasource = new PluginConfigurationHistoryDataSource();
+ setDataSource(datasource);
+ }
+
+ /**
+ * Use this constructor to view the plugin config history for the Resource with the specified ID.
+ *
+ * @param resourceId a Resource ID
+ */
+ public PluginConfigurationHistoryView(String locatorId, boolean hasWritePerm, int resourceId) {
+ super(locatorId, VIEW_ID.getTitle(), hasWritePerm, resourceId);
+ PluginConfigurationHistoryDataSource datasource = new PluginConfigurationHistoryDataSource();
+ setDataSource(datasource);
+ }
+
+ @Override
+ public Canvas getDetailsView(int id) {
+ PluginConfigurationHistoryDetailView detailView = new PluginConfigurationHistoryDetailView(this.getLocatorId());
+ return detailView;
+ }
+
+ @Override
+ protected void rollback(int configHistoryIdToRollbackTo) {
+ GWTServiceLookup.getConfigurationService().rollbackPluginConfiguration(getResourceId().intValue(),
+ configHistoryIdToRollbackTo, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_configurationHistoryList_rollback_success(), Severity.Info));
+ refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_configurationHistoryList_rollback_failure(), caught);
+ }
+ });
+ }
+
+ @Override
+ protected void delete(int[] doomedIds) {
+ GWTServiceLookup.getConfigurationService().purgePluginConfigurationUpdates(doomedIds, true,
+ new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_configurationHistoryList_delete_success(), Severity.Info));
+ refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_configurationHistoryList_delete_failure(), caught);
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index ff848de..e30b1f1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -98,6 +98,17 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
@Override
+ public PluginConfigurationUpdate getLatestPluginConfigurationUpdate(int resourceId) throws RuntimeException {
+ try {
+ PluginConfigurationUpdate update = configurationManager.getLatestPluginConfigurationUpdate(
+ getSessionSubject(), resourceId);
+ return SerialUtility.prepare(update, "ConfigurationService.getLatestPluginConfigurationUpdate");
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ @Override
public Configuration getPluginConfiguration(int resourceId) throws RuntimeException {
try {
Configuration configuration = configurationManager.getPluginConfiguration(getSessionSubject(), resourceId);
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 951f0b9..2caa83d 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
@@ -1727,24 +1727,6 @@ view_connectionSettingsDetails_messageDetailed_updateSuccess = Connection settin
view_connectionSettingsDetails_allPropertiesValid = All connection settings have valid values, so the settings can now be saved.
view_connectionSettingsDetails_somePropertiesInvalid = The following connection settings have invalid values: {0}. The values must be corrected before the settings can be saved.
-# Connection History
-#-----------------------------------------
-view_connectionSettingsHistory_view_noperm = You do not have permissions to see the connection settings
-view_connectionSettingsHistory_view_connProperties = Connection Properties
-view_connectionSettingsHistory_table_rollback = Rollback
-view_connectionSettingsHistory_table_rollback_success = You successfully rolled back the resource configuration to the selected past configuration.
-view_connectionSettingsHistory_table_rollback_failure = Failed to rollback the configuration. The original configuration is still in effect.
-view_connectionSettingsHistory_table_failFetch = Failed to get plugin config history
-view_connectionSettingsHistory_table_statusDetails = Status Details
-view_connectionSettingsHistory_table_deleteSuccessful = You have successfully deleted [{0}] history items
-view_connectionSettingsHistory_table_deleteFailure = Failed to delete plugin configuration history
-view_connectionSettingsHistory_table_statusSuccess = This configuration update was successful
-view_connectionSettingsHistory_table_statusInprogress = This configuration update is still in progress
-view_connectionSettingsHistory_table_statusNochange = No changes were made to this configuration
-view_connectionSettingsHistory_table_statusFailure = This configuration update failed
-view_connectionSettingsHistory_table_clickStatusIcon = Click the status icon for full details
-view_connectionSettingsHistory_settings_fetchFailure = Failed to retrieve connection settings for [{0}]
-
# Resource Resource Groups
#-----------------------------------------
view_resourceResourceGroupList_error_fetchFailure = Failed to fetch Resource''s groups.
@@ -1760,15 +1742,25 @@ view_configurationDetails_messageDetailed = Configuration updated for Resource [
view_configurationDetails_allPropertiesValid = All configuration properties have valid values, so the configuration can now be saved.
view_configurationDetails_somePropertiesInvalid = The following configuration properties have invalid values: {0}. The values must be corrected before the configuration can be saved.
-# Configuration History List
+# Resource Configuration History List
+#-------------------------------
view_configurationHistoryList_title = Configuration History
+
+# Abstract Configuration History List
+#-------------------------------
view_configurationHistoryList_rollback = Rollback
-view_configurationHistoryList_rollback_success = You successfully rolled back the resource configuration to the selected past configuration.
+view_configurationHistoryList_rollback_success = You successfully rolled back the configuration to the selected past configuration.
view_configurationHistoryList_rollback_failure = Failed to rollback the configuration. The original configuration is still in effect.
view_configurationHistoryList_delete_success = You successfully deleted the selected configuration history items.
view_configurationHistoryList_delete_failure = Failed to delete the configuration history items.
view_configurationHistoryList_cannotDeleteGroupItems = One or more selected configuration history items are part of a group configuration update. \
You must purge that parent group history item before you can delete its individual resource history items.
+view_configurationHistoryList_cannotDeleteCurrent = One of the selected history items represents the current configuration - you cannot delete it.
+view_configurationHistoryList_table_statusSuccess = This configuration update was successful
+view_configurationHistoryList_table_statusInprogress = This configuration update is still in progress
+view_configurationHistoryList_table_statusNochange = No changes were made to this configuration
+view_configurationHistoryList_table_statusFailure = This configuration update failed
+view_configurationHistoryList_table_clickStatusIcon = Click the status icon for full details
# Configuration History Details
#------------------------------------------
commit 9a45e868aa6db13ba0aa326d581a896205733dda
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 15:02:10 2011 -0500
more code to support plugin configuration history pages
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractResourceConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractResourceConfigurationUpdate.java
index 5f377cf..aa073a6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractResourceConfigurationUpdate.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractResourceConfigurationUpdate.java
@@ -34,6 +34,8 @@ import javax.persistence.InheritanceType;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
+import org.rhq.core.domain.resource.Resource;
+
/**
* Provides a {@link Configuration configuration} that constitutes a configuration update request. This allows you to
* maintain a history of a configuration update request - when it was made, who made it and if it was successful or not.
@@ -57,6 +59,8 @@ public abstract class AbstractResourceConfigurationUpdate extends AbstractConfig
@Id
private int id;
+ public abstract Resource getResource();
+
protected AbstractResourceConfigurationUpdate() {
}
@@ -70,7 +74,7 @@ public abstract class AbstractResourceConfigurationUpdate extends AbstractConfig
protected AbstractResourceConfigurationUpdate(Configuration config, String subjectName) {
super(subjectName);
//this.configuration = config.deepCopy(false);
- this.configuration = config.deepCopyWithoutProxies();
+ this.configuration = config.deepCopyWithoutProxies();
}
public int getId() {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java
index b07e884..d7e7af4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java
@@ -154,6 +154,7 @@ public class PluginConfigurationUpdate extends AbstractResourceConfigurationUpda
this.resource = resource;
}
+ @Override
public Resource getResource() {
return resource;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
index e0a2460..b814ea4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
@@ -207,6 +207,7 @@ public class ResourceConfigurationUpdate extends AbstractResourceConfigurationUp
this.resource = resource;
}
+ @Override
public Resource getResource() {
return resource;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java
index f9e4970..3b462c2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java
@@ -35,9 +35,9 @@ import com.smartgwt.client.widgets.tree.TreeGridField;
import com.smartgwt.client.widgets.tree.TreeNode;
import org.rhq.core.domain.configuration.AbstractPropertyMap;
+import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
@@ -172,7 +172,7 @@ public class ConfigurationComparisonView extends VLayout {
parent.setChildren(children.toArray(new TreeNode[children.size()]));
}
- public static void displayComparisonDialog(final ArrayList<ResourceConfigurationUpdate> configs) {
+ public static void displayComparisonDialog(final ArrayList<? extends AbstractResourceConfigurationUpdate> configs) {
int resourceId = configs.get(0).getResource().getResourceType().getId();
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceId,
EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
@@ -184,7 +184,7 @@ public class ConfigurationComparisonView extends VLayout {
ArrayList<Configuration> configurations = new ArrayList<Configuration>();
ArrayList<String> titles = new ArrayList<String>();
- for (ResourceConfigurationUpdate update : configs) {
+ for (AbstractResourceConfigurationUpdate update : configs) {
configurations.add(update.getConfiguration());
titles.add(String.valueOf(update.getId()));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index 45bd2c4..171a28e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -30,6 +30,8 @@ public interface ConfigurationGWTService extends RemoteService {
void purgeResourceConfigurationUpdates(int[] configUpdateIds, boolean purgeInProgress) throws RuntimeException;
+ void rollbackPluginConfiguration(int resourceId, int configHistoryId) throws RuntimeException;
+
void rollbackResourceConfiguration(int resourceId, int configHistoryId) throws RuntimeException;
ResourceConfigurationUpdate getLatestResourceConfigurationUpdate(int resourceId) throws RuntimeException;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
index ea03013..9a43379 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
+import java.util.ArrayList;
import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
@@ -28,6 +29,7 @@ import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.CloseClickHandler;
import com.smartgwt.client.widgets.events.CloseClientEvent;
@@ -48,14 +50,17 @@ import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryDataSource.Field;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
@@ -190,6 +195,46 @@ public class HistoryPluginConfigurationView extends TableSection<HistoryPluginCo
});
}
});
+
+ addTableAction(extendLocatorId("Compare"), MSG.common_button_compare(), null, new AbstractTableAction(
+ TableActionEnablement.MULTIPLE) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ ArrayList<PluginConfigurationUpdate> configs = new ArrayList<PluginConfigurationUpdate>();
+ for (ListGridRecord record : selection) {
+ PluginConfigurationUpdate update = (PluginConfigurationUpdate) record
+ .getAttributeAsObject(DataSource.OBJECT);
+ configs.add(update);
+ }
+ ConfigurationComparisonView.displayComparisonDialog(configs);
+ }
+ });
+
+ addTableAction(extendLocatorId("Rollback"), MSG.view_connectionSettingsHistory_table_rollback(), MSG
+ .common_msg_areYouSure(), new AbstractTableAction(
+ this.resourcePerms.isInventory() ? TableActionEnablement.SINGLE : TableActionEnablement.NEVER) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ if (selection != null && selection.length == 1) {
+ ListGridRecord record = selection[0];
+ GWTServiceLookup.getConfigurationService().rollbackPluginConfiguration(resource.getId(),
+ record.getAttributeAsInt(Field.ID).intValue(), new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_connectionSettingsHistory_table_rollback_success(),
+ Severity.Info));
+ refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_connectionSettingsHistory_table_rollback_failure(), caught);
+ }
+ });
+ }
+ }
+ });
+
}
private String getStatusHtmlString(Record record) {
@@ -283,4 +328,10 @@ public class HistoryPluginConfigurationView extends TableSection<HistoryPluginCo
});
}
}
+
+ @Override
+ public Canvas getDetailsView(int id) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index a301b44..ff848de 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -78,6 +78,15 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
@Override
+ public void rollbackPluginConfiguration(int resourceId, int configHistoryId) throws RuntimeException {
+ try {
+ configurationManager.rollbackPluginConfiguration(getSessionSubject(), resourceId, configHistoryId);
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ @Override
public ResourceConfigurationUpdate getLatestResourceConfigurationUpdate(int resourceId) throws RuntimeException {
try {
ResourceConfigurationUpdate update = configurationManager.getLatestResourceConfigurationUpdate(
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 401359f..951f0b9 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
@@ -1731,9 +1731,12 @@ view_connectionSettingsDetails_somePropertiesInvalid = The following connection
#-----------------------------------------
view_connectionSettingsHistory_view_noperm = You do not have permissions to see the connection settings
view_connectionSettingsHistory_view_connProperties = Connection Properties
+view_connectionSettingsHistory_table_rollback = Rollback
+view_connectionSettingsHistory_table_rollback_success = You successfully rolled back the resource configuration to the selected past configuration.
+view_connectionSettingsHistory_table_rollback_failure = Failed to rollback the configuration. The original configuration is still in effect.
view_connectionSettingsHistory_table_failFetch = Failed to get plugin config history
view_connectionSettingsHistory_table_statusDetails = Status Details
-view_connectionSettingsHistory_table_deleteSuccessful = You have deleted [{0}] history items
+view_connectionSettingsHistory_table_deleteSuccessful = You have successfully deleted [{0}] history items
view_connectionSettingsHistory_table_deleteFailure = Failed to delete plugin configuration history
view_connectionSettingsHistory_table_statusSuccess = This configuration update was successful
view_connectionSettingsHistory_table_statusInprogress = This configuration update is still in progress
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 5c82990..1552162 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -1184,6 +1184,19 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
}
+ public void rollbackPluginConfiguration(Subject subject, int resourceId, int configHistoryId)
+ throws ConfigurationUpdateException {
+ PluginConfigurationUpdate configurationUpdateHistory = entityManager.find(PluginConfigurationUpdate.class,
+ configHistoryId);
+ Configuration configuration = configurationUpdateHistory.getConfiguration();
+ if (configuration == null) {
+ throw new ConfigurationUpdateException("No plugin configuration history element exists with id = '"
+ + configHistoryId + "'");
+ }
+
+ updatePluginConfiguration(subject, resourceId, configuration);
+ }
+
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public ResourceConfigurationUpdate persistNewResourceConfigurationUpdateHistory(Subject subject, int resourceId,
Configuration newConfiguration, ConfigurationUpdateStatus newStatus, String newSubject,
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index 37d8a06..018b6eb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -165,6 +165,24 @@ public interface ConfigurationManagerLocal {
throws ConfigurationUpdateException;
/**
+ * This method is called when a user has requested to change the plugin configuration for an existing resource to
+ * one of its previous values. If the user does not have the proper permissions to change the resource's
+ * plugin configuration, an exception is thrown.
+ *
+ * <p>This will not wait for the agent to finish the configuration update. This will return after the request is
+ * sent. Once the agent finishes with the request, it will send the completed request information to
+ * {@link #completePluginConfigurationUpdate}.</p>
+ *
+ * @param subject the user who is requesting the update
+ * @param resourceId identifies the resource to be updated
+ * @param configHistoryId the id of the resource's previous configuration to rollback to
+ *
+ * @throws ConfigurationUpdateException if the configHistoryId does not exist
+ */
+ void rollbackPluginConfiguration(Subject subject, int resourceId, int configHistoryId)
+ throws ConfigurationUpdateException;
+
+ /**
* For internal use only - do not call this method. This is for
* {@link #updateResourceConfiguration(Subject, int, Configuration)} to call with REQUIRES_NEW transaction scope so
* it can force the new request to be committed to the DB. Also used by
commit 2d043745134c1f4e35065e6197b18711156f5820
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 15:01:51 2011 -0500
dont' refresh the entire ui, just the table
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 837206b..cf83667 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -173,7 +173,7 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_configurationHistoryList_rollback_success(), Severity.Info));
- CoreGUI.refresh();
+ refresh();
}
@Override
@@ -190,7 +190,7 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_configurationHistoryList_delete_success(), Severity.Info));
- CoreGUI.refresh();
+ refresh();
}
@Override
commit fd3ea15d142423479c30eacdcbeaecabbde0fe56
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 14:33:16 2011 -0500
remove unused imports
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractConfigurationUpdate.java
index 79c0145..c6d5cbf 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractConfigurationUpdate.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractConfigurationUpdate.java
@@ -22,8 +22,6 @@
*/
package org.rhq.core.domain.configuration;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
import java.io.Serializable;
import javax.persistence.CascadeType;
@@ -244,7 +242,8 @@ public abstract class AbstractConfigurationUpdate implements Serializable {
@Override
public String toString() {
- StringBuilder str = new StringBuilder(this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".")+1));
+ StringBuilder str = new StringBuilder(this.getClass().getName().substring(
+ this.getClass().getName().lastIndexOf(".") + 1));
str.append("[status=").append(this.status);
str.append(", configuration=").append(this.configuration);
str.append(", subjectName=").append(this.subjectName);
commit 7966ffef9b662085ad2ac066a5665d74ed3ef106
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 14:32:57 2011 -0500
adding auth check to res config history views
more coding for plugin config history views (not done yet)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index d5da970..a1b2fc3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -146,8 +146,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
.view_tabs_common_child_history()), null);
inventoryConn = new SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), new ViewName(
"ConnectionSettings", MSG.view_tabs_common_connectionSettings()), null);
- inventoryConnHistory = new SubTab(inventoryTab.extendLocatorId("ConnSetHist"), new ViewName(
- "ConnectionSettingsHistory", MSG.view_tabs_common_connectionSettingsHistory()), null);
+ inventoryConnHistory = new SubTab(inventoryTab.extendLocatorId("ConnSetHist"),
+ HistoryPluginConfigurationView.VIEW_ID, null);
inventoryGroups = new SubTab(inventoryTab.extendLocatorId("Groups"), new ViewName("Groups", MSG
.view_tabs_common_groups()), null);
inventoryAgent = new SubTab(inventoryTab.extendLocatorId("Agent"), new ViewName("Agent", MSG
@@ -365,7 +365,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
.extendLocatorId("ResourceConfigView"), resourceComposite), true, true);
updateSubTab(this.configurationTab, this.configHistory, ConfigurationHistoryView.getHistoryOf(this
- .extendLocatorId("ConfigHistView"), resource.getId()), true, true);
+ .extendLocatorId("ConfigHistView"), this.resourceComposite.getResourcePermission().isConfigureWrite(),
+ resource.getId()), true, true);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 5e7bc9e..837206b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -54,12 +54,14 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
.view_configurationHistoryList_title());
private Integer resourceId;
+ private boolean hasWritePerm; // can delete history or rollback to a previous config
/**
* Use this constructor to view config histories for all viewable Resources.
*/
- public ConfigurationHistoryView(String locatorId) {
+ public ConfigurationHistoryView(String locatorId, boolean hasWritePerm) {
super(locatorId, VIEW_ID.getTitle());
+ this.hasWritePerm = hasWritePerm;
this.resourceId = null;
ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
setDataSource(datasource);
@@ -70,8 +72,9 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
*
* @param resourceId a Resource ID
*/
- public ConfigurationHistoryView(String locatorId, int resourceId) {
+ public ConfigurationHistoryView(String locatorId, boolean hasWritePerm, int resourceId) {
super(locatorId, VIEW_ID.getTitle(), createCriteria(resourceId));
+ this.hasWritePerm = hasWritePerm;
this.resourceId = resourceId;
ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
setDataSource(datasource);
@@ -90,7 +93,7 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
getListGrid().sort(Field.ID, SortDirection.DESCENDING);
addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
- new AbstractTableAction(TableActionEnablement.ANY) {
+ new AbstractTableAction(hasWritePerm ? TableActionEnablement.ANY : TableActionEnablement.NEVER) {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
if (selection != null && selection.length > 0) {
int[] doomedIds = new int[selection.length];
@@ -123,7 +126,8 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
});
addTableAction(extendLocatorId("Rollback"), MSG.view_configurationHistoryList_rollback(), MSG
- .common_msg_areYouSure(), new AbstractTableAction(TableActionEnablement.SINGLE) {
+ .common_msg_areYouSure(), new AbstractTableAction(hasWritePerm ? TableActionEnablement.SINGLE
+ : TableActionEnablement.NEVER) {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
if (selection != null && selection.length == 1) {
ListGridRecord record = selection[0];
@@ -198,8 +202,8 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
// -------- Static Utility loaders ------------
- public static ConfigurationHistoryView getHistoryOf(String locatorId, int resourceId) {
- return new ConfigurationHistoryView(locatorId, resourceId);
+ public static ConfigurationHistoryView getHistoryOf(String locatorId, boolean hasWritePerm, int resourceId) {
+ return new ConfigurationHistoryView(locatorId, hasWritePerm, resourceId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationTable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationTable.java
deleted file mode 100644
index 1e6ccb4..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationTable.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
-
-import java.util.Date;
-import java.util.EnumSet;
-import java.util.HashMap;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
-import com.smartgwt.client.widgets.grid.HoverCustomizer;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-
-import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
-import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
-import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
-import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.core.domain.resource.composite.ResourcePermission;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
-import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
-
-/**
- * Table showing resource plugin configuration history.
- *
- * @author John Mazzitelli
- */
-public class HistoryPluginConfigurationTable extends Table<HistoryPluginConfigurationTable.DataSource> {
- private final Resource resource;
- private final ResourcePermission resourcePerms;
-
- public HistoryPluginConfigurationTable(String locatorId, ResourceComposite composite) {
- super(locatorId, MSG.view_connectionSettingsHistory_table_title());
- this.resource = composite.getResource();
- this.resourcePerms = composite.getResourcePermission();
-
- setDataSource(new DataSource());
- }
-
- @Override
- protected void configureTable() {
- ListGridField fieldId = new ListGridField(DataSource.ID, MSG.common_title_version());
- ListGridField fieldDateCreated = new ListGridField(DataSource.DATE_CREATED, MSG.common_title_dateCreated());
- ListGridField fieldLastUpdated = new ListGridField(DataSource.LAST_UPDATED, MSG.common_title_lastUpdated());
- ListGridField fieldUser = new ListGridField(DataSource.USER, MSG.common_title_user());
- ListGridField fieldStatus = new ListGridField(DataSource.STATUS, MSG.common_title_status());
-
- fieldId.setWidth("10%");
- fieldDateCreated.setWidth("35%");
- fieldLastUpdated.setWidth("35%");
- fieldUser.setWidth("*");
- fieldStatus.setWidth("10%");
-
- fieldStatus.setType(ListGridFieldType.ICON);
- HashMap<String, String> statusIcons = new HashMap<String, String>(4);
- statusIcons.put(ConfigurationUpdateStatus.SUCCESS.name(), ImageManager
- .getPluginConfigurationIcon(ConfigurationUpdateStatus.SUCCESS));
- statusIcons.put(ConfigurationUpdateStatus.FAILURE.name(), ImageManager
- .getPluginConfigurationIcon(ConfigurationUpdateStatus.FAILURE));
- statusIcons.put(ConfigurationUpdateStatus.INPROGRESS.name(), ImageManager
- .getPluginConfigurationIcon(ConfigurationUpdateStatus.INPROGRESS));
- statusIcons.put(ConfigurationUpdateStatus.NOCHANGE.name(), ImageManager
- .getPluginConfigurationIcon(ConfigurationUpdateStatus.NOCHANGE));
- fieldStatus.setValueIcons(statusIcons);
- fieldStatus.addRecordClickHandler(new RecordClickHandler() {
- @Override
- public void onRecordClick(RecordClickEvent event) {
- final Window winModal = new LocatableWindow(HistoryPluginConfigurationTable.this
- .extendLocatorId("statusDetailsWin"));
- winModal.setTitle(MSG.view_connectionSettingsHistory_table_statusDetails());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setShowMaximizeButton(true);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setAutoSize(true);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- LocatableHTMLPane htmlPane = new LocatableHTMLPane(HistoryPluginConfigurationTable.this
- .extendLocatorId("statusDetailsPane"));
- htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(500);
- htmlPane.setDefaultHeight(400);
- htmlPane.setContents(getStatusHtmlString(event.getRecord()));
- winModal.addItem(htmlPane);
- winModal.show();
- }
- });
- fieldStatus.setShowHover(true);
- fieldStatus.setHoverCustomizer(new HoverCustomizer() {
- @Override
- public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
- String html = getStatusHtmlString(record);
- return html;
- }
- });
-
- ListGrid listGrid = getListGrid();
- listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldUser, fieldStatus);
-
- addTableAction(extendLocatorId("deleteAction"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
- new AbstractTableAction(this.resourcePerms.isInventory() ? TableActionEnablement.ANY
- : TableActionEnablement.NEVER) {
-
- @Override
- public void executeAction(final ListGridRecord[] selection, Object actionValue) {
- if (selection == null || selection.length == 0) {
- return;
- }
-
- ConfigurationGWTServiceAsync service = GWTServiceLookup.getConfigurationService();
- int[] updateIds = new int[selection.length];
- int i = 0;
- for (ListGridRecord record : selection) {
- updateIds[i++] = record.getAttributeAsInt(DataSource.ID).intValue();
- }
-
- service.purgePluginConfigurationUpdates(updateIds, true, new AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- refresh();
- Message message = new Message(
- MSG.view_connectionSettingsHistory_table_deleteSuccessful(String
- .valueOf(selection.length)), Message.Severity.Info, EnumSet.of(
- Message.Option.Transient, Message.Option.Sticky));
- CoreGUI.getMessageCenter().notify(message);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_connectionSettingsHistory_table_deleteFailure(), caught);
- }
- });
- }
- });
- }
-
- private String getStatusHtmlString(Record record) {
- String html = null;
- AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record.getAttributeAsObject(DataSource.OBJECT);
- switch (obj.getStatus()) {
- case SUCCESS: {
- html = MSG.view_connectionSettingsHistory_table_statusSuccess();
- break;
- }
- case INPROGRESS: {
- html = "<p>" + MSG.view_connectionSettingsHistory_table_statusInprogress() + "</p>";
- break;
- }
- case NOCHANGE: {
- html = MSG.view_connectionSettingsHistory_table_statusNochange();
- break;
- }
- case FAILURE: {
- html = obj.getErrorMessage();
- if (html == null) {
- html = "<p>" + MSG.view_connectionSettingsHistory_table_statusFailure() + "</p>";
- } else {
- if (html.length() > 80) {
- // this was probably an error stack trace, snip it so the tooltip isn't too big
- html = "<pre>" + html.substring(0, 80) + "...</pre><p>"
- + MSG.view_connectionSettingsHistory_table_clickStatusIcon() + "</p>";
- } else {
- html = "<pre>" + html + "</pre>";
- }
- }
- break;
- }
- }
- return html;
- }
-
- class DataSource extends RPCDataSource<PluginConfigurationUpdate> {
-
- public static final String ID = "id";
- public static final String DATE_CREATED = "dateCreated";
- public static final String LAST_UPDATED = "lastUpdated";
- public static final String USER = "user";
- public static final String STATUS = "status";
- public static final String OBJECT = "object";
-
- @Override
- public PluginConfigurationUpdate copyValues(Record from) {
- return (PluginConfigurationUpdate) from.getAttributeAsObject(DataSource.OBJECT);
- }
-
- @Override
- public ListGridRecord copyValues(PluginConfigurationUpdate from) {
- ListGridRecord record = new ListGridRecord();
-
- record.setAttribute(DataSource.ID, from.getId());
- record.setAttribute(DataSource.DATE_CREATED, new Date(from.getCreatedTime()));
- record.setAttribute(DataSource.LAST_UPDATED, new Date(from.getModifiedTime()));
- record.setAttribute(DataSource.USER, from.getSubjectName());
- record.setAttribute(DataSource.STATUS, from.getStatus().name());
-
- record.setAttribute(DataSource.OBJECT, from);
-
- return record;
- }
-
- @Override
- protected void executeFetch(final DSRequest request, final DSResponse response) {
- ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
-
- PluginConfigurationUpdateCriteria criteria = new PluginConfigurationUpdateCriteria();
- criteria.addFilterResourceIds(HistoryPluginConfigurationTable.this.resource.getId());
-
- configurationService.findPluginConfigurationUpdatesByCriteria(criteria,
- new AsyncCallback<PageList<PluginConfigurationUpdate>>() {
-
- @Override
- public void onSuccess(PageList<PluginConfigurationUpdate> result) {
- response.setData(buildRecords(result));
- response.setTotalRows(result.getTotalSize());
- processResponse(request.getRequestId(), response);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_connectionSettingsHistory_table_failFetch(),
- caught);
- response.setStatus(DSResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
- });
- }
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
new file mode 100644
index 0000000..ea03013
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
@@ -0,0 +1,286 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
+
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
+import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
+
+/**
+ * Table showing resource plugin configuration history.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryPluginConfigurationView extends TableSection<HistoryPluginConfigurationView.DataSource> {
+ public static final ViewName VIEW_ID = new ViewName("ConnectionSettings", MSG
+ .view_tabs_common_connectionSettingsHistory());
+
+ private final Resource resource;
+ private final ResourcePermission resourcePerms;
+
+ public HistoryPluginConfigurationView(String locatorId, ResourceComposite composite) {
+ super(locatorId, VIEW_ID.getTitle());
+ this.resource = composite.getResource();
+ this.resourcePerms = composite.getResourcePermission();
+
+ setDataSource(new DataSource());
+ }
+
+ @Override
+ protected String getDetailsLinkColumnName() {
+ return DataSource.ID;
+ }
+
+ @Override
+ protected void configureTable() {
+ ListGridField fieldId = new ListGridField(DataSource.ID, MSG.common_title_version());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.DATE_CREATED, MSG.common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.LAST_UPDATED, MSG.common_title_lastUpdated());
+ ListGridField fieldStatus = new ListGridField(DataSource.STATUS, MSG.common_title_status());
+ ListGridField fieldUser = new ListGridField(DataSource.USER, MSG.common_title_user());
+
+ fieldId.setWidth("10%");
+ fieldDateCreated.setWidth("35%");
+ fieldLastUpdated.setWidth("35%");
+ fieldStatus.setWidth("10%");
+ fieldUser.setWidth("*");
+
+ fieldStatus.setType(ListGridFieldType.ICON);
+ HashMap<String, String> statusIcons = new HashMap<String, String>(4);
+ statusIcons.put(ConfigurationUpdateStatus.SUCCESS.name(), ImageManager
+ .getPluginConfigurationIcon(ConfigurationUpdateStatus.SUCCESS));
+ statusIcons.put(ConfigurationUpdateStatus.FAILURE.name(), ImageManager
+ .getPluginConfigurationIcon(ConfigurationUpdateStatus.FAILURE));
+ statusIcons.put(ConfigurationUpdateStatus.INPROGRESS.name(), ImageManager
+ .getPluginConfigurationIcon(ConfigurationUpdateStatus.INPROGRESS));
+ statusIcons.put(ConfigurationUpdateStatus.NOCHANGE.name(), ImageManager
+ .getPluginConfigurationIcon(ConfigurationUpdateStatus.NOCHANGE));
+ fieldStatus.setValueIcons(statusIcons);
+ fieldStatus.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ final Window winModal = new LocatableWindow(HistoryPluginConfigurationView.this
+ .extendLocatorId("statusDetailsWin"));
+ winModal.setTitle(MSG.view_connectionSettingsHistory_table_statusDetails());
+ winModal.setOverflow(Overflow.VISIBLE);
+ winModal.setShowMinimizeButton(false);
+ winModal.setShowMaximizeButton(true);
+ winModal.setIsModal(true);
+ winModal.setShowModalMask(true);
+ winModal.setAutoSize(true);
+ winModal.setAutoCenter(true);
+ winModal.setShowResizer(true);
+ winModal.setCanDragResize(true);
+ winModal.centerInPage();
+ winModal.addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ winModal.markForDestroy();
+ }
+ });
+
+ LocatableHTMLPane htmlPane = new LocatableHTMLPane(HistoryPluginConfigurationView.this
+ .extendLocatorId("statusDetailsPane"));
+ htmlPane.setMargin(10);
+ htmlPane.setDefaultWidth(500);
+ htmlPane.setDefaultHeight(400);
+ htmlPane.setContents(getStatusHtmlString(event.getRecord()));
+ winModal.addItem(htmlPane);
+ winModal.show();
+ }
+ });
+ fieldStatus.setShowHover(true);
+ fieldStatus.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String html = getStatusHtmlString(record);
+ return html;
+ }
+ });
+
+ ListGrid listGrid = getListGrid();
+ listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
+
+ addTableAction(extendLocatorId("deleteAction"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ new AbstractTableAction(this.resourcePerms.isInventory() ? TableActionEnablement.ANY
+ : TableActionEnablement.NEVER) {
+
+ @Override
+ public void executeAction(final ListGridRecord[] selection, Object actionValue) {
+ if (selection == null || selection.length == 0) {
+ return;
+ }
+
+ ConfigurationGWTServiceAsync service = GWTServiceLookup.getConfigurationService();
+ int[] updateIds = new int[selection.length];
+ int i = 0;
+ for (ListGridRecord record : selection) {
+ updateIds[i++] = record.getAttributeAsInt(DataSource.ID).intValue();
+ }
+
+ service.purgePluginConfigurationUpdates(updateIds, true, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ refresh();
+ Message message = new Message(
+ MSG.view_connectionSettingsHistory_table_deleteSuccessful(String
+ .valueOf(selection.length)), Message.Severity.Info, EnumSet.of(
+ Message.Option.Transient, Message.Option.Sticky));
+ CoreGUI.getMessageCenter().notify(message);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_connectionSettingsHistory_table_deleteFailure(), caught);
+ }
+ });
+ }
+ });
+ }
+
+ private String getStatusHtmlString(Record record) {
+ String html = null;
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record.getAttributeAsObject(DataSource.OBJECT);
+ switch (obj.getStatus()) {
+ case SUCCESS: {
+ html = MSG.view_connectionSettingsHistory_table_statusSuccess();
+ break;
+ }
+ case INPROGRESS: {
+ html = "<p>" + MSG.view_connectionSettingsHistory_table_statusInprogress() + "</p>";
+ break;
+ }
+ case NOCHANGE: {
+ html = MSG.view_connectionSettingsHistory_table_statusNochange();
+ break;
+ }
+ case FAILURE: {
+ html = obj.getErrorMessage();
+ if (html == null) {
+ html = "<p>" + MSG.view_connectionSettingsHistory_table_statusFailure() + "</p>";
+ } else {
+ if (html.length() > 80) {
+ // this was probably an error stack trace, snip it so the tooltip isn't too big
+ html = "<pre>" + html.substring(0, 80) + "...</pre><p>"
+ + MSG.view_connectionSettingsHistory_table_clickStatusIcon() + "</p>";
+ } else {
+ html = "<pre>" + html + "</pre>";
+ }
+ }
+ break;
+ }
+ }
+ return html;
+ }
+
+ class DataSource extends RPCDataSource<PluginConfigurationUpdate> {
+
+ public static final String ID = "id";
+ public static final String DATE_CREATED = "dateCreated";
+ public static final String LAST_UPDATED = "lastUpdated";
+ public static final String USER = "user";
+ public static final String STATUS = "status";
+ public static final String OBJECT = "object";
+
+ @Override
+ public PluginConfigurationUpdate copyValues(Record from) {
+ return (PluginConfigurationUpdate) from.getAttributeAsObject(DataSource.OBJECT);
+ }
+
+ @Override
+ public ListGridRecord copyValues(PluginConfigurationUpdate from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(DataSource.ID, from.getId());
+ record.setAttribute(DataSource.DATE_CREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(DataSource.LAST_UPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(DataSource.USER, from.getSubjectName());
+ record.setAttribute(DataSource.STATUS, from.getStatus().name());
+
+ record.setAttribute(DataSource.OBJECT, from);
+
+ return record;
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+ PluginConfigurationUpdateCriteria criteria = new PluginConfigurationUpdateCriteria();
+ criteria.addFilterResourceIds(HistoryPluginConfigurationView.this.resource.getId());
+
+ configurationService.findPluginConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<PluginConfigurationUpdate>>() {
+
+ @Override
+ public void onSuccess(PageList<PluginConfigurationUpdate> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_connectionSettingsHistory_table_failFetch(),
+ caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index 7a29da1..b82603f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -113,7 +113,8 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
NavigationItem recentConfigurationChangesItem = new NavigationItem(ConfigurationHistoryView.VIEW_ID,
"subsystems/configure/Configure_16.png", new ViewFactory() {
public Canvas createView() {
- return new ConfigurationHistoryView(extendLocatorId(ConfigurationHistoryView.VIEW_ID.getName()));
+ return new ConfigurationHistoryView(extendLocatorId(ConfigurationHistoryView.VIEW_ID.getName()),
+ getGlobalPermissions().contains(Permission.MANAGE_INVENTORY));
}
});
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 dbf48f4..401359f 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
@@ -1732,7 +1732,6 @@ view_connectionSettingsDetails_somePropertiesInvalid = The following connection
view_connectionSettingsHistory_view_noperm = You do not have permissions to see the connection settings
view_connectionSettingsHistory_view_connProperties = Connection Properties
view_connectionSettingsHistory_table_failFetch = Failed to get plugin config history
-view_connectionSettingsHistory_table_title = Connection Settings History
view_connectionSettingsHistory_table_statusDetails = Status Details
view_connectionSettingsHistory_table_deleteSuccessful = You have deleted [{0}] history items
view_connectionSettingsHistory_table_deleteFailure = Failed to delete plugin configuration history
commit f98ee8d204fb4a403bf14a266f7cf94295589a64
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 13:52:12 2011 -0500
remove this file, the table will be the view now (will check that in separately)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
deleted file mode 100644
index ff35b3e..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
-
-import com.smartgwt.client.widgets.Canvas;
-
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.ViewPath;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-
-/**
- * A view for resource plugin configuration history.
- *
- * @author John Mazzitelli
- */
-public class HistoryPluginConfigurationView extends LocatableVLayout implements BookmarkableView {
- private final ResourceComposite resourceComposite;
- private HistoryPluginConfigurationTable historyTable;
- private Canvas detailsCanvas = null;
-
- public HistoryPluginConfigurationView(String locatorId, ResourceComposite composite) {
- super(locatorId);
- this.resourceComposite = composite;
-
- historyTable = new HistoryPluginConfigurationTable(extendLocatorId("Table"), composite);
- addMember(historyTable);
- }
-
- @Override
- public void renderView(ViewPath viewPath) {
- if (viewPath.isEnd()) {
- setVisibleMember(this.historyTable);
- } else {
- int historyId = viewPath.getCurrentAsInt();
-
- if (detailsCanvas != null) {
- removeMember(detailsCanvas);
- this.detailsCanvas.destroy();
- }
-
- detailsCanvas = new HistoryPluginConfigurationSettings(extendLocatorId("SettingsView"),
- this.resourceComposite, historyId);
-
- addMember(detailsCanvas);
- setVisibleMember(detailsCanvas);
- }
- }
-}
commit bd5178f61a91718655ddd086a278810cdabe0422
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 13:42:44 2011 -0500
the start of the resource plugin config history pages
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 5ea1c98..d010c41 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
@@ -83,6 +83,10 @@ public class LinkManager {
}
}
+ public static String getResourcePluginConfigurationUpdateHistoryLink(int groupId) {
+ return getResourceLink(groupId) + "/Inventory/ConnectionSettingsHistory";
+ }
+
public static String getGroupPluginConfigurationUpdateHistoryLink(int groupId) {
return getResourceGroupLink(groupId) + "/Inventory/ConnectionSettingsHistory";
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index 25bc2dd..45bd2c4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -21,11 +21,13 @@ import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
/**
- *
+ * API for resource and plugin configurations for resources and groups.
*/
@RemoteServiceRelativePath("ConfigurationGWTService")
public interface ConfigurationGWTService extends RemoteService {
+ void purgePluginConfigurationUpdates(int[] configUpdateIds, boolean purgeInProgress) throws RuntimeException;
+
void purgeResourceConfigurationUpdates(int[] configUpdateIds, boolean purgeInProgress) throws RuntimeException;
void rollbackResourceConfiguration(int resourceId, int configHistoryId) throws RuntimeException;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 8e6bc32..d5da970 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -58,6 +58,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceComposit
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ResourceConfigurationEditView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.HistoryPluginConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.ResourceResourceAgentView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
@@ -280,7 +281,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.inventoryTab, this.inventoryConn, canvas, visible, true);
// same test, use above setting for 'visible'
- canvas = (visible) ? new Canvas() : null; // TODO: Add real canvas when visible
+ canvas = (visible) ? new HistoryPluginConfigurationView(this.inventoryConnHistory.extendLocatorId("View"),
+ this.resourceComposite) : null;
updateSubTab(this.inventoryTab, this.inventoryConnHistory, canvas, visible, true);
boolean canModifyMembership = globalPermissions.contains(Permission.MANAGE_INVENTORY);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationSettings.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationSettings.java
new file mode 100644
index 0000000..506e130
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationSettings.java
@@ -0,0 +1,139 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
+
+import java.util.EnumSet;
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * Read only view that shows resource plugin configuration properties.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryPluginConfigurationSettings extends LocatableVLayout {
+ private final Resource resource;
+ private final ResourcePermission resourcePerms;
+ private final int resourceUpdateId;
+ private ConfigurationDefinition configurationDefinition;
+ private Configuration resourceConfiguration;
+ private ConfigurationEditor editor;
+
+ public HistoryPluginConfigurationSettings(String locatorId, ResourceComposite composite, int updateId) {
+ super(locatorId);
+ this.resource = composite.getResource();
+ this.resourcePerms = composite.getResourcePermission();
+ this.resourceUpdateId = updateId;
+
+ setMargin(5);
+ setMembersMargin(5);
+ String backPath = LinkManager.getResourcePluginConfigurationUpdateHistoryLink(this.resource.getId());
+ BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
+ backPath);
+ addMember(backButton);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ if (this.resourcePerms.isInventory()) {
+ loadConfigurationDefinition();
+ loadConfiguration();
+ } else {
+ CoreGUI.getMessageCenter().notify(new Message(MSG.view_connectionSettingsHistory_view_noperm()));
+ }
+ }
+
+ private void initEditor() {
+ if (this.configurationDefinition != null && this.resourceConfiguration != null) {
+ this.editor = new ConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
+ this.resourceConfiguration);
+ this.editor.setEditorTitle(MSG.view_connectionSettingsHistory_view_connProperties() + " - "
+ + this.resourceUpdateId);
+ this.editor.setOverflow(Overflow.AUTO);
+ this.editor.setReadOnly(true);
+ addMember(this.editor);
+ }
+ }
+
+ private void loadConfigurationDefinition() {
+ if (this.configurationDefinition == null) {
+ final ResourceType type = this.resource.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
+ EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(Map<Integer, ResourceType> types) {
+ configurationDefinition = types.get(type.getId()).getPluginConfigurationDefinition();
+ if (configurationDefinition == null) {
+ throw new IllegalStateException("Connection settings are not supported by this group.");
+ }
+ initEditor();
+ }
+ });
+ }
+ }
+
+ private void loadConfiguration() {
+ this.resourceConfiguration = null;
+
+ PluginConfigurationUpdateCriteria criteria = new PluginConfigurationUpdateCriteria();
+ criteria.addFilterId(resourceUpdateId);
+ criteria.fetchConfiguration(true);
+
+ GWTServiceLookup.getConfigurationService().findPluginConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<PluginConfigurationUpdate>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_connectionSettingsHistory_settings_fetchFailure(resource.getName()), caught);
+ }
+
+ public void onSuccess(PageList<PluginConfigurationUpdate> results) {
+ if (results != null && results.size() > 0) {
+ resourceConfiguration = results.get(0).getConfiguration();
+ initEditor();
+ } else {
+ // should never really happen
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_connectionSettingsHistory_settings_fetchFailure(resource.getName()),
+ new Throwable("bad results"));
+ }
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationTable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationTable.java
new file mode 100644
index 0000000..1e6ccb4
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationTable.java
@@ -0,0 +1,277 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
+
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
+import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
+
+/**
+ * Table showing resource plugin configuration history.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryPluginConfigurationTable extends Table<HistoryPluginConfigurationTable.DataSource> {
+ private final Resource resource;
+ private final ResourcePermission resourcePerms;
+
+ public HistoryPluginConfigurationTable(String locatorId, ResourceComposite composite) {
+ super(locatorId, MSG.view_connectionSettingsHistory_table_title());
+ this.resource = composite.getResource();
+ this.resourcePerms = composite.getResourcePermission();
+
+ setDataSource(new DataSource());
+ }
+
+ @Override
+ protected void configureTable() {
+ ListGridField fieldId = new ListGridField(DataSource.ID, MSG.common_title_version());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.DATE_CREATED, MSG.common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.LAST_UPDATED, MSG.common_title_lastUpdated());
+ ListGridField fieldUser = new ListGridField(DataSource.USER, MSG.common_title_user());
+ ListGridField fieldStatus = new ListGridField(DataSource.STATUS, MSG.common_title_status());
+
+ fieldId.setWidth("10%");
+ fieldDateCreated.setWidth("35%");
+ fieldLastUpdated.setWidth("35%");
+ fieldUser.setWidth("*");
+ fieldStatus.setWidth("10%");
+
+ fieldStatus.setType(ListGridFieldType.ICON);
+ HashMap<String, String> statusIcons = new HashMap<String, String>(4);
+ statusIcons.put(ConfigurationUpdateStatus.SUCCESS.name(), ImageManager
+ .getPluginConfigurationIcon(ConfigurationUpdateStatus.SUCCESS));
+ statusIcons.put(ConfigurationUpdateStatus.FAILURE.name(), ImageManager
+ .getPluginConfigurationIcon(ConfigurationUpdateStatus.FAILURE));
+ statusIcons.put(ConfigurationUpdateStatus.INPROGRESS.name(), ImageManager
+ .getPluginConfigurationIcon(ConfigurationUpdateStatus.INPROGRESS));
+ statusIcons.put(ConfigurationUpdateStatus.NOCHANGE.name(), ImageManager
+ .getPluginConfigurationIcon(ConfigurationUpdateStatus.NOCHANGE));
+ fieldStatus.setValueIcons(statusIcons);
+ fieldStatus.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ final Window winModal = new LocatableWindow(HistoryPluginConfigurationTable.this
+ .extendLocatorId("statusDetailsWin"));
+ winModal.setTitle(MSG.view_connectionSettingsHistory_table_statusDetails());
+ winModal.setOverflow(Overflow.VISIBLE);
+ winModal.setShowMinimizeButton(false);
+ winModal.setShowMaximizeButton(true);
+ winModal.setIsModal(true);
+ winModal.setShowModalMask(true);
+ winModal.setAutoSize(true);
+ winModal.setAutoCenter(true);
+ winModal.setShowResizer(true);
+ winModal.setCanDragResize(true);
+ winModal.centerInPage();
+ winModal.addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ winModal.markForDestroy();
+ }
+ });
+
+ LocatableHTMLPane htmlPane = new LocatableHTMLPane(HistoryPluginConfigurationTable.this
+ .extendLocatorId("statusDetailsPane"));
+ htmlPane.setMargin(10);
+ htmlPane.setDefaultWidth(500);
+ htmlPane.setDefaultHeight(400);
+ htmlPane.setContents(getStatusHtmlString(event.getRecord()));
+ winModal.addItem(htmlPane);
+ winModal.show();
+ }
+ });
+ fieldStatus.setShowHover(true);
+ fieldStatus.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String html = getStatusHtmlString(record);
+ return html;
+ }
+ });
+
+ ListGrid listGrid = getListGrid();
+ listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldUser, fieldStatus);
+
+ addTableAction(extendLocatorId("deleteAction"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ new AbstractTableAction(this.resourcePerms.isInventory() ? TableActionEnablement.ANY
+ : TableActionEnablement.NEVER) {
+
+ @Override
+ public void executeAction(final ListGridRecord[] selection, Object actionValue) {
+ if (selection == null || selection.length == 0) {
+ return;
+ }
+
+ ConfigurationGWTServiceAsync service = GWTServiceLookup.getConfigurationService();
+ int[] updateIds = new int[selection.length];
+ int i = 0;
+ for (ListGridRecord record : selection) {
+ updateIds[i++] = record.getAttributeAsInt(DataSource.ID).intValue();
+ }
+
+ service.purgePluginConfigurationUpdates(updateIds, true, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ refresh();
+ Message message = new Message(
+ MSG.view_connectionSettingsHistory_table_deleteSuccessful(String
+ .valueOf(selection.length)), Message.Severity.Info, EnumSet.of(
+ Message.Option.Transient, Message.Option.Sticky));
+ CoreGUI.getMessageCenter().notify(message);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_connectionSettingsHistory_table_deleteFailure(), caught);
+ }
+ });
+ }
+ });
+ }
+
+ private String getStatusHtmlString(Record record) {
+ String html = null;
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record.getAttributeAsObject(DataSource.OBJECT);
+ switch (obj.getStatus()) {
+ case SUCCESS: {
+ html = MSG.view_connectionSettingsHistory_table_statusSuccess();
+ break;
+ }
+ case INPROGRESS: {
+ html = "<p>" + MSG.view_connectionSettingsHistory_table_statusInprogress() + "</p>";
+ break;
+ }
+ case NOCHANGE: {
+ html = MSG.view_connectionSettingsHistory_table_statusNochange();
+ break;
+ }
+ case FAILURE: {
+ html = obj.getErrorMessage();
+ if (html == null) {
+ html = "<p>" + MSG.view_connectionSettingsHistory_table_statusFailure() + "</p>";
+ } else {
+ if (html.length() > 80) {
+ // this was probably an error stack trace, snip it so the tooltip isn't too big
+ html = "<pre>" + html.substring(0, 80) + "...</pre><p>"
+ + MSG.view_connectionSettingsHistory_table_clickStatusIcon() + "</p>";
+ } else {
+ html = "<pre>" + html + "</pre>";
+ }
+ }
+ break;
+ }
+ }
+ return html;
+ }
+
+ class DataSource extends RPCDataSource<PluginConfigurationUpdate> {
+
+ public static final String ID = "id";
+ public static final String DATE_CREATED = "dateCreated";
+ public static final String LAST_UPDATED = "lastUpdated";
+ public static final String USER = "user";
+ public static final String STATUS = "status";
+ public static final String OBJECT = "object";
+
+ @Override
+ public PluginConfigurationUpdate copyValues(Record from) {
+ return (PluginConfigurationUpdate) from.getAttributeAsObject(DataSource.OBJECT);
+ }
+
+ @Override
+ public ListGridRecord copyValues(PluginConfigurationUpdate from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(DataSource.ID, from.getId());
+ record.setAttribute(DataSource.DATE_CREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(DataSource.LAST_UPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(DataSource.USER, from.getSubjectName());
+ record.setAttribute(DataSource.STATUS, from.getStatus().name());
+
+ record.setAttribute(DataSource.OBJECT, from);
+
+ return record;
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+ PluginConfigurationUpdateCriteria criteria = new PluginConfigurationUpdateCriteria();
+ criteria.addFilterResourceIds(HistoryPluginConfigurationTable.this.resource.getId());
+
+ configurationService.findPluginConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<PluginConfigurationUpdate>>() {
+
+ @Override
+ public void onSuccess(PageList<PluginConfigurationUpdate> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_connectionSettingsHistory_table_failFetch(),
+ caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
new file mode 100644
index 0000000..ff35b3e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/HistoryPluginConfigurationView.java
@@ -0,0 +1,65 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
+
+import com.smartgwt.client.widgets.Canvas;
+
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A view for resource plugin configuration history.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryPluginConfigurationView extends LocatableVLayout implements BookmarkableView {
+ private final ResourceComposite resourceComposite;
+ private HistoryPluginConfigurationTable historyTable;
+ private Canvas detailsCanvas = null;
+
+ public HistoryPluginConfigurationView(String locatorId, ResourceComposite composite) {
+ super(locatorId);
+ this.resourceComposite = composite;
+
+ historyTable = new HistoryPluginConfigurationTable(extendLocatorId("Table"), composite);
+ addMember(historyTable);
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ if (viewPath.isEnd()) {
+ setVisibleMember(this.historyTable);
+ } else {
+ int historyId = viewPath.getCurrentAsInt();
+
+ if (detailsCanvas != null) {
+ removeMember(detailsCanvas);
+ this.detailsCanvas.destroy();
+ }
+
+ detailsCanvas = new HistoryPluginConfigurationSettings(extendLocatorId("SettingsView"),
+ this.resourceComposite, historyId);
+
+ addMember(detailsCanvas);
+ setVisibleMember(detailsCanvas);
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index 9668517..a301b44 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -31,7 +31,7 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
/**
- *
+ * API for resource and plugin configurations for resources and groups.
*/
public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implements ConfigurationGWTService {
@@ -47,6 +47,17 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
private ResourceGroupManagerLocal groupManager = LookupUtil.getResourceGroupManager();
+ @Override
+ public void purgePluginConfigurationUpdates(int[] configUpdateIds, boolean purgeInProgress) throws RuntimeException {
+ try {
+ this.configurationManager.purgePluginConfigurationUpdates(getSessionSubject(), configUpdateIds,
+ purgeInProgress);
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ @Override
public void purgeResourceConfigurationUpdates(int[] configUpdateIds, boolean purgeInProgress)
throws RuntimeException {
try {
@@ -57,6 +68,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public void rollbackResourceConfiguration(int resourceId, int configHistoryId) throws RuntimeException {
try {
configurationManager.rollbackResourceConfiguration(getSessionSubject(), resourceId, configHistoryId);
@@ -65,6 +77,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public ResourceConfigurationUpdate getLatestResourceConfigurationUpdate(int resourceId) throws RuntimeException {
try {
ResourceConfigurationUpdate update = configurationManager.getLatestResourceConfigurationUpdate(
@@ -75,6 +88,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public Configuration getPluginConfiguration(int resourceId) throws RuntimeException {
try {
Configuration configuration = configurationManager.getPluginConfiguration(getSessionSubject(), resourceId);
@@ -84,6 +98,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public ConfigurationDefinition getPluginConfigurationDefinition(int resourceTypeId) throws RuntimeException {
try {
ConfigurationDefinition definition = configurationManager.getPluginConfigurationDefinitionForResourceType(
@@ -94,6 +109,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public Configuration getResourceConfiguration(int resourceId) throws RuntimeException {
try {
Configuration configuration = configurationManager
@@ -104,6 +120,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public ConfigurationDefinition getResourceConfigurationDefinition(int resourceTypeId) throws RuntimeException {
try {
ConfigurationDefinition definition = configurationManager
@@ -114,6 +131,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdates(Integer resourceId, Long beginDate,
Long endDate, boolean suppressOldest, PageControl pc) throws RuntimeException {
try {
@@ -125,6 +143,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public ResourceConfigurationUpdate updateResourceConfiguration(int resourceId, Configuration configuration)
throws RuntimeException {
try {
@@ -136,6 +155,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public PluginConfigurationUpdate updatePluginConfiguration(int resourceId, Configuration configuration)
throws RuntimeException {
try {
@@ -147,6 +167,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdatesByCriteria(
ResourceConfigurationUpdateCriteria criteria) throws RuntimeException {
try {
@@ -158,6 +179,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public PageList<PluginConfigurationUpdate> findPluginConfigurationUpdatesByCriteria(
PluginConfigurationUpdateCriteria criteria) throws RuntimeException {
try {
@@ -169,6 +191,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public PageList<GroupResourceConfigurationUpdate> findGroupResourceConfigurationUpdatesByCriteria(
GroupResourceConfigurationUpdateCriteria criteria) throws RuntimeException {
try {
@@ -181,6 +204,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public PageList<GroupPluginConfigurationUpdate> findGroupPluginConfigurationUpdatesByCriteria(
GroupPluginConfigurationUpdateCriteria criteria) throws RuntimeException {
try {
@@ -192,6 +216,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public List<DisambiguationReport<ResourceConfigurationComposite>> findResourceConfigurationsForGroup(int groupId)
throws RuntimeException {
try {
@@ -212,6 +237,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroup(int groupId)
throws RuntimeException {
try {
@@ -231,6 +257,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroupUpdate(
int groupUpdateId) throws RuntimeException {
try {
@@ -250,6 +277,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public void updateResourceConfigurationsForGroup(int groupId,
List<ResourceConfigurationComposite> resourceConfigurations) throws RuntimeException {
try {
@@ -261,6 +289,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public void updatePluginConfigurationsForGroup(int groupId,
List<ResourceConfigurationComposite> pluginConfigurations) throws RuntimeException {
try {
@@ -272,6 +301,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public void deleteGroupPluginConfigurationUpdate(Integer groupId, Integer[] groupPluginConfigUpdateIds)
throws RuntimeException {
try {
@@ -282,6 +312,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
public void deleteGroupResourceConfigurationUpdate(Integer groupId, Integer[] groupResourceConfigUpdateIds)
throws RuntimeException {
try {
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 d2ad927..dbf48f4 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
@@ -1674,7 +1674,7 @@ view_group_resConfig_edit_saveFailure = Failed to initiate group configuration u
view_group_resConfig_edit_valid = All configuration properties have valid values, so the configuration can now be saved
view_group_resConfig_edit_invalid = The following configuration properties have invalid values and must be corrected before the configuration can be saved: [{0}]
view_group_pluginConfig_view_noperm = You do not have permissions to see the connection settings
-view_group_pluginConfig_view_groupProperties = Group Properties
+view_group_pluginConfig_view_groupProperties = Group Properties
view_group_pluginConfig_table_failFetch = Failed to get group plugin config history
view_group_pluginConfig_table_title = Group Connection Settings History
view_group_pluginConfig_table_statusDetails = Status Details
@@ -1727,6 +1727,22 @@ view_connectionSettingsDetails_messageDetailed_updateSuccess = Connection settin
view_connectionSettingsDetails_allPropertiesValid = All connection settings have valid values, so the settings can now be saved.
view_connectionSettingsDetails_somePropertiesInvalid = The following connection settings have invalid values: {0}. The values must be corrected before the settings can be saved.
+# Connection History
+#-----------------------------------------
+view_connectionSettingsHistory_view_noperm = You do not have permissions to see the connection settings
+view_connectionSettingsHistory_view_connProperties = Connection Properties
+view_connectionSettingsHistory_table_failFetch = Failed to get plugin config history
+view_connectionSettingsHistory_table_title = Connection Settings History
+view_connectionSettingsHistory_table_statusDetails = Status Details
+view_connectionSettingsHistory_table_deleteSuccessful = You have deleted [{0}] history items
+view_connectionSettingsHistory_table_deleteFailure = Failed to delete plugin configuration history
+view_connectionSettingsHistory_table_statusSuccess = This configuration update was successful
+view_connectionSettingsHistory_table_statusInprogress = This configuration update is still in progress
+view_connectionSettingsHistory_table_statusNochange = No changes were made to this configuration
+view_connectionSettingsHistory_table_statusFailure = This configuration update failed
+view_connectionSettingsHistory_table_clickStatusIcon = Click the status icon for full details
+view_connectionSettingsHistory_settings_fetchFailure = Failed to retrieve connection settings for [{0}]
+
# Resource Resource Groups
#-----------------------------------------
view_resourceResourceGroupList_error_fetchFailure = Failed to fetch Resource''s groups.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 4b99c06..5c82990 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -808,8 +808,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
long duration = request.getDuration();
if (duration > timeout) {
- log.info("Group Resource configuration update request seems to have been orphaned - timing it out: "
- + request);
+ log.info("Group Resource config update request seems to be orphaned - timing it out: " + request);
request.setErrorMessage("Timed out - did not complete after " + duration + " ms"
+ " (the timeout period was " + timeout + " ms)");
@@ -979,6 +978,19 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return;
}
+ public void purgePluginConfigurationUpdates(Subject subject, int[] configurationUpdateIds, boolean purgeInProgress) {
+ if ((configurationUpdateIds == null) || (configurationUpdateIds.length == 0)) {
+ return;
+ }
+
+ // TODO [mazz]: ugly - let's make this more efficient, just getting this to work first
+ for (int configurationUpdateId : configurationUpdateIds) {
+ purgePluginConfigurationUpdate(subject, configurationUpdateId, purgeInProgress);
+ }
+
+ return;
+ }
+
public void purgeResourceConfigurationUpdate(Subject subject, int configurationUpdateId, boolean purgeInProgress) {
ResourceConfigurationUpdate doomedRequest = entityManager.find(ResourceConfigurationUpdate.class,
configurationUpdateId);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index f2cab8a..37d8a06 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -201,9 +201,35 @@ public interface ConfigurationManagerLocal {
ConfigurationUpdateResponse executePluginConfigurationUpdate(PluginConfigurationUpdate update);
+ /**
+ * This deletes the update information belonging to the {@link AbstractResourceConfigurationUpdate} object with the
+ * given ID. Once this returns, the complete audit trail for that update will be gone and you will not be able to
+ * rollback to that configuration.
+ *
+ * <p>Under normal circumstances, you will not want to purge an update that is currently in progress. However, there
+ * may be conditions in which an update request "gets stuck" in the in-progress state, even though you know the
+ * agent will never report the completed request (typically caused by an unusual crash of the agent). In this case,
+ * you should pass <code>true</code> in for the <code>purgeInProgress</code> parameter to tell this method to delete
+ * the request even if it says it is in-progress.
+ *
+ * @param subject the user who is requesting the purge
+ * @param configurationUpdateId identifies the update record to be deleted
+ * @param purgeInProgress if <code>true</code>, delete it even if its
+ * {@link ConfigurationUpdateStatus#INPROGRESS in progress}
+ */
public void purgePluginConfigurationUpdate(Subject subject, int configurationUpdateId, boolean purgeInProgress);
/**
+ * This deletes one or more plugin configuration updates from the resource's plugin config history.
+ *
+ * @param subject the user who is requesting the purge
+ * @param configurationUpdateIds identifies the update records to be deleted
+ * @param purgeInProgress if <code>true</code>, delete those even if
+ * {@link ConfigurationUpdateStatus#INPROGRESS in progress}
+ */
+ void purgePluginConfigurationUpdates(Subject subject, int[] configurationUpdateIds, boolean purgeInProgress);
+
+ /**
* This deletes the update information belonging to the {@link AbstractResourceConfigurationUpdate} object with the
* given ID. Once this returns, the complete audit trail for that update will be gone and you will not be able to
* rollback to that configuration.
commit c70d6d78f38346aa4989742e2a5d177c4b9716de
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Feb 24 13:58:02 2011 -0500
change "get started" link from "/Login.do" to "/" (https://bugzilla.redhat.com/show_bug.cgi?id=664567)
diff --git a/modules/enterprise/server/container/src/main/resources/jbossas/server/default/deploy/rhq-postinstaller.war.rej/welcome.jsf b/modules/enterprise/server/container/src/main/resources/jbossas/server/default/deploy/rhq-postinstaller.war.rej/welcome.jsf
index 2ea8a43..4ce54a0 100644
--- a/modules/enterprise/server/container/src/main/resources/jbossas/server/default/deploy/rhq-postinstaller.war.rej/welcome.jsf
+++ b/modules/enterprise/server/container/src/main/resources/jbossas/server/default/deploy/rhq-postinstaller.war.rej/welcome.jsf
@@ -8,6 +8,6 @@
<body>
<p> </p>
<h1 align="center">The Server Is Installed!</h1>
- <p align="center"><a href="/Login.do">Click here to get started!</a></p>
+ <p align="center"><a href="/">Click here to get started!</a></p>
</body>
</html>
commit 0aefd8c5cc4837aad89342f64dd76083ab6542fb
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Feb 24 13:20:16 2011 -0500
for list of maps where list is read-only or entire config is read-only, show a view icon, rather than an edit icon and enable the OK button in the popup map editor; add test views under #Test for read-only config editor and read-only group config editor
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
index da0b477..1aad4e6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
@@ -38,6 +38,13 @@ public class ImageManager {
/**
* Returns a generic edit icon.
*/
+ public static String getViewIcon() {
+ return "[SKIN]/actions/view.png";
+ }
+
+ /**
+ * Returns a generic edit icon.
+ */
public static String getEditIcon() {
return "[SKIN]/actions/edit.png";
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 894aeb3..b7c45d6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -552,7 +552,8 @@ public class ConfigurationEditor extends LocatableVLayout {
// List of Maps is a specially supported case with summary fields as columns in a table
// Note: This field spans 3 columns.
PropertyDefinitionMap memberDefinitionMap = (PropertyDefinitionMap) memberDefinition;
- CanvasItem listOfMapsItem = buildListOfMapsField(locatorId, memberDefinitionMap, propertyList, oddRow);
+ CanvasItem listOfMapsItem = buildListOfMapsField(locatorId, memberDefinitionMap, propertyDefinitionList,
+ propertyList, oddRow);
fields.add(listOfMapsItem);
} else if (memberDefinition instanceof PropertyDefinitionSimple) {
SpacerItem unsetItem = new SpacerItem();
@@ -811,7 +812,9 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private CanvasItem buildListOfMapsField(final String locatorId,
- final PropertyDefinitionMap memberPropertyDefinitionMap, final PropertyList propertyList, boolean oddRow) {
+ final PropertyDefinitionMap memberPropertyDefinitionMap,
+ PropertyDefinitionList propertyDefinitionList,
+ final PropertyList propertyList, boolean oddRow) {
Log.debug("Building list-of-maps field for " + propertyList + "...");
final ListGrid summaryTable = new ListGrid();
@@ -872,26 +875,29 @@ public class ConfigurationEditor extends LocatableVLayout {
}
}
+ boolean allSubDefsReadOnly = isAllReadOnly(propertyDefinitions);
+
ListGridField editField = new ListGridField("edit", 20);
editField.setType(ListGridFieldType.ICON);
- // editField.setIcon(Window.getImgURL(ImageManager.getEditIcon()));
- editField.setCellIcon(Window.getImgURL(ImageManager.getEditIcon()));
+ final boolean mapReadOnly = this.readOnly || allSubDefsReadOnly;
+ String icon = (mapReadOnly) ? ImageManager.getViewIcon() : ImageManager.getEditIcon();
+ editField.setCellIcon(Window.getImgURL(icon));
editField.setCanEdit(false);
editField.setCanGroupBy(false);
editField.setCanSort(false);
editField.setCanHide(false);
editField.addRecordClickHandler(new RecordClickHandler() {
public void onRecordClick(RecordClickEvent recordClickEvent) {
- Log.info("You want to edit: " + recordClickEvent.getRecord());
+ Log.debug("Editing property map: " + recordClickEvent.getRecord());
PropertyMap memberPropertyMap = (PropertyMap) recordClickEvent.getRecord().getAttributeAsObject(
RHQ_PROPERTY_ATTRIBUTE_NAME);
displayMapEditor(extendLocatorId("MapEdit"), summaryTable, recordClickEvent.getRecord(),
- memberPropertyDefinitionMap, propertyList, memberPropertyMap);
+ memberPropertyDefinitionMap, propertyList, memberPropertyMap, mapReadOnly);
}
});
fieldsList.add(editField);
- if (!readOnly) {
+ if (!(readOnly || propertyDefinitionList.isReadOnly())) {
ListGridField removeField = new ListGridField("remove", 20);
removeField.setType(ListGridFieldType.ICON);
// removeField.setIcon(Window.getImgURL("[SKIN]/actions/remove.png")); //"/images/tbb_delete.gif");
@@ -930,16 +936,17 @@ public class ConfigurationEditor extends LocatableVLayout {
ToolStrip toolStrip = new ToolStrip();
toolStrip.setWidth100();
- IButton addRowButton = new IButton();
- addRowButton.setIcon(Window.getImgURL("[SKIN]/actions/add.png"));
- addRowButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- displayMapEditor(extendLocatorId("MapEdit"), summaryTable, null, memberPropertyDefinitionMap,
- propertyList, null);
- }
- });
-
- toolStrip.addMember(addRowButton);
+ if (!(readOnly || propertyDefinitionList.isReadOnly())) {
+ IButton addRowButton = new IButton();
+ addRowButton.setIcon(Window.getImgURL("[SKIN]/actions/add.png"));
+ addRowButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ displayMapEditor(extendLocatorId("MapEdit"), summaryTable, null, memberPropertyDefinitionMap,
+ propertyList, null, mapReadOnly);
+ }
+ });
+ toolStrip.addMember(addRowButton);
+ }
summaryTableHolder.setMembers(summaryTable, toolStrip);
@@ -950,6 +957,17 @@ public class ConfigurationEditor extends LocatableVLayout {
return canvasItem;
}
+ private static boolean isAllReadOnly(List<PropertyDefinition> propertyDefinitions) {
+ boolean allPropsDefsReadOnly = true;
+ for (PropertyDefinition subDef : propertyDefinitions) {
+ if (!subDef.isReadOnly()) {
+ allPropsDefsReadOnly = false;
+ break;
+ }
+ }
+ return allPropsDefsReadOnly;
+ }
+
private ListGridRecord[] buildSummaryRecords(PropertyList propertyList, List<PropertyDefinition> definitions) {
ListGridRecord[] rows = new ListGridRecord[propertyList == null ? 0 : propertyList.getList().size()];
int i = 0;
@@ -1428,7 +1446,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private void displayMapEditor(String locatorId, final ListGrid summaryTable, final Record existingRecord,
- PropertyDefinitionMap definition, final PropertyList list, final PropertyMap map) {
+ PropertyDefinitionMap definition, final PropertyList list, final PropertyMap map, boolean mapReadOnly) {
final List<PropertyDefinition> memberDefinitions = new ArrayList<PropertyDefinition>(definition
.getPropertyDefinitions().values());
@@ -1454,7 +1472,9 @@ public class ConfigurationEditor extends LocatableVLayout {
popup.centerInPage();
final IButton okButton = new LocatableIButton(extendLocatorId("OK"), MSG.common_button_ok());
- okButton.disable();
+ if (!mapReadOnly) {
+ okButton.disable();
+ }
okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
if (newRow) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
index 95bfaa5..5e69c1b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -33,6 +33,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.Resour
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeTreeView;
import org.rhq.enterprise.gui.coregui.client.test.configuration.TestConfigurationView;
import org.rhq.enterprise.gui.coregui.client.test.configuration.TestGroupConfigurationView;
+import org.rhq.enterprise.gui.coregui.client.test.configuration.TestReadOnlyConfigurationView;
+import org.rhq.enterprise.gui.coregui.client.test.configuration.TestReadOnlyGroupConfigurationView;
import org.rhq.enterprise.gui.coregui.client.test.i18n.TestPluralizationView;
import org.rhq.enterprise.gui.coregui.client.test.i18n.TestRemoteServiceStatisticsView;
import org.rhq.enterprise.gui.coregui.client.test.inventory.TestSearchBarView;
@@ -44,6 +46,7 @@ import org.rhq.enterprise.gui.coregui.client.test.inventory.TestSearchBarView;
* @author Ian Springer
*/
public class TestTopView extends AbstractSectionedLeftNavigationView {
+
public static final ViewName VIEW_ID = new ViewName("Test");
// view IDs for Inventory section
@@ -55,7 +58,9 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
// view IDs for Configuration section
private static final ViewName CONFIGURATION_SECTION_VIEW_ID = new ViewName("Configuration");
private static final ViewName PAGE_CONFIG_EDITOR = new ViewName("ConfigEditor");
+ private static final ViewName PAGE_READONLY_CONFIG_EDITOR = new ViewName("ReadOnlyConfigEditor");
private static final ViewName PAGE_GROUP_CONFIG_EDITOR = new ViewName("GroupConfigEditor");
+ private static final ViewName PAGE_READONLY_GROUP_CONFIG_EDITOR = new ViewName("ReadOnlyGroupConfigEditor");
// view IDs for Misc section
private static final ViewName MISC_SECTION_VIEW_ID = new ViewName("Misc");
@@ -119,13 +124,26 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
}
});
+ NavigationItem readOnlyConfigEditorItem = new NavigationItem(PAGE_READONLY_CONFIG_EDITOR, null, new ViewFactory() {
+ public Canvas createView() {
+ return new TestReadOnlyConfigurationView(extendLocatorId(PAGE_READONLY_CONFIG_EDITOR.getName()));
+ }
+ });
+
NavigationItem groupConfigEditorItem = new NavigationItem(PAGE_GROUP_CONFIG_EDITOR, null, new ViewFactory() {
public Canvas createView() {
return new TestGroupConfigurationView(extendLocatorId(PAGE_GROUP_CONFIG_EDITOR.getName()));
}
});
- return new NavigationSection(CONFIGURATION_SECTION_VIEW_ID, configEditorItem, groupConfigEditorItem);
+ NavigationItem readOnlyGroupConfigEditorItem = new NavigationItem(PAGE_READONLY_GROUP_CONFIG_EDITOR, null, new ViewFactory() {
+ public Canvas createView() {
+ return new TestReadOnlyGroupConfigurationView(extendLocatorId(PAGE_READONLY_GROUP_CONFIG_EDITOR.getName()));
+ }
+ });
+
+ return new NavigationSection(CONFIGURATION_SECTION_VIEW_ID, configEditorItem, readOnlyConfigEditorItem,
+ groupConfigEditorItem, readOnlyGroupConfigEditorItem);
}
private NavigationSection buildMiscSection() {
@@ -145,4 +163,5 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
return new NavigationSection(MISC_SECTION_VIEW_ID, pluralizationItem, remoteServiceStatisticsItem);
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationFactory.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationFactory.java
index e786a36..cca914c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationFactory.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationFactory.java
@@ -44,6 +44,7 @@ import org.rhq.core.domain.configuration.definition.PropertySimpleType;
* @author Ian Springer
*/
public abstract class TestConfigurationFactory {
+
public static ConfigurationDefinition createConfigurationDefinition() {
ConfigurationDefinition configDef = new ConfigurationDefinition("TestConfig", "a test config");
@@ -308,4 +309,5 @@ public abstract class TestConfigurationFactory {
private TestConfigurationFactory() {
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java
index 206c78a..f1845b7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java
@@ -44,7 +44,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class TestConfigurationView
extends LocatableVLayout implements PropertyValueChangeListener {
- public static final String VIEW_ID = "TestConfig";
private ConfigurationEditor editor;
private LocatableIButton saveButton;
@@ -119,15 +118,22 @@ public class TestConfigurationView
removeMember(editor);
}
- editor = new ConfigurationEditor(extendLocatorId("Editor"), this.configurationDefinition, this.configuration);
+ editor = createConfigurationEditor();
+ addMember(editor);
+ }
+
+ protected ConfigurationEditor createConfigurationEditor() {
+ ConfigurationEditor editor = new ConfigurationEditor(extendLocatorId("Editor"), this.configurationDefinition, this.configuration);
+ editor.setEditorTitle("Test Configuration");
editor.setOverflow(Overflow.AUTO);
editor.addPropertyValueChangeListener(this);
- addMember(editor);
+ return editor;
}
private void save() {
CoreGUI.getMessageCenter().notify(
new Message("Configuration updated.", "Test configuration updated."));
reloadConfiguration();
- }
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestGroupConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestGroupConfigurationView.java
index 1a8b304..8179fbd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestGroupConfigurationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestGroupConfigurationView.java
@@ -48,7 +48,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class TestGroupConfigurationView
extends LocatableVLayout implements PropertyValueChangeListener {
- public static final String VIEW_ID = "TestGroupConfig";
private static final int GROUP_SIZE = 2;
@@ -127,16 +126,23 @@ public class TestGroupConfigurationView
removeMember(editor);
}
- editor = new GroupConfigurationEditor(extendLocatorId("Editor"), this.configurationDefinition,
+ editor = createConfigurationEditor();
+ addMember(editor);
+ }
+
+ protected GroupConfigurationEditor createConfigurationEditor() {
+ GroupConfigurationEditor editor = new GroupConfigurationEditor(extendLocatorId("Editor"), this.configurationDefinition,
this.memberConfigurations);
+ editor.setEditorTitle("Test Group Configuration");
editor.setOverflow(Overflow.AUTO);
editor.addPropertyValueChangeListener(this);
- addMember(editor);
+ return editor;
}
private void save() {
CoreGUI.getMessageCenter().notify(
new Message("Member configurations updated.", "Member configurations updated."));
reloadConfiguration();
- }
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestReadOnlyConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestReadOnlyConfigurationView.java
new file mode 100644
index 0000000..899da26
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestReadOnlyConfigurationView.java
@@ -0,0 +1,41 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.test.configuration;
+
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+
+/**
+ * @author Ian Springer
+ */
+public class TestReadOnlyConfigurationView extends TestConfigurationView {
+
+ public TestReadOnlyConfigurationView(String locatorId) {
+ super(locatorId);
+ }
+
+ @Override
+ protected ConfigurationEditor createConfigurationEditor() {
+ ConfigurationEditor editor = super.createConfigurationEditor();
+ editor.setEditorTitle("Test Read-Only Configuration");
+ editor.setReadOnly(true);
+ return editor;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestReadOnlyGroupConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestReadOnlyGroupConfigurationView.java
new file mode 100644
index 0000000..f8d3829
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestReadOnlyGroupConfigurationView.java
@@ -0,0 +1,41 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.test.configuration;
+
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
+
+/**
+ * @author Ian Springer
+ */
+public class TestReadOnlyGroupConfigurationView extends TestGroupConfigurationView {
+
+ public TestReadOnlyGroupConfigurationView(String locatorId) {
+ super(locatorId);
+ }
+
+ @Override
+ protected GroupConfigurationEditor createConfigurationEditor() {
+ GroupConfigurationEditor editor = super.createConfigurationEditor();
+ editor.setEditorTitle("Test Read-Only Group Configuration");
+ editor.setReadOnly(true);
+ return editor;
+ }
+
+}
commit e70fa2a1dc64bf5e721083e99d759bea71fe4202
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Feb 24 11:43:08 2011 -0500
only clear the message bar if we're rendering a new view, rather than performing a refresh of the current view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 6f447ff..2edcf48 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -367,7 +367,9 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
// default view
History.newItem(DEFAULT_VIEW_PATH);
} else {
- messageBar.clearMessage(true);
+ if (!viewPath.isRefresh()) {
+ messageBar.clearMessage(true);
+ }
if (
pendingMessage != null) {
commit f6afe87f74959e2376de60a3ceef910843e1b644
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 11:25:05 2011 -0500
pad the search bar with a small amount of space
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 95fd4e1..c2403c6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -808,6 +808,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
public TableFilter(Table table) {
super();
setWidth100();
+ setPadding(5);
this.table = table;
//this.table.setTableTitle(null);
}
commit 08f7e2e988fdd857e37a70a9f13fe29820f0d4b8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 10:32:20 2011 -0500
remove the ugly labels, use the new config editor title
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
index 87c4179..e33773c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
@@ -27,7 +27,6 @@ import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
@@ -126,14 +125,12 @@ public class CurrentGroupPluginConfigurationView extends LocatableVLayout implem
private void initEditor() {
if (this.configurationDefinition != null && this.memberConfigurations != null) {
- Label title = new Label(MSG.view_group_pluginConfig_edit_currentGroupProperties());
- addMember(title);
-
this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
this.memberConfigurations);
+ this.editor.setEditorTitle(MSG.view_group_pluginConfig_edit_currentGroupProperties());
this.editor.setOverflow(Overflow.AUTO);
this.editor.addPropertyValueChangeListener(this);
- this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
+ this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
addMember(this.editor);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java
index 22aa7be..fed4f63 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationSettings.java
@@ -25,7 +25,6 @@ import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Label;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
@@ -87,12 +86,9 @@ public class HistoryGroupPluginConfigurationSettings extends LocatableVLayout {
private void initEditor() {
if (this.configurationDefinition != null && this.memberConfigurations != null) {
- Label title = new Label(MSG.view_group_pluginConfig_view_groupProperties() + " - "
- + this.groupUpdateId);
- addMember(title);
-
this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
this.memberConfigurations);
+ this.editor.setEditorTitle(MSG.view_group_pluginConfig_view_groupProperties() + " - " + this.groupUpdateId);
this.editor.setOverflow(Overflow.AUTO);
this.editor.setReadOnly(true);
addMember(this.editor);
commit 762027f422b393fbe239a4a046c815f36dd7797f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 10:24:10 2011 -0500
now that we no longer have tabs, we lost the ability to give a title to the config
this adds the new "editor title" attribute which becomes a label in the top toolstip, to the left of the jump menu
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index ff33cc7..894aeb3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -161,6 +161,7 @@ public class ConfigurationEditor extends LocatableVLayout {
private int resourceTypeId;
private ConfigType configType;
+ private String editorTitle = null;
private boolean readOnly = false;
private Set<String> invalidPropertyNames = new HashSet<String>();
private Set<PropertyValueChangeListener> propertyValueChangeListeners = new HashSet<PropertyValueChangeListener>();
@@ -204,6 +205,14 @@ public class ConfigurationEditor extends LocatableVLayout {
this.readOnly = readOnly;
}
+ public String getEditorTitle() {
+ return editorTitle;
+ }
+
+ public void setEditorTitle(String title) {
+ this.editorTitle = title;
+ }
+
public void showError(Throwable failure) {
addMember(new Label(failure.getMessage()));
}
@@ -366,6 +375,14 @@ public class ConfigurationEditor extends LocatableVLayout {
LocatableToolStrip toolStrip = new LocatableToolStrip(layout.extendLocatorId("Tools"));
toolStrip.setBackgroundImage(null);
toolStrip.setWidth100();
+ toolStrip.setMembersMargin(3);
+ toolStrip.setPadding(3);
+
+ if (getEditorTitle() != null) {
+ Label titleLabel = new Label(getEditorTitle());
+ titleLabel.setWrap(false);
+ toolStrip.addMember(titleLabel);
+ }
Menu menu = new LocatableMenu(toolStrip.extendLocatorId("JumpMenu"));
for (SectionStackSection section : sectionStack.getSections()) {
@@ -391,9 +408,6 @@ public class ConfigurationEditor extends LocatableVLayout {
});
menu.addItem(hideAllItem);
- // TODO GH: Save button as saveListener() or remove the buttons from this form and have
- // the container provide them?
-
toolStrip.addMember(new LocatableIMenuButton(toolStrip.extendLocatorId("Jump"), MSG
.view_configEdit_jumpToSection(), menu));
commit 66ce36f27f22beea0c61a4c718b6ae7653e41992
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 24 09:03:16 2011 -0500
give the id column the title of "version" to be consistent with a) the old JSF ui and b) the current group plugin config UI
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
index 17b3bfc..579083e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -105,7 +105,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
public ArrayList<ListGridField> getListGridFields(boolean includeResourceFields) {
ArrayList<ListGridField> fields = new ArrayList<ListGridField>();
- ListGridField idField = new ListGridField(Field.ID, MSG.common_title_id());
+ ListGridField idField = new ListGridField(Field.ID, MSG.common_title_version());
idField.setShowHover(true);
idField.setHoverCustomizer(new HoverCustomizer() {
@Override
@@ -240,7 +240,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
@Override
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID, MSG.common_title_id());
+ DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID, MSG.common_title_version());
idField.setPrimaryKey(true);
fields.add(idField);
return fields;
commit d829b866aad9a7c1e97df1c17d71e0a5eb78c47f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 23 21:21:35 2011 -0500
ask for confirmation before rolling back
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 9062e3b..5e7bc9e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -122,15 +122,15 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
}
});
- addTableAction(extendLocatorId("Rollback"), MSG.view_configurationHistoryList_rollback(), null,
- new AbstractTableAction(TableActionEnablement.SINGLE) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- if (selection != null && selection.length == 1) {
- ListGridRecord record = selection[0];
- rollback(record.getAttributeAsInt(Field.ID).intValue());
- }
+ addTableAction(extendLocatorId("Rollback"), MSG.view_configurationHistoryList_rollback(), MSG
+ .common_msg_areYouSure(), new AbstractTableAction(TableActionEnablement.SINGLE) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ if (selection != null && selection.length == 1) {
+ ListGridRecord record = selection[0];
+ rollback(record.getAttributeAsInt(Field.ID).intValue());
}
- });
+ }
+ });
super.configureTable();
}
commit f1da38a0dbdaa91ef9f938578ddcb3f78ec7460e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 23 21:17:37 2011 -0500
bz 679130 - finish the resource config history page.
we now have rollback working
the delete button works now
we see additional column data including a link to the group history item if there is one (note, group history GWT pages don't exist yet)
there is now a green check box with a hover message over the ID column that represents the current config
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 640ba32..5ea1c98 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
@@ -87,6 +87,10 @@ public class LinkManager {
return getResourceGroupLink(groupId) + "/Inventory/ConnectionSettingsHistory";
}
+ public static String getGroupResourceConfigurationUpdateHistoryLink(int groupId, int groupUpdateHistoryId) {
+ return getResourceGroupLink(groupId) + "/Configuration/History/" + groupUpdateHistoryId;
+ }
+
public static String getGroupOperationHistoryLink(int groupId, int groupOperationHistoryId) {
return getResourceGroupLink(groupId) + "/Operations/History/" + groupOperationHistoryId;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
index 83f730e..17b3bfc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -71,6 +71,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
public static final String RESOURCE_TYPE_ID = "resourceTypeId";
public static final String CONFIGURATION = "configuration";
public static final String GROUP_CONFIG_UPDATE_ID = "groupConfigUpdateId";
+ public static final String GROUP_ID = "groupId"; // will only be non-null if group config update id is non-null
public static final String DURATION = "duration";
public static final String ERROR_MESSAGE = "errorMessage";
public static final String MODIFIED_TIME = "modifiedTime";
@@ -193,7 +194,10 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
if (value == null) {
return MSG.dataSource_configurationHistory_updateType_individual();
}
- return MSG.dataSource_configurationHistory_updateType_group();
+ Integer groupId = record.getAttributeAsInt(Field.GROUP_ID);
+ return "<a href=\""
+ + LinkManager.getGroupResourceConfigurationUpdateHistoryLink(groupId, ((Number) value).intValue())
+ + "\">" + MSG.dataSource_configurationHistory_updateType_group() + "</a>";
}
});
fields.add(updateTypeField);
@@ -330,6 +334,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
}
if (from.getGroupConfigurationUpdate() != null) {
record.setAttribute(Field.GROUP_CONFIG_UPDATE_ID, from.getGroupConfigurationUpdate().getId());
+ record.setAttribute(Field.GROUP_ID, from.getGroupConfigurationUpdate().getGroup().getId()); // note group must be eagerly loaded here
}
record.setAttribute(Field.OBJECT, from);
return record;
commit e88da782dbd2e6fbcfff6081fb028f93a831bef3
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 23 20:35:11 2011 -0500
bz 679130 more fixing of the res config history page
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
index 034a133..83f730e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -27,20 +28,37 @@ import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
-import com.smartgwt.client.data.fields.DataSourceTextField;
-import com.smartgwt.client.types.FieldType;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.DateDisplayFormat;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
+ * A data source that loads information about all the configuration changes that happened
+ * for a resource or across all inventory.
+ *
* @author Greg Hinkle
+ * @author John Mazzitelli
*/
public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfigurationUpdate> {
@@ -52,9 +70,11 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
public static final String SUBJECT = "subject";
public static final String RESOURCE_TYPE_ID = "resourceTypeId";
public static final String CONFIGURATION = "configuration";
+ public static final String GROUP_CONFIG_UPDATE_ID = "groupConfigUpdateId";
public static final String DURATION = "duration";
public static final String ERROR_MESSAGE = "errorMessage";
public static final String MODIFIED_TIME = "modifiedTime";
+ public static final String CURRENT_CONFIG = "currentConfig"; // will be true if the history item represents the current config
public static final String OBJECT = "object"; // the full entity object is stored in this attribute
}
@@ -70,32 +90,155 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
addFields(fields);
}
- @Override
- protected List<DataSourceField> addDataSourceFields() {
- List<DataSourceField> fields = super.addDataSourceFields();
+ /**
+ * Views that use this data source can call this method to get a list of fields
+ * that can be used in a list grid to show the data for this data source.
+ *
+ * @param includeResourceFields if true, the list of fields that are returned will
+ * include fields to show individual resource data.
+ * Pass in false if you are only collecting data on a
+ * single resource, since you don't need every row to
+ * show the same data on the same resource.
+ * @return fields
+ */
+ public ArrayList<ListGridField> getListGridFields(boolean includeResourceFields) {
+ ArrayList<ListGridField> fields = new ArrayList<ListGridField>();
- DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID,
- MSG.dataSource_configurationHistory_field_id());
- idField.setPrimaryKey(true);
+ ListGridField idField = new ListGridField(Field.ID, MSG.common_title_id());
+ idField.setShowHover(true);
+ idField.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ if (Boolean.parseBoolean(record.getAttribute(Field.CURRENT_CONFIG))) {
+ return MSG.dataSource_configurationHistory_currentConfig();
+ }
+ return null;
+ }
+ });
fields.add(idField);
- DataSourceTextField resourceField = new DataSourceTextField(Field.RESOURCE,
- MSG.dataSource_configurationHistory_field_resource());
- fields.add(resourceField);
+ ListGridField submittedTimeField = new ListGridField(Field.CREATED_TIME, MSG
+ .dataSource_configurationHistory_dateSubmitted());
+ submittedTimeField.setType(ListGridFieldType.DATE);
+ submittedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+ fields.add(submittedTimeField);
- DataSourceTextField submittedField = new DataSourceTextField(Field.CREATED_TIME,
- MSG.dataSource_configurationHistory_field_createdTime());
- submittedField.setType(FieldType.DATETIME);
- fields.add(submittedField);
+ ListGridField completedTimeField = new ListGridField(Field.MODIFIED_TIME, MSG
+ .dataSource_configurationHistory_dateCompleted());
+ completedTimeField.setType(ListGridFieldType.DATE);
+ completedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+ fields.add(completedTimeField);
- DataSourceTextField statusField = new DataSourceTextField(Field.STATUS,
- MSG.dataSource_configurationHistory_field_status());
+ ListGridField statusField = new ListGridField(Field.STATUS, MSG.common_title_status());
+ statusField.setAlign(Alignment.CENTER);
+ statusField.setCellFormatter(new CellFormatter() {
+ public String format(Object value, ListGridRecord listGridRecord, int i, int i1) {
+ ConfigurationUpdateStatus status = ConfigurationUpdateStatus.valueOf(value.toString());
+ return Canvas.imgHTML(ImageManager.getResourceConfigurationIcon(status), 16, 16);
+ }
+ });
+ statusField.setShowHover(true);
+ statusField.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String html = null;
+ String err = record.getAttribute(Field.ERROR_MESSAGE);
+ if (err != null && err.length() > 0) {
+ html = MSG.dataSource_configurationHistory_clickToSeeError();
+ } else {
+ ConfigurationUpdateStatus status = ConfigurationUpdateStatus.valueOf(record
+ .getAttribute(Field.STATUS));
+ switch (status) {
+ case SUCCESS: {
+ html = MSG.common_status_success();
+ break;
+ }
+ case FAILURE: {
+ html = MSG.common_status_failed();
+ break;
+ }
+ case INPROGRESS: {
+ html = MSG.common_status_inprogress();
+ break;
+ }
+ case NOCHANGE: {
+ html = MSG.common_status_success();
+ break;
+ }
+ }
+ }
+ return html;
+ }
+ });
+ statusField.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ String err = event.getRecord().getAttribute(Field.ERROR_MESSAGE);
+ if (err != null && err.length() > 0) {
+ err = "<pre>" + err + "</pre>";
+ new ErrorMessageWindow("errWin", MSG.common_title_error(), err).show();
+ }
+ }
+ });
fields.add(statusField);
- DataSourceTextField subjectField = new DataSourceTextField(Field.SUBJECT,
- MSG.dataSource_configurationHistory_field_subject());
+ ListGridField subjectField = new ListGridField(Field.SUBJECT, MSG.common_title_user());
fields.add(subjectField);
+ ListGridField updateTypeField = new ListGridField(Field.GROUP_CONFIG_UPDATE_ID, MSG
+ .dataSource_configurationHistory_updateType());
+ updateTypeField.setCellFormatter(new CellFormatter() {
+ @Override
+ public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+ if (value == null) {
+ return MSG.dataSource_configurationHistory_updateType_individual();
+ }
+ return MSG.dataSource_configurationHistory_updateType_group();
+ }
+ });
+ fields.add(updateTypeField);
+
+ // determine the widths of our columns
+ if (includeResourceFields) {
+ ListGridField resourceField = new ListGridField(Field.RESOURCE, MSG.common_title_resource());
+ resourceField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ if (listGridRecord == null) {
+ return "unknown";
+ }
+ Resource res = (Resource) listGridRecord.getAttributeAsObject(Field.RESOURCE);
+ String url = LinkManager.getResourceLink(res.getId());
+ // TODO disambiguate the resource name
+ return SeleniumUtility.getLocatableHref(url, res.getName(), null);
+ }
+ });
+ fields.add(resourceField);
+
+ idField.setWidth("10%");
+ submittedTimeField.setWidth("20%");
+ completedTimeField.setWidth("20%");
+ statusField.setWidth("10%");
+ subjectField.setWidth("10%");
+ updateTypeField.setWidth("10%");
+ resourceField.setWidth("*");
+ } else {
+ idField.setWidth("10%");
+ submittedTimeField.setWidth("20%");
+ completedTimeField.setWidth("20%");
+ statusField.setWidth("10%");
+ subjectField.setWidth("10%");
+ updateTypeField.setWidth("*");
+ }
+
+ return fields;
+ }
+
+ @Override
+ protected List<DataSourceField> addDataSourceFields() {
+ List<DataSourceField> fields = super.addDataSourceFields();
+ DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID, MSG.common_title_id());
+ idField.setPrimaryKey(true);
+ fields.add(idField);
return fields;
}
@@ -105,10 +248,11 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
ResourceConfigurationUpdateCriteria criteria = new ResourceConfigurationUpdateCriteria();
criteria.fetchConfiguration(true);
criteria.fetchResource(true);
+ criteria.fetchGroupConfigurationUpdate(true);
criteria.setPageControl(getPageControl(request));
- Integer resourceId = (Integer) request.getCriteria().getValues().get(CriteriaField.RESOURCE_ID);
+ final Integer resourceId = (Integer) request.getCriteria().getValues().get(CriteriaField.RESOURCE_ID);
if (resourceId != null) {
criteria.addFilterResourceIds(resourceId);
}
@@ -122,10 +266,43 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
processResponse(request.getRequestId(), response);
}
- public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
- response.setData(buildRecords(result));
- response.setTotalRows(result.getTotalSize());
- processResponse(request.getRequestId(), response);
+ public void onSuccess(final PageList<ResourceConfigurationUpdate> result) {
+ final ListGridRecord[] records = buildRecords(result);
+ if (resourceId == null) {
+ response.setData(records);
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ return; // we can finish now, we don't need any additional information
+ }
+
+ // we are obtaining a single resource's history items. Let's find out which is
+ // its latest, current config item so we can mark it as such
+ configurationService.getLatestResourceConfigurationUpdate(resourceId.intValue(),
+ new AsyncCallback<ResourceConfigurationUpdate>() {
+ @Override
+ public void onSuccess(ResourceConfigurationUpdate latestResult) {
+ if (latestResult != null) {
+ for (ListGridRecord record : records) {
+ boolean latest = record.getAttributeAsInt(Field.ID).intValue() == latestResult
+ .getId();
+ record.setAttribute(Field.CURRENT_CONFIG, latest);
+ }
+ }
+ finish();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ // should we show an error message? this just means we can't show any item as the "current" one
+ finish();
+ }
+
+ private void finish() {
+ response.setData(records);
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
}
});
}
@@ -142,12 +319,18 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
record.setAttribute(Field.RESOURCE, from.getResource());
record.setAttribute(Field.RESOURCE_TYPE_ID, from.getResource().getResourceType().getId());
record.setAttribute(Field.SUBJECT, from.getSubjectName());
+ record.setAttribute(Field.STATUS, from.getStatus().name());
record.setAttribute(Field.CONFIGURATION, from.getConfiguration());
- record.setAttribute(Field.CREATED_TIME, new Date(from.getCreatedTime()));
record.setAttribute(Field.DURATION, from.getDuration());
record.setAttribute(Field.ERROR_MESSAGE, from.getErrorMessage());
- record.setAttribute(Field.MODIFIED_TIME, new Date(from.getModifiedTime()));
- record.setAttribute(Field.STATUS, from.getStatus().name());
+ record.setAttribute(Field.CREATED_TIME, new Date(from.getCreatedTime()));
+ // if it is still in progress, the modified time (which we label as "date completed") is meaningless since it isn't completed yet
+ if (from.getStatus() != ConfigurationUpdateStatus.INPROGRESS) {
+ record.setAttribute(Field.MODIFIED_TIME, new Date(from.getModifiedTime()));
+ }
+ if (from.getGroupConfigurationUpdate() != null) {
+ record.setAttribute(Field.GROUP_CONFIG_UPDATE_ID, from.getGroupConfigurationUpdate().getId());
+ }
record.setAttribute(Field.OBJECT, from);
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index d758fcb..9062e3b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -23,17 +23,15 @@ import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
@@ -46,7 +44,10 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
+ * The main view that lists all resource configuration history items.
+ *
* @author Greg Hinkle
+ * @author John Mazzitelli
*/
public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryDataSource> {
public static final ViewName VIEW_ID = new ViewName("RecentConfigurationChanges", MSG
@@ -59,7 +60,8 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
*/
public ConfigurationHistoryView(String locatorId) {
super(locatorId, VIEW_ID.getTitle());
- final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
+ this.resourceId = null;
+ ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
setDataSource(datasource);
}
@@ -83,52 +85,29 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
@Override
protected void configureTable() {
- List<ListGridField> fields = new ArrayList<ListGridField>();
-
- ListGridField idField = new ListGridField(ConfigurationHistoryDataSource.Field.ID, 60);
- fields.add(idField);
+ List<ListGridField> fields = getDataSource().getListGridFields(this.resourceId == null);
+ setListGridFields(true, fields.toArray(new ListGridField[fields.size()])); // true = always show the ID field
+ getListGrid().sort(Field.ID, SortDirection.DESCENDING);
- ListGridField createdTimeField = new ListGridField(ConfigurationHistoryDataSource.Field.CREATED_TIME, 200);
- fields.add(createdTimeField);
-
- if (this.resourceId == null) {
- ListGridField resourceField = new ListGridField(ConfigurationHistoryDataSource.Field.RESOURCE);
- resourceField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- if (listGridRecord == null) {
- return "unknown";
+ addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ new AbstractTableAction(TableActionEnablement.ANY) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ if (selection != null && selection.length > 0) {
+ int[] doomedIds = new int[selection.length];
+ int i = 0;
+ for (ListGridRecord selected : selection) {
+ doomedIds[i] = selected.getAttributeAsInt(Field.ID);
+ if (selected.getAttribute(Field.GROUP_CONFIG_UPDATE_ID) != null) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_configurationHistoryList_cannotDeleteGroupItems(),
+ Severity.Warning));
+ return; // abort
+ }
+ }
+ delete(doomedIds);
}
- Resource res = (Resource) listGridRecord
- .getAttributeAsObject(ConfigurationHistoryDataSource.Field.RESOURCE);
- String url = LinkManager.getResourceLink(res.getId());
- return SeleniumUtility.getLocatableHref(url, res.getName(), null);
}
});
- fields.add(resourceField);
- }
-
- ListGridField statusField = new ListGridField(ConfigurationHistoryDataSource.Field.STATUS, 100);
- statusField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- ConfigurationUpdateStatus status = ConfigurationUpdateStatus.valueOf((String) o);
- return Canvas.imgHTML(ImageManager.getResourceConfigurationIcon(status), 16, 16);
- }
- });
- fields.add(statusField);
-
- ListGridField subjectField = new ListGridField(ConfigurationHistoryDataSource.Field.SUBJECT, 150);
- fields.add(subjectField);
-
- setListGridFields(fields.toArray(new ListGridField[fields.size()]));
-
- addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_deleteConfirm(MSG
- .common_msg_deleteConfirm(MSG.view_configurationHistoryList_itemNamePlural())), new AbstractTableAction(
- TableActionEnablement.ANY) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- // TODO: Implement this method.
- CoreGUI.getErrorHandler().handleError(MSG.common_msg_notYetImplemented());
- }
- });
addTableAction(extendLocatorId("Compare"), MSG.common_button_compare(), null, new AbstractTableAction(
TableActionEnablement.MULTIPLE) {
@@ -146,8 +125,10 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
addTableAction(extendLocatorId("Rollback"), MSG.view_configurationHistoryList_rollback(), null,
new AbstractTableAction(TableActionEnablement.SINGLE) {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
- ListGridRecord record = selection[0];
- rollback(record.getAttributeAsInt(Field.ID).intValue());
+ if (selection != null && selection.length == 1) {
+ ListGridRecord record = selection[0];
+ rollback(record.getAttributeAsInt(Field.ID).intValue());
+ }
}
});
@@ -156,7 +137,23 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
@Override
protected String getDetailsLinkColumnName() {
- return Field.CREATED_TIME;
+ return Field.ID;
+ }
+
+ @Override
+ protected CellFormatter getDetailsLinkColumnCellFormatter() {
+ return new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int i, int i1) {
+ Integer recordId = getId(record);
+ String detailsUrl = "#" + getBasePath() + "/" + recordId;
+ String cellHtml = SeleniumUtility.getLocatableHref(detailsUrl, value.toString(), null);
+ String isCurrentConfig = record.getAttribute(Field.CURRENT_CONFIG);
+ if (Boolean.parseBoolean(isCurrentConfig)) {
+ cellHtml = Canvas.imgHTML(ImageManager.getApproveIcon()) + cellHtml;
+ }
+ return cellHtml;
+ }
+ };
}
@Override
@@ -172,6 +169,7 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_configurationHistoryList_rollback_success(), Severity.Info));
+ CoreGUI.refresh();
}
@Override
@@ -181,6 +179,23 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
});
}
+ private void delete(int[] doomedIds) {
+ GWTServiceLookup.getConfigurationService().purgeResourceConfigurationUpdates(doomedIds, true,
+ new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_configurationHistoryList_delete_success(), Severity.Info));
+ CoreGUI.refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_configurationHistoryList_delete_failure(), caught);
+ }
+ });
+ }
+
// -------- Static Utility loaders ------------
public static ConfigurationHistoryView getHistoryOf(String locatorId, int resourceId) {
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 2582d0b..d2ad927 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
@@ -480,11 +480,13 @@ dataSource_operationHistory_startedTime = Started Time
# Configuration History
#-------------------------------
-dataSource_configurationHistory_field_id = ID
-dataSource_configurationHistory_field_resource = Resource
-dataSource_configurationHistory_field_createdTime = Created
-dataSource_configurationHistory_field_status = Status
-dataSource_configurationHistory_field_subject = Subject
+dataSource_configurationHistory_dateSubmitted = Date Submitted
+dataSource_configurationHistory_dateCompleted = Date Completed
+dataSource_configurationHistory_updateType = Update Type
+dataSource_configurationHistory_updateType_individual = Individual
+dataSource_configurationHistory_updateType_group = Group
+dataSource_configurationHistory_currentConfig = This is the current configuration
+dataSource_configurationHistory_clickToSeeError = Double click to see error message...
dataSource_configurationHistory_error_fetchFailure = Unable to load configuration history.
# Resource Errors
@@ -1742,10 +1744,13 @@ view_configurationDetails_somePropertiesInvalid = The following configuration pr
# Configuration History List
view_configurationHistoryList_title = Configuration History
-view_configurationHistoryList_itemNamePlural = configuration history items
view_configurationHistoryList_rollback = Rollback
view_configurationHistoryList_rollback_success = You successfully rolled back the resource configuration to the selected past configuration.
view_configurationHistoryList_rollback_failure = Failed to rollback the configuration. The original configuration is still in effect.
+view_configurationHistoryList_delete_success = You successfully deleted the selected configuration history items.
+view_configurationHistoryList_delete_failure = Failed to delete the configuration history items.
+view_configurationHistoryList_cannotDeleteGroupItems = One or more selected configuration history items are part of a group configuration update. \
+You must purge that parent group history item before you can delete its individual resource history items.
# Configuration History Details
#------------------------------------------
commit 8f0490a3b644e86002422fbc2aace8e688f8ca32
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 23 14:45:08 2011 -0500
part of BZ 679130 - add rollback button to resource config history view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index cb28a85..25bc2dd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -25,6 +25,11 @@ import org.rhq.core.domain.util.PageList;
*/
@RemoteServiceRelativePath("ConfigurationGWTService")
public interface ConfigurationGWTService extends RemoteService {
+
+ void purgeResourceConfigurationUpdates(int[] configUpdateIds, boolean purgeInProgress) throws RuntimeException;
+
+ void rollbackResourceConfiguration(int resourceId, int configHistoryId) throws RuntimeException;
+
ResourceConfigurationUpdate getLatestResourceConfigurationUpdate(int resourceId) throws RuntimeException;
Configuration getPluginConfiguration(int resourceId) throws RuntimeException;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
index cc48ae9..136ba94 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configur
import java.util.EnumSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.Window;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
@@ -40,7 +39,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Greg Hinkle
*/
public class ConfigurationHistoryDetailView extends LocatableVLayout implements BookmarkableView {
-
+
public ConfigurationHistoryDetailView(String locatorId) {
super(locatorId);
@@ -65,19 +64,6 @@ public class ConfigurationHistoryDetailView extends LocatableVLayout implements
});
}
- public void displayInDialog() {
- Window window = new Window();
- window.setTitle(MSG.view_configurationHistoryDetails_dialogTitle());
- window.setWidth(800);
- window.setHeight(800);
- window.setIsModal(true);
- window.setShowModalMask(true);
- window.setCanDragResize(true);
- window.centerInPage();
- window.addItem(this);
- window.show();
- }
-
@Override
public void renderView(ViewPath viewPath) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 14d74b3..d758fcb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configur
import java.util.ArrayList;
import java.util.List;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
@@ -38,7 +39,10 @@ import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableActio
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryDataSource.Field;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
@@ -139,6 +143,14 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
}
});
+ addTableAction(extendLocatorId("Rollback"), MSG.view_configurationHistoryList_rollback(), null,
+ new AbstractTableAction(TableActionEnablement.SINGLE) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ ListGridRecord record = selection[0];
+ rollback(record.getAttributeAsInt(Field.ID).intValue());
+ }
+ });
+
super.configureTable();
}
@@ -150,10 +162,25 @@ public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryD
@Override
public Canvas getDetailsView(int id) {
ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView(this.getLocatorId());
-
return detailView;
}
+ private void rollback(int configHistoryIdToRollbackTo) {
+ GWTServiceLookup.getConfigurationService().rollbackResourceConfiguration(this.resourceId.intValue(),
+ configHistoryIdToRollbackTo, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_configurationHistoryList_rollback_success(), Severity.Info));
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_configurationHistoryList_rollback_failure(), caught);
+ }
+ });
+ }
+
// -------- Static Utility loaders ------------
public static ConfigurationHistoryView getHistoryOf(String locatorId, int resourceId) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index d285b4b..9668517 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -47,6 +47,24 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
private ResourceGroupManagerLocal groupManager = LookupUtil.getResourceGroupManager();
+ public void purgeResourceConfigurationUpdates(int[] configUpdateIds, boolean purgeInProgress)
+ throws RuntimeException {
+ try {
+ configurationManager.purgeResourceConfigurationUpdates(getSessionSubject(), configUpdateIds,
+ purgeInProgress);
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ public void rollbackResourceConfiguration(int resourceId, int configHistoryId) throws RuntimeException {
+ try {
+ configurationManager.rollbackResourceConfiguration(getSessionSubject(), resourceId, configHistoryId);
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
public ResourceConfigurationUpdate getLatestResourceConfigurationUpdate(int resourceId) throws RuntimeException {
try {
ResourceConfigurationUpdate update = configurationManager.getLatestResourceConfigurationUpdate(
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 2e2cd19..2582d0b 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
@@ -1743,10 +1743,12 @@ view_configurationDetails_somePropertiesInvalid = The following configuration pr
# Configuration History List
view_configurationHistoryList_title = Configuration History
view_configurationHistoryList_itemNamePlural = configuration history items
+view_configurationHistoryList_rollback = Rollback
+view_configurationHistoryList_rollback_success = You successfully rolled back the resource configuration to the selected past configuration.
+view_configurationHistoryList_rollback_failure = Failed to rollback the configuration. The original configuration is still in effect.
# Configuration History Details
#------------------------------------------
-view_configurationHistoryDetails_dialogTitle = Configuration Details
view_configurationHistoryDetails_error_loadFailure = Unable to load configuration history.
# Operation History List
commit c6e63ff13c49f901d77c33962296dd9903519729
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 23 14:01:15 2011 -0500
this class already supports double-clicking to show details (TableSection).
no need for show details button, that is not consistent wiht the rest of the ui
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index df13c8f..14d74b3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -44,7 +44,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* @author Greg Hinkle
*/
-public class ConfigurationHistoryView extends TableSection {
+public class ConfigurationHistoryView extends TableSection<ConfigurationHistoryDataSource> {
public static final ViewName VIEW_ID = new ViewName("RecentConfigurationChanges", MSG
.view_configurationHistoryList_title());
@@ -139,14 +139,6 @@ public class ConfigurationHistoryView extends TableSection {
}
});
- addTableAction(extendLocatorId("ShowDetail"), MSG.common_button_showDetails(), null, new AbstractTableAction(
- TableActionEnablement.SINGLE) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- ListGridRecord record = selection[0];
- showDetails(record);
- }
- });
-
super.configureTable();
}
commit 5a945cfca6b3b1b046b439d9dd1f4ea878a288a5
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Feb 23 17:27:26 2011 -0500
a few locator fixes; clear message bar when user goes to a new url
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 7d06d1d..6f447ff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -367,7 +367,10 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
// default view
History.newItem(DEFAULT_VIEW_PATH);
} else {
- if (pendingMessage != null) {
+ messageBar.clearMessage(true);
+
+ if (
+ pendingMessage != null) {
getMessageCenter().notify(pendingMessage);
pendingMessage = null;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
index 9300960..a2e1f04 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionsEditor.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -49,6 +49,7 @@ import org.rhq.core.domain.authz.Role;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVStack;
/**
@@ -142,7 +143,7 @@ public class PermissionsEditor extends LocatableVStack {
}
private ListGrid createGlobalPermissionsGrid() {
- ListGrid grid = createPermissionsGrid();
+ ListGrid grid = createPermissionsGrid("GlobalPermissions");
// TODO: Add table title.
@@ -182,7 +183,7 @@ public class PermissionsEditor extends LocatableVStack {
}
private ListGrid createResourcePermissionsGrid() {
- ListGrid grid = createPermissionsGrid();
+ ListGrid grid = createPermissionsGrid("ResourcePermissions");
// TODO: Add table title.
ListGridField iconField = createIconField();
@@ -290,8 +291,8 @@ public class PermissionsEditor extends LocatableVStack {
return iconField;
}
- private ListGrid createPermissionsGrid() {
- ListGrid grid = new ListGrid();
+ private LocatableListGrid createPermissionsGrid(String id) {
+ LocatableListGrid grid = new LocatableListGrid(extendLocatorId(id));
grid.setAutoFitData(Autofit.BOTH);
grid.setWrapCells(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
index 1731a7a..b28c6ce 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
@@ -22,12 +22,12 @@ package org.rhq.enterprise.gui.coregui.client.util.message;
import com.google.gwt.user.client.Timer;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
/**
* A bar for displaying a message at the top of a page - the equivalent of the JSF h:messages component.
@@ -39,7 +39,7 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
private static final String LOCATOR_ID = "MessageBar";
private static final int AUTO_HIDE_DELAY_MILLIS = 30000;
- private Label label = new Label();
+ private LocatableLabel label = new LocatableLabel(extendLocatorId("Label"));
private Message stickyMessage;
private static final String NON_BREAKING_SPACE = " ";
@@ -64,7 +64,7 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
setLabelEmpty();
addMember(label);
- // sometimes its annoying to have the error message hang around for too long
+ // sometimes it's annoying to have the error message hang around for too long;
// let the user click the message so it goes away on demand
addDoubleClickHandler(new DoubleClickHandler() {
@Override
@@ -98,7 +98,7 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
}
}
- private void clearMessage(boolean clearSticky) {
+ public void clearMessage(boolean clearSticky) {
setLabelEmpty();
markForRedraw();
@@ -121,7 +121,7 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
String styleName = (contents != null) ? message.getSeverity().getStyle() : null;
label.setStyleName(styleName);
- // TODO: Create some custom edge images in greed, yellow, red, etc. so we can add nice rounded corners to the
+ // TODO: Create some custom edge images in green, yellow, red, etc. so we can add nice rounded corners to the
// label.
//label.setShowEdges(true);
commit b74b8aeeaa7ed64a7ace616fa05773f14247fdba
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Feb 23 10:45:21 2011 -0500
fix a couple bugs in RoleManager, one of which was causing role creation to fail if the role had any associated resource groups
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
index eba8968..ec3e998 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
@@ -141,8 +141,9 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
public Role createRole(Subject whoami, Role newRole) {
// TODO (ips): Do we want to enforce uniqueness of the Role name?
- if (newRole.getFsystem()) {
- throw new IllegalArgumentException("Unable to create role [" + newRole.getName()
+ Boolean isSystemRole = newRole.getFsystem();
+ if (isSystemRole) {
+ throw new IllegalArgumentException("Unable to create system role [" + newRole.getName()
+ "] - new system roles cannot be created.");
}
processDependentPermissions(newRole);
@@ -163,9 +164,6 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
}
addSubjectsToRole(whoami, newRole.getId(), subjectIds);
- for (ResourceGroup resourceGroup : newRole.getResourceGroups()) {
- entityManager.merge(resourceGroup);
- }
int[] resourceGroupIds = new int[newRole.getResourceGroups().size()];
i = 0;
for (ResourceGroup resourceGroup : newRole.getResourceGroups()) {
@@ -566,9 +564,9 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
for (Integer groupId : groupIds) {
ResourceGroup group = entityManager.find(ResourceGroup.class, groupId);
- if (role == null) {
+ if (group == null) {
throw new IllegalArgumentException("Tried to add resourceGroup[" + groupId + "] to role[" + roleId
- + "], but resourceGroup was not found");
+ + "], but resourceGroup was not found.");
}
role.addResourceGroup(group);
}
commit 3d9933e477c7262cc55e76041d781e8339b382a7
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Feb 22 18:57:58 2011 -0500
BZ:679200: finish conversion from Http get to Post during login requests. Embedded url no longer displays.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
index 2b4848f..3a5fa85 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -516,8 +516,9 @@ public class LoginView extends LocatableCanvas {
loginButton.setDisabled(true);
try {
- RequestBuilder b = new RequestBuilder(RequestBuilder.POST, "/j_security_check.do?j_username=" + user
- + "&j_password=" + password);
+ RequestBuilder b = new RequestBuilder(RequestBuilder.POST, "/j_security_check.do");
+ b.setHeader("Content-Type", "application/x-www-form-urlencoded");
+ b.setRequestData("j_username=" + user + "&j_password=" + password);
b.setCallback(new RequestCallback() {
public void onResponseReceived(Request request, Response response) {
int statusCode = response.getStatusCode();
commit af1df72c6ba095b7ad6c7e67226f09197c7cf4e1
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Feb 22 17:09:58 2011 -0500
enable group Activity OOB content. Criteria method seemed non-trivial and not useful beyond this one case.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java
index c586c87..192b854 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementOOB.java
@@ -114,7 +114,21 @@ import javax.persistence.Table;
+ " AND sched.definition = def " //
+ " AND sched.resource = res " //
+ " AND bal.schedule = sched " //
- + " AND :resourceId = res.id ") })
+ + " AND :resourceId = res.id "), //
+ @NamedQuery(name = MeasurementOOB.GET_HIGHEST_FACTORS_FOR_GROUP, query = "" //
+ + " SELECT new org.rhq.core.domain.measurement.composite.MeasurementOOBComposite" //
+ + " ( res.name, res.id, def.displayName, sched.id, o.timestamp, def.id, o.oobFactor, " //
+ + " bal.baselineMin , bal.baselineMax, def.units ) " //
+ + " FROM MeasurementOOB o, MeasurementSchedule sched " //
+ + "LEFT JOIN sched.definition def " //
+ + "LEFT JOIN sched.resource res " //
+ + "LEFT JOIN sched.baseline bal " //
+ + "LEFT JOIN sched.resource.explicitGroups ig " //
+ + " WHERE o.id = sched.id " //
+ + " AND sched.definition = def " //
+ + " AND sched.resource = res " //
+ + " AND bal.schedule = sched " //
+ + " AND :groupId = ig.id ") })
@Entity
@Table(name = "RHQ_MEASUREMENT_OOB")
public class MeasurementOOB {
@@ -125,6 +139,7 @@ public class MeasurementOOB {
public static final String DELETE_OUTDATED = "DeleteOutdatedOOBs";
public static final String COUNT_FOR_DATE = "CountOOBForDate";
public static final String GET_HIGHEST_FACTORS_FOR_RESOURCE = "GetHighestOOBFactorForResource";
+ public static final String GET_HIGHEST_FACTORS_FOR_GROUP = "GetHighestOOBFactorForGroup";
public static final String DELETE_FOR_GROUP_AND_DEFINITION = "DeleteOOBForGroupAndDefinition";
public static final String DELETE_FOR_SCHEDULE = "DeleteOOBForSchedule";
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
index e80bba4..8db6354 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
@@ -74,6 +74,8 @@ public interface MeasurementDataGWTService extends RemoteService {
PageList<MeasurementOOBComposite> getHighestNOOBsForResource(int resourceId, int n) throws RuntimeException;
+ PageList<MeasurementOOBComposite> getHighestNOOBsForGroup(int groupId, int n) throws RuntimeException;
+
void enableSchedulesForResource(int resourceId, int[] measurementDefinitionIds) throws RuntimeException;
void disableSchedulesForResource(int resourceId, int[] measurementDefinitionIds) throws RuntimeException;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 5e19edf..625c139 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -44,6 +44,7 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.event.EventSeverity;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
+import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.group.GroupCategory;
@@ -86,7 +87,7 @@ public class ActivityView2 extends AbstractActivityView {
//TODO: spinder need to drive these calls off off facet availability
getRecentOperations();
getRecentConfigurationUpdates();
- // getRecentOobs();
+ getRecentOobs();
// getRecentPkgHistory();
getRecentMetrics();
}
@@ -346,55 +347,53 @@ public class ActivityView2 extends AbstractActivityView {
});
}
- // /** Fetches OOB measurements and updates the DynamicForm instance with the latest 5
- // * oob change details.
- // */
- // private void getRecentOobs() {
- // final int groupId = this.groupComposite.getResourceGroup().getId();
- //
- //// GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForCompatibleGroup(groupId, 5,
- //
- // GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForResource(groupId, 5,
- // new AsyncCallback<PageList<MeasurementOOBComposite>>() {
- // @Override
- // public void onFailure(Throwable caught) {
- // Log.debug("Error retrieving recent out of bound metrics for resource [" + groupId + "]:"
- // + caught.getMessage());
- // }
- //
- // @Override
- // public void onSuccess(PageList<MeasurementOOBComposite> result) {
- // VLayout column = new VLayout();
- // column.setHeight(10);
- // if (!result.isEmpty()) {
- // for (MeasurementOOBComposite oob : result) {
- // LocatableDynamicForm row = new LocatableDynamicForm(recentOobContent.extendLocatorId(oob
- // .getScheduleName()));
- // row.setNumCols(2);
- //
- // String title = oob.getScheduleName() + ":";
- // String destination = "/resource/common/monitor/Visibility.do?m=" + oob.getDefinitionId()
- // + "&id=" + groupId + "&mode=chartSingleMetricSingleResource";
- // LinkItem link = newLinkItem(title, destination);
- // StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(oob.getTimestamp()));
- //
- // row.setItems(link, time);
- // column.addMember(row);
- // }
- // } else {
- // LocatableDynamicForm row = createEmptyDisplayRow(recentOobContent.extendLocatorId("None"),
- // RECENT_OOB_NONE);
- // column.addMember(row);
- // }
- // recentOobContent.setContents("");
- // for (Canvas child : recentOobContent.getChildren()) {
- // child.destroy();
- // }
- // recentOobContent.addChild(column);
- // recentOobContent.markForRedraw();
- // }
- // });
- // }
+ /** Fetches OOB measurements and updates the DynamicForm instance with the latest 5
+ * oob change details.
+ */
+ private void getRecentOobs() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+
+ GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForGroup(groupId, 5,
+ new AsyncCallback<PageList<MeasurementOOBComposite>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent out of bound metrics for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
+
+ @Override
+ public void onSuccess(PageList<MeasurementOOBComposite> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ for (MeasurementOOBComposite oob : result) {
+ LocatableDynamicForm row = new LocatableDynamicForm(recentOobContent.extendLocatorId(oob
+ .getScheduleName()));
+ row.setNumCols(2);
+
+ String title = oob.getScheduleName() + ":";
+ String destination = "/resource/common/monitor/Visibility.do?m=" + oob.getDefinitionId()
+ + "&id=" + groupId + "&mode=chartSingleMetricSingleResource";
+ LinkItem link = newLinkItem(title, destination);
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(oob.getTimestamp()));
+
+ row.setItems(link, time);
+ column.addMember(row);
+ }
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentOobContent.extendLocatorId("None"),
+ RECENT_OOB_NONE);
+ column.addMember(row);
+ }
+ recentOobContent.setContents("");
+ for (Canvas child : recentOobContent.getChildren()) {
+ child.destroy();
+ }
+ recentOobContent.addChild(column);
+ recentOobContent.markForRedraw();
+ }
+ });
+ }
// /** Fetches recent package history information and updates the DynamicForm instance with details.
// */
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
index 61d3a5e..4c19c9d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
@@ -167,6 +167,16 @@ public class MeasurementDataGWTServiceImpl extends AbstractGWTServiceImpl implem
}
}
+ public PageList<MeasurementOOBComposite> getHighestNOOBsForGroup(int groupId, int n) throws RuntimeException {
+ try {
+ return SerialUtility.prepare(
+ measurementOOBManager.getHighestNOOBsForGroup(getSessionSubject(), groupId, n),
+ "MeasurementDataService.getHighestNOOBsForGroup");
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
public void enableSchedulesForResource(int resourceId, int[] measurementDefinitionIds) throws RuntimeException {
try {
scheduleManager.enableSchedulesForResource(getSessionSubject(), resourceId, measurementDefinitionIds);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerBean.java
index 72d1cd4..0bf42d3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerBean.java
@@ -54,7 +54,6 @@ import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.core.server.MeasurementConverter;
import org.rhq.core.server.PersistenceUtility;
import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
@@ -278,7 +277,7 @@ public class MeasurementOOBManagerBean implements MeasurementOOBManagerLocal {
metricNameFilter = QueryUtility.formatSearchParameter(metricNameFilter);
resourceNameFilter = QueryUtility.formatSearchParameter(resourceNameFilter);
- parentNameFilter = QueryUtility.formatSearchParameter(parentNameFilter);
+ parentNameFilter = QueryUtility.formatSearchParameter(parentNameFilter);
query.setParameter("metricName", metricNameFilter);
queryCount.setParameter("metricName", metricNameFilter);
@@ -287,7 +286,7 @@ public class MeasurementOOBManagerBean implements MeasurementOOBManagerLocal {
query.setParameter("parentName", parentNameFilter);
queryCount.setParameter("parentName", parentNameFilter);
query.setParameter("escapeChar", QueryUtility.getEscapeCharacter());
- queryCount.setParameter("escapeChar", QueryUtility.getEscapeCharacter());
+ queryCount.setParameter("escapeChar", QueryUtility.getEscapeCharacter());
if (!isAdmin) {
query.setParameter("subjectId", subject.getId());
@@ -375,6 +374,58 @@ public class MeasurementOOBManagerBean implements MeasurementOOBManagerLocal {
}
/**
+ * Returns the highest n OOBs for the passed group id
+ * @param subject caller
+ * @param groupId the group we are interested in
+ * @param n max number of entries wanted
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public PageList<MeasurementOOBComposite> getHighestNOOBsForGroup(Subject subject, int groupId, int n) {
+
+ if (!authMangager.canViewResource(subject, groupId)) {
+ return new PageList<MeasurementOOBComposite>();
+ }
+
+ PageControl pc = new PageControl(0, n);
+ pc.addDefaultOrderingField("sched.id");
+ pc.addDefaultOrderingField("o.oobFactor", PageOrdering.DESC);
+
+ String queryName = MeasurementOOB.GET_HIGHEST_FACTORS_FOR_GROUP;
+ Query query = PersistenceUtility.createQueryWithOrderBy(entityManager, queryName, pc);
+ Query countQuery = PersistenceUtility.createCountQuery(entityManager, queryName);
+ query.setParameter("groupId", groupId);
+ countQuery.setParameter("groupId", groupId);
+
+ List<MeasurementOOBComposite> results = query.getResultList();
+
+ if (!results.isEmpty()) {
+ // we have the n OOBs, so lets fetch the MeasurementData for those
+ List<MeasurementDataPK> pks = new ArrayList<MeasurementDataPK>(results.size());
+ Map<MeasurementDataPK, MeasurementOOBComposite> map = new HashMap<MeasurementDataPK, MeasurementOOBComposite>();
+ for (MeasurementOOBComposite comp : results) {
+ int schedule = comp.getScheduleId();
+ MeasurementDataPK key = new MeasurementDataPK(comp.getTimestamp(), schedule);
+ pks.add(key);
+ map.put(key, comp);
+ }
+ // compute and add the outlier data
+ List<MeasurementDataNumeric1H> datas = getOneHourDataForPKs(pks);
+ for (MeasurementDataNumeric1H data : datas) {
+ MeasurementDataPK pk = new MeasurementDataPK(data.getTimestamp(), data.getScheduleId());
+ MeasurementOOBComposite comp = map.get(pk);
+ comp.setData(data);
+ comp.calculateOutlier();
+ }
+ }
+ // return the result
+ long totalCount = (Long) countQuery.getSingleResult();
+ PageList<MeasurementOOBComposite> result = new PageList<MeasurementOOBComposite>(results, (int) totalCount, pc);
+
+ return result;
+ }
+
+ /**
* Return the 1h numeric data for the passed primary keys (schedule, timestamp)
* @param pks Primary keys to look up
* @return List of 1h data
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerLocal.java
index 527ec29..e22a429 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerLocal.java
@@ -90,4 +90,13 @@ public interface MeasurementOOBManagerLocal {
* @return
*/
PageList<MeasurementOOBComposite> getHighestNOOBsForResource(Subject subject, int resourceId, int n);
+
+ /**
+ * Returns the highest n OOBs for the passed group id within the last 72h
+ * @param subject caller
+ * @param groupId the resource we are interested in
+ * @param n max number of entries wanted
+ * @return
+ */
+ PageList<MeasurementOOBComposite> getHighestNOOBsForGroup(Subject subject, int groupId, int n);
}
commit 15ebbfb34b7d6bde6fc6efa532f30b413591cb4f
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Feb 22 14:21:43 2011 -0500
fix/enable group metric summary activity region.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
index 19899a1..e80bba4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
@@ -54,7 +54,7 @@ public interface MeasurementDataGWTService extends RemoteService {
List<List<MeasurementDataNumericHighLowComposite>> findDataForResource(int resourceId, int[] definitionIds,
long beginTime, long endTime, int numPoints) throws RuntimeException;
- List<List<MeasurementDataNumericHighLowComposite>> findDataForCompatibleGroup(int groupId, int definitionId,
+ List<List<MeasurementDataNumericHighLowComposite>> findDataForCompatibleGroup(int groupId, int[] definitionIds,
long beginTime, long endTime, int numPoints) throws RuntimeException;
PageList<CallTimeDataComposite> findCallTimeDataForResource(int scheduleId, long start, long end,
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 31f92fe..5e19edf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -19,13 +19,18 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -37,6 +42,8 @@ import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.event.EventSeverity;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.group.GroupCategory;
@@ -49,6 +56,7 @@ import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
import org.rhq.enterprise.gui.coregui.client.util.GwtTuple;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
@@ -78,9 +86,9 @@ public class ActivityView2 extends AbstractActivityView {
//TODO: spinder need to drive these calls off off facet availability
getRecentOperations();
getRecentConfigurationUpdates();
- // getRecentOobs();
- // getRecentPkgHistory();
- // getRecentMetrics();
+ // getRecentOobs();
+ // getRecentPkgHistory();
+ getRecentMetrics();
}
}
@@ -338,65 +346,69 @@ public class ActivityView2 extends AbstractActivityView {
});
}
- // /** Fetches OOB measurements and updates the DynamicForm instance with the latest 5
- // * oob change details.
- // */
- // private void getRecentOobs() {
- // final int resourceId = this.resourceComposite.getResource().getId();
- // GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForResource(resourceId, 5,
- // new AsyncCallback<PageList<MeasurementOOBComposite>>() {
- // @Override
- // public void onFailure(Throwable caught) {
- // Log.debug("Error retrieving recent out of bound metrics for resource [" + resourceId + "]:"
- // + caught.getMessage());
- // }
+ // /** Fetches OOB measurements and updates the DynamicForm instance with the latest 5
+ // * oob change details.
+ // */
+ // private void getRecentOobs() {
+ // final int groupId = this.groupComposite.getResourceGroup().getId();
//
- // @Override
- // public void onSuccess(PageList<MeasurementOOBComposite> result) {
- // VLayout column = new VLayout();
- // column.setHeight(10);
- // if (!result.isEmpty()) {
- // for (MeasurementOOBComposite oob : result) {
- // LocatableDynamicForm row = new LocatableDynamicForm(recentOobContent.extendLocatorId(oob
- // .getScheduleName()));
- // row.setNumCols(2);
+ //// GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForCompatibleGroup(groupId, 5,
//
- // String title = oob.getScheduleName() + ":";
- // String destination = "/resource/common/monitor/Visibility.do?m=" + oob.getDefinitionId()
- // + "&id=" + resourceId + "&mode=chartSingleMetricSingleResource";
- // LinkItem link = newLinkItem(title, destination);
- // StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(oob.getTimestamp()));
+ // GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForResource(groupId, 5,
+ // new AsyncCallback<PageList<MeasurementOOBComposite>>() {
+ // @Override
+ // public void onFailure(Throwable caught) {
+ // Log.debug("Error retrieving recent out of bound metrics for resource [" + groupId + "]:"
+ // + caught.getMessage());
+ // }
+ //
+ // @Override
+ // public void onSuccess(PageList<MeasurementOOBComposite> result) {
+ // VLayout column = new VLayout();
+ // column.setHeight(10);
+ // if (!result.isEmpty()) {
+ // for (MeasurementOOBComposite oob : result) {
+ // LocatableDynamicForm row = new LocatableDynamicForm(recentOobContent.extendLocatorId(oob
+ // .getScheduleName()));
+ // row.setNumCols(2);
+ //
+ // String title = oob.getScheduleName() + ":";
+ // String destination = "/resource/common/monitor/Visibility.do?m=" + oob.getDefinitionId()
+ // + "&id=" + groupId + "&mode=chartSingleMetricSingleResource";
+ // LinkItem link = newLinkItem(title, destination);
+ // StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(oob.getTimestamp()));
//
- // row.setItems(link, time);
+ // row.setItems(link, time);
+ // column.addMember(row);
+ // }
+ // } else {
+ // LocatableDynamicForm row = createEmptyDisplayRow(recentOobContent.extendLocatorId("None"),
+ // RECENT_OOB_NONE);
// column.addMember(row);
// }
- // } else {
- // LocatableDynamicForm row = createEmptyDisplayRow(recentOobContent.extendLocatorId("None"),
- // RECENT_OOB_NONE);
- // column.addMember(row);
- // }
- // recentOobContent.setContents("");
- // for (Canvas child : recentOobContent.getChildren()) {
- // child.destroy();
+ // recentOobContent.setContents("");
+ // for (Canvas child : recentOobContent.getChildren()) {
+ // child.destroy();
+ // }
+ // recentOobContent.addChild(column);
+ // recentOobContent.markForRedraw();
// }
- // recentOobContent.addChild(column);
- // recentOobContent.markForRedraw();
- // }
- // });
- // }
- //
+ // });
+ // }
+
// /** Fetches recent package history information and updates the DynamicForm instance with details.
// */
// private void getRecentPkgHistory() {
- //// final int resourceId = this.resourceComposite.getResource().getId();
+ // // final int resourceId = this.resourceComposite.getResource().getId();
// final int groupId = this.groupComposite.getResourceGroup().getId();
// InstalledPackageCriteria criteria = new InstalledPackageCriteria();
- //// criteria.addFilterResourceId(resourceId);
- // criteria.addFilterResourceId(groupId);
+ // // criteria.addFilterResourceId(resourceId);
+ //// criteria.addFilterResourceId(groupId);
+ // criteria.addFilter(groupId);
// PageControl pageControl = new PageControl(0, 5);
// criteria.setPageControl(pageControl);
//
- //// GWTServiceLookup.getContentService().getInstalledPackageHistoryForResource(resourceId, 5,
+ // // GWTServiceLookup.getContentService().getInstalledPackageHistoryForResource(resourceId, 5,
// GWTServiceLookup.getContentService().getInstalledPackageHistoryForResource(resourceId, 5,
// new AsyncCallback<PageList<InstalledPackageHistory>>() {
// @Override
@@ -442,151 +454,143 @@ public class ActivityView2 extends AbstractActivityView {
// });
// }
- // /** Fetches recent metric information and updates the DynamicForm instance with i)sparkline information,
- // * ii) link to recent metric graph for more details and iii) last metric value formatted to show significant
- // * digits.
- // */
- // private void getRecentMetrics() {
- // //display container
- // final VLayout column = new VLayout();
- // column.setHeight(10);//pack
- // // final int resourceId = this.resourceComposite.getResource().getId();
- // final int groupId = this.groupComposite.getResourceGroup().getId();
- //
- // // MeasurementDefinitionCriteria mdc = new MeasurementDefinitionCriteria();
- // // mdc.
- //
- // //retrieve all relevant measurement definition ids.
- // // Set<MeasurementDefinition> definitions = this.resourceComposite.getResource().getResourceType()
- // Set<MeasurementDefinition> definitions = this.groupComposite.getResourceGroup().getResourceType()
- // .getMetricDefinitions();
- //
- // //build id mapping for measurementDefinition instances Ex. Free Memory -> MeasurementDefinition[100071]
- // final HashMap<String, MeasurementDefinition> measurementDefMap = new HashMap<String, MeasurementDefinition>();
- // for (MeasurementDefinition definition : definitions) {
- // measurementDefMap.put(definition.getDisplayName(), definition);
- // }
- //
- // //bundle definition ids for asynch call.
- // int[] definitionArrayIds = new int[definitions.size()];
- // final String[] displayOrder = new String[definitions.size()];
- // measurementDefMap.keySet().toArray(displayOrder);
- // //sort the charting data ex. Free Memory, Free Swap Space,..System Load
- // Arrays.sort(displayOrder);
- //
- // //organize definitionArrayIds for ordered request on server.
- // int index = 0;
- // for (String definitionToDisplay : displayOrder) {
- // definitionArrayIds[index++] = measurementDefMap.get(definitionToDisplay).getId();
- // }
- // //make the asynchronous call for all the measurement data
- // // GWTServiceLookup.getMeasurementDataService().findDataForResource(resourceId, definitionArrayIds,
- // GWTServiceLookup.getMeasurementDataService().findDataForCompatibleGroup(groupId, definitionArrayIds[0],
- // System.currentTimeMillis() - (1000L * 60 * 60 * 8), System.currentTimeMillis(), 60,
- // new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
- // @Override
- // public void onFailure(Throwable caught) {
- // // Log.debug("Error retrieving recent metrics charting data for group [" + resourceId + "]:"
- // Log.debug("Error retrieving recent metrics charting data for group [" + groupId + "]:"
- // + caught.getMessage());
- // }
- //
- // @Override
- // public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> results) {
- // if (!results.isEmpty()) {
- // boolean someChartedData = false;
- // //iterate over the retrieved charting data
- // for (int index = 0; index < displayOrder.length; index++) {
- //
- // //retrieve the correct measurement definition
- // MeasurementDefinition md = measurementDefMap.get(displayOrder[index]);
- //
- // //load the data results for the given metric definition
- // List<MeasurementDataNumericHighLowComposite> data = results.get(index);
- //
- // //locate last and minimum values.
- // double lastValue = -1;
- // double minValue = Double.MAX_VALUE;//
- // for (MeasurementDataNumericHighLowComposite d : data) {
- // if ((!Double.isNaN(d.getValue()))
- // && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
- // if (d.getValue() < minValue) {
- // minValue = d.getValue();
- // }
- // lastValue = d.getValue();
- // }
- // }
- //
- // //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
- // String commaDelimitedList = "";
- //
- // for (MeasurementDataNumericHighLowComposite d : data) {
- // if ((!Double.isNaN(d.getValue()))
- // && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
- // commaDelimitedList += d.getValue() + ",";
- // }
- // }
- // LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
- // .extendLocatorId(md.getName()));
- // row.setNumCols(3);
- // HTMLFlow graph = new HTMLFlow();
- // // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0'>"
- // // + commaDelimitedList + "</span>";
- // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0' "
- // + "values='" + commaDelimitedList + "'>...</span>";
- // graph.setContents(contents);
- // graph.setContentsType(ContentsType.PAGE);
- // //diable scrollbars on span
- // graph.setScrollbarSize(0);
- //
- // CanvasItem graphContainer = new CanvasItem();
- // graphContainer.setShowTitle(false);
- // graphContainer.setHeight(16);
- // graphContainer.setWidth(60);
- // graphContainer.setCanvas(graph);
- //
- // //Link/title element
- // //TODO: spinder, change link whenever portal.war/graphing is removed.
- // String title = md.getDisplayName() + ":";
- // // String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricSingleResource&id="
- // // + resourceId + "&m=" + md.getId();
- // String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricMultiResource&groupId="
- // + groupId + "&m=" + md.getId();
- // LinkItem link = newLinkItem(title, destination);
- //
- // //Value
- // String convertedValue = lastValue + " " + md.getUnits();
- // convertedValue = convertLastValueForDisplay(lastValue, md);
- // StaticTextItem value = newTextItem(convertedValue);
- //
- // row.setItems(graphContainer, link, value);
- // //if graph content returned
- // if ((md.getName().trim().indexOf("Trait.") == -1) && (lastValue != -1)) {
- // column.addMember(row);
- // someChartedData = true;
- // }
- // }
- // if (!someChartedData) {// when there are results but no chartable entries.
- // LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
- // .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
- // column.addMember(row);
- // }
- // //call out to 3rd party javascript lib
- // BrowserUtility.graphSparkLines();
- // } else {
- // LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
- // .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
- // column.addMember(row);
- // }
- // }
- // });
- //
- // //cleanup
- // for (Canvas child : recentMeasurementsContent.getChildren()) {
- // child.destroy();
- // }
- // recentMeasurementsContent.addChild(column);
- // recentMeasurementsContent.markForRedraw();
- // }
+ /** Fetches recent metric information and updates the DynamicForm instance with i)sparkline information,
+ * ii) link to recent metric graph for more details and iii) last metric value formatted to show significant
+ * digits.
+ */
+ private void getRecentMetrics() {
+
+ //display container
+ final VLayout column = new VLayout();
+ column.setHeight(10);//pack
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+
+ //retrieve all relevant measurement definition ids.
+ Set<MeasurementDefinition> definitions = this.groupComposite.getResourceGroup().getResourceType()
+ .getMetricDefinitions();
+
+ //build id mapping for measurementDefinition instances Ex. Free Memory -> MeasurementDefinition[100071]
+ final HashMap<String, MeasurementDefinition> measurementDefMap = new HashMap<String, MeasurementDefinition>();
+ for (MeasurementDefinition definition : definitions) {
+ measurementDefMap.put(definition.getDisplayName(), definition);
+ }
+ //bundle definition ids for asynch call.
+ int[] definitionArrayIds = new int[definitions.size()];
+ final String[] displayOrder = new String[definitions.size()];
+ measurementDefMap.keySet().toArray(displayOrder);
+ //sort the charting data ex. Free Memory, Free Swap Space,..System Load
+ Arrays.sort(displayOrder);
+
+ //organize definitionArrayIds for ordered request on server.
+ int index = 0;
+ for (String definitionToDisplay : displayOrder) {
+ definitionArrayIds[index++] = measurementDefMap.get(definitionToDisplay).getId();
+ }
+ //make the asynchronous call for all the measurement data
+ GWTServiceLookup.getMeasurementDataService().findDataForCompatibleGroup(groupId, definitionArrayIds,
+ System.currentTimeMillis() - (1000L * 60 * 60 * 8), System.currentTimeMillis(), 60,
+ new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent metrics charting data for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
+
+ @Override
+ public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> results) {
+ if (!results.isEmpty()) {
+ boolean someChartedData = false;
+ //iterate over the retrieved charting data
+ for (int index = 0; index < displayOrder.length; index++) {
+ //retrieve the correct measurement definition
+ MeasurementDefinition md = measurementDefMap.get(displayOrder[index]);
+
+ //load the data results for the given metric definition
+ List<MeasurementDataNumericHighLowComposite> data = results.get(index);
+
+ //locate last and minimum values.
+ double lastValue = -1;
+ double minValue = Double.MAX_VALUE;//
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
+ if (d.getValue() < minValue) {
+ minValue = d.getValue();
+ }
+ lastValue = d.getValue();
+ }
+ }
+
+ //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
+ String commaDelimitedList = "";
+
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
+ commaDelimitedList += d.getValue() + ",";
+ }
+ }
+ LocatableDynamicForm row = new LocatableDynamicForm(recentMeasurementsContent
+ .extendLocatorId(md.getName()));
+ row.setNumCols(3);
+ HTMLFlow graph = new HTMLFlow();
+ // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0'>"
+ // + commaDelimitedList + "</span>";
+ String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0' "
+ + "values='" + commaDelimitedList + "'>...</span>";
+ graph.setContents(contents);
+ graph.setContentsType(ContentsType.PAGE);
+ //diable scrollbars on span
+ graph.setScrollbarSize(0);
+
+ CanvasItem graphContainer = new CanvasItem();
+ graphContainer.setShowTitle(false);
+ graphContainer.setHeight(16);
+ graphContainer.setWidth(60);
+ graphContainer.setCanvas(graph);
+
+ //Link/title element
+ //TODO: spinder, change link whenever portal.war/graphing is removed.
+ String title = md.getDisplayName() + ":";
+ // String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricSingleResource&id="
+ // + resourceId + "&m=" + md.getId();
+ String destination = "/resource/common/monitor/Visibility.do?mode=chartSingleMetricMultiResource&groupId="
+ + groupId + "&m=" + md.getId();
+ LinkItem link = newLinkItem(title, destination);
+
+ //Value
+ String convertedValue = lastValue + " " + md.getUnits();
+ convertedValue = convertLastValueForDisplay(lastValue, md);
+ StaticTextItem value = newTextItem(convertedValue);
+
+ row.setItems(graphContainer, link, value);
+ //if graph content returned
+ if ((md.getName().trim().indexOf("Trait.") == -1) && (lastValue != -1)) {
+ column.addMember(row);
+ someChartedData = true;
+ }
+ }
+ if (!someChartedData) {// when there are results but no chartable entries.
+ LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
+ .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
+ column.addMember(row);
+ }
+ //call out to 3rd party javascript lib
+ BrowserUtility.graphSparkLines();
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentMeasurementsContent
+ .extendLocatorId("None"), RECENT_MEASUREMENTS_NONE);
+ column.addMember(row);
+ }
+ }
+ });
+
+ //cleanup
+ for (Canvas child : recentMeasurementsContent.getChildren()) {
+ child.destroy();
+ }
+ recentMeasurementsContent.addChild(column);
+ recentMeasurementsContent.markForRedraw();
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
index 3af7acb..61d3a5e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -47,6 +48,7 @@ import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
/**
+ * @author Simeon Pinder
* @author Greg Hinkle
*/
public class MeasurementDataGWTServiceImpl extends AbstractGWTServiceImpl implements MeasurementDataGWTService {
@@ -89,12 +91,16 @@ public class MeasurementDataGWTServiceImpl extends AbstractGWTServiceImpl implem
}
}
- // public List<List<MeasurementDataNumericHighLowComposite>> findDataForCompatibleGroup(int resourceId, int[] definitionIds,
- public List<List<MeasurementDataNumericHighLowComposite>> findDataForCompatibleGroup(int resourceId,
- int definitionId, long beginTime, long endTime, int numPoints) throws RuntimeException {
+ public List<List<MeasurementDataNumericHighLowComposite>> findDataForCompatibleGroup(int groupId,
+ int[] definitionIds, long beginTime, long endTime, int numPoints) throws RuntimeException {
try {
- return SerialUtility.prepare(dataManager.findDataForCompatibleGroup(getSessionSubject(), resourceId,
- definitionId, beginTime, endTime, numPoints), "MeasurementDataService.findDataForCompatibleGroup");
+ //iterate over each of the definitionIds to retrieve the display data for each.
+ List<List<MeasurementDataNumericHighLowComposite>> results = new ArrayList<List<MeasurementDataNumericHighLowComposite>>();
+ for (int nextDefinitionId : definitionIds) {
+ results.addAll(dataManager.findDataForCompatibleGroup(getSessionSubject(), groupId, nextDefinitionId,
+ beginTime, endTime, numPoints));
+ }
+ return SerialUtility.prepare(results, "MeasurementDataService.findDataForCompatibleGroup");
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
commit c7dfdd202b030c91874181b12da596674b76025b
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Feb 21 12:03:41 2011 -0500
enable group config query. More work needed here as group config changes not currently supported.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index 17fcad0..31f92fe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -32,8 +32,10 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
+import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.event.EventSeverity;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
@@ -73,8 +75,9 @@ public class ActivityView2 extends AbstractActivityView {
getRecentEventUpdates();
if ((groupComposite != null)
&& (groupComposite.getResourceGroup().getGroupCategory().equals(GroupCategory.COMPATIBLE))) {//CompatibleGroup
+ //TODO: spinder need to drive these calls off off facet availability
getRecentOperations();
- // getRecentConfigurationUpdates();
+ getRecentConfigurationUpdates();
// getRecentOobs();
// getRecentPkgHistory();
// getRecentMetrics();
@@ -203,67 +206,73 @@ public class ActivityView2 extends AbstractActivityView {
});
}
- // /** Fetches configuration updates and updates the DynamicForm instance with the latest
- // * config change information.
- // */
- // private void getRecentConfigurationUpdates() {
- // final int resourceId = this.resourceComposite.getResource().getId();
- //
- // PageControl lastFive = new PageControl(0, 5);
- // lastFive.initDefaultOrderingField("cu.createdTime", PageOrdering.DESC);
- //
- // GWTServiceLookup.getConfigurationService().findResourceConfigurationUpdates(resourceId, null, null, true,
- // lastFive, new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
- //
- // @Override
- // public void onFailure(Throwable caught) {
- // Log.debug("Error retrieving recent configuration updates for resource [" + resourceId + "]:"
- // + caught.getMessage());
- // }
- //
- // @Override
- // public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
- // VLayout column = new VLayout();
- // column.setHeight(10);
- // if (!result.isEmpty()) {
- // int rowNum = 0;
- // for (ResourceConfigurationUpdate update : result) {
- // // config update history records do not have a usable locatorId, we'll use rownum, which is unique and
- // // may be repeatable.
- // LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
- // .extendLocatorId(String.valueOf(rowNum)));
- // row.setNumCols(3);
- //
- // StaticTextItem iconItem = newTextItemIcon(ImageManager.getResourceConfigurationIcon(update
- // .getStatus()), null);
- // String linkTitle = MSG.view_resource_inventory_activity_changed_by() + " "
- // + update.getSubjectName() + ":";
- // if ((update.getSubjectName() == null) || (update.getSubjectName().trim().isEmpty())) {
- // linkTitle = MSG.common_msg_changeAutoDetected();
- // }
- // LinkItem link = newLinkItem(linkTitle, ReportDecorator.GWT_RESOURCE_URL + resourceId
- // + "/Configuration/History/" + update.getId());
- // StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(update
- // .getCreatedTime()));
- //
- // row.setItems(iconItem, link, time);
- // column.addMember(row);
- // }
- // } else {
- // LocatableDynamicForm row = createEmptyDisplayRow(recentConfigurationContent
- // .extendLocatorId("None"), RECENT_CONFIGURATIONS_NONE);
- // column.addMember(row);
- // }
- // //cleanup
- // for (Canvas child : recentConfigurationContent.getChildren()) {
- // child.destroy();
- // }
- // recentConfigurationContent.addChild(column);
- // recentConfigurationContent.markForRedraw();
- // }
- // });
- // }
- //
+ /** Fetches configuration updates and updates the DynamicForm instance with the latest
+ * config change information.
+ */
+ private void getRecentConfigurationUpdates() {
+ final int groupId = this.groupComposite.getResourceGroup().getId();
+
+ PageControl lastFive = new PageControl(0, 5);
+ GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();
+ criteria.setPageControl(lastFive);
+ criteria.addSortStatus(PageOrdering.DESC);
+ List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
+ filterResourceGroupIds.add(groupId);
+ criteria.addFilterResourceGroupIds(filterResourceGroupIds);
+
+ GWTServiceLookup.getConfigurationService().findGroupResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<GroupResourceConfigurationUpdate>>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent configuration updates for group [" + groupId + "]:"
+ + caught.getMessage());
+ }
+
+ @Override
+ public void onSuccess(PageList<GroupResourceConfigurationUpdate> result) {
+ VLayout column = new VLayout();
+ column.setHeight(10);
+ if (!result.isEmpty()) {
+ int rowNum = 0;
+ for (GroupResourceConfigurationUpdate update : result) {
+ // config update history records do not have a usable locatorId, we'll use rownum, which is unique and
+ // may be repeatable.
+ LocatableDynamicForm row = new LocatableDynamicForm(recentConfigurationContent
+ .extendLocatorId(String.valueOf(rowNum)));
+ row.setNumCols(3);
+
+ StaticTextItem iconItem = newTextItemIcon(ImageManager.getResourceConfigurationIcon(update
+ .getStatus()), null);
+ String linkTitle = MSG.view_resource_inventory_activity_changed_by() + " "
+ + update.getSubjectName() + ":";
+ if ((update.getSubjectName() == null) || (update.getSubjectName().trim().isEmpty())) {
+ linkTitle = MSG.common_msg_changeAutoDetected();
+ }
+ LinkItem link = newLinkItem(linkTitle, ReportDecorator.GWT_GROUP_URL + groupId
+ + "/Configuration/History/" + update.getId());
+ StaticTextItem time = newTextItem(GwtRelativeDurationConverter.format(update
+ .getCreatedTime()));
+
+ row.setItems(iconItem, link, time);
+ column.addMember(row);
+ }
+ } else {
+ LocatableDynamicForm row = createEmptyDisplayRow(recentConfigurationContent
+ .extendLocatorId("None"), RECENT_CONFIGURATIONS_NONE);
+ column.addMember(row);
+ }
+ //cleanup
+ for (Canvas child : recentConfigurationContent.getChildren()) {
+ child.destroy();
+ }
+ recentConfigurationContent.addChild(column);
+ recentConfigurationContent.markForRedraw();
+
+ }
+ });
+ }
+
/** Fetches recent events and updates the DynamicForm instance with the latest
* event information over last 24hrs.
*/
13 years, 3 months
[rhq] Branch 'cli-alert-notifs' - 2 commits - modules/core modules/enterprise
by lkrejci
modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersionFormatDescription.java | 91 ++++
modules/core/domain/src/main/java/org/rhq/core/domain/content/ValidatablePackageDetailsKey.java | 107 ++++
modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageAndLatestVersionComposite.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageTypeAndVersionFormatComposite.java | 68 +++
modules/core/domain/src/main/java/org/rhq/core/domain/util/OSGiVersion.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java | 117 ++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java | 6
modules/enterprise/server/ear/pom.xml | 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java | 87 +++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java | 57 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java | 15
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerRemote.java | 15
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java | 56 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerLocal.java | 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerRemote.java | 5
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/AbstractPackageTypeBehavior.java | 33 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageDetailsValidationException.java | 47 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageSource.java | 16
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypeBehavior.java | 67 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypePluginManager.java | 155 +++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypeServerPluginContainer.java | 56 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java | 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 6
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java | 6
modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java | 41 -
modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java | 2
modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java | 18
modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java | 9
modules/enterprise/server/plugins/packagetype-cli/pom.xml | 217 ++++++++++
modules/enterprise/server/plugins/packagetype-cli/src/main/java/org/rhq/enterprise/server/plugins/packagetypeCli/CliPackageTypeBehavior.java | 132 ++++++
modules/enterprise/server/plugins/packagetype-cli/src/main/resources/META-INF/rhq-serverplugin.xml | 24 +
modules/enterprise/server/plugins/pom.xml | 1
modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java | 9
modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java | 10
modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java | 9
modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java | 3
modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java | 4
modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-packagetype.xsd | 144 ++++++
42 files changed, 1481 insertions(+), 210 deletions(-)
New commits:
commit f786a5d381aa060eaa7b365f78b8571b259e1ca4
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Mar 2 10:39:43 2011 +0100
Updating the CLI notification form to make use of the version formatting info provided by the package type behaviors.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/OSGiVersion.java b/modules/core/domain/src/main/java/org/rhq/core/domain/util/OSGiVersion.java
index 0c9d664..eedadc2 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/OSGiVersion.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/OSGiVersion.java
@@ -36,6 +36,22 @@ public class OSGiVersion {
}
+ public static boolean isValid(String version) {
+ try {
+ new OSGiVersion(version);
+ return true;
+ } catch (IllegalArgumentException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Creates new OSGiVersion instance from the version string.
+ *
+ * @param version
+ *
+ * @throws IllegalArgumentException if the version string isn't a well-formed OSGi version string.
+ */
public OSGiVersion(String version) {
String[] parts = version.split("\\.");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java
index e8d1c1c..dd18191 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java
@@ -30,8 +30,6 @@ import com.smartgwt.client.widgets.form.events.FormSubmitFailedEvent;
import com.smartgwt.client.widgets.form.events.FormSubmitFailedHandler;
import com.smartgwt.client.widgets.form.events.ItemChangeEvent;
import com.smartgwt.client.widgets.form.events.ItemChangeHandler;
-import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
-import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
@@ -48,9 +46,10 @@ import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import org.rhq.core.domain.alert.notification.AlertNotification;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.PackageVersionFormatDescription;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
+import org.rhq.core.domain.content.composite.PackageTypeAndVersionFormatComposite;
import org.rhq.core.domain.criteria.PackageCriteria;
import org.rhq.core.domain.criteria.RepoCriteria;
import org.rhq.core.domain.criteria.SubjectCriteria;
@@ -78,7 +77,7 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
private static final String PROP_USER_ID = "userId";
private static final String PROP_USER_NAME = "userName";
private static final String PROP_USER_PASSWORD = "userPassword";
- private static final String PACKAGE_TYPE_NAME = "__SERVER_SIDE_CLI_SCRIPT";
+ private static final String PACKAGE_TYPE_NAME = "org.rhq.enterprise.server.plugins.packagetypeCli.SERVER_SIDE_CLI_SCRIPT";
private static class Config {
List<Repo> allRepos;
@@ -185,12 +184,12 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
private SelectItem existingPackageSelector;
private RadioGroupWithComponentsItem userSelector;
private PackageVersionFileUploadFormWithVersion uploadForm;
- private PackageType cliScriptPackageType;
+ private PackageTypeAndVersionFormatComposite cliScriptPackageType;
private TextItem anotherUserName;
private TextItem anotherUserPassword;
private ButtonItem verifyUserButton;
- private FormItemIcon authSuccessIcon;
- private FormItemIcon authFailureIcon;
+ private FormItemIcon successIcon;
+ private FormItemIcon failureIcon;
private ForwardingSubmitFailedHandler uploadFailureHandler;
private ForwardingDynamicFormHandler uploadSuccessHandler;
@@ -205,13 +204,13 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
super.onInit();
if (!formBuilt) {
- loadPackageType(new AsyncCallback<PackageType>() {
+ loadPackageType(new AsyncCallback<PackageTypeAndVersionFormatComposite>() {
public void onFailure(Throwable t) {
CoreGUI.getErrorHandler().handleError(MSG.view_alert_definition_notification_cliScript_editor_loadFailed(),
t);
}
- public void onSuccess(PackageType result) {
+ public void onSuccess(PackageTypeAndVersionFormatComposite result) {
cliScriptPackageType = result;
LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("form"));
@@ -346,7 +345,7 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
PackageCriteria pc = new PackageCriteria();
pc.addFilterRepoId(repoId);
- pc.addFilterPackageTypeId(cliScriptPackageType.getId());
+ pc.addFilterPackageTypeId(cliScriptPackageType.getPackageType().getId());
packageSelector.setDisabled(false);
existingPackageSelector.setDisabled(true);
@@ -404,6 +403,20 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
getConfiguration().put(new PropertySimple(PROP_PACKAGE_ID, config.selectedPackage.getGeneralPackage().getId()));
callback.onSuccess(null);
} else {
+ if (cliScriptPackageType.getVersionFormat() != null) {
+ String versionRegex = cliScriptPackageType.getVersionFormat().getFullFormatRegex();
+ if (versionRegex != null) {
+ if (!matches(uploadForm.getField("version").getValue().toString(), versionRegex)) {
+ uploadForm.getItem("editableVersion").setIcons(failureIcon);
+ callback.onFailure(null);
+ return;
+ } else {
+ uploadForm.getItem("editableVersion").setIcons(successIcon);
+ }
+ } else {
+ uploadForm.getItem("editableVersion").setIcons();
+ }
+ }
uploadFailureHandler.setCallback(callback);
uploadSuccessHandler.setCallback(new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
@@ -449,7 +462,7 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
if (repoId != null && repoId.trim().length() > 0) {
PackageCriteria pc = new PackageCriteria();
pc.addFilterRepoId(Integer.parseInt(repoId));
- pc.addFilterPackageTypeId(cliScriptPackageType.getId());
+ pc.addFilterPackageTypeId(cliScriptPackageType.getPackageType().getId());
GWTServiceLookup.getContentService().findPackagesWithLatestVersion(pc, new AsyncCallback<PageList<PackageAndLatestVersionComposite>>() {
public void onSuccess(PageList<PackageAndLatestVersionComposite> result) {
config.allPackages = result;
@@ -505,15 +518,15 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
anotherUserPassword = new PasswordItem("password", MSG.dataSource_users_field_password());
verifyUserButton = new ButtonItem("verify", MSG.view_alert_definition_notification_cliScript_editor_verifyAuthentication());
- authSuccessIcon = new FormItemIcon();
- authSuccessIcon.setSrc(ImageManager.getAvailabilityIcon(Boolean.TRUE));
- authSuccessIcon.setWidth(16);
- authSuccessIcon.setHeight(16);
+ successIcon = new FormItemIcon();
+ successIcon.setSrc(ImageManager.getAvailabilityIcon(Boolean.TRUE));
+ successIcon.setWidth(16);
+ successIcon.setHeight(16);
- authFailureIcon = new FormItemIcon();
- authFailureIcon.setSrc(ImageManager.getAvailabilityIcon(Boolean.FALSE));
- authFailureIcon.setWidth(16);
- authFailureIcon.setHeight(16);
+ failureIcon = new FormItemIcon();
+ failureIcon.setSrc(ImageManager.getAvailabilityIcon(Boolean.FALSE));
+ failureIcon.setWidth(16);
+ failureIcon.setHeight(16);
form.setFields(anotherUserName, anotherUserPassword, verifyUserButton);
@@ -548,9 +561,9 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
}
private DynamicForm createUploadNewScriptForm() {
- uploadForm = new PackageVersionFileUploadFormWithVersion(extendLocatorId("uploadForm"), cliScriptPackageType.getId());
+ uploadForm = new PackageVersionFileUploadFormWithVersion(extendLocatorId("uploadForm"), cliScriptPackageType.getPackageType().getId());
uploadForm.setTitleOrientation(TitleOrientation.TOP);
- uploadForm.setPackageTypeId(cliScriptPackageType.getId());
+ uploadForm.setPackageTypeId(cliScriptPackageType.getPackageType().getId());
uploadFailureHandler = (new ForwardingSubmitFailedHandler() {
public void onFormSubmitFailed(FormSubmitFailedEvent event) {
@@ -579,13 +592,34 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
uploadForm.addItemChangeHandler(new ItemChangeHandler() {
public void onItemChange(ItemChangeEvent event) {
if (event.getItem() instanceof UploadItem) {
+ if (event.getNewValue() == null) {
+ uploadForm.getField("editableVersion").setValue("");
+ return;
+ }
+
String fileName = event.getNewValue().toString();
if (config.allPackages != null) {
for(PackageAndLatestVersionComposite plv : config.allPackages) {
if (plv.getGeneralPackage().getName().equals(fileName)) {
try {
- OSGiVersion v = new OSGiVersion(plv.getLatestPackageVersion().getVersion());
+ String version = plv.getLatestPackageVersion().getVersion();
+
+ PackageVersionFormatDescription format = cliScriptPackageType.getVersionFormat();
+ if (format == null) {
+ return;
+ }
+
+ if (format.getOsgiVersionExtractionRegex() == null) {
+ return;
+ }
+
+ String regex = format.getOsgiVersionExtractionRegex();
+ int group = format.getOsgiVersionGroupIndex();
+ String oldOsgiVersion = getOsgiVersion(version, regex, group);
+
+
+ OSGiVersion v = new OSGiVersion(oldOsgiVersion);
if (v.getMicroIfDefined() != null) {
v.setMicro(v.getMicro() + 1);
} else if (v.getMinorIfDefined() != null) {
@@ -593,10 +627,13 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
} else {
v.setMajor(v.getMajor() + 1);
}
+
+ String newVersion = version.replace(oldOsgiVersion, v.toString());
- uploadForm.getField("editableVersion").setValue(v.toString());
+ uploadForm.getField("editableVersion").setValue(newVersion);
+ uploadForm.getField("version").setValue(newVersion);
return;
- } catch (IllegalArgumentException e) {
+ } catch (Exception e) {
//ok, can't suggest anything
return;
}
@@ -604,8 +641,17 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
}
//no existing package exists with the same name as the file being uploaded
- uploadForm.getField("editableVersion").setValue("1.0");
- }
+
+ String defaultVersion = "";
+ if (cliScriptPackageType.getVersionFormat() != null && cliScriptPackageType.getVersionFormat().getOsgiVersionExtractionRegex() != null) {
+ //check if the package format understands plain OSGi versioning
+ if (matches("1.0", cliScriptPackageType.getVersionFormat().getFullFormatRegex())) {
+ defaultVersion = "1.0";
+ }
+ }
+ uploadForm.getField("editableVersion").setValue(defaultVersion);
+ uploadForm.getField("version").setValue(defaultVersion);
+ }
}
}
});
@@ -613,7 +659,7 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
return uploadForm;
}
- private void loadPackageType(AsyncCallback<PackageType> handler) {
+ private void loadPackageType(AsyncCallback<PackageTypeAndVersionFormatComposite> handler) {
GWTServiceLookup.getContentService().findPackageType(null, PACKAGE_TYPE_NAME, handler);
}
@@ -624,14 +670,14 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
GWTServiceLookup.getSubjectService().checkAuthentication(username, password, new AsyncCallback<Subject>() {
public void onFailure(Throwable caught) {
config.selectedSubject = null;
- verifyUserButton.setIcons(authFailureIcon);
+ verifyUserButton.setIcons(failureIcon);
markForRedraw();
action.onFailure(caught);
}
public void onSuccess(Subject result) {
config.selectedSubject = result;
- verifyUserButton.setIcons(result == null ? authFailureIcon : authSuccessIcon);
+ verifyUserButton.setIcons(result == null ? failureIcon : successIcon);
markForRedraw();
if (result == null) {
action.onFailure(null);
@@ -641,4 +687,17 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
}
});
}
+
+ private static native String getOsgiVersion(String version, String osgiRegex, int groupIdx) /*-{
+ var re = new RegExp(osgiRegex);
+ var groupRef = '$' + groupIdx;
+ version = version.replace(re, groupRef);
+
+ return version;
+ }-*/;
+
+ private static native boolean matches(String string, String regex) /*-{
+ var re = new RegExp(regex);
+ return re.test(string);
+ }-*/;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java
index 27f6bad..e9428a4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ContentGWTService.java
@@ -32,6 +32,7 @@ import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
+import org.rhq.core.domain.content.composite.PackageTypeAndVersionFormatComposite;
import org.rhq.core.domain.criteria.PackageCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
import org.rhq.core.domain.util.PageList;
@@ -56,6 +57,6 @@ public interface ContentGWTService extends RemoteService {
PackageType getResourceCreationPackageType(int resourceTypeId) throws RuntimeException;
- PackageType findPackageType(Integer resourceTypeId, String packageTypeName) throws RuntimeException;
+ PackageTypeAndVersionFormatComposite findPackageType(Integer resourceTypeId, String packageTypeName) throws RuntimeException;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java
index 6a0f3eb..7a66cff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ContentGWTServiceImpl.java
@@ -29,7 +29,9 @@ import org.rhq.core.domain.content.InstalledPackageHistory;
import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
+import org.rhq.core.domain.content.PackageVersionFormatDescription;
import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
+import org.rhq.core.domain.content.composite.PackageTypeAndVersionFormatComposite;
import org.rhq.core.domain.criteria.PackageCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
import org.rhq.core.domain.util.PageControl;
@@ -119,9 +121,9 @@ public class ContentGWTServiceImpl extends AbstractGWTServiceImpl implements Con
}
@Override
- public PackageType findPackageType(Integer resourceTypeId, String packageTypeName) throws RuntimeException {
+ public PackageTypeAndVersionFormatComposite findPackageType(Integer resourceTypeId, String packageTypeName) throws RuntimeException {
try {
- return SerialUtility.prepare(contentManager.findPackageType(getSessionSubject(), resourceTypeId, packageTypeName),
+ return SerialUtility.prepare(contentManager.findPackageTypeWithVersionFormat(getSessionSubject(), resourceTypeId, packageTypeName),
"ContentService.findPackageType");
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
commit 557da3b9e2b646883d7793b355a1c662d144b770
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Mar 2 10:37:19 2011 +0100
This rather huge commit contains the following changes:
* a new server-side plugin type is defined - the packagetype plugin that can define new package types and their "behaviors"
* a concept of packagetype behavior is introduced - basically impls of this interface can enforce naming conventions, etc.
* content subsystem is modified to consult the packagetype behaviors when creating package versions in user initiated workflows
* a packagetype plugin for CLI scripts is defined
* changes made to PackageSource iface (and impls) to return package version comparators are reverted because this functionality is now the responsibility of the behaviors
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java
index c42862e..76dbff4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java
@@ -335,8 +335,9 @@ public class PackageVersion implements Serializable {
}
//hmm... there's actually nothing we can sort these two by..
- //pronounce them equal
- return 0;
+ //let's compare them by id - the one inserted sooner will have a lower id
+
+ return Integer.valueOf(p1.getId()).compareTo(p2.getId());
}
};
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersionFormatDescription.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersionFormatDescription.java
new file mode 100644
index 0000000..3df2748
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersionFormatDescription.java
@@ -0,0 +1,91 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.domain.content;
+
+import java.io.Serializable;
+
+/**
+ * This class describes the qualities of a package version format
+ * and is used by the UI to provide "next version" hints to the user
+ * as well as for checking the version string format validity.
+ * <p>
+ * Note that this is going to be used in UI and therefore the regexes
+ * need to be written using the Javascript regex synax, *NOT* the Java one.
+ *
+ * @author Lukas Krejci
+ */
+public class PackageVersionFormatDescription implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String fullFormatRegex;
+ private String osgiVersionExtractionRegex;
+ private int osgiVersionGroupIndex;
+ private String textualDesctiption;
+
+ //GWT mandates a no-arg constructor, even if just private
+ protected PackageVersionFormatDescription() {
+
+ }
+
+ /**
+ *
+ * @param fullFormatRegex the regex the user supplied version must match
+ * @param osgiVersionExtractionRegex a regex to extract the osgi version string from the full version string.
+ * The regex must match the whole version string and have a group enclosing the osgi version string within it.
+ * @param osgiVersionGroupIndex the index of the group in the osgi version regex that contains the actual osgi version string
+ * @param textualDescription the textual description of format
+ */
+ public PackageVersionFormatDescription(String fullFormatRegex, String osgiVersionExtractionRegex, int osgiVersionGroupIndex, String textualDescription) {
+ super();
+ this.fullFormatRegex = fullFormatRegex;
+ this.osgiVersionExtractionRegex = osgiVersionExtractionRegex;
+ this.osgiVersionGroupIndex = osgiVersionGroupIndex;
+ this.textualDesctiption = textualDescription;
+ }
+
+ /**
+ * @return the fullFormatRegex
+ */
+ public String getFullFormatRegex() {
+ return fullFormatRegex;
+ }
+
+ /**
+ * @return the osgiVersionExtractionRegex
+ */
+ public String getOsgiVersionExtractionRegex() {
+ return osgiVersionExtractionRegex;
+ }
+
+ /**
+ * @return the osgiVersionGroupIndex
+ */
+ public int getOsgiVersionGroupIndex() {
+ return osgiVersionGroupIndex;
+ }
+
+ /**
+ * @return the textualDesctiption
+ */
+ public String getTextualDesctiption() {
+ return textualDesctiption;
+ }
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ValidatablePackageDetailsKey.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ValidatablePackageDetailsKey.java
new file mode 100644
index 0000000..848df3d
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ValidatablePackageDetailsKey.java
@@ -0,0 +1,107 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.domain.content;
+
+/**
+ * This is a mutable version of the {@link PackageDetailsKey} used
+ * for validation purposes.
+ *
+ * @author Lukas Krejci
+ */
+public class ValidatablePackageDetailsKey {
+ private String name;
+ private String version;
+ private String packageTypeName;
+ private String architectureName;
+
+ public ValidatablePackageDetailsKey() {
+
+ }
+
+ public ValidatablePackageDetailsKey(String name, String version, String packageTypeName, String architectureName) {
+ this.name = name;
+ this.version = version;
+ this.packageTypeName = packageTypeName;
+ this.architectureName = architectureName;
+ }
+
+ public ValidatablePackageDetailsKey(PackageDetailsKey key) {
+ this.name = key.getName();
+ this.version = key.getVersion();
+ this.packageTypeName = key.getPackageTypeName();
+ this.architectureName = key.getArchitectureName();
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * @param version the version to set
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * @return the packageTypeName
+ */
+ public String getPackageTypeName() {
+ return packageTypeName;
+ }
+
+ /**
+ * @param packageTypeName the packageTypeName to set
+ */
+ public void setPackageTypeName(String packageTypeName) {
+ this.packageTypeName = packageTypeName;
+ }
+
+ /**
+ * @return the architectureName
+ */
+ public String getArchitectureName() {
+ return architectureName;
+ }
+
+ /**
+ * @param architectureName the architectureName to set
+ */
+ public void setArchitectureName(String architectureName) {
+ this.architectureName = architectureName;
+ }
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageAndLatestVersionComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageAndLatestVersionComposite.java
index 5c7c88f..62230e1 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageAndLatestVersionComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageAndLatestVersionComposite.java
@@ -21,6 +21,9 @@ package org.rhq.core.domain.content.composite;
import java.io.Serializable;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageVersion;
@@ -30,6 +33,7 @@ import org.rhq.core.domain.content.PackageVersion;
*
* @author Lukas Krejci
*/
+(a)XmlAccessorType(XmlAccessType.FIELD)
public class PackageAndLatestVersionComposite implements Serializable {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageTypeAndVersionFormatComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageTypeAndVersionFormatComposite.java
new file mode 100644
index 0000000..e4c9332
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageTypeAndVersionFormatComposite.java
@@ -0,0 +1,68 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.domain.content.composite;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.PackageVersionFormatDescription;
+
+/**
+ * @author Lukas Krejci
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+public class PackageTypeAndVersionFormatComposite implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private PackageType packageType;
+ private PackageVersionFormatDescription versionFormat;
+
+ protected PackageTypeAndVersionFormatComposite() {
+
+ }
+
+ /**
+ * @param packageType
+ * @param versionFormat
+ */
+ public PackageTypeAndVersionFormatComposite(PackageType packageType, PackageVersionFormatDescription versionFormat) {
+ super();
+ this.packageType = packageType;
+ this.versionFormat = versionFormat;
+ }
+
+ /**
+ * @return the packageType
+ */
+ public PackageType getPackageType() {
+ return packageType;
+ }
+
+ /**
+ * @return the versionFormat, can be null
+ */
+ public PackageVersionFormatDescription getVersionFormat() {
+ return versionFormat;
+ }
+}
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index 78c882d..220eee6 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -321,6 +321,18 @@
<artifactId>alert-subject</artifactId>
<version>${project.version}</version>
</artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-cli</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>packagetype-cli</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
</artifactItems>
<outputDirectory>${earDirectory}/rhq-serverplugins</outputDirectory>
</configuration>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 157a55d..d0ddc8f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -704,8 +704,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
q.setParameter("name", architecture.getName());
architecture = (Architecture) q.getSingleResult();
}
- PackageVersion packageVersion = contentManager.createPackageVersion(name, packageType.getId(), version,
- architecture.getId(), fileStream);
+ PackageVersion packageVersion = contentManager.createPackageVersion(subject, name, packageType.getId(),
+ version, architecture.getId(), fileStream);
// set the PackageVersion's filename to the bundleFile name, it's left null by default
packageVersion.setFileName(name);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index 026ea38..2713ff4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -77,7 +77,10 @@ import org.rhq.core.domain.content.PackageDetailsKey;
import org.rhq.core.domain.content.PackageInstallationStep;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
+import org.rhq.core.domain.content.PackageVersionFormatDescription;
+import org.rhq.core.domain.content.ValidatablePackageDetailsKey;
import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
+import org.rhq.core.domain.content.composite.PackageTypeAndVersionFormatComposite;
import org.rhq.core.domain.content.transfer.ContentResponseResult;
import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
import org.rhq.core.domain.content.transfer.DeployPackageStep;
@@ -102,6 +105,8 @@ import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.core.AgentManagerLocal;
+import org.rhq.enterprise.server.plugin.pc.content.PackageDetailsValidationException;
+import org.rhq.enterprise.server.plugin.pc.content.PackageTypeBehavior;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
@@ -1142,6 +1147,26 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
}
}
+ public PackageTypeAndVersionFormatComposite findPackageTypeWithVersionFormat(Subject subject,
+ Integer resourceTypeId, String packageTypeName) {
+
+ PackageType type = findPackageType(subject, resourceTypeId, packageTypeName);
+
+ PackageVersionFormatDescription format = null;
+
+ try {
+ PackageTypeBehavior behavior = ContentManagerHelper.getPackageTypeBehavior(packageTypeName);
+ if (behavior != null) {
+ format = behavior.getPackageVersionFormat(packageTypeName);
+ }
+ } catch (Exception e) {
+ //well, this shouldn't happen but is not crucial in this case
+ log.info("Failed to obtain the behavior of package type '" + packageTypeName + "'.", e);
+ }
+
+ return new PackageTypeAndVersionFormatComposite(type, format);
+ }
+
@SuppressWarnings("unchecked")
public void checkForTimedOutRequests(Subject subject) {
if (!authorizationManager.isOverlord(subject)) {
@@ -1219,14 +1244,13 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
+ "] does not have permission to create package versions");
}
- return createPackageVersion(packageName, packageTypeId, version, (null == architectureId) ? getNoArchitecture()
- .getId() : architectureId, new ByteArrayInputStream(packageBytes));
+ return createPackageVersion(subject, packageName, packageTypeId, version, (null == architectureId) ? getNoArchitecture()
+ .getId() : architectureId, new ByteArrayInputStream(packageBytes));
}
- @SuppressWarnings("unchecked")
@TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW)
- public PackageVersion createPackageVersion(String packageName, int packageTypeId, String version,
- int architectureId, InputStream packageBitStream) {
+ public PackageVersion createPackageVersion(Subject subject, String packageName, int packageTypeId,
+ String version, int architectureId, InputStream packageBitStream) {
// See if the package version already exists and return that if it does
Query packageVersionQuery = entityManager.createNamedQuery(PackageVersion.QUERY_FIND_BY_PACKAGE_VER_ARCH);
packageVersionQuery.setParameter("name", packageName);
@@ -1240,6 +1264,29 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
return (PackageVersion) existingVersionList.get(0);
}
+ Architecture architecture = entityManager.find(Architecture.class, architectureId);
+ PackageType packageType = entityManager.find(PackageType.class, packageTypeId);
+
+ //check the validity of the provided data
+ try {
+ PackageTypeBehavior behavior = ContentManagerHelper.getPackageTypeBehavior(packageTypeId);
+ ValidatablePackageDetailsKey key = new ValidatablePackageDetailsKey(packageName, version, packageType.getName(), architecture.getName());
+ behavior.validateDetails(key, subject);
+
+ packageName = key.getName();
+ version = key.getVersion();
+ if (!architecture.getName().equals(key.getArchitectureName())) {
+ Query q = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
+ q.setParameter("name", key.getArchitectureName());
+ architecture = (Architecture) q.getSingleResult();
+ }
+ } catch (PackageDetailsValidationException e) {
+ throw e;
+ } catch (Exception e) {
+ log.error("Failed to get the package type plugin container. This is a bug.", e);
+ throw new IllegalStateException("Failed to get the package type plugin container.", e);
+ }
+
// If the package doesn't exist, create that here
Query packageQuery = entityManager.createNamedQuery(Package.QUERY_FIND_BY_NAME_PKG_TYPE_ID);
packageQuery.setParameter("name", packageName);
@@ -1250,7 +1297,6 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
List existingPackageList = packageQuery.getResultList();
if (existingPackageList.size() == 0) {
- PackageType packageType = entityManager.find(PackageType.class, packageTypeId);
existingPackage = new Package(packageName, packageType);
existingPackage = persistOrMergePackageSafely(existingPackage);
} else {
@@ -1258,8 +1304,6 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
}
// Create a package version and add it to the package
- Architecture architecture = entityManager.find(Architecture.class, architectureId);
-
PackageVersion newPackageVersion = new PackageVersion(existingPackage, version, architecture);
newPackageVersion.setDisplayName(existingPackage.getName());
@@ -1611,6 +1655,33 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
packageType = entityManager.find(PackageType.class, packageTypeId);
}
+ try {
+ PackageTypeBehavior behavior = ContentManagerHelper.getPackageTypeBehavior(packageTypeId);
+
+ if (behavior != null) {
+ String packageTypeName = packageType.getName();
+ String archName = architecture.getName();
+ ValidatablePackageDetailsKey key = new ValidatablePackageDetailsKey(packageName, version, packageTypeName, archName);
+ behavior.validateDetails(key, subject);
+
+ //update the details from the validation results
+ packageName = key.getName();
+ version = key.getVersion();
+
+ if (!architecture.getName().equals(key.getArchitectureName())) {
+ Query q = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
+ q.setParameter("name", key.getArchitectureName());
+ architecture = (Architecture) q.getSingleResult();
+ }
+ }
+ } catch (PackageDetailsValidationException e) {
+ throw e;
+ } catch (Exception e) {
+ log.error("Failed to get the package type plugin container. This is a bug.", e);
+ throw new IllegalStateException("Failed to get the package type plugin container.", e);
+ }
+
+
Package existingPackage = null;
Query packageQuery = entityManager.createNamedQuery(Package.QUERY_FIND_BY_NAME_PKG_TYPE_ID);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java
index a00a40c..d47dc84 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java
@@ -18,21 +18,28 @@
*/
package org.rhq.enterprise.server.content;
+import java.util.Comparator;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.content.ContentSyncResults;
import org.rhq.core.domain.content.ContentSyncStatus;
import org.rhq.core.domain.content.InstalledPackage;
import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageDetailsKey;
import org.rhq.core.domain.content.PackageVersion;
+import org.rhq.core.domain.content.PackageVersionFormatDescription;
+import org.rhq.core.domain.content.ValidatablePackageDetailsKey;
import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement;
import org.rhq.enterprise.server.plugin.pc.content.ContentServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.content.PackageDetailsValidationException;
+import org.rhq.enterprise.server.plugin.pc.content.PackageTypeBehavior;
+import org.rhq.enterprise.server.plugin.pc.content.PackageTypeServerPluginContainer;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -41,6 +48,21 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class ContentManagerHelper {
private EntityManager entityManager;
+ private static class DefaultPackageTypeBehavior implements PackageTypeBehavior {
+ public Comparator<PackageVersion> getPackageVersionComparator(String packageTypeName) {
+ return PackageVersion.DEFAULT_COMPARATOR;
+ }
+
+ public void validateDetails(ValidatablePackageDetailsKey key, Subject origin)
+ throws PackageDetailsValidationException {
+ }
+
+ public PackageVersionFormatDescription getPackageVersionFormat(String packageTypeName) {
+ return null;
+ }
+ }
+ private static final PackageTypeBehavior DEFAULT_PACKAGE_TYPE_BEHAVIOR = new DefaultPackageTypeBehavior();
+
public ContentManagerHelper(EntityManager managerIn) {
this.entityManager = managerIn;
}
@@ -69,6 +91,30 @@ public class ContentManagerHelper {
return pc;
}
+ public static PackageTypeServerPluginContainer getPackageTypePluginContainer() throws Exception {
+ PackageTypeServerPluginContainer pc = null;
+
+ try {
+ ServerPluginServiceManagement mbean = LookupUtil.getServerPluginService();
+ if (!mbean.isMasterPluginContainerStarted()) {
+ throw new IllegalStateException("The master plugin container is not started!");
+ }
+
+ MasterServerPluginContainer master = mbean.getMasterPluginContainer();
+ pc = master.getPluginContainerByClass(PackageTypeServerPluginContainer.class);
+ } catch (IllegalStateException ise) {
+ throw ise;
+ } catch (Exception e) {
+ throw new Exception("Cannot obtain the package type plugin container", e);
+ }
+
+ if (pc == null) {
+ throw new Exception("Package type plugin container is null!");
+ }
+
+ return pc;
+ }
+
public static ResourcePackageDetails installedPackageToDetails(InstalledPackage installedPackage) {
PackageVersion packageVersion = installedPackage.getPackageVersion();
ResourcePackageDetails details = packageVersionToDetails(packageVersion);
@@ -147,4 +193,15 @@ public class ContentManagerHelper {
return persistedResults;
}
+
+ public static PackageTypeBehavior getPackageTypeBehavior(int packageTypeId) throws Exception {
+ PackageTypeBehavior ret = getPackageTypePluginContainer().getPluginManager().getBehavior(packageTypeId);
+ return ret == null ? DEFAULT_PACKAGE_TYPE_BEHAVIOR : ret;
+ }
+
+ public static PackageTypeBehavior getPackageTypeBehavior(String packageTypeName) throws Exception {
+ PackageTypeBehavior ret = getPackageTypePluginContainer().getPluginManager().getBehavior(packageTypeName);
+ return ret == null ? DEFAULT_PACKAGE_TYPE_BEHAVIOR : ret;
+ }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java
index 6ae321a..b4644d0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java
@@ -38,6 +38,7 @@ import org.rhq.core.domain.content.PackageDetailsKey;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
+import org.rhq.core.domain.content.composite.PackageTypeAndVersionFormatComposite;
import org.rhq.core.domain.content.transfer.DeployPackageStep;
import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
@@ -226,7 +227,8 @@ public interface ContentManagerLocal {
* Creates a new package version in the system. If the parent package (identified by the packageName parameter) does
* not exist, it will be created. If a package version exists with the specified version ID, a new one will not be
* created and the existing package version instance will be returned.
- *
+ *
+ * @param subject the user requesting the package creation
* @param packageName parent package name; uniquely identifies the package under which this version goes
* @param packageTypeId identifies the type of package in case the general package needs to be created
* @param version identifies the version to be create
@@ -235,11 +237,11 @@ public interface ContentManagerLocal {
* @return newly created package version if one did not exist; existing package version that matches these data if
* one was found
*/
- PackageVersion createPackageVersion(String packageName, int packageTypeId, String version, int architectureId,
- InputStream packageBitStream);
+ PackageVersion createPackageVersion(Subject subject, String packageName, int packageTypeId, String version,
+ int architectureId, InputStream packageBitStream);
/**
- * This method is similar to the {@link #createPackageVersion(String, int, String, int, InputStream)} but fails if
+ * This method is similar to the {@link #createPackageVersion(Subject, String, int, String, int, InputStream)} but fails if
* the package version with the provided details already exists which is a desired behaviour for the GUI originating
* requests.
* @param subject the current user
@@ -384,6 +386,11 @@ public interface ContentManagerLocal {
PackageType findPackageType(Subject subject, Integer resourceTypeId, String packageTypeName);
/**
+ * @see {@link ContentManagerRemote#findPackageTypeWithVersionFormat(Subject, Integer, String)}
+ */
+ PackageTypeAndVersionFormatComposite findPackageTypeWithVersionFormat(Subject subject, Integer resourceTypeId, String packageTypeName);
+
+ /**
* @see {@link ContentManagerRemote#findInstalledPackagesByCriteria(Subject, InstalledPackageCriteria)}
*/
PageList<InstalledPackage> findInstalledPackagesByCriteria(Subject subject, InstalledPackageCriteria criteria);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerRemote.java
index 261accf..edeb2b2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerRemote.java
@@ -33,6 +33,7 @@ import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
+import org.rhq.core.domain.content.composite.PackageTypeAndVersionFormatComposite;
import org.rhq.core.domain.criteria.InstalledPackageCriteria;
import org.rhq.core.domain.criteria.PackageCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
@@ -158,6 +159,20 @@ public interface ContentManagerRemote {
);
/**
+ * Similar to {@link #findPackageType(Subject, Integer, String)} but
+ * returns the package type along with the version format specification.
+ *
+ * @param subject
+ * @param resourceTypeId
+ * @param packageTypeName
+ * @return
+ */
+ @WebMethod
+ PackageTypeAndVersionFormatComposite findPackageTypeWithVersionFormat(
+ @WebParam(name = "subject") Subject subject,
+ @WebParam(name ="resourceTypeId") Integer resourceTypeId,
+ @WebParam(name = "packageTypeName") String packageTypeName);
+ /**
* @param subject
* @param criteria {@link InstalledPackageCriteria}
* @return InstalledPackages for the criteria
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
index 6eadde8..959b321 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
@@ -82,6 +82,7 @@ import org.rhq.enterprise.server.plugin.pc.content.ContentProvider;
import org.rhq.enterprise.server.plugin.pc.content.ContentProviderManager;
import org.rhq.enterprise.server.plugin.pc.content.ContentServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.content.PackageSource;
+import org.rhq.enterprise.server.plugin.pc.content.PackageTypeBehavior;
import org.rhq.enterprise.server.plugin.pc.content.RepoDetails;
import org.rhq.enterprise.server.plugin.pc.content.RepoGroupDetails;
import org.rhq.enterprise.server.plugin.pc.content.RepoImportReport;
@@ -412,51 +413,10 @@ public class RepoManagerBean implements RepoManagerLocal, RepoManagerRemote {
}
public PackageVersion getLatestPackageVersion(Subject subject, int packageId, int repoId) {
- return getLatestPackageVersion(subject, packageId, repoId, null);
- }
-
- public PackageVersion getLatestPackageVersion(Subject subject, int packageId, int repoId, Comparator<PackageVersion> versionComparator) {
if (!authzManager.canViewRepo(subject, repoId)) {
throw new PermissionException("User [" + subject + "] cannot access the repo with id " + repoId);
}
- if (versionComparator == null) {
- Query pvcsQ = entityManager.createNamedQuery(PackageVersionContentSource.QUERY_FIND_BY_PACKAGE_AND_REPO_ID_NO_FETCH);
- pvcsQ.setParameter("package_id", packageId);
- pvcsQ.setParameter("repo_id", repoId);
-
- @SuppressWarnings("unchecked")
- List<PackageVersionContentSource> pvcss = (List<PackageVersionContentSource>) pvcsQ.getResultList();
-
- try {
- ContentProviderManager manager = ContentManagerHelper.getPluginContainer().getAdapterManager();
- for(PackageVersionContentSource pvcs : pvcss) {
- ContentProvider provider = manager.getIsolatedContentProvider(pvcs.getPackageVersionContentSourcePK().getContentSource().getId());
-
- if (provider instanceof PackageSource) {
- versionComparator = ((PackageSource)provider).getPackageVersionComparator();
-
- if (versionComparator != null) {
- //ok, we found one non-default, let's go with that.
- break;
- }
- }
- }
- } catch (Exception e) {
- log.warn("Searching package sources for a version comparator failed. Will use the default comparator.", e);
- }
-
- if (versionComparator == null) {
- versionComparator = PackageVersion.DEFAULT_COMPARATOR;
- }
-
- //even though we can obtain the package versions from the pvcss elements, we can't
- //use just these, because these are not all the package versions there might be present
- //in the repo for this package. Some package versions can have no content source.
- //therefore we need to query the database again in the code below to obtain the full
- //list of package versions.
- }
-
Query q = entityManager.createNamedQuery(PackageVersion.QUERY_FIND_BY_PACKAGE_AND_REPO_ID);
q.setParameter("packageId", packageId);
q.setParameter("repoId", repoId);
@@ -471,6 +431,20 @@ public class RepoManagerBean implements RepoManagerLocal, RepoManagerRemote {
}
PackageVersion latest = results.get(0);
+ String packageTypeName = latest.getGeneralPackage().getPackageType().getName();
+
+ Comparator<PackageVersion> versionComparator = null;
+ try {
+ PackageTypeBehavior behavior = ContentManagerHelper.getPackageTypeBehavior(packageTypeName);
+ versionComparator = behavior.getPackageVersionComparator(packageTypeName);
+ } catch (Exception e) {
+ log.error("Could not get the package type behavior for package type '" + packageTypeName + "'. This should not happen.", e);
+ }
+
+ if (versionComparator == null) {
+ versionComparator = PackageVersion.DEFAULT_COMPARATOR;
+ }
+
Iterator<PackageVersion> it = results.iterator();
it.next(); //skip the first element, we don't have to compare it with itself
while(it.hasNext()) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerLocal.java
index bc22d81..51957bd 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerLocal.java
@@ -120,14 +120,6 @@ public interface RepoManagerLocal {
PackageVersion getLatestPackageVersion(Subject subject, int packageId, int repoId);
/**
- * This is an enhanced version of the remoted method that is able to override the default
- * package version comparator.
- *
- * @see RepoManagerRemote#getLatestPackageVersion(Subject, int, int)
- */
- PackageVersion getLatestPackageVersion(Subject subject, int packageId, int repoId, Comparator<PackageVersion> versionComparator);
-
- /**
* Get the overall sync status of this Repository. This is a summation of all the syncs.
*
* There is a weight to the status since this returns the most 'relevant' status:
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerRemote.java
index 54d2732..d144443 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerRemote.java
@@ -135,9 +135,8 @@ public interface RepoManagerRemote {
* Returns the latest package version of the supplied package.
* The latest version is determined using a comparator which is found using the following rules:
* <ol>
- * <li>Find the first content provider defining the package connected to given repo
- * that defines a non-null version comparator
- * <li>If no content provider provides explicit comparator, use {@link PackageVersion#DEFAULT_COMPARATOR}
+ * <li>determine the comparator using the package type behavior if one is setup for the package type
+ * <li>If no package behavior exists, use {@link PackageVersion#DEFAULT_COMPARATOR}
* </ol>
*
* @param subject the authenticated user
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java
index bd4feac..87e659d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java
@@ -39,6 +39,7 @@ import org.rhq.core.domain.plugin.PluginKey;
import org.rhq.enterprise.server.plugin.pc.alert.AlertServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.content.ContentServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.content.PackageTypeServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.entitlement.EntitlementServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.generic.GenericServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.perspective.PerspectiveServerPluginContainer;
@@ -463,6 +464,7 @@ public class MasterServerPluginContainer {
pcs.add(new AlertServerPluginContainer(this));
pcs.add(new EntitlementServerPluginContainer(this));
pcs.add(new BundleServerPluginContainer(this));
+ pcs.add(new PackageTypeServerPluginContainer(this));
return pcs;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/AbstractPackageTypeBehavior.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/AbstractPackageTypeBehavior.java
new file mode 100644
index 0000000..dfd0750
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/AbstractPackageTypeBehavior.java
@@ -0,0 +1,33 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.plugin.pc.content;
+
+import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+public abstract class AbstractPackageTypeBehavior<T extends ServerPluginComponent> implements PackageTypeBehavior {
+
+ protected T pluginComponent;
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageDetailsValidationException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageDetailsValidationException.java
new file mode 100644
index 0000000..026b343
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageDetailsValidationException.java
@@ -0,0 +1,47 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.plugin.pc.content;
+
+/**
+ * Thrown from {@link PackageTypeBehavior} when package details validation fails.
+ *
+ * @author Lukas Krejci
+ */
+public class PackageDetailsValidationException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public PackageDetailsValidationException() {
+ super();
+ }
+
+ public PackageDetailsValidationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PackageDetailsValidationException(String message) {
+ super(message);
+ }
+
+ public PackageDetailsValidationException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageSource.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageSource.java
index a5c7bae..dc51451 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageSource.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageSource.java
@@ -24,9 +24,6 @@ package org.rhq.enterprise.server.plugin.pc.content;
import java.io.InputStream;
import java.util.Collection;
-import java.util.Comparator;
-
-import org.rhq.core.domain.content.PackageVersion;
/**
* Indicates a content source has the capability to provide packages into the server. Package synchronization will
@@ -34,7 +31,6 @@ import org.rhq.core.domain.content.PackageVersion;
* passed into the plugin through {@link ContentProvider#initialize(org.rhq.core.domain.configuration.Configuration)}
*
* @author Jason Dobies
- * @author Lukas Krejci
*/
public interface PackageSource {
@@ -63,16 +59,4 @@ public interface PackageSource {
* @throws Exception if failed to obtain the stream to the remote package data
*/
InputStream getInputStream(String location) throws Exception;
-
- /**
- * This comparator will be used to determine the latest version of a package.
- * It should sort the package versions from the "oldest" to the "youngest", i.e. when comparing
- * <br/>
- * <code>comparator.compare(older, younger)</code>
- * <br/>
- * the comparator should return a value < 0.
- *
- * @return a comparator to use when sorting the package versions or null if {@link PackageVersion#DEFAULT_COMPARATOR} should be used.
- */
- Comparator<PackageVersion> getPackageVersionComparator();
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypeBehavior.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypeBehavior.java
new file mode 100644
index 0000000..b11818f
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypeBehavior.java
@@ -0,0 +1,67 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.plugin.pc.content;
+
+import java.util.Comparator;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.content.PackageVersion;
+import org.rhq.core.domain.content.PackageVersionFormatDescription;
+import org.rhq.core.domain.content.ValidatablePackageDetailsKey;
+
+/**
+ * The package types are either defined in the agent plugin descriptors or by the server-side
+ * package type plugins. The server-side plugins define a "behaviorClass" that implements
+ * this interface to provide additional runtime "hooks" controlling the package type
+ * behavior.
+ *
+ * @author Lukas Krejci
+ */
+public interface PackageTypeBehavior {
+
+ /**
+ * Validate the package before it gets stored.
+ *
+ * @param key the package details key
+ * @param origin who is uploading the package
+ * @throws PackageDetailsValidationException
+ */
+ void validateDetails(ValidatablePackageDetailsKey key, Subject origin) throws PackageDetailsValidationException;
+
+ /**
+ * This comparator will be used to determine the latest version of a package.
+ * It should sort the package versions from the "oldest" to the "youngest", i.e. when comparing
+ * <br/>
+ * <code>comparator.compare(older, younger)</code>
+ * <br/>
+ * the comparator should return a value < 0.
+ *
+ * @param packageTypeName the name of the package type
+ * @return a comparator to use when sorting the package versions or null if {@link PackageVersion#DEFAULT_COMPARATOR} should be used.
+ */
+ Comparator<PackageVersion> getPackageVersionComparator(String packageTypeName);
+
+ /**
+ * Description of the package version format mandated by the package type.
+ *
+ * @return the package version format description
+ */
+ PackageVersionFormatDescription getPackageVersionFormat(String packageTypeName);
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypePluginManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypePluginManager.java
new file mode 100644
index 0000000..f62b8e5
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypePluginManager.java
@@ -0,0 +1,155 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.plugin.pc.content;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.rhq.core.clientapi.agent.metadata.ConfigurationMetadataParser;
+import org.rhq.core.clientapi.agent.metadata.InvalidPluginDescriptorException;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.content.ContentManagerLocal;
+import org.rhq.enterprise.server.plugin.pc.AbstractTypeServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginEnvironment;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginManager;
+import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.xmlschema.generated.serverplugin.packagetype.PackageTypeDefinitionType;
+import org.rhq.enterprise.server.xmlschema.generated.serverplugin.packagetype.PackageTypePluginDescriptorType;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+public class PackageTypePluginManager extends ServerPluginManager {
+
+ private Map<PackageType, ServerPluginEnvironment> pluginsByPackageTypeId;
+
+ public PackageTypePluginManager(AbstractTypeServerPluginContainer pc) {
+ super(pc);
+ pluginsByPackageTypeId = new HashMap<PackageType, ServerPluginEnvironment>();
+ }
+
+ @Override
+ protected void loadPlugin(ServerPluginEnvironment env, boolean enabled) throws Exception {
+ super.loadPlugin(env, enabled);
+
+ PackageTypePluginDescriptorType descriptor = (PackageTypePluginDescriptorType) env.getPluginDescriptor();
+
+ try {
+ //check the behavior class exists
+ String behaviorClassName = descriptor.getBehaviorClass();
+
+ Class<?> behaviorClass = loadPluginClass(env, behaviorClassName, false);
+
+ if (!AbstractPackageTypeBehavior.class.isAssignableFrom(behaviorClass)) {
+ throw new Exception("The behavior class '" + behaviorClassName + "' of the plugin '"
+ + env.getPluginKey().getPluginName() + "' does not inherit from AbstractPackageTypeBehavior class.");
+ }
+
+ //check that all the package types defined by this plugin exist
+ for (PackageTypeDefinitionType def : descriptor.getPackageType()) {
+ PackageType pt = ensurePackageTypeExists(def);
+ pluginsByPackageTypeId.put(pt, env);
+ }
+ } catch (Exception e) {
+ // do not deploy this plugin - its stinky
+ try {
+ unloadPlugin(env.getPluginKey().getPluginName());
+ } catch (Exception ignore) {
+ }
+ throw e;
+ }
+ }
+
+ private PackageType ensurePackageTypeExists(PackageTypeDefinitionType def) throws InvalidPluginDescriptorException {
+ SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
+ ContentManagerLocal cm = LookupUtil.getContentManager();
+
+ PackageType packageType = cm.findPackageType(subjectManager.getOverlord(), null, def.getName());
+
+ if (packageType == null) {
+ //TODO support tying the package type to the resource types?
+ packageType = new PackageType(def.getName(), null);
+ packageType.setDescription(def.getDescription());
+ packageType.setDisplayName(def.getDisplayName());
+ packageType.setSupportsArchitecture(def.isSupportsArchitecture());
+ packageType.setCreationData(false);
+ packageType.setDeploymentConfigurationDefinition(ConfigurationMetadataParser.parse(def.getName(),
+ def.getConfiguration()));
+ packageType.setDiscoveryInterval(-1);
+ packageType.setPackageExtraPropertiesDefinition(null);
+
+ packageType = cm.persistServersidePackageType(packageType);
+ }
+
+ return packageType;
+ }
+
+ public AbstractPackageTypeBehavior<? extends ServerPluginComponent> getBehavior(int packageTypeId) throws Exception {
+ return getBehavior(findByPackageTypeId(packageTypeId));
+ }
+
+ public AbstractPackageTypeBehavior<? extends ServerPluginComponent> getBehavior(String packageTypeName)
+ throws Exception {
+ return getBehavior(findByPackageTypeName(packageTypeName));
+ }
+
+ private AbstractPackageTypeBehavior<? extends ServerPluginComponent> getBehavior(ServerPluginEnvironment env)
+ throws Exception {
+ if (env == null) {
+ return null;
+ }
+
+ PackageTypePluginDescriptorType descriptor = (PackageTypePluginDescriptorType) env.getPluginDescriptor();
+
+ String behaviorClassName = descriptor.getBehaviorClass();
+
+ @SuppressWarnings("unchecked")
+ AbstractPackageTypeBehavior<ServerPluginComponent> ret = (AbstractPackageTypeBehavior<ServerPluginComponent>) instantiatePluginClass(
+ env, behaviorClassName);
+
+ ret.pluginComponent = getServerPluginComponent(env.getPluginKey().getPluginName());
+
+ return ret;
+ }
+
+ private ServerPluginEnvironment findByPackageTypeId(int id) {
+ for (Map.Entry<PackageType, ServerPluginEnvironment> entry : pluginsByPackageTypeId.entrySet()) {
+ if (entry.getKey().getId() == id) {
+ return entry.getValue();
+ }
+ }
+
+ return null;
+ }
+
+ private ServerPluginEnvironment findByPackageTypeName(String name) {
+ for (Map.Entry<PackageType, ServerPluginEnvironment> entry : pluginsByPackageTypeId.entrySet()) {
+ if (entry.getKey().getName().equals(name)) {
+ return entry.getValue();
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypeServerPluginContainer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypeServerPluginContainer.java
new file mode 100644
index 0000000..df07119
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/PackageTypeServerPluginContainer.java
@@ -0,0 +1,56 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.plugin.pc.content;
+
+import org.rhq.enterprise.server.plugin.pc.AbstractTypeServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginEnvironment;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginManager;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginType;
+import org.rhq.enterprise.server.xmlschema.generated.serverplugin.packagetype.PackageTypePluginDescriptorType;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+public class PackageTypeServerPluginContainer extends AbstractTypeServerPluginContainer {
+
+ /**
+ * @param master
+ */
+ public PackageTypeServerPluginContainer(MasterServerPluginContainer master) {
+ super(master);
+ }
+
+ public ServerPluginType getSupportedServerPluginType() {
+ return new ServerPluginType(PackageTypePluginDescriptorType.class);
+ }
+
+ @Override
+ public PackageTypePluginManager getPluginManager() {
+ return (PackageTypePluginManager) super.getPluginManager();
+ }
+
+ @Override
+ protected ServerPluginManager createPluginManager() {
+ return new PackageTypePluginManager(this);
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
index 5a08508..8d5fad4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
@@ -463,8 +463,8 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
// Create/locate package and package version
PackageVersion packageVersion = null;
if (packageUploadDetails == null) {
- packageVersion = contentManager.createPackageVersion(packageName, newPackageType.getId(),
- packageVersionNumber, architectureId, packageBitStream);
+ packageVersion = contentManager.createPackageVersion(user, packageName,
+ newPackageType.getId(), packageVersionNumber, architectureId, packageBitStream);
} else {
packageVersion = contentManager.getUploadedPackageVersion(user, packageName,
newPackageType.getId(), packageVersionNumber, architectureId, packageBitStream, packageUploadDetails, newResourceTypeId, null);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 2ee417c..3a4910b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -68,6 +68,7 @@ import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
+import org.rhq.core.domain.content.composite.PackageTypeAndVersionFormatComposite;
import org.rhq.core.domain.content.transfer.SubscribedRepo;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
@@ -517,6 +518,11 @@ public class WebservicesManagerBean implements WebservicesRemote {
return contentManager.findPackageType(subject, resourceTypeId, packageTypeName);
}
+ public PackageTypeAndVersionFormatComposite findPackageTypeWithVersionFormat(Subject subject,
+ Integer resourceTypeId, String packageTypeName) {
+ return contentManager.findPackageTypeWithVersionFormat(subject, resourceTypeId, packageTypeName);
+ }
+
public InstalledPackage getBackingPackageForResource(Subject subject, int resourceId) {
return contentManager.getBackingPackageForResource(subject, resourceId);
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
index 0258f3a..749f73b 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
@@ -10,7 +10,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.content.PackageDetailsKey;
import org.rhq.core.domain.content.PackageVersion;
public class TestContentProvider implements ContentProvider, PackageSource, RepoSource, DistributionSource {
@@ -251,10 +253,6 @@ public class TestContentProvider implements ContentProvider, PackageSource, Repo
return bis;
}
- public Comparator<PackageVersion> getPackageVersionComparator() {
- return null;
- }
-
public void synchronizeDistribution(String repoName, DistributionSyncReport report,
Collection<DistributionDetails> existingDistros) throws SyncException, InterruptedException {
diff --git a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
index 2835ab9..d73b42e 100644
--- a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
+++ b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
@@ -35,7 +35,6 @@ import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.content.PackageCategory;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
@@ -50,7 +49,6 @@ import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.content.ContentManagerLocal;
-import org.rhq.enterprise.server.content.RepoManagerLocal;
import org.rhq.enterprise.server.plugin.pc.ControlFacet;
import org.rhq.enterprise.server.plugin.pc.ControlResults;
import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
@@ -67,14 +65,8 @@ import org.rhq.enterprise.server.xmlschema.generated.serverplugin.alert.AlertPlu
*/
public class CliComponent implements ServerPluginComponent, ControlFacet {
- //TODO the package type definition could be defined somewhere accessible
- //server-wide if we decide to use it in more places than just this alert sender
-
- public static final String PACKAGE_TYPE_NAME = "__SERVER_SIDE_CLI_SCRIPT";
- public static final String PACKAGE_TYPE_DESCRIPTION =
- "A CLI script running on the server-side.";
- public static final String PACKAGE_TYPE_DISPLAY_NAME = "Server-side CLI Script";
-
+ public static final String PACKAGE_TYPE_NAME = "org.rhq.enterprise.server.plugins.packagetypeCli.SERVER_SIDE_CLI_SCRIPT";
+
private static final String CONTROL_CHECK_ALERTS_VALIDITY = "checkAlertsValidity";
private static final String CONTROL_REASSIGN_ALERTS = "reassignAlerts";
@@ -93,36 +85,21 @@ public class CliComponent implements ServerPluginComponent, ControlFacet {
private PackageType packageType;
private int scriptTimeout;
- private SubjectManagerLocal subjectManager;
-
public void initialize(ServerPluginContext context) throws Exception {
pluginName = ((AlertPluginDescriptorType)context.getPluginEnvironment().getPluginDescriptor()).getShortName();
-
- subjectManager = LookupUtil.getSubjectManager();
- ContentManagerLocal cm = LookupUtil.getContentManager();
-
- packageType = cm.findPackageType(subjectManager.getOverlord(), null, PACKAGE_TYPE_NAME);
-
- if (packageType == null) {
- packageType = new PackageType(PACKAGE_TYPE_NAME, null);
- packageType.setCategory(PackageCategory.EXECUTABLE_SCRIPT);
- packageType.setDescription(PACKAGE_TYPE_DESCRIPTION);
- packageType.setDisplayName(PACKAGE_TYPE_DISPLAY_NAME);
- packageType.setSupportsArchitecture(false);
- packageType.setCreationData(false);
- packageType.setDeploymentConfigurationDefinition(null);
- packageType.setDiscoveryInterval(-1);
- packageType.setPackageExtraPropertiesDefinition(null);
-
- packageType = cm.persistServersidePackageType(packageType);
- }
-
+
String timeoutValue = context.getPluginConfiguration() == null ? "60" : context.getPluginConfiguration().getSimpleValue(PROP_SCRIPT_TIMEOUT, "60");
scriptTimeout = Integer.parseInt(timeoutValue);
}
public PackageType getScriptPackageType() {
+ if (packageType == null) {
+ SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
+ ContentManagerLocal cm = LookupUtil.getContentManager();
+
+ packageType = cm.findPackageType(subjectManager.getOverlord(), null, PACKAGE_TYPE_NAME);
+ }
return packageType;
}
diff --git a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
index 3916c8a..61d5a3b 100644
--- a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
+++ b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
@@ -247,7 +247,7 @@ public class CliSender extends AlertSender<CliComponent> {
private static InputStream getPackageBits(int packageId, int repoId) throws IOException {
final ContentSourceManagerLocal csm = LookupUtil.getContentSourceManager();
RepoManagerLocal rm = LookupUtil.getRepoManagerLocal();
- final PackageVersion versionToUse = rm.getLatestPackageVersion(LookupUtil.getSubjectManager().getOverlord(), packageId, repoId, null);
+ final PackageVersion versionToUse = rm.getLatestPackageVersion(LookupUtil.getSubjectManager().getOverlord(), packageId, repoId);
if (versionToUse == null) {
throw new IllegalArgumentException("The package with id " + packageId + " either doesn't exist at all or doesn't have any version. Can't execute a CLI script without a script to run.");
diff --git a/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java b/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
index 1c408ab..3155976 100644
--- a/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
+++ b/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
@@ -24,7 +24,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -33,7 +32,6 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.core.util.file.ContentFileInfo;
import org.rhq.core.util.file.ContentFileInfoFactory;
@@ -166,20 +164,6 @@ public class DiskSource implements ContentProvider, PackageSource, RepoSource {
return new FileInputStream(new File(getRootDirectory(), location));
}
- /**
- * The disk source doesn't have a meaningful version strings, so this
- * implementation compares strictly by {@link PackageVersion#getFileCreatedDate() file creation date}.
- *
- * @return a comparator comparing two package versions coming from DiskSource by their file-created-date.
- */
- public Comparator<PackageVersion> getPackageVersionComparator() {
- return new Comparator<PackageVersion>() {
- public int compare(PackageVersion o1, PackageVersion o2) {
- return o1.getFileCreatedDate().compareTo(o2.getFileCreatedDate());
- }
- };
- }
-
protected File getRootDirectory() {
return this.rootDirectory;
}
@@ -332,7 +316,7 @@ public class DiskSource implements ContentProvider, PackageSource, RepoSource {
String resourceAndPlugin = configuration.getSimpleValue("resourceType", null);
- String resourceType = resourceAndPlugin.substring( (resourceAndPlugin.indexOf('-') + 1) );
+ String resourceType = resourceAndPlugin.substring((resourceAndPlugin.indexOf('-') + 1));
String pluginType = resourceAndPlugin.substring(0, resourceAndPlugin.indexOf('-'));
supportedPackageType.resourceTypeName = resourceType;
diff --git a/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java b/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
index a40047a..2758e2b 100644
--- a/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
+++ b/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
@@ -22,7 +22,6 @@ import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.util.Collection;
-import java.util.Comparator;
import churchillobjects.rss4j.RssDocument;
import churchillobjects.rss4j.parser.RssParser;
@@ -39,7 +38,6 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.content.PackageVersion;
import org.rhq.enterprise.server.plugin.pc.content.ContentProvider;
import org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetails;
import org.rhq.enterprise.server.plugin.pc.content.PackageSource;
@@ -165,13 +163,6 @@ public class JBossSoftwareContentSourceAdapter implements ContentProvider, Packa
return stream;
}
- /**
- * @return null so that the {@link PackageVersion#DEFAULT_COMPARATOR} is used because it is well suited for the CSP packages.
- */
- public Comparator<PackageVersion> getPackageVersionComparator() {
- return null;
- }
-
public RepoImportReport importRepos() throws Exception {
RepoDetails repo = new RepoDetails("JBoss Patches");
diff --git a/modules/enterprise/server/plugins/packagetype-cli/pom.xml b/modules/enterprise/server/plugins/packagetype-cli/pom.xml
new file mode 100644
index 0000000..65c8e71
--- /dev/null
+++ b/modules/enterprise/server/plugins/packagetype-cli/pom.xml
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>rhq-enterprise-server-plugins-parent</artifactId>
+ <groupId>org.rhq</groupId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>packagetype-cli</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+
+ <name>RHQ Enterprise Server CLI Package Type Plugin</name>
+
+ <scm>
+ <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/...
+ </connection>
+ <developerConnection>
+ scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/...
+ </developerConnection>
+ </scm>
+
+ <properties>
+ <scm.module.path>modules/enterprise/server/plugins/packagetype-cli/</scm.module.path>
+ </properties>
+
+ <dependencies>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
+ <!--
+ <argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
+ -->
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-serverplugins
+ </rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file"
+ location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir
+ in ${deployment.file}...</echo>
+ <unjar
+ src="${project.build.directory}/${project.build.finalName}.jar"
+ dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}"
+ manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
+ update="true">
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>cobertura-plugins</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>${cobertura.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup" />
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties" />
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.plugin.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.plugin.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup" />
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+
+</project>
diff --git a/modules/enterprise/server/plugins/packagetype-cli/src/main/java/org/rhq/enterprise/server/plugins/packagetypeCli/CliPackageTypeBehavior.java b/modules/enterprise/server/plugins/packagetype-cli/src/main/java/org/rhq/enterprise/server/plugins/packagetypeCli/CliPackageTypeBehavior.java
new file mode 100644
index 0000000..ea9c376
--- /dev/null
+++ b/modules/enterprise/server/plugins/packagetype-cli/src/main/java/org/rhq/enterprise/server/plugins/packagetypeCli/CliPackageTypeBehavior.java
@@ -0,0 +1,132 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.plugins.packagetypeCli;
+
+import java.util.Comparator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.content.PackageVersion;
+import org.rhq.core.domain.content.PackageVersionFormatDescription;
+import org.rhq.core.domain.content.ValidatablePackageDetailsKey;
+import org.rhq.core.domain.util.OSGiVersion;
+import org.rhq.core.domain.util.OSGiVersionComparator;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
+import org.rhq.enterprise.server.plugin.pc.content.AbstractPackageTypeBehavior;
+import org.rhq.enterprise.server.plugin.pc.content.PackageDetailsValidationException;
+
+/**
+ * This plugin defines the version formatting of the server-side CLI package type.
+ *
+ * In order for the CLI packages to exist per user, the format of the version has to include
+ * the username.
+ *
+ * The format is therefore following:
+ *
+ * {username}:{osgi.version.string}
+ *
+ * @author Lukas Krejci
+ */
+public class CliPackageTypeBehavior extends AbstractPackageTypeBehavior<ServerPluginComponent> {
+
+ private static final Log LOG = LogFactory.getLog(CliPackageTypeBehavior.class);
+
+ private static final String FULL_VERSION_REGEX = "^([^:]+:)?\\d+(\\.\\d+(\\.\\d+(\\..*)?)?)?$";
+ private static final String OSGI_EXTRACT_REGEX = "^([^:]+:)?(\\d+(\\.\\d+(\\.\\d+(\\..*)?)?)?)$";
+ private static final int OSGI_EXTRACT_VERSION_GROUP = 2;
+
+ private static final String PACKAGETYPE_NAME = "__SERVER_SIDE_CLI_SCRIPT";
+
+ private static final Comparator<PackageVersion> VERSION_COMPARATOR = new Comparator<PackageVersion>() {
+ private final OSGiVersionComparator OSGI_COMPARATOR = new OSGiVersionComparator();
+ public int compare(PackageVersion o1, PackageVersion o2) {
+ String v1 = o1.getVersion();
+ String v2 = o2.getVersion();
+
+ if (v1 != null && v2 != null) {
+ String[] v1Parts = getVersionParts(v1);
+ String[] v2Parts = getVersionParts(v2);
+
+ if (v1Parts[1] != null && v2Parts[1] != null) {
+ try {
+ return OSGI_COMPARATOR.compare(v1Parts[1], v2Parts[1]);
+ } catch (IllegalArgumentException e) {
+ //well.. they don't look like OSGi versions
+ }
+ }
+ }
+
+ //as a fallback, compare by ID. But we're enforcing the format in the validate
+ //method so this shouldn't ever happen.
+
+ LOG.warn("Using a fallback version comparison on package versions " + o1 + " and " + o2 + ". This should not happen.");
+
+ return Integer.valueOf(o1.getId()).compareTo(o2.getId());
+ }
+ };
+
+ public Comparator<PackageVersion> getPackageVersionComparator(String packageTypeName) {
+ if (PACKAGETYPE_NAME.equals(packageTypeName)) {
+ return VERSION_COMPARATOR;
+ }
+ return null;
+ }
+
+ public void validateDetails(ValidatablePackageDetailsKey key, Subject origin)
+ throws PackageDetailsValidationException {
+
+ key.setVersion(reformatVersion(key.getVersion(), origin.getName()));
+ }
+
+ public PackageVersionFormatDescription getPackageVersionFormat(String packageTypeName) {
+ if (PACKAGETYPE_NAME.equals(packageTypeName)) {
+ return new PackageVersionFormatDescription(FULL_VERSION_REGEX, OSGI_EXTRACT_REGEX, OSGI_EXTRACT_VERSION_GROUP, null);
+ }
+ return null;
+ }
+
+ private static String reformatVersion(String version, String userName) throws PackageDetailsValidationException {
+ String[] parts = getVersionParts(version);
+
+ if (!OSGiVersion.isValid(parts[1])) {
+ //ok the user supplied something that isn't an OSGi version.
+ //We can't accept that.
+ throw new PackageDetailsValidationException("The version part of '" + version + "' isn't an OSGi version string.");
+ }
+
+ return userName + ":" + parts[1];
+ }
+
+ private static String[] getVersionParts(String version) {
+ String[] ret = new String[2];
+
+ int colonIdx = version.indexOf(':');
+ if (colonIdx >= 0 && colonIdx < version.length() - 1) {
+ ret[0] = version.substring(0, colonIdx);
+ ret[1] = version.substring(colonIdx + 1);
+ } else {
+ ret[1] = version;
+ }
+
+ return ret;
+ }
+}
diff --git a/modules/enterprise/server/plugins/packagetype-cli/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/packagetype-cli/src/main/resources/META-INF/rhq-serverplugin.xml
new file mode 100644
index 0000000..d57d82b
--- /dev/null
+++ b/modules/enterprise/server/plugins/packagetype-cli/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<packagetype-plugin name="packagetype-cli"
+ displayName="PackageType:CLI" xmlns="urn:xmlns:rhq-serverplugin.packagetype"
+ xmlns:c="urn:xmlns:rhq-configuration" xmlns:serverplugin="urn:xmlns:rhq-serverplugin"
+ package="org.rhq.enterprise.server.plugins.packagetypeCli"
+ description="A package type for CLI scripts.">
+
+ <serverplugin:help>
+ This plugin defines the "Server-side CLI Script"
+ package type used
+ by the Alert:CLI plugin to store the scripts in
+ the content subsystem.
+ </serverplugin:help>
+
+ <!-- How does this sender show up in drop downs etc -->
+ <behavior-class>CliPackageTypeBehavior</behavior-class>
+
+
+ <package-type
+ name="org.rhq.enterprise.server.plugins.packagetypeCli.SERVER_SIDE_CLI_SCRIPT"
+ displayName="Server-side CLI Script" description="A CLI script running on the server-side." />
+
+</packagetype-plugin>
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index 7da7c3b..2ebb23e 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -87,6 +87,7 @@
<module>ant-bundle</module>
<module>validate-all-serverplugins</module>
<module>groovy-script</module>
+ <module>packagetype-cli</module>
</modules>
</project>
diff --git a/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java b/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java
index f9710cf..03e7ba6 100644
--- a/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java
+++ b/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java
@@ -28,7 +28,6 @@ import java.net.URL;
import java.security.KeyException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Comparator;
import java.util.List;
import org.apache.commons.io.FileUtils;
@@ -37,7 +36,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.xmlrpc.XmlRpcException;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.content.PackageVersion;
import org.rhq.enterprise.server.plugin.pc.content.AdvisoryDetails;
import org.rhq.enterprise.server.plugin.pc.content.AdvisorySource;
import org.rhq.enterprise.server.plugin.pc.content.AdvisorySyncReport;
@@ -227,13 +225,6 @@ public class RHNProvider implements ContentProvider, PackageSource, RepoSource,
}
/**
- * @return null so that the {@link PackageVersion#DEFAULT_COMPARATOR} is used because it is well suited for the RHN packages.
- */
- public Comparator<PackageVersion> getPackageVersionComparator() {
- return null;
- }
-
- /**
* @inheritDoc
*/
public void synchronizeAdvisory(String repoName, AdvisorySyncReport report,
diff --git a/modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java b/modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java
index 2f98600..c229a2b 100644
--- a/modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java
+++ b/modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java
@@ -25,7 +25,6 @@ import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -34,7 +33,6 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
-import org.rhq.core.domain.content.PackageVersion;
import org.rhq.enterprise.server.plugin.pc.content.ContentProvider;
import org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetails;
import org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetailsKey;
@@ -211,14 +209,6 @@ public class UrlProvider implements ContentProvider, PackageSource {
return;
}
- /**
- * This uses the default comparator.
- * @return null so that the {@link PackageVersion#DEFAULT_COMPARATOR} is used.
- */
- public Comparator<PackageVersion> getPackageVersionComparator() {
- return null;
- }
-
public void testConnection() throws Exception {
// to test, just make sure we can read the index file;
// errors will caused exceptions to be thrown.
diff --git a/modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java b/modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java
index ffff370..f065ba7 100644
--- a/modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java
+++ b/modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java
@@ -21,14 +21,12 @@ package org.rhq.enterprise.server.plugins.yum;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Comparator;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.content.PackageVersion;
import org.rhq.enterprise.server.plugin.pc.content.ContentProvider;
import org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetails;
import org.rhq.enterprise.server.plugin.pc.content.PackageSource;
@@ -179,13 +177,6 @@ public class RepoProvider implements ContentProvider, PackageSource {
}
/**
- * @return null so that the {@link PackageVersion#DEFAULT_COMPARATOR} is used because it is well suited for YUM packages.
- */
- public Comparator<PackageVersion> getPackageVersionComparator() {
- return null;
- }
-
- /**
* Trim white space and trailing (/) characters.
*
* @param path A url/directory path string.
diff --git a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java
index d427c05..00ba663 100644
--- a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java
+++ b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java
@@ -79,7 +79,8 @@ public abstract class ServerPluginDescriptorUtil {
PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_ALERT, XmlSchemas.PKG_SERVERPLUGIN_ALERT);
PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_ENTITLEMENT, XmlSchemas.PKG_SERVERPLUGIN_ENTITLEMENT);
PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_BUNDLE, XmlSchemas.PKG_SERVERPLUGIN_BUNDLE);
-
+ PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_PACKAGETYPE, XmlSchemas.PKG_SERVERPLUGIN_PACKAGETYPE);
+
// so we only have to do this once, build a ':' separated context path containing all schema package names
StringBuilder packages = new StringBuilder();
for (String packageName : PLUGIN_SCHEMA_PACKAGES.values()) {
diff --git a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java
index 8d270e6..63050dd 100644
--- a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java
+++ b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java
@@ -62,6 +62,10 @@ public interface XmlSchemas {
public static final String XSD_SERVERPLUGIN_BUNDLE = "rhq-serverplugin-bundle.xsd";
public static final String PKG_SERVERPLUGIN_BUNDLE = "org.rhq.enterprise.server.xmlschema.generated.serverplugin.bundle";
+ // the server plugin descriptor for the package type plugin type
+ public static final String XSD_SERVERPLUGIN_PACKAGETYPE = "rhq-serverplugin-packagetype.xsd";
+ public static final String PKG_SERVERPLUGIN_PACKAGETYPE = "org.rhq.enterprise.server.xmlschema.generated.serverplugin.packagetype";
+
// the configuration schema that can be reused in any other server-side schema to define normal configuration properties
public static final String XSD_CONFIGURATION = "rhq-configuration.xsd";
public static final String PKG_CONFIGURATION = DescriptorPackages.CONFIGURATION;
diff --git a/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-packagetype.xsd b/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-packagetype.xsd
new file mode 100644
index 0000000..fff6046
--- /dev/null
+++ b/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-packagetype.xsd
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:serverplugin="urn:xmlns:rhq-serverplugin" xmlns:config="urn:xmlns:rhq-configuration"
+ xmlns:c="urn:xmlns:rhq-configuration" xmlns:packagetype="urn:xmlns:rhq-serverplugin.packagetype"
+ targetNamespace="urn:xmlns:rhq-serverplugin.packagetype"
+ elementFormDefault="qualified" jaxb:version="2.0"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" blockDefault="">
+
+ <xs:import namespace="urn:xmlns:rhq-serverplugin"
+ schemaLocation="rhq-serverplugin.xsd" />
+ <xs:import namespace="urn:xmlns:rhq-configuration"
+ schemaLocation="rhq-configuration.xsd" />
+
+ <xs:annotation>
+ <xs:documentation>
+ Schema for package type server-side plug-ins.
+ </xs:documentation>
+ <xs:appinfo>
+ <jaxb:schemaBindings>
+ <jaxb:package
+ name="org.rhq.enterprise.server.xmlschema.generated.serverplugin.packagetype" />
+ </jaxb:schemaBindings>
+ </xs:appinfo>
+ </xs:annotation>
+
+ <xs:element name="packagetype-plugin"
+ type="packagetype:PackageTypePluginDescriptorType"
+ substitutionGroup="serverplugin:server-plugin">
+ <xs:annotation>
+ <xs:documentation>
+ Defines a server-side package type
+ plug-in. This type of plug-in allows you to define your
+ own package types.
+ Users are then able to create packages
+ of those types and the data stored in the content
+ subsystem for such
+ packages can then be used in other
+ server-side plugins.
+ </xs:documentation>
+ <xs:appinfo>
+ <jaxb:class name="PackageTypePluginElement" />
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="PackageTypePluginDescriptorType">
+ <xs:complexContent>
+ <xs:extension base="serverplugin:ServerPluginDescriptorType">
+ <xs:sequence>
+ <xs:element name="behavior-class" type="xs:string"
+ minOccurs="1" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ The name of the class
+ implementing the
+ PackageTypeBehavior
+ interface.
+ This class provides runtime
+ hooks for checking
+ the correctness of the
+ packages of different types.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="package-type"
+ type="packagetype:PackageTypeDefinitionType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>
+ The list of package types
+ this plugin defines.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="PackageTypeDefinitionType">
+ <xs:sequence>
+ <xs:element name="configuration" type="config:configuration"
+ minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ Describes properties that dictate
+ how the package was deployed or
+ installed. The
+ user will be
+ prompted for values for these
+ properties when deploying a new package of
+ this
+ type.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ Name of this package type. This must
+ be unique across all other package
+ types defined for
+ this
+ resource type.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="displayName" type="xs:string"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ The user friendly name of the package
+ type that will be displayed in
+ the UI.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="description" type="xs:string"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ Description of the package type that
+ will be displayed in the UI.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="supportsArchitecture" type="xs:boolean"
+ use="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Indicates packages of this type may be
+ of different architectures. If this
+ is set to false,
+ when
+ creating new packages of this type, the
+ architecture will be defaulted to
+ "noarch".
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+</xs:schema>
13 years, 3 months
[rhq] 6 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java | 245 ++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationSettings.java | 150 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java | 276 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationView.java | 86 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java | 249 ---------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java | 249 +++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java | 93 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java | 87 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java | 22
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 26
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java | 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java | 3
16 files changed, 1145 insertions(+), 379 deletions(-)
New commits:
commit 239280baebbfa542c60cc6430ae526150ab84398
Merge: 0ca30d0... ef1a25d...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 18:01:30 2011 -0500
Merge commit 'origin/master' into group-config-history
commit 0ca30d011810cfdd624e41cc8316d76e838428e8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 18:01:27 2011 -0500
firs try at group resource config history
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 5770cd3..61bfede 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
@@ -98,7 +98,7 @@ public class LinkManager {
public static String getGroupResourceConfigurationUpdateHistoryLink(int groupId, Integer groupUpdateHistoryId) {
if (groupUpdateHistoryId != null) {
- return getResourceGroupLink(groupId) + "/Configuration/History/" + groupUpdateHistoryId;
+ return getResourceGroupLink(groupId) + "/Configuration/History/" + groupUpdateHistoryId + "/Members";
} else {
return getResourceGroupLink(groupId) + "/Configuration/History";
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index e1757b8..62f9655 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -73,6 +73,9 @@ public interface ConfigurationGWTService extends RemoteService {
List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroup(int groupId)
throws RuntimeException;
+ List<DisambiguationReport<ResourceConfigurationComposite>> findResourceConfigurationsForGroupUpdate(
+ int groupUpdateId) throws RuntimeException;
+
List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroupUpdate(int groupUpdateId)
throws RuntimeException;
@@ -87,6 +90,4 @@ public interface ConfigurationGWTService extends RemoteService {
void deleteGroupResourceConfigurationUpdate(Integer groupId, Integer[] groupResourceConfigUpdateIds)
throws RuntimeException;
-
- //RawConfiguration dummy(RawConfiguration config) throws RuntimeException;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index a137250..9b89dff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -55,6 +55,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
import org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventCompositeHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.GroupResourceConfigurationEditView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.HistoryGroupResourceConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.GroupPluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.HistoryGroupPluginConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.MembersView;
@@ -337,8 +338,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
true, new ViewFactory() {
@Override
public Canvas createView() {
- return new GroupPluginConfigurationEditView(inventoryConn.extendLocatorId("View"),
- groupComposite);
+ return new GroupPluginConfigurationEditView(inventoryConn.extendLocatorId("View"), groupComposite);
}
});
updateSubTab(this.inventoryTab, this.inventoryConnHistory, facets
@@ -397,8 +397,6 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
.contains(ResourceTypeFacet.CONFIGURATION));
Set<Permission> groupPermissions = this.groupComposite.getResourcePermission().getPermissions();
if (updateTab(this.configurationTab, visible, visible && groupPermissions.contains(Permission.CONFIGURE_READ))) {
- //updateSubTab(this.configurationTab, this.configCurrent, new FullHTMLPane(
- // "/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId), true, true);
updateSubTab(this.configurationTab, this.configCurrent, true, true, new ViewFactory() {
@Override
public Canvas createView() {
@@ -408,8 +406,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
updateSubTab(this.configurationTab, this.configHistory, true, true, new ViewFactory() {
@Override
public Canvas createView() {
- return new FullHTMLPane(configHistory.extendLocatorId("View"),
- "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId);
+ return new HistoryGroupResourceConfigurationView(inventoryConnHistory.extendLocatorId("View"),
+ groupComposite);
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java
new file mode 100644
index 0000000..99fd567
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java
@@ -0,0 +1,245 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import java.util.Date;
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * Shows a table of individual resource members that belonged to the group when the group configuration was updated.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryGroupResourceConfigurationMembers extends LocatableVLayout {
+ private final ResourceGroup group;
+ private final ResourcePermission groupPerms;
+ private final int groupUpdateId;
+
+ public HistoryGroupResourceConfigurationMembers(String locatorId, ResourceGroupComposite groupComposite,
+ int updateId) {
+ super(locatorId);
+ this.group = groupComposite.getResourceGroup();
+ this.groupPerms = groupComposite.getResourcePermission();
+ this.groupUpdateId = updateId;
+
+ setMargin(5);
+ setMembersMargin(5);
+ String backPath = LinkManager.getGroupResourceConfigurationUpdateHistoryLink(this.group.getId(), null);
+ BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
+ backPath);
+ addMember(backButton);
+
+ MembersTable table = new MembersTable(extendLocatorId("Table"));
+ addMember(table);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ }
+
+ private class MembersTable extends Table<MembersTable.DataSource> {
+ public MembersTable(String locatorId) {
+ super(locatorId, MSG.view_group_resConfig_members_title());
+ setDataSource(new DataSource());
+ }
+
+ @Override
+ protected void configureTable() {
+ ListGridField fieldResource = new ListGridField(DataSource.Field.RESOURCELINK, MSG.common_title_resource());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG
+ .common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG
+ .common_title_lastUpdated());
+ ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
+ ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
+
+ fieldResource.setWidth("*");
+ fieldDateCreated.setWidth("15%");
+ fieldLastUpdated.setWidth("15%");
+ fieldStatus.setWidth("10%");
+ fieldUser.setWidth("10%");
+
+ fieldResource.setType(ListGridFieldType.LINK);
+ fieldResource.setTarget("_self");
+
+ fieldStatus.setType(ListGridFieldType.ICON);
+ HashMap<String, String> statusIcons = new HashMap<String, String>(4);
+ statusIcons.put(ConfigurationUpdateStatus.SUCCESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.SUCCESS));
+ statusIcons.put(ConfigurationUpdateStatus.FAILURE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.FAILURE));
+ statusIcons.put(ConfigurationUpdateStatus.INPROGRESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.INPROGRESS));
+ statusIcons.put(ConfigurationUpdateStatus.NOCHANGE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.NOCHANGE));
+ fieldStatus.setValueIcons(statusIcons);
+ fieldStatus.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ new ErrorMessageWindow("statusDetailsWin", MSG.view_group_resConfig_members_statusDetails(),
+ "<pre>" + getStatusHtmlString(event.getRecord()) + "</pre>").show();
+ }
+ });
+ fieldStatus.setShowHover(true);
+ fieldStatus.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String html = getStatusHtmlString(record);
+ if (html.length() > 80) {
+ // this was probably an error stack trace, snip it so the tooltip isn't too big
+ html = "<pre>" + html.substring(0, 80) + "...</pre><p>"
+ + MSG.view_group_resConfig_table_clickStatusIcon() + "</p>";
+ }
+ return html;
+ }
+ });
+
+ ListGrid listGrid = getListGrid();
+ listGrid.setFields(fieldResource, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
+ listGrid.setLinkTextProperty(DataSource.Field.RESOURCENAME);
+ }
+
+ private String getStatusHtmlString(Record record) {
+ String html = null;
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record
+ .getAttributeAsObject(DataSource.Field.OBJECT);
+ switch (obj.getStatus()) {
+ case SUCCESS: {
+ html = MSG.view_group_resConfig_members_statusSuccess();
+ break;
+ }
+ case INPROGRESS: {
+ html = MSG.view_group_resConfig_members_statusInprogress();
+ break;
+ }
+ case NOCHANGE: {
+ html = MSG.view_group_resConfig_members_statusNochange();
+ break;
+ }
+ case FAILURE: {
+ html = obj.getErrorMessage();
+ if (html == null) {
+ html = MSG.view_group_resConfig_members_statusFailure();
+ }
+ break;
+ }
+ }
+ return html;
+ }
+
+ private class DataSource extends RPCDataSource<ResourceConfigurationUpdate> {
+
+ public class Field {
+ public static final String ID = "id";
+ public static final String RESOURCELINK = "resourceLink";
+ public static final String RESOURCENAME = "resourceName";
+ public static final String DATECREATED = "dateCreated";
+ public static final String LASTUPDATED = "lastUpdated";
+ public static final String STATUS = "status";
+ public static final String USER = "user";
+ public static final String OBJECT = "object";
+ }
+
+ @Override
+ public ResourceConfigurationUpdate copyValues(Record from) {
+ return (ResourceConfigurationUpdate) from.getAttributeAsObject(Field.OBJECT);
+ }
+
+ @Override
+ public ListGridRecord copyValues(ResourceConfigurationUpdate from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.RESOURCELINK, LinkManager.getResourceLink(from.getResource().getId()));
+ record.setAttribute(Field.RESOURCENAME, from.getResource().getName());
+ record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(Field.USER, from.getSubjectName());
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+
+ record.setAttribute(Field.OBJECT, from);
+
+ return record;
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+ ResourceConfigurationUpdateCriteria criteria = new ResourceConfigurationUpdateCriteria();
+ criteria
+ .addFilterGroupConfigurationUpdateId(HistoryGroupResourceConfigurationMembers.this.groupUpdateId);
+ // TODO need to disambiguate resources
+ criteria.fetchResource(true);
+
+ configurationService.findResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
+
+ @Override
+ public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_resConfig_members_fetchFailure(String
+ .valueOf(HistoryGroupResourceConfigurationMembers.this.groupUpdateId)), caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationSettings.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationSettings.java
new file mode 100644
index 0000000..375183a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationSettings.java
@@ -0,0 +1,150 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * Read only view that shows group resource configuration properties. These are properties
+ * that are common across all members of the group.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryGroupResourceConfigurationSettings extends LocatableVLayout {
+ private final ResourceGroup group;
+ private final ResourcePermission groupPerms;
+ private final int groupUpdateId;
+ private ConfigurationDefinition configurationDefinition;
+ private List<GroupMemberConfiguration> memberConfigurations;
+ private GroupConfigurationEditor editor;
+
+ public HistoryGroupResourceConfigurationSettings(String locatorId, ResourceGroupComposite groupComposite,
+ int updateId) {
+ super(locatorId);
+ this.group = groupComposite.getResourceGroup();
+ this.groupPerms = groupComposite.getResourcePermission();
+ this.groupUpdateId = updateId;
+
+ setMargin(5);
+ setMembersMargin(5);
+ String backPath = LinkManager.getGroupResourceConfigurationUpdateHistoryLink(this.group.getId(), null);
+ BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
+ backPath);
+ addMember(backButton);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ if (this.groupPerms.isInventory()) {
+ loadConfigurationDefinition();
+ loadConfigurations();
+ } else {
+ CoreGUI.getMessageCenter().notify(new Message(MSG.view_group_resConfig_view_noperm()));
+ }
+ }
+
+ private void initEditor() {
+ if (this.configurationDefinition != null && this.memberConfigurations != null) {
+ this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
+ this.memberConfigurations);
+ this.editor.setEditorTitle(MSG.view_group_resConfig_view_groupProperties() + " - " + this.groupUpdateId);
+ this.editor.setOverflow(Overflow.AUTO);
+ this.editor.setReadOnly(true);
+ addMember(this.editor);
+ }
+ }
+
+ private void loadConfigurationDefinition() {
+ if (this.configurationDefinition == null) {
+ final ResourceType type = this.group.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(Map<Integer, ResourceType> types) {
+ configurationDefinition = types.get(type.getId()).getResourceConfigurationDefinition();
+ if (configurationDefinition == null) {
+ throw new IllegalStateException("Resource configuration is not supported by this group.");
+ }
+ initEditor();
+ }
+ });
+ }
+ }
+
+ private void loadConfigurations() {
+ this.memberConfigurations = null;
+ GWTServiceLookup.getConfigurationService().findResourceConfigurationsForGroupUpdate(groupUpdateId,
+ new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
+ public void onFailure(Throwable caught) {
+ if (caught.getMessage().contains("ConfigurationUpdateStillInProgressException")) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_resConfig_members_fetchFailureConfigInProgress(), caught,
+ Severity.Info));
+ } else {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_resConfig_members_fetchFailureConfig(group.toString()), caught);
+ }
+ }
+
+ public void onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results) {
+ memberConfigurations = new ArrayList<GroupMemberConfiguration>(results.size());
+ for (DisambiguationReport<ResourceConfigurationComposite> result : results) {
+ int resourceId = result.getOriginal().getResourceId();
+ String label = ReportDecorator.decorateDisambiguationReport(result, resourceId, false);
+ Configuration configuration = result.getOriginal().getConfiguration();
+ GroupMemberConfiguration memberConfiguration = new GroupMemberConfiguration(resourceId, label,
+ configuration);
+ if (configuration == null || configuration.getProperties().isEmpty()) {
+ throw new RuntimeException(
+ "One or more null or empty member resource configurations was returned by the Server.");
+ }
+ memberConfigurations.add(memberConfiguration);
+ }
+ initEditor();
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
new file mode 100644
index 0000000..38174c8
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
@@ -0,0 +1,276 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+import org.rhq.core.domain.configuration.AbstractConfigurationUpdate;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.group.GroupResourceConfigurationUpdate;
+import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * Table showing group resource configuration history.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryGroupResourceConfigurationTable extends Table<HistoryGroupResourceConfigurationTable.DataSource> {
+ private final ResourceGroup group;
+ private final ResourcePermission groupPerms;
+
+ public HistoryGroupResourceConfigurationTable(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId, MSG.view_group_resConfig_table_title());
+ this.group = groupComposite.getResourceGroup();
+ this.groupPerms = groupComposite.getResourcePermission();
+
+ setDataSource(new DataSource());
+ }
+
+ @Override
+ protected void configureTable() {
+ ListGridField fieldId = new ListGridField(DataSource.Field.ID, MSG.common_title_version());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG.common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG.common_title_lastUpdated());
+ ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
+ ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
+
+ fieldId.setWidth("10%");
+ fieldDateCreated.setWidth("35%");
+ fieldLastUpdated.setWidth("35%");
+ fieldStatus.setWidth("10%");
+ fieldUser.setWidth("*");
+
+ fieldStatus.setType(ListGridFieldType.ICON);
+ HashMap<String, String> statusIcons = new HashMap<String, String>(4);
+ statusIcons.put(ConfigurationUpdateStatus.SUCCESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.SUCCESS));
+ statusIcons.put(ConfigurationUpdateStatus.FAILURE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.FAILURE));
+ statusIcons.put(ConfigurationUpdateStatus.INPROGRESS.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.INPROGRESS));
+ statusIcons.put(ConfigurationUpdateStatus.NOCHANGE.name(), ImageManager
+ .getResourceConfigurationIcon(ConfigurationUpdateStatus.NOCHANGE));
+ fieldStatus.setValueIcons(statusIcons);
+ fieldStatus.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ new ErrorMessageWindow("errWin", MSG.common_title_error(), getStatusHtmlString(event.getRecord()))
+ .show();
+ }
+ });
+ fieldStatus.setShowHover(true);
+ fieldStatus.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String html = getStatusHtmlString(record);
+ return html;
+ }
+ });
+
+ ListGrid listGrid = getListGrid();
+ listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
+
+ addTableAction(extendLocatorId("deleteAction"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ new AbstractTableAction(this.groupPerms.isInventory() ? TableActionEnablement.ANY
+ : TableActionEnablement.NEVER) {
+
+ @Override
+ public void executeAction(final ListGridRecord[] selection, Object actionValue) {
+ if (selection == null || selection.length == 0) {
+ return;
+ }
+
+ ConfigurationGWTServiceAsync service = GWTServiceLookup.getConfigurationService();
+ Integer groupId = HistoryGroupResourceConfigurationTable.this.group.getId();
+ Integer[] updateIds = new Integer[selection.length];
+ int i = 0;
+ for (ListGridRecord record : selection) {
+ updateIds[i++] = record.getAttributeAsInt(DataSource.Field.ID);
+ }
+
+ service.deleteGroupResourceConfigurationUpdate(groupId, updateIds, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ refresh();
+ Message message = new Message(MSG.view_group_resConfig_table_deleteSuccessful(String
+ .valueOf(selection.length)), Message.Severity.Info, EnumSet.of(
+ Message.Option.Transient, Message.Option.Sticky));
+ CoreGUI.getMessageCenter().notify(message);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_group_resConfig_table_deleteFailure(),
+ caught);
+ }
+ });
+ }
+ });
+
+ addTableAction(extendLocatorId("viewSettingsAction"), MSG.view_group_resConfig_table_viewSettings(),
+ new AbstractTableAction(TableActionEnablement.SINGLE) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ CoreGUI.goToView(LinkManager.getGroupResourceConfigurationUpdateHistoryLink(
+ HistoryGroupResourceConfigurationTable.this.group.getId(), null)
+ + "/" + selection[0].getAttribute(DataSource.Field.ID) + "/Settings");
+ }
+ });
+
+ addTableAction(extendLocatorId("viewMemberHistoryAction"), MSG.view_group_resConfig_table_viewMemberHistory(),
+ new AbstractTableAction(TableActionEnablement.SINGLE) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ CoreGUI.goToView(LinkManager.getGroupResourceConfigurationUpdateHistoryLink(
+ HistoryGroupResourceConfigurationTable.this.group.getId(), null)
+ + "/" + selection[0].getAttribute(DataSource.Field.ID) + "/Members");
+ }
+ });
+
+ }
+
+ private String getStatusHtmlString(Record record) {
+ String html = null;
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record
+ .getAttributeAsObject(DataSource.Field.OBJECT);
+ switch (obj.getStatus()) {
+ case SUCCESS: {
+ html = MSG.view_group_resConfig_table_statusSuccess();
+ break;
+ }
+ case INPROGRESS: {
+ html = "<p>" + MSG.view_group_resConfig_table_statusInprogress() + "</p><p>"
+ + MSG.view_group_resConfig_table_msg1() + "</p>";
+ break;
+ }
+ case NOCHANGE: {
+ html = MSG.view_group_resConfig_table_statusNochange();
+ break;
+ }
+ case FAILURE: {
+ html = obj.getErrorMessage();
+ if (html == null) {
+ html = "<p>" + MSG.view_group_resConfig_table_statusFailure() + "</p><p>"
+ + MSG.view_group_resConfig_table_msg1() + "</p>";
+ } else {
+ if (html.length() > 80) {
+ // this was probably an error stack trace, snip it so the tooltip isn't too big
+ html = "<pre>" + html.substring(0, 80) + "...</pre><p>"
+ + MSG.view_group_resConfig_table_clickStatusIcon() + "</p>";
+ } else {
+ html = "<pre>" + html + "</pre>";
+ }
+ html = html + "<p>" + MSG.view_group_resConfig_table_msg1() + "</p>";
+ }
+ break;
+ }
+ }
+ return html;
+ }
+
+ class DataSource extends RPCDataSource<GroupResourceConfigurationUpdate> {
+
+ public class Field {
+ public static final String ID = "id";
+ public static final String DATECREATED = "dateCreated";
+ public static final String LASTUPDATED = "lastUpdated";
+ public static final String STATUS = "status";
+ public static final String USER = "user";
+ public static final String OBJECT = "object";
+ }
+
+ @Override
+ public GroupResourceConfigurationUpdate copyValues(Record from) {
+ return (GroupResourceConfigurationUpdate) from.getAttributeAsObject(DataSource.Field.OBJECT);
+ }
+
+ @Override
+ public ListGridRecord copyValues(GroupResourceConfigurationUpdate from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+ record.setAttribute(Field.USER, from.getSubjectName());
+
+ record.setAttribute(Field.OBJECT, from);
+
+ return record;
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+ GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();
+ ArrayList<Integer> groupList = new ArrayList<Integer>(1);
+ groupList.add(HistoryGroupResourceConfigurationTable.this.group.getId());
+ criteria.addFilterResourceGroupIds(groupList);
+
+ configurationService.findGroupResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<GroupResourceConfigurationUpdate>>() {
+
+ @Override
+ public void onSuccess(PageList<GroupResourceConfigurationUpdate> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_group_resConfig_table_failFetch(), caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationView.java
new file mode 100644
index 0000000..0d8b76a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationView.java
@@ -0,0 +1,86 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration;
+
+import com.smartgwt.client.widgets.Canvas;
+
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A view for group resource configuration history.
+ *
+ * @author John Mazzitelli
+ */
+public class HistoryGroupResourceConfigurationView extends LocatableVLayout implements BookmarkableView {
+ private final ResourceGroupComposite groupComposite;
+ private HistoryGroupResourceConfigurationTable groupHistoryTable;
+ private Canvas detailsCanvas = null;
+
+ public HistoryGroupResourceConfigurationView(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
+ this.groupComposite = groupComposite;
+
+ groupHistoryTable = new HistoryGroupResourceConfigurationTable(extendLocatorId("Table"), groupComposite);
+ addMember(groupHistoryTable);
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ if (viewPath.isEnd()) {
+ setVisibleMember(this.groupHistoryTable);
+ } else {
+ // the details view can be one of two: the "Settings" view which shows the group config properties themselves
+ // or "Members" view which shows a tabular set of data, one history row for each individual resource in the group
+ // the syntax is "/#####/{Settings,Members}" where ##### is the group history ID
+ int groupHistoryId = viewPath.getCurrentAsInt();
+ viewPath.next();
+ boolean configView = false;
+ if (viewPath.isEnd()) {
+ configView = true; // if nothing follows the ID, the default view to show is the config properties
+ } else {
+ String currentPath = viewPath.getCurrent().getPath();
+ if ("Settings".equals(currentPath)) { // do not i18n this string, its a URL fragment
+ configView = true;
+ } else if ("Members".equals(currentPath)) { // do not i18n this string, its a URL fragment
+ configView = false;
+ } else {
+ throw new IllegalArgumentException("Cannot render page - invalid URL: " + currentPath);
+ }
+ }
+
+ if (detailsCanvas != null) {
+ removeMember(detailsCanvas);
+ this.detailsCanvas.destroy();
+ }
+
+ if (configView) {
+ detailsCanvas = new HistoryGroupResourceConfigurationSettings(extendLocatorId("SettingsView"),
+ this.groupComposite, groupHistoryId);
+ } else {
+ detailsCanvas = new HistoryGroupResourceConfigurationMembers(extendLocatorId("MembersView"),
+ this.groupComposite, groupHistoryId);
+ }
+ addMember(detailsCanvas);
+ setVisibleMember(detailsCanvas);
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
index b7ca5fc..2af2fcf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
@@ -26,10 +26,6 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -46,6 +42,7 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
@@ -53,12 +50,10 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
- * Shows a table of individual resource members that belonged to the group when the group plugin configuration was updated.
+ * Shows a table of individual resource members that belonged to the group when the group configuration was updated.
*
* @author John Mazzitelli
*/
@@ -89,7 +84,7 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
super.onDraw();
}
- private class MembersTable extends Table {
+ private class MembersTable extends Table<MembersTable.DataSource> {
public MembersTable(String locatorId) {
super(locatorId, MSG.view_group_pluginConfig_members_title());
setDataSource(new DataSource());
@@ -97,17 +92,19 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
@Override
protected void configureTable() {
- ListGridField fieldResource = new ListGridField("resourceLink", MSG.common_title_resource());
- ListGridField fieldDateCreated = new ListGridField("dateCreated", MSG.common_title_dateCreated());
- ListGridField fieldLastUpdated = new ListGridField("lastUpdated", MSG.common_title_lastUpdated());
- ListGridField fieldUser = new ListGridField("user", MSG.common_title_user());
- ListGridField fieldStatus = new ListGridField("status", MSG.common_title_status());
+ ListGridField fieldResource = new ListGridField(DataSource.Field.RESOURCELINK, MSG.common_title_resource());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG
+ .common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG
+ .common_title_lastUpdated());
+ ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
+ ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
fieldResource.setWidth("*");
fieldDateCreated.setWidth("15%");
fieldLastUpdated.setWidth("15%");
- fieldUser.setWidth("10%");
fieldStatus.setWidth("10%");
+ fieldUser.setWidth("10%");
fieldResource.setType(ListGridFieldType.LINK);
fieldResource.setTarget("_self");
@@ -126,34 +123,8 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
fieldStatus.addRecordClickHandler(new RecordClickHandler() {
@Override
public void onRecordClick(RecordClickEvent event) {
- final Window winModal = new LocatableWindow(HistoryGroupPluginConfigurationMembers.this
- .extendLocatorId("statusDetailsWin"));
- winModal.setTitle(MSG.view_group_pluginConfig_members_statusDetails());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setShowMaximizeButton(true);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setAutoSize(true);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- LocatableHTMLPane htmlPane = new LocatableHTMLPane(HistoryGroupPluginConfigurationMembers.this
- .extendLocatorId("statusDetailsPane"));
- htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(500);
- htmlPane.setDefaultHeight(400);
- htmlPane.setContents("<pre>" + getStatusHtmlString(event.getRecord()) + "</pre>");
- winModal.addItem(htmlPane);
- winModal.show();
+ new ErrorMessageWindow("statusDetailsWin", MSG.view_group_pluginConfig_members_statusDetails(),
+ "<pre>" + getStatusHtmlString(event.getRecord()) + "</pre>").show();
}
});
fieldStatus.setShowHover(true);
@@ -171,15 +142,14 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
});
ListGrid listGrid = getListGrid();
- listGrid.setFields(fieldResource, fieldDateCreated, fieldLastUpdated, fieldUser, fieldStatus);
-
- listGrid.setLinkTextProperty("resourceName");
-
+ listGrid.setFields(fieldResource, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
+ listGrid.setLinkTextProperty(DataSource.Field.RESOURCENAME);
}
private String getStatusHtmlString(Record record) {
String html = null;
- AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record.getAttributeAsObject("object");
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record
+ .getAttributeAsObject(DataSource.Field.OBJECT);
switch (obj.getStatus()) {
case SUCCESS: {
html = MSG.view_group_pluginConfig_members_statusSuccess();
@@ -206,24 +176,35 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
private class DataSource extends RPCDataSource<PluginConfigurationUpdate> {
+ public class Field {
+ public static final String ID = "id";
+ public static final String RESOURCELINK = "resourceLink";
+ public static final String RESOURCENAME = "resourceName";
+ public static final String DATECREATED = "dateCreated";
+ public static final String LASTUPDATED = "lastUpdated";
+ public static final String STATUS = "status";
+ public static final String USER = "user";
+ public static final String OBJECT = "object";
+ }
+
@Override
public PluginConfigurationUpdate copyValues(Record from) {
- return (PluginConfigurationUpdate) from.getAttributeAsObject("object");
+ return (PluginConfigurationUpdate) from.getAttributeAsObject(Field.OBJECT);
}
@Override
public ListGridRecord copyValues(PluginConfigurationUpdate from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("resourceLink", LinkManager.getResourceLink(from.getResource().getId()));
- record.setAttribute("resourceName", from.getResource().getName());
- record.setAttribute("dateCreated", new Date(from.getCreatedTime()));
- record.setAttribute("lastUpdated", new Date(from.getModifiedTime()));
- record.setAttribute("user", from.getSubjectName());
- record.setAttribute("status", from.getStatus().name());
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.RESOURCELINK, LinkManager.getResourceLink(from.getResource().getId()));
+ record.setAttribute(Field.RESOURCENAME, from.getResource().getName());
+ record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(Field.USER, from.getSubjectName());
+ record.setAttribute(Field.STATUS, from.getStatus().name());
- record.setAttribute("object", from);
+ record.setAttribute(Field.OBJECT, from);
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
index e4d5c78..fe975f2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
@@ -28,10 +28,6 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -48,6 +44,7 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
@@ -57,15 +54,13 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* Table showing group plugin configuration history.
*
* @author John Mazzitelli
*/
-public class HistoryGroupPluginConfigurationTable extends Table {
+public class HistoryGroupPluginConfigurationTable extends Table<HistoryGroupPluginConfigurationTable.DataSource> {
private final ResourceGroup group;
private final ResourcePermission groupPerms;
@@ -79,17 +74,17 @@ public class HistoryGroupPluginConfigurationTable extends Table {
@Override
protected void configureTable() {
- ListGridField fieldId = new ListGridField("id", MSG.common_title_version());
- ListGridField fieldDateCreated = new ListGridField("dateCreated", MSG.common_title_dateCreated());
- ListGridField fieldLastUpdated = new ListGridField("lastUpdated", MSG.common_title_lastUpdated());
- ListGridField fieldUser = new ListGridField("user", MSG.common_title_user());
- ListGridField fieldStatus = new ListGridField("status", MSG.common_title_status());
+ ListGridField fieldId = new ListGridField(DataSource.Field.ID, MSG.common_title_version());
+ ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG.common_title_dateCreated());
+ ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG.common_title_lastUpdated());
+ ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
+ ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
fieldId.setWidth("10%");
fieldDateCreated.setWidth("35%");
fieldLastUpdated.setWidth("35%");
- fieldUser.setWidth("*");
fieldStatus.setWidth("10%");
+ fieldUser.setWidth("*");
fieldStatus.setType(ListGridFieldType.ICON);
HashMap<String, String> statusIcons = new HashMap<String, String>(4);
@@ -105,34 +100,8 @@ public class HistoryGroupPluginConfigurationTable extends Table {
fieldStatus.addRecordClickHandler(new RecordClickHandler() {
@Override
public void onRecordClick(RecordClickEvent event) {
- final Window winModal = new LocatableWindow(HistoryGroupPluginConfigurationTable.this
- .extendLocatorId("statusDetailsWin"));
- winModal.setTitle(MSG.view_group_pluginConfig_table_statusDetails());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setShowMaximizeButton(true);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setAutoSize(true);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- LocatableHTMLPane htmlPane = new LocatableHTMLPane(HistoryGroupPluginConfigurationTable.this
- .extendLocatorId("statusDetailsPane"));
- htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(500);
- htmlPane.setDefaultHeight(400);
- htmlPane.setContents(getStatusHtmlString(event.getRecord()));
- winModal.addItem(htmlPane);
- winModal.show();
+ new ErrorMessageWindow("errWin", MSG.common_title_error(), getStatusHtmlString(event.getRecord()))
+ .show();
}
});
fieldStatus.setShowHover(true);
@@ -145,7 +114,7 @@ public class HistoryGroupPluginConfigurationTable extends Table {
});
ListGrid listGrid = getListGrid();
- listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldUser, fieldStatus);
+ listGrid.setFields(fieldId, fieldDateCreated, fieldLastUpdated, fieldStatus, fieldUser);
addTableAction(extendLocatorId("deleteAction"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
new AbstractTableAction(this.groupPerms.isInventory() ? TableActionEnablement.ANY
@@ -162,7 +131,7 @@ public class HistoryGroupPluginConfigurationTable extends Table {
Integer[] updateIds = new Integer[selection.length];
int i = 0;
for (ListGridRecord record : selection) {
- updateIds[i++] = record.getAttributeAsInt("id");
+ updateIds[i++] = record.getAttributeAsInt(DataSource.Field.ID);
}
service.deleteGroupPluginConfigurationUpdate(groupId, updateIds, new AsyncCallback<Void>() {
@@ -190,7 +159,7 @@ public class HistoryGroupPluginConfigurationTable extends Table {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
CoreGUI.goToView(LinkManager.getGroupPluginConfigurationUpdateHistoryLink(
HistoryGroupPluginConfigurationTable.this.group.getId(), null)
- + "/" + selection[0].getAttribute("id") + "/Settings");
+ + "/" + selection[0].getAttribute(DataSource.Field.ID) + "/Settings");
}
});
@@ -200,7 +169,7 @@ public class HistoryGroupPluginConfigurationTable extends Table {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
CoreGUI.goToView(LinkManager.getGroupPluginConfigurationUpdateHistoryLink(
HistoryGroupPluginConfigurationTable.this.group.getId(), null)
- + "/" + selection[0].getAttribute("id") + "/Members");
+ + "/" + selection[0].getAttribute(DataSource.Field.ID) + "/Members");
}
});
@@ -208,7 +177,8 @@ public class HistoryGroupPluginConfigurationTable extends Table {
private String getStatusHtmlString(Record record) {
String html = null;
- AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record.getAttributeAsObject("object");
+ AbstractConfigurationUpdate obj = (AbstractConfigurationUpdate) record
+ .getAttributeAsObject(DataSource.Field.OBJECT);
switch (obj.getStatus()) {
case SUCCESS: {
html = MSG.view_group_pluginConfig_table_statusSuccess();
@@ -244,24 +214,33 @@ public class HistoryGroupPluginConfigurationTable extends Table {
return html;
}
- private class DataSource extends RPCDataSource<GroupPluginConfigurationUpdate> {
+ class DataSource extends RPCDataSource<GroupPluginConfigurationUpdate> {
+
+ public class Field {
+ public static final String ID = "id";
+ public static final String DATECREATED = "dateCreated";
+ public static final String LASTUPDATED = "lastUpdated";
+ public static final String STATUS = "status";
+ public static final String USER = "user";
+ public static final String OBJECT = "object";
+ }
@Override
public GroupPluginConfigurationUpdate copyValues(Record from) {
- return (GroupPluginConfigurationUpdate) from.getAttributeAsObject("object");
+ return (GroupPluginConfigurationUpdate) from.getAttributeAsObject(DataSource.Field.OBJECT);
}
@Override
public ListGridRecord copyValues(GroupPluginConfigurationUpdate from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("dateCreated", new Date(from.getCreatedTime()));
- record.setAttribute("lastUpdated", new Date(from.getModifiedTime()));
- record.setAttribute("user", from.getSubjectName());
- record.setAttribute("status", from.getStatus().name());
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.DATECREATED, new Date(from.getCreatedTime()));
+ record.setAttribute(Field.LASTUPDATED, new Date(from.getModifiedTime()));
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+ record.setAttribute(Field.USER, from.getSubjectName());
- record.setAttribute("object", from);
+ record.setAttribute(Field.OBJECT, from);
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index e30b1f1..336206b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -278,11 +278,31 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
@Override
+ public List<DisambiguationReport<ResourceConfigurationComposite>> findResourceConfigurationsForGroupUpdate(
+ int groupUpdateId) throws RuntimeException {
+ try {
+ Map<Integer, Configuration> configurations = this.configurationManager
+ .getResourceConfigurationMapForGroupUpdate(getSessionSubject(), groupUpdateId);
+ List<ResourceConfigurationComposite> configurationComposites = convertToCompositesList(configurations);
+
+ // Disambiguate - i.e. generate unambiguous Resource names for each of the Resource id's.
+ List<DisambiguationReport<ResourceConfigurationComposite>> disambiguatedConfigurationComposites = resourceManager
+ .disambiguate(configurationComposites, RESOURCE_CONFIGURATION_COMPOSITE_RESOURCE_ID_EXTRACTOR,
+ DefaultDisambiguationUpdateStrategies.getDefault());
+
+ return SerialUtility.prepare(disambiguatedConfigurationComposites,
+ "ConfigurationService.findResourceConfigurationsForGroupUpdate");
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ @Override
public List<DisambiguationReport<ResourceConfigurationComposite>> findPluginConfigurationsForGroupUpdate(
int groupUpdateId) throws RuntimeException {
try {
Map<Integer, Configuration> configurations = this.configurationManager
- .getPluginConfigurationMapForGroupUpdate(groupUpdateId);
+ .getPluginConfigurationMapForGroupUpdate(getSessionSubject(), groupUpdateId);
List<ResourceConfigurationComposite> configurationComposites = convertToCompositesList(configurations);
// Disambiguate - i.e. generate unambiguous Resource names for each of the Resource id's.
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 f6d806d..d6db964 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
@@ -1733,6 +1733,32 @@ view_group_resConfig_edit_saveInitiated_full = The group configuration updates h
view_group_resConfig_edit_saveFailure = Failed to initiate group configuration update for [{0}] compatible group named [{1}]
view_group_resConfig_edit_valid = All configuration properties have valid values, so the configuration can now be saved
view_group_resConfig_edit_invalid = The following configuration properties have invalid values and must be corrected before the configuration can be saved: [{0}]
+
+view_group_resConfig_view_noperm = You do not have permissions to see the resource configuration settings
+view_group_resConfig_view_groupProperties = Group Properties
+view_group_resConfig_table_title = Group Resource Configuration History
+view_group_resConfig_table_statusDetails = Status Details
+view_group_resConfig_table_viewSettings = View Settings
+view_group_resConfig_table_viewMemberHistory = View Member History
+view_group_resConfig_table_msg1 = View Member History for status of each individual resource
+view_group_resConfig_table_failFetch = Failed to get group resource config history
+view_group_resConfig_table_deleteSuccessful = You have deleted [{0}] history items
+view_group_resConfig_table_deleteFailure = Failed to delete group resource config history
+view_group_resConfig_table_statusSuccess = This group configuration update was successful
+view_group_resConfig_table_statusInprogress = This group configuration update is still in progress
+view_group_resConfig_table_statusNochange = No changes were made to this group configuration
+view_group_resConfig_table_statusFailure = This group configuration update failed
+view_group_resConfig_table_clickStatusIcon = Click the status icon for full details
+view_group_resConfig_members_title = Group Resource Configuration Member Histories
+view_group_resConfig_members_fetchFailure = Failed to get resource config update history for members of group [{0}]
+view_group_resConfig_members_fetchFailureConfig = Failed to retrieve member resource configuration settings for [{0}]
+view_group_resConfig_members_fetchFailureConfigInProgress = A group resource configuration update is currently in progress. You must wait until the update is finished before you can view the group settings.
+view_group_resConfig_members_statusDetails = Status Details
+view_group_resConfig_members_statusSuccess = This configuration update was successful
+view_group_resConfig_members_statusInprogress = This configuration update is still in progress
+view_group_resConfig_members_statusNochange = No changes were made to this configuration
+view_group_resConfig_members_statusFailure = This configuration update failed for an unknown reason
+
view_group_pluginConfig_view_noperm = You do not have permissions to see the connection settings
view_group_pluginConfig_view_groupProperties = Group Properties
view_group_pluginConfig_table_failFetch = Failed to get group plugin config history
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java
index 5f3229d..dd463a3 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java
@@ -22,14 +22,14 @@ import java.util.Map;
import javax.faces.model.DataModel;
-import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.core.gui.configuration.propset.ConfigurationSet;
+import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.common.framework.PagedDataTableUIBean;
import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
@@ -39,7 +39,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class ViewGroupConnectionPropertyDetailsUIBean extends PagedDataTableUIBean {
public static final String MANAGED_BEAN_NAME = "ViewGroupConnectionPropertyDetailsUIBean";
- public static final String VIEW_ID = "/rhq/group/inventory/view-plugin-configuration-update-details.xhtml";
+ public static final String VIEW_ID = "/rhq/group/inventory/view-plugin-configuration-update-details.xhtml";
private ResourceGroup resourceGroup;
private Map<Integer, Configuration> pluginConfigurations;
@@ -63,8 +63,8 @@ public class ViewGroupConnectionPropertyDetailsUIBean extends PagedDataTableUIBe
ResourceGroup group = EnterpriseFacesContextUtility.getResourceGroup();
int groupPluginConfigurationUpdateId = getPluginResourceConfigurationUpdateId();
- this.pluginConfigurations = this.configurationManager
- .getPluginConfigurationMapForGroupUpdate(groupPluginConfigurationUpdateId);
+ this.pluginConfigurations = this.configurationManager.getPluginConfigurationMapForGroupUpdate(subject,
+ groupPluginConfigurationUpdateId);
this.configurationSet = GroupPluginConfigurationUtility.buildConfigurationSet(subject, group,
this.pluginConfigurations);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 1552162..41c2a58 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -1801,9 +1801,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
groupIdParameter);
}
- // TODO: THIS NEEDS AUTHZ CHECK!
@SuppressWarnings("unchecked")
- public Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Integer groupPluginConfigurationUpdateId) {
+ public Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Subject subject,
+ Integer groupPluginConfigurationUpdateId) {
+ // this method will perform the CONFIGURE_READ security check for us, no need to keep reference to result
+ getGroupPluginConfigurationUpdate(subject, groupPluginConfigurationUpdateId);
+
Tuple<String, Object> groupIdParameter = new Tuple<String, Object>("groupConfigurationUpdateId",
groupPluginConfigurationUpdateId);
return executeGetConfigurationMapQuery(Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_UPDATE_ID, 100,
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index 018b6eb..29e1cb1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -415,7 +415,8 @@ public interface ConfigurationManagerLocal {
Map<Integer, Configuration> getPluginConfigurationsForCompatibleGroup(Subject subject, int groupId)
throws ConfigurationUpdateStillInProgressException, Exception;
- Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Integer groupPluginConfigurationUpdateId);
+ Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Subject subject,
+ Integer groupPluginConfigurationUpdateId);
/**
* The purpose of this method is really to clean up requests when we detect
commit c433f882c4d966a9e876d95bb08b5017459a4cc4
Merge: cc8fc60... 9fb84ad...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 16:04:20 2011 -0500
Merge commit 'origin/master' into group-config-history
commit cc8fc603342b7b3acd9f69965c1934ea4d960cff
Merge: 68206c8... 8b3cd4e...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 13:12:06 2011 -0500
Merge commit 'origin/master' into group-config-history
commit 68206c8f090db0124c2be476442cc4f13f7e6a36
Merge: 41c1e1f... f1f4426...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 1 10:40:42 2011 -0500
Merge commit 'origin/master' into group-config-history
commit 41c1e1ff0358ba46be80defce3ede2bd5c385e3f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Feb 28 15:36:23 2011 -0500
rename view class so it is consistent with the names of the group/indiv resource/plugin config edit views
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 9b2ad10..a137250 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -55,7 +55,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
import org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventCompositeHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.GroupResourceConfigurationEditView;
-import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.CurrentGroupPluginConfigurationView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.GroupPluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.HistoryGroupPluginConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.MembersView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.schedules.SchedulesView;
@@ -337,7 +337,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
true, new ViewFactory() {
@Override
public Canvas createView() {
- return new CurrentGroupPluginConfigurationView(inventoryConn.extendLocatorId("View"),
+ return new GroupPluginConfigurationEditView(inventoryConn.extendLocatorId("View"),
groupComposite);
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
deleted file mode 100644
index f64b74e..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/CurrentGroupPluginConfigurationView.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.DisambiguationReport;
-import org.rhq.core.domain.resource.composite.ResourcePermission;
-import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.RefreshableView;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
-import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-
-/**
- * A view for editing a group's current plugin configuration.
- *
- * @author Ian Springer
- * @author John Mazzitelli
- */
-public class CurrentGroupPluginConfigurationView extends LocatableVLayout implements PropertyValueChangeListener,
- RefreshableView {
- private final ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
-
- private ResourceGroup group;
- private ResourcePermission resourcePermission;
- private ConfigurationDefinition configurationDefinition;
- private List<GroupMemberConfiguration> memberConfigurations;
-
- private ConfigurationEditor editor;
- private IButton saveButton;
-
- private boolean refreshing = false;
-
- public CurrentGroupPluginConfigurationView(String locatorId, ResourceGroupComposite groupComposite) {
- super(locatorId);
-
- this.group = groupComposite.getResourceGroup();
- this.resourcePermission = groupComposite.getResourcePermission();
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setWidth100();
- toolStrip.setExtraSpace(10);
- toolStrip.setMembersMargin(5);
- toolStrip.setLayoutMargin(5);
-
- this.saveButton = new LocatableIButton(this.extendLocatorId("Save"), MSG.common_button_save());
- this.saveButton.setTooltip(MSG.view_group_pluginConfig_edit_saveTooltip());
- this.saveButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- save();
- }
- });
-
- toolStrip.addMember(saveButton);
-
- addMember(toolStrip);
- refresh();
-
- if (!this.resourcePermission.isInventory()) {
- Message message = new Message(MSG.view_group_pluginConfig_edit_noperm(), Message.Severity.Info, EnumSet.of(
- Message.Option.Transient, Message.Option.Sticky));
- CoreGUI.getMessageCenter().notify(message);
- }
- }
-
- @Override
- public void refresh() {
- if (this.refreshing) {
- return; // we are already in the process of refreshing, don't do it again
- }
-
- this.refreshing = true;
- this.saveButton.disable();
- if (editor != null) {
- editor.destroy();
- removeMember(editor);
- }
- // TODO (ips): If editor != null, use editor.reload() instead.
-
- loadConfigurationDefinition();
- loadConfigurations();
- }
-
- private void initEditor() {
- if (this.configurationDefinition != null && this.memberConfigurations != null) {
- this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
- this.memberConfigurations);
- this.editor.setEditorTitle(MSG.view_group_pluginConfig_edit_currentGroupProperties());
- this.editor.setOverflow(Overflow.AUTO);
- this.editor.addPropertyValueChangeListener(this);
- this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
- addMember(this.editor);
- this.refreshing = false;
- }
- }
-
- private void loadConfigurationDefinition() {
- if (this.configurationDefinition == null) {
- final ResourceType type = this.group.getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
- EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
- new ResourceTypeRepository.TypesLoadedCallback() {
- public void onTypesLoaded(Map<Integer, ResourceType> types) {
- configurationDefinition = types.get(type.getId()).getPluginConfigurationDefinition();
- if (configurationDefinition == null) {
- throw new IllegalStateException("Connection settings are not supported by this group.");
- }
- initEditor();
- }
- });
- }
- }
-
- private void loadConfigurations() {
- this.memberConfigurations = null;
- this.configurationService.findPluginConfigurationsForGroup(group.getId(),
- new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
- public void onFailure(Throwable caught) {
- refreshing = false;
- if (caught.getMessage().contains("ConfigurationUpdateStillInProgressException")) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_group_pluginConfig_members_fetchFailureConnInProgress(), caught,
- Severity.Info));
- } else {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_group_pluginConfig_members_fetchFailureConn(group.toString()), caught);
- }
- }
-
- public void onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results) {
- memberConfigurations = new ArrayList<GroupMemberConfiguration>(results.size());
- for (DisambiguationReport<ResourceConfigurationComposite> result : results) {
- int resourceId = result.getOriginal().getResourceId();
- String label = ReportDecorator.decorateDisambiguationReport(result, resourceId, false);
- Configuration configuration = result.getOriginal().getConfiguration();
- GroupMemberConfiguration memberConfiguration = new GroupMemberConfiguration(resourceId, label,
- configuration);
- if (configuration == null || configuration.getProperties().isEmpty()) {
- throw new RuntimeException(
- "One or more null or empty member connection settings was returned by the Server.");
- }
- memberConfigurations.add(memberConfiguration);
- }
- initEditor();
- }
- });
- }
-
- private void save() {
- List<ResourceConfigurationComposite> resourceConfigurations = convertToCompositeList();
- GWTServiceLookup.getConfigurationService().updatePluginConfigurationsForGroup(this.group.getId(),
- resourceConfigurations, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- String typeName = group.getResourceType().getName();
- CoreGUI.getErrorHandler().handleError(
- MSG.view_group_pluginConfig_edit_saveFailure(typeName, group.getName()), caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_group_pluginConfig_edit_saveInitiated_concise(), MSG
- .view_group_pluginConfig_edit_saveInitiated_full(group.getResourceType().getName(), group
- .getName()), Message.Severity.Info));
- refresh();
- }
- });
- }
-
- private List<ResourceConfigurationComposite> convertToCompositeList() {
- List<ResourceConfigurationComposite> resourceConfigurations = new ArrayList<ResourceConfigurationComposite>(
- this.memberConfigurations.size());
- for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
- resourceConfigurations.add(new ResourceConfigurationComposite(memberConfiguration.getId(),
- memberConfiguration.getConfiguration()));
- }
- return resourceConfigurations;
- }
-
- @Override
- public void propertyValueChanged(PropertyValueChangeEvent event) {
- MessageCenter messageCenter = CoreGUI.getMessageCenter();
- Message message;
- if (event.isValidationStateChanged()) {
- Set<String> invalidPropertyNames = event.getInvalidPropertyNames();
- if (invalidPropertyNames.isEmpty()) {
- this.saveButton.enable();
- message = new Message(MSG.view_group_pluginConfig_edit_valid(), Message.Severity.Info, EnumSet.of(
- Message.Option.Transient, Message.Option.Sticky));
- } else {
- this.saveButton.disable();
- message = new Message(MSG.view_group_pluginConfig_edit_invalid(invalidPropertyNames.toString()),
- Message.Severity.Error, EnumSet.of(Message.Option.Transient, Message.Option.Sticky));
- }
- messageCenter.notify(message);
- } else {
- this.saveButton.enable();
- }
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java
new file mode 100644
index 0000000..973c371
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java
@@ -0,0 +1,249 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A view for editing a group's current plugin configuration.
+ *
+ * @author Ian Springer
+ * @author John Mazzitelli
+ */
+public class GroupPluginConfigurationEditView extends LocatableVLayout implements PropertyValueChangeListener,
+ RefreshableView {
+ private final ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+ private ResourceGroup group;
+ private ResourcePermission resourcePermission;
+ private ConfigurationDefinition configurationDefinition;
+ private List<GroupMemberConfiguration> memberConfigurations;
+
+ private ConfigurationEditor editor;
+ private IButton saveButton;
+
+ private boolean refreshing = false;
+
+ public GroupPluginConfigurationEditView(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
+
+ this.group = groupComposite.getResourceGroup();
+ this.resourcePermission = groupComposite.getResourcePermission();
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
+ toolStrip.setExtraSpace(10);
+ toolStrip.setMembersMargin(5);
+ toolStrip.setLayoutMargin(5);
+
+ this.saveButton = new LocatableIButton(this.extendLocatorId("Save"), MSG.common_button_save());
+ this.saveButton.setTooltip(MSG.view_group_pluginConfig_edit_saveTooltip());
+ this.saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ save();
+ }
+ });
+
+ toolStrip.addMember(saveButton);
+
+ addMember(toolStrip);
+ refresh();
+
+ if (!this.resourcePermission.isInventory()) {
+ Message message = new Message(MSG.view_group_pluginConfig_edit_noperm(), Message.Severity.Info, EnumSet.of(
+ Message.Option.Transient, Message.Option.Sticky));
+ CoreGUI.getMessageCenter().notify(message);
+ }
+ }
+
+ @Override
+ public void refresh() {
+ if (this.refreshing) {
+ return; // we are already in the process of refreshing, don't do it again
+ }
+
+ this.refreshing = true;
+ this.saveButton.disable();
+ if (editor != null) {
+ editor.destroy();
+ removeMember(editor);
+ }
+ // TODO (ips): If editor != null, use editor.reload() instead.
+
+ loadConfigurationDefinition();
+ loadConfigurations();
+ }
+
+ private void initEditor() {
+ if (this.configurationDefinition != null && this.memberConfigurations != null) {
+ this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition,
+ this.memberConfigurations);
+ this.editor.setEditorTitle(MSG.view_group_pluginConfig_edit_currentGroupProperties());
+ this.editor.setOverflow(Overflow.AUTO);
+ this.editor.addPropertyValueChangeListener(this);
+ this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
+ addMember(this.editor);
+ this.refreshing = false;
+ }
+ }
+
+ private void loadConfigurationDefinition() {
+ if (this.configurationDefinition == null) {
+ final ResourceType type = this.group.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() },
+ EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(Map<Integer, ResourceType> types) {
+ configurationDefinition = types.get(type.getId()).getPluginConfigurationDefinition();
+ if (configurationDefinition == null) {
+ throw new IllegalStateException("Connection settings are not supported by this group.");
+ }
+ initEditor();
+ }
+ });
+ }
+ }
+
+ private void loadConfigurations() {
+ this.memberConfigurations = null;
+ this.configurationService.findPluginConfigurationsForGroup(group.getId(),
+ new AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>() {
+ public void onFailure(Throwable caught) {
+ refreshing = false;
+ if (caught.getMessage().contains("ConfigurationUpdateStillInProgressException")) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_pluginConfig_members_fetchFailureConnInProgress(), caught,
+ Severity.Info));
+ } else {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_pluginConfig_members_fetchFailureConn(group.toString()), caught);
+ }
+ }
+
+ public void onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results) {
+ memberConfigurations = new ArrayList<GroupMemberConfiguration>(results.size());
+ for (DisambiguationReport<ResourceConfigurationComposite> result : results) {
+ int resourceId = result.getOriginal().getResourceId();
+ String label = ReportDecorator.decorateDisambiguationReport(result, resourceId, false);
+ Configuration configuration = result.getOriginal().getConfiguration();
+ GroupMemberConfiguration memberConfiguration = new GroupMemberConfiguration(resourceId, label,
+ configuration);
+ if (configuration == null || configuration.getProperties().isEmpty()) {
+ throw new RuntimeException(
+ "One or more null or empty member connection settings was returned by the Server.");
+ }
+ memberConfigurations.add(memberConfiguration);
+ }
+ initEditor();
+ }
+ });
+ }
+
+ private void save() {
+ List<ResourceConfigurationComposite> resourceConfigurations = convertToCompositeList();
+ GWTServiceLookup.getConfigurationService().updatePluginConfigurationsForGroup(this.group.getId(),
+ resourceConfigurations, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ String typeName = group.getResourceType().getName();
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_pluginConfig_edit_saveFailure(typeName, group.getName()), caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_pluginConfig_edit_saveInitiated_concise(), MSG
+ .view_group_pluginConfig_edit_saveInitiated_full(group.getResourceType().getName(), group
+ .getName()), Message.Severity.Info));
+ refresh();
+ }
+ });
+ }
+
+ private List<ResourceConfigurationComposite> convertToCompositeList() {
+ List<ResourceConfigurationComposite> resourceConfigurations = new ArrayList<ResourceConfigurationComposite>(
+ this.memberConfigurations.size());
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ resourceConfigurations.add(new ResourceConfigurationComposite(memberConfiguration.getId(),
+ memberConfiguration.getConfiguration()));
+ }
+ return resourceConfigurations;
+ }
+
+ @Override
+ public void propertyValueChanged(PropertyValueChangeEvent event) {
+ MessageCenter messageCenter = CoreGUI.getMessageCenter();
+ Message message;
+ if (event.isValidationStateChanged()) {
+ Set<String> invalidPropertyNames = event.getInvalidPropertyNames();
+ if (invalidPropertyNames.isEmpty()) {
+ this.saveButton.enable();
+ message = new Message(MSG.view_group_pluginConfig_edit_valid(), Message.Severity.Info, EnumSet.of(
+ Message.Option.Transient, Message.Option.Sticky));
+ } else {
+ this.saveButton.disable();
+ message = new Message(MSG.view_group_pluginConfig_edit_invalid(invalidPropertyNames.toString()),
+ Message.Severity.Error, EnumSet.of(Message.Option.Transient, Message.Option.Sticky));
+ }
+ messageCenter.notify(message);
+ } else {
+ this.saveButton.enable();
+ }
+ }
+}
13 years, 3 months
[rhq] modules/core modules/enterprise
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java | 16 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java | 66 +++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java | 27 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java | 73 ++++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java | 76 ----------
6 files changed, 126 insertions(+), 136 deletions(-)
New commits:
commit ef1a25db284b1ac680f611fbef4426b53e4b8d10
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 1 17:16:39 2011 -0500
Width Handling for Dashboards
- Fix a problem with Dashboard width specification. It seems there is a
Smartgwt javascript issue with, minimally, single String varargs array
handling. Accessing varargs[0] was unreliable. In dev mode this was
more tolerant but the javascript failed silently. Watch out for potential
issues using varargs.
- Added the ability to dragResize widths for dash columns
- Dashboard save() now persists column widths on each save operation
- Now allow independent scrolling of dash columns. This allows a user to
view any portlet combination across the columns.
- Added some null protection in Dashboard getColumns and getColumnWidths.
- played with borders, margins, etc to tweak reals estate and make drag
easier.
- Removed a bunch of debug message center notifications
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
index 622bd28..4c061fb 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
@@ -171,7 +171,7 @@ public class Dashboard implements Serializable {
}
public int getColumns() {
- return configuration.getSimple(CFG_COLUMNS).getIntegerValue();
+ return Integer.valueOf(configuration.getSimpleValue(CFG_COLUMNS, "1"));
}
public void setColumns(int columns) {
@@ -179,7 +179,7 @@ public class Dashboard implements Serializable {
}
public String[] getColumnWidths() {
- return configuration.getSimple(CFG_WIDTHS).getStringValue().split(",");
+ return configuration.getSimpleValue(CFG_WIDTHS, "").split(",");
}
public void setColumnWidths(String... columnWidths) {
@@ -187,11 +187,17 @@ public class Dashboard implements Serializable {
return;
}
- String widths = columnWidths[0];
+ // note - this impl is a little verbose but it avoids a smartgwt javascript problem with
+ // varargs handling. Not sure how bad the problem is but it definitely occured with SmartGwt 2.4
+ // when a single String was pssed as the varArg list. Be wary of directly using varargs array
+ // element 0...
+ StringBuilder sb = new StringBuilder();
+ sb.append(columnWidths[0]);
for (int i = 1; i < columnWidths.length; ++i) {
- widths += ("," + columnWidths[i]);
+ sb.append(",");
+ sb.append(columnWidths[i]);
}
- configuration.put(new PropertySimple(CFG_WIDTHS, widths));
+ configuration.put(new PropertySimple(CFG_WIDTHS, sb));
}
public Configuration getConfiguration() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index cd73f5d..f5f3fc8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -56,7 +56,6 @@ import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.form.ColorButtonItem;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
@@ -108,8 +107,6 @@ public class DashboardView extends LocatableVLayout {
@Override
protected void onInit() {
if (!isInitialized) {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.oninit()", Severity.Info)); // TODO
-
super.onInit();
this.setWidth100();
@@ -123,8 +120,6 @@ public class DashboardView extends LocatableVLayout {
}
public void rebuild() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.rebuild()", Severity.Info)); // TODO
-
// destroy all of the portlets and recreate from scratch
portalLayout.removeFromParent();
portalLayout.destroy();
@@ -133,48 +128,26 @@ public class DashboardView extends LocatableVLayout {
buildPortlets();
}
- public void redraw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.redraw()", Severity.Info)); // TODO
- super.redraw();
- }
-
- @Override
- public void draw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.draw()", Severity.Info)); // TODO
- super.draw();
- }
-
@Override
protected void onDraw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.onDraw()", Severity.Info)); // TODO
super.onDraw();
setEditMode(editMode);
}
public void buildPortlets() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(1)", Severity.Info)); // TODO
-
this.setBackgroundColor(storedDashboard.getConfiguration().getSimpleValue(Dashboard.CFG_BACKGROUND, "white"));
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(2)", Severity.Info)); // TODO
portalLayout = new PortalLayout(extendLocatorId("PortalLayout"), this, storedDashboard.getColumns(),
storedDashboard.getColumnWidths());
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(3)", Severity.Info)); // TODO
portalLayout.setOverflow(Overflow.AUTO);
portalLayout.setWidth100();
portalLayout.setHeight100();
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(4)", Severity.Info)); // TODO
-
loadPortletWindows();
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(5)", Severity.Info)); // TODO
-
addMember(portalLayout);
-
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildPortlets(6)", Severity.Info)); // TODO
}
protected boolean canEditName() {
@@ -182,8 +155,6 @@ public class DashboardView extends LocatableVLayout {
}
private DynamicForm buildEditForm() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildEditForm(1)", Severity.Info)); // TODO
-
editForm = new LocatableDynamicForm(extendLocatorId("Editor"));
editForm.setMargin(5);
editForm.setAutoWidth();
@@ -192,8 +163,6 @@ public class DashboardView extends LocatableVLayout {
TextItem nameItem = null;
if (dashboardContainer.supportsDashboardNameEdit()) {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildEditForm(2)", Severity.Info)); // TODO
-
nameItem = new TextItem("name", MSG.common_title_dashboard_name());
nameItem.setValue(storedDashboard.getName());
nameItem.setWrapTitle(false);
@@ -374,23 +343,16 @@ public class DashboardView extends LocatableVLayout {
}
updateRefreshMenu();
this.refreshMenuButton.markForRedraw();
- //this.markForRedraw();
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.buildEditForm(2)", Severity.Info)); // TODO
return editForm;
}
private void loadPortletWindows() {
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.loadPortletWindows(1)", Severity.Info)); // TODO
-
for (int i = 0; i < storedDashboard.getColumns(); i++) {
for (DashboardPortlet storedPortlet : storedDashboard.getPortlets(i)) {
String locatorId = getPortletLocatorId(portalLayout, storedPortlet);
- CoreGUI.getMessageCenter().notify(
- new Message("------->> DashboardView.loadPortletWindows(" + locatorId + ")", Severity.Info)); // TODO
-
PortletWindow portletWindow = new PortletWindow(locatorId, this, storedPortlet);
portletWindow.setTitle(storedPortlet.getName());
portletWindow.setHeight(storedPortlet.getHeight());
@@ -400,8 +362,6 @@ public class DashboardView extends LocatableVLayout {
portalLayout.addPortletWindow(portletWindow, i);
}
}
-
- CoreGUI.getMessageCenter().notify(new Message("------->> DashboardView.loadPortletWindows(2)", Severity.Info)); // TODO
}
/**
@@ -503,7 +463,31 @@ public class DashboardView extends LocatableVLayout {
save((AsyncCallback<Dashboard>) null);
}
+ public String[] updatePortalColumnWidths() {
+ int numColumns = storedDashboard.getColumns();
+ int totalPixelWidth = 0;
+ int[] columnPixelWidths = new int[numColumns];
+ for (int i = 0; i < numColumns; ++i) {
+ PortalColumn col = portalLayout.getPortalColumn(i);
+ totalPixelWidth += col.getWidth();
+ columnPixelWidths[i] = col.getWidth();
+ }
+ String[] columnWidths = new String[numColumns];
+ columnWidths[numColumns - 1] = "*";
+ for (int i = 0; i < numColumns - 1; ++i) {
+ columnWidths[i] = String.valueOf(((int) columnPixelWidths[i] * 100 / totalPixelWidth)) + "%";
+ }
+
+ storedDashboard.setColumnWidths(columnWidths);
+
+ return columnWidths;
+ }
+
public void save(final AsyncCallback<Dashboard> callback) {
+ // a variety of edits (dragResize, add/remove column, etc) can cause column width changes. Update them
+ // prior to every save.
+ updatePortalColumnWidths();
+
// since we reset storedDashboard after the async update completes, block modification of the dashboard
// during that interval.
DashboardView.this.disable();
@@ -648,7 +632,7 @@ public class DashboardView extends LocatableVLayout {
}
this.editForm.markForRedraw();
this.portalLayout.show();
- this.portalLayout.markForRedraw(); // TODO
+ this.portalLayout.markForRedraw();
}
public class UpdatePortletRefreshCallback implements AsyncCallback<Subject> {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java
index 1eedc08..fcc65b4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.VStack;
@@ -31,14 +32,21 @@ public class PortalColumn extends VStack {
public PortalColumn() {
// leave some space between portlets
- setMembersMargin(6);
- this.setBorder("1px solid #999999");
+ setMembersMargin(4);
+
+ // Provide a visible border for framing of columns (especially when empty) and add padding to make
+ // the border easier to see for dragging
+ setBorder("2px solid #999999");
+
+ // Allow column specific vertical scrolling to see off-screen portlets. Takes up real estate but allows
+ // a user to see specific portlets in each column at the same time.
+ setOverflow(Overflow.AUTO);
// enable predefined component animation
setAnimateMembers(true);
setAnimateMemberTime(300);
- // enable drop handling
+ // enable drop handling for moving portlet windows within or between columns
setCanAcceptDrop(true);
// change appearance of drag placeholder and drop indicator
@@ -53,6 +61,19 @@ public class PortalColumn extends VStack {
Canvas placeHolderProperties = new Canvas();
placeHolderProperties.setBorder("2px solid #4A5D75");
setPlaceHolderProperties(placeHolderProperties);
+
+ // Allow column resizing (width only)
+ setCanDragResize(true);
+
+ // Use Left side drag resize because right side seems to conflict with vertical scroll bars.
+ setResizeFrom("L");
+
+ // Do not use the resize bar. It looks good but does not behave as well as the border dragging, and does
+ // not seem to play as well with the resize handlers. Maybe in the future...
+ // setShowResizeBar(true);
+
+ // True is the default, just capturing this call here for any future tweaking
+ // setRedrawOnResize(true);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
index 9a8b0dd..34775a2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
@@ -27,13 +27,15 @@ import java.util.Arrays;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.util.EventHandler;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.DragResizeStartEvent;
+import com.smartgwt.client.widgets.events.DragResizeStartHandler;
import com.smartgwt.client.widgets.events.DropEvent;
import com.smartgwt.client.widgets.events.DropHandler;
+import com.smartgwt.client.widgets.events.ResizedEvent;
+import com.smartgwt.client.widgets.events.ResizedHandler;
import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.dashboard.DashboardPortlet;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
@@ -44,6 +46,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
public class PortalLayout extends LocatableHLayout {
private DashboardView dashboardView;
+ private Integer dragResizeColumnCount;
/**
* @param locatorId
@@ -55,19 +58,24 @@ public class PortalLayout extends LocatableHLayout {
public PortalLayout(String locatorId, DashboardView dashboardView, int numColumns, String[] columnWidths) {
super(locatorId);
- CoreGUI.getMessageCenter().notify(
- new Message("------->> PortalLayout(numColumns=" + numColumns + ",columnWidths="
- + Arrays.toString(columnWidths) + ")")); // TODO
+ if (numColumns < 1) {
+ throw new IllegalArgumentException("Invalid number of columns [" + numColumns + "]");
+ }
+ if ((null != columnWidths && columnWidths.length > numColumns)) {
+ throw new IllegalArgumentException("Invalid column widths (more widths than columns) "
+ + Arrays.toString(columnWidths));
+ }
this.dashboardView = dashboardView;
- setMargin(5);
- setMembersMargin(6);
+ setMargin(4);
+ setMembersMargin(4);
+
for (int i = 0; i < numColumns; i++) {
final PortalColumn column = new PortalColumn();
if (null != columnWidths && i < columnWidths.length) {
column.setWidth(columnWidths[i]);
- } else if (i == 0) {
- column.setWidth("30%");
+ } else {
+ column.setWidth("*");
}
final int columnNumber = i;
@@ -129,7 +137,47 @@ public class PortalLayout extends LocatableHLayout {
}
});
- CoreGUI.getMessageCenter().notify(new Message("------->> PortalLayout() adding column " + i)); // TODO
+ column.addDragResizeStartHandler(new DragResizeStartHandler() {
+
+ @Override
+ public void onDragResizeStart(DragResizeStartEvent event) {
+
+ // When a drag resize starts activate a counter keeping track of the number of columns that
+ // have been resized. A resize of one column will force a resize of all columns. After the
+ // last column resize completes, persist the new column widths to the database.
+ dragResizeColumnCount = 0;
+ }
+ });
+
+ // This handler is called when the resizing is complete (the DragResizeStopHandler is called
+ // immediately on stop but before all resizing is complete.)
+ column.addResizedHandler(new ResizedHandler() {
+
+ @Override
+ public void onResized(ResizedEvent event) {
+
+ // ignore resizing not related to drag resize (presumable initial draw)
+ if (null == dragResizeColumnCount) {
+ return;
+ }
+
+ ++dragResizeColumnCount;
+ Canvas[] members = getMembers();
+
+ // ignore resizing prior to all columns being resized as a result of the drag operation
+ if (dragResizeColumnCount != members.length) {
+ return;
+ }
+
+ // one drag operation results in a save for each column, as they all get resized
+ // now that they are all resized, save the column widths (save updates these automatically)
+ save();
+
+ // reset the flag
+ dragResizeColumnCount = null;
+ }
+ });
+
addMember(column);
}
}
@@ -146,6 +194,10 @@ public class PortalLayout extends LocatableHLayout {
return portalColumn;
}
+ public void save() {
+ this.dashboardView.save();
+ }
+
public void save(AsyncCallback<Dashboard> callback) {
this.dashboardView.save(callback);
}
@@ -163,7 +215,6 @@ public class PortalLayout extends LocatableHLayout {
PortletWindow portlet = (PortletWindow) p;
portlet.setWidth(column.getWidth());
-
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
index 0f76e5b..2eac777 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
@@ -91,6 +91,7 @@ public class PortletWindow extends LocatableWindow {
};
private ClickHandler refreshHandler = new ClickHandler() {
+ @SuppressWarnings("unchecked")
public void onClick(ClickEvent clickEvent) {
if (PortletWindow.this.view instanceof Table) {
((Table) PortletWindow.this.view).refresh();
@@ -137,7 +138,7 @@ public class PortletWindow extends LocatableWindow {
setCanDrop(true);
setCanDragResize(true);
- // setResizeFrom("B");
+ setResizeFrom("T", "B");
setShowShadow(false);
@@ -166,7 +167,6 @@ public class PortletWindow extends LocatableWindow {
setSettingsClickHandler(settingsHandler);
setHelpClickHandler(helpHandler);
-
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index df8c9f4..38b4194 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -48,8 +48,6 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -89,17 +87,12 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
@Override
protected void onInit() {
if (!isInitialized()) {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.oninit()", Severity.Info)); // TODO
-
super.onInit();
// first async call to get global permissions
new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
public void onPermissionsLoaded(Set<Permission> permissions) {
- CoreGUI.getMessageCenter().notify(
- new Message("------->> ActivityView.oninit( gotGlobalPerms )", Severity.Info)); // TODO
-
globalPermissions = permissions;
// now make async call to look for customized dash for this user and entity
@@ -112,9 +105,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
}
public void onSuccess(final PageList<Dashboard> result) {
- CoreGUI.getMessageCenter().notify(
- new Message("------->> ActivityView.oninit( gotCriteriaResult )", Severity.Info)); // TODO
-
Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
setDashboard(dashboard);
@@ -131,65 +121,7 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
}
}
- @Override
- public void draw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.draw()", Severity.Info)); // TODO
- super.draw();
- }
-
- @Override
- public void redraw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.redraw()", Severity.Info)); // TODO
- super.redraw();
- }
-
- @Override
- protected void onDraw() {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.onDraw()", Severity.Info)); // TODO
- super.onDraw();
-
- /*
- * If we really had something to do here we'd want to wait until the async initialization was really over.
- *
- new Timer() {
- final long startTime = System.currentTimeMillis();
-
- public void run() {
- if (isInitialized) {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.onDraw( 1 )", Severity.Info)); // TODO
-
- ActivityView.super.onDraw();
- if (!dashboardView.isDrawn()) {
- dashboardView.draw();
- }
- if (!dashboardView.isVisible()) {
- dashboardView.show();
- }
- markForRedraw();
- dashboardView.markForRedraw();
-
- } else {
- long elapsedMillis = System.currentTimeMillis() - startTime;
- if (elapsedMillis < 10000) {
- CoreGUI.getMessageCenter().notify(
- new Message("------->> ActivityView.onDraw( 2 )", Severity.Info)); // TODO
- schedule(100); // Reschedule the timer.
- } else {
- // give up and just do the draw()
- CoreGUI.getMessageCenter().notify(
- new Message("------->> ActivityView.onDraw( 3 )", Severity.Info)); // TODO
- ActivityView.super.onDraw();
-
- }
- }
- }
- }.run(); // fire the timer immediately
- */
- }
-
private void setDashboard(Dashboard dashboard) {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.setDashboard()", Severity.Info)); // TODO
-
Canvas[] members = getMembers();
removeMembers(members);
@@ -237,23 +169,19 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
}
protected Dashboard getDefaultDashboard() {
- CoreGUI.getMessageCenter().notify(new Message("------->> ActivityView.getDefaultDashboard", Severity.Info)); // TODO
-
Subject sessionSubject = UserSessionManager.getSessionSubject();
ResourceGroup group = groupComposite.getResourceGroup();
Dashboard dashboard = new Dashboard();
- //dashboard.getConfiguration().setProperties(new ArrayList<Property>()); // replace the LinkedHashMap...
-
dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + group.getId());
dashboard.setCategory(DashboardCategory.GROUP);
dashboard.setGroup(group);
dashboard.setColumns(2);
// TODO, add real portlets
- // set leftmost column and letthe rest be equally divided
- dashboard.setColumnWidths("40%", "*");
+ // set leftmost column and let the rest be equally divided
+ dashboard.setColumnWidths("40%");
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
// Left Column
13 years, 3 months