[rhq] modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 187c15f60aca609f18587382665d060de15a8492
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Aug 6 03:01:09 2010 -0400
opps, I swapped agent and server addresses by mistake.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java
index 2cc16b6..dd017ab 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java
@@ -132,8 +132,8 @@ public class SSHInstallUtility {
public AgentInstallInfo installAgent(String parentPath) {
String serverAddress = LookupUtil.getServerManager().getServer().getAddress();
- AgentInstallInfo info = new AgentInstallInfo(parentPath, accessInfo.getUser(), agentVersion, accessInfo
- .getHost(), serverAddress);
+ AgentInstallInfo info = new AgentInstallInfo(parentPath, accessInfo.getUser(), agentVersion, serverAddress,
+ accessInfo.getHost());
executeCommand("uname -a", "Machine uname", info);
executeCommand("java -version", "Java Version Check", info);
13 years, 10 months
[rhq] modules/core modules/enterprise
by mazz
modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallInfo.java | 26
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java | 366 +++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RemoteInstallGWTServiceImpl.java | 57 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java | 12
4 files changed, 326 insertions(+), 135 deletions(-)
New commits:
commit ea0888854eff323615fe3b9c81efacce49b9c8f9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Aug 6 00:53:03 2010 -0400
finish up the remote agent install UI. error messages aren't ideal and can use improvement
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallInfo.java b/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallInfo.java
index 055b5f4..5326eaa 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallInfo.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/install/remote/AgentInstallInfo.java
@@ -49,18 +49,14 @@ public class AgentInstallInfo implements Serializable {
public static final int DEFAULT_AGENT_PORT = 16163;
public AgentInstallInfo() {
- this(null, null);
}
- public AgentInstallInfo(String serverAddress, String agentAddress) {
- this.serverAddress = serverAddress;
- this.agentAddress = agentAddress;
- }
-
- public AgentInstallInfo(String path, String owner, String version) {
+ public AgentInstallInfo(String path, String owner, String version, String serverAddress, String agentAddress) {
this.path = path;
this.owner = owner;
this.version = version;
+ this.serverAddress = serverAddress;
+ this.agentAddress = agentAddress;
}
public String getPath() {
@@ -87,6 +83,22 @@ public class AgentInstallInfo implements Serializable {
this.version = version;
}
+ public String getServerAddress() {
+ return serverAddress;
+ }
+
+ public void setServerAddress(String serverAddress) {
+ this.serverAddress = serverAddress;
+ }
+
+ public String getAgentAddress() {
+ return agentAddress;
+ }
+
+ public void setAgentAddress(String agentAddress) {
+ this.agentAddress = agentAddress;
+ }
+
public void addStep(AgentInstallStep step) {
steps.add(step);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
index 621771f..926fa49 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
@@ -25,11 +25,11 @@ package org.rhq.enterprise.gui.coregui.client.admin.agent.install;
import java.util.ArrayList;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Autofit;
import com.smartgwt.client.types.ExpansionMode;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.HeaderItem;
import com.smartgwt.client.widgets.form.fields.PasswordItem;
import com.smartgwt.client.widgets.form.fields.SpacerItem;
@@ -59,11 +59,17 @@ public class RemoteAgentInstallView extends VLayout {
private RemoteInstallGWTServiceAsync remoteInstallService = GWTServiceLookup.getRemoteInstallService();
- private DynamicForm form;
+ private DynamicForm connectionForm;
+ private DynamicForm buttonsForm;
+ private ButtonItem installButton;
+ private ButtonItem startButton;
+ private ButtonItem stopButton;
private VLayout agentInfoLayout;
public RemoteAgentInstallView() {
- setMembersMargin(10);
+ setMembersMargin(1);
+ setWidth100();
+ setHeight100();
}
@Override
@@ -71,152 +77,275 @@ public class RemoteAgentInstallView extends VLayout {
super.onInit();
addMember(getConnectionForm());
+ addMember(getButtons());
agentInfoLayout = new VLayout();
agentInfoLayout.setWidth100();
+ agentInfoLayout.setHeight100();
+ agentInfoLayout.setMembersMargin(1);
addMember(agentInfoLayout);
}
- DynamicForm getConnectionForm() {
-
- form = new DynamicForm();
- form.setWidth100();
+ private DynamicForm getConnectionForm() {
+ connectionForm = new DynamicForm();
+ connectionForm.setWidth100();
+ connectionForm.setNumCols(3);
+ connectionForm.setWrapItemTitles(false);
+ connectionForm.setColWidths("25%", "50%", "25%");
+ connectionForm.setMargin(20);
HeaderItem connectionHeader = new HeaderItem();
connectionHeader.setValue("Connection Information");
TextItem host = new TextItem("host", "Hostname");
host.setRequired(true);
+ host.setWidth("100%");
+ host.setPrompt("The host where the agent is or will be installed");
+ host.setColSpan(2);
+
+ TextItem port = new TextItem("port", "Port");
+ port.setRequired(false);
+ port.setWidth("90");
+ port.setPrompt("The port the SSH server is listening to. If not specified, the default is 22");
+ port.setColSpan(1);
TextItem username = new TextItem("username", "Username");
username.setRequired(true);
+ username.setWidth("100%");
+ username.setPrompt("The name of the user whose credentials are passed to the host via SSH");
+ username.setColSpan(2);
PasswordItem password = new PasswordItem("password", "Password");
- // password.setRequired(true);
+ password.setRequired(false);
+ password.setWidth("100%");
+ password.setPrompt("The credentials that are used to authenticate the user on the host via SSH");
+ password.setColSpan(2);
TextItem agentInstallPath = new TextItem("agentInstallPath", "Agent Install Path");
agentInstallPath.setRequired(true);
+ agentInstallPath.setWidth("100%");
+ agentInstallPath
+ .setPrompt("Where the agent is or will be installed. If you aren't sure where an agent is installed, enter a parent directory and click the 'Find Agent' button to scan that directory and below. If you enter an empty path, common locations are searched on the host for an agent install.");
+ agentInstallPath.setStartRow(true);
+ agentInstallPath.setEndRow(false);
+
+ ButtonItem findAgentInstallPathButton = new ButtonItem("findAgentInstallPathButton", "Find Agent");
+ findAgentInstallPathButton.setStartRow(false);
+ findAgentInstallPathButton.setEndRow(true);
+ findAgentInstallPathButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ if (connectionForm.validate()) {
+ findAgentInstallPath();
+ }
+ }
+ });
- ButtonItem statusCheck = new ButtonItem("updateStatus", "Update Status");
-
- final StaticTextItem agentStatus = new StaticTextItem("agentStatus", "Agent Status");
+ StaticTextItem agentStatus = new StaticTextItem("agentStatus", "Agent Status");
+ agentStatus.setDefaultValue("-Click Update Status Button-");
agentStatus.setRedrawOnChange(true);
-
- statusCheck.addClickHandler(new ClickHandler() {
+ agentStatus.setRedrawOnChange(true);
+ agentStatus.setWidth("100%");
+ agentStatus.setStartRow(true);
+ agentStatus.setEndRow(false);
+
+ ButtonItem statusCheckButton = new ButtonItem("updateStatus", "Update Status");
+ statusCheckButton.setStartRow(false);
+ statusCheckButton.setEndRow(true);
+ statusCheckButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- if (form.validate()) {
+ if (connectionForm.validate()) {
agentStatusCheck();
}
}
});
- ButtonItem startButton = new ButtonItem("start", "Start Agent");
+ connectionForm.setFields(connectionHeader, host, port, username, password, agentInstallPath,
+ findAgentInstallPathButton, agentStatus, statusCheckButton);
+
+ return connectionForm;
+ }
+
+ private DynamicForm getButtons() {
+ buttonsForm = new DynamicForm();
+ buttonsForm.setWidth("75%");
+ buttonsForm.setNumCols(4);
+ buttonsForm.setMargin(20);
+ buttonsForm.setColWidths("10%", "30%", "30%", "30%");
+
+ HeaderItem buttonsHeader = new HeaderItem();
+ buttonsHeader.setValue("Operations");
+
+ SpacerItem spacerItem = new SpacerItem();
+ spacerItem.setStartRow(true);
+ spacerItem.setEndRow(false);
+
+ installButton = new ButtonItem("install", "Install Agent");
+ installButton.setStartRow(false);
+ installButton.setEndRow(false);
+ installButton.setRedrawOnChange(true);
+ installButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ if (connectionForm.validate()) {
+ installAgent();
+ }
+ }
+ });
+
+ startButton = new ButtonItem("start", "Start Agent");
+ startButton.setStartRow(false);
startButton.setEndRow(false);
- // startButton.setShowIfCondition(new FormItemIfFunction() {
- // public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- // return form.getValue("agentStatus") != null && !"Agent Not Installed".equals(form.getValue("agentStatus"));
- // }
- // });
+ // startButton.setShowIfCondition(new FormItemIfFunction() {
+ // public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ // return form.getValue("agentStatus") != null && !"Agent Not Installed".equals(form.getValue("agentStatus"));
+ // }
+ // });
startButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- remoteInstallService.startAgent(getRemoteAccessInfo(), getAgentInstallPath(),
- new AsyncCallback<String>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to start agent", caught);
- }
-
- public void onSuccess(String result) {
- CoreGUI.getMessageCenter().notify(
- new Message("Agent successfully started.", Message.Severity.Info));
- agentStatusCheck();
- }
- });
+ if (connectionForm.validate()) {
+ startAgent();
+ }
}
});
- ButtonItem stopButton = new ButtonItem("stop", "Stop Agent");
+ stopButton = new ButtonItem("stop", "Stop Agent");
stopButton.setStartRow(false);
- // stopButton.setShowIfCondition(new FormItemIfFunction() {
- // public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- // return form.getValue("agentStatus") != null && !"Agent Not Installed".equals(form.getValue("agentStatus"));
- // }
- // });
+ stopButton.setEndRow(true);
stopButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- remoteInstallService.stopAgent(getRemoteAccessInfo(), getAgentInstallPath(),
- new AsyncCallback<String>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to stop agent", caught);
- }
-
- public void onSuccess(String result) {
- CoreGUI.getMessageCenter().notify(
- new Message("Agent successfully stopped.", Message.Severity.Info));
- agentStatusCheck();
- }
- });
+ if (connectionForm.validate()) {
+ stopAgent();
+ }
}
});
- ButtonItem installButton = new ButtonItem("install", "Install Agent");
- installButton.setRedrawOnChange(true);
- // installButton.setShowIfCondition(new FormItemIfFunction() {
- // public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- // return form.getValue("agentStatus") != null && "Agent Not Installed".equals(form.getValue("agentStatus"));
- // }
- // });
+ buttonsForm.setFields(buttonsHeader, spacerItem, installButton, startButton, stopButton);
+ return buttonsForm;
+ }
- installButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- remoteInstallService.installAgent(getRemoteAccessInfo(), getAgentInstallPath(),
- new AsyncCallback<AgentInstallInfo>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to install agent", caught);
- }
-
- public void onSuccess(AgentInstallInfo result) {
- CoreGUI.getMessageCenter().notify(
- new Message("Agent successfully installed.", Message.Severity.Info));
-
- for (Canvas child : agentInfoLayout.getChildren()) {
- child.destroy();
- }
- agentInfoLayout.addMember(buildInstallInfoCanvas(result));
- agentInfoLayout.markForRedraw();
- agentStatusCheck();
- }
- });
- }
- });
+ private void findAgentInstallPath() {
+ disableButtons(true);
- form.setFields(connectionHeader, host, username, password, agentInstallPath, statusCheck, agentStatus,
- new SpacerItem(), startButton, stopButton, new SpacerItem(), installButton, new SpacerItem());
+ final String parentPath = getAgentInstallPath();
- return form;
+ remoteInstallService.findAgentInstallPath(getRemoteAccessInfo(), parentPath, new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ disableButtons(false);
+ CoreGUI.getErrorHandler().handleError("Error occurred while trying to find agent install path", caught);
+ }
+
+ public void onSuccess(String result) {
+ disableButtons(false);
+ if (result != null) {
+ connectionForm.setValue("agentInstallPath", result);
+ } else {
+ String err;
+ if (parentPath == null || parentPath.length() == 0) {
+ err = "Could not find an agent installed when looking in common locations";
+ } else {
+ err = "Could not find an agent installed at or under [" + parentPath + "]";
+ }
+ CoreGUI.getErrorHandler().handleError(err);
+ }
+ agentStatusCheck();
+ }
+ });
}
private void agentStatusCheck() {
+ disableButtons(true);
remoteInstallService.agentStatus(getRemoteAccessInfo(), getAgentInstallPath(), new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
- form.setValue("agentStatus", caught.getMessage());
+ disableButtons(false);
+ connectionForm.setValue("agentStatus", caught.getMessage());
+ }
+
+ public void onSuccess(String result) {
+ disableButtons(false);
+ connectionForm.setValue("agentStatus", result);
+ }
+ });
+ }
+
+ private void installAgent() {
+ disableButtons(true);
+
+ // FOR TESTING WITHOUT DOING A REAL INSTALL - START
+ // AgentInstallInfo result = new AgentInstallInfo("mypath", "myown", "1.1", "localHOST", "serverHOST");
+ // for (int i = 1; i < 20; i++)
+ // result.addStep(new AgentInstallStep("cmd" + i, "desc" + i, i, "result" + i, i * 10));
+ // for (Canvas child : agentInfoLayout.getChildren())
+ // child.destroy();
+ // buildInstallInfoCanvas(agentInfoLayout, result);
+ // agentInfoLayout.markForRedraw();
+ // disableButtons(false);
+ // if (true)
+ // return;
+ // FOR TESTING WITHOUT DOING A REAL INSTALL - END
+
+ remoteInstallService.installAgent(getRemoteAccessInfo(), getAgentInstallPath(),
+ new AsyncCallback<AgentInstallInfo>() {
+ public void onFailure(Throwable caught) {
+ disableButtons(false);
+ CoreGUI.getErrorHandler().handleError("Failed to install agent", caught);
+ }
+
+ public void onSuccess(AgentInstallInfo result) {
+ disableButtons(false);
+ CoreGUI.getMessageCenter().notify(
+ new Message("Agent installation completed", Message.Severity.Info));
+
+ for (Canvas child : agentInfoLayout.getChildren()) {
+ child.destroy();
+ }
+ buildInstallInfoCanvas(agentInfoLayout, result);
+ agentInfoLayout.markForRedraw();
+ agentStatusCheck();
+ }
+ });
+ }
+
+ private void startAgent() {
+ disableButtons(true);
+ remoteInstallService.startAgent(getRemoteAccessInfo(), getAgentInstallPath(), new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ disableButtons(false);
+ CoreGUI.getErrorHandler().handleError("Failed to start agent", caught);
}
public void onSuccess(String result) {
- form.setValue("agentStatus", result);
+ disableButtons(false);
+ CoreGUI.getMessageCenter().notify(new Message("Agent start results: " + result, Message.Severity.Info));
+ agentStatusCheck();
}
});
}
- private Canvas buildInstallInfoCanvas(AgentInstallInfo info) {
+ private void stopAgent() {
+ disableButtons(true);
+ remoteInstallService.stopAgent(getRemoteAccessInfo(), getAgentInstallPath(), new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ disableButtons(false);
+ CoreGUI.getErrorHandler().handleError("Failed to stop agent", caught);
+ }
- VLayout installInfo = new VLayout();
- installInfo.setWidth100();
+ public void onSuccess(String result) {
+ disableButtons(false);
+ CoreGUI.getMessageCenter().notify(new Message("Agent stop results: " + result, Message.Severity.Info));
+ agentStatusCheck();
+ }
+ });
+ }
+ private void buildInstallInfoCanvas(VLayout installInfo, AgentInstallInfo info) {
DynamicForm infoForm = new DynamicForm();
+ infoForm.setMargin(20);
infoForm.setWidth100();
+ infoForm.setHeight100();
+
HeaderItem infoHeader = new HeaderItem();
infoHeader.setValue("Agent Installation Information");
+
StaticTextItem version = new StaticTextItem("version", "Version");
version.setValue(info.getVersion());
@@ -229,9 +358,13 @@ public class RemoteAgentInstallView extends VLayout {
StaticTextItem config = new StaticTextItem("config", "Configuration");
config.setValue(info.getConfigurationStartString());
- infoForm.setFields(infoHeader, version, path, owner, config);
+ CanvasItem listCanvas = new CanvasItem();
+ listCanvas.setShowTitle(false);
+ listCanvas.setColSpan(2);
- installInfo.addMember(infoForm);
+ VLayout listLayout = new VLayout(0);
+ listLayout.setWidth100();
+ listLayout.setHeight100();
ListGrid listGrid = new ListGrid() {
@Override
@@ -241,29 +374,25 @@ public class RemoteAgentInstallView extends VLayout {
return canvas;
}
};
- listGrid.setWidth(800);
- listGrid.setHeight(500);
+ listGrid.setWidth100();
+ listGrid.setHeight100();
listGrid.setCanExpandRecords(true);
listGrid.setExpansionMode(ExpansionMode.DETAIL_FIELD);
listGrid.setDetailField("result");
-
- listGrid.setAutoFitData(Autofit.VERTICAL);
ListGridField step = new ListGridField("description", "Step");
+ ListGridField result = new ListGridField("result", "Result");
ListGridField resultCode = new ListGridField("resultCode", "Result Code", 90);
ListGridField duration = new ListGridField("duration", "Duration", 90);
-
- listGrid.setFields(step, resultCode, duration);
-
+ listGrid.setFields(step, result, resultCode, duration);
listGrid.setData(getStepRecords(info));
- installInfo.addMember(listGrid);
-
- for (ListGridRecord rec : listGrid.getRecords()) {
- listGrid.expandRecord(rec);
- }
+ listLayout.addMember(listGrid);
+ listCanvas.setCanvas(listLayout);
- return installInfo;
+ infoForm.setFields(infoHeader, version, path, owner, config, listCanvas);
+ installInfo.addMember(infoForm);
+ return;
}
private ListGridRecord[] getStepRecords(AgentInstallInfo info) {
@@ -272,7 +401,11 @@ public class RemoteAgentInstallView extends VLayout {
for (AgentInstallStep step : info.getSteps()) {
ListGridRecord rec = new ListGridRecord();
rec.setAttribute("description", step.getDescription());
- rec.setAttribute("result", step.getResult());
+ String result = step.getResult();
+ if (result == null || result.trim().length() == 0) {
+ result = "Result code=" + step.getResultCode();
+ }
+ rec.setAttribute("result", result);
rec.setAttribute("resultCode", "" + step.getResultCode());
rec.setAttribute("duration", MeasurementConverterClient.format((double) step.getDuration(),
MeasurementUnits.MILLISECONDS, true));
@@ -282,15 +415,32 @@ public class RemoteAgentInstallView extends VLayout {
return steps.toArray(new ListGridRecord[steps.size()]);
}
+ private void disableButtons(boolean disabled) {
+ installButton.setDisabled(disabled);
+ startButton.setDisabled(disabled);
+ stopButton.setDisabled(disabled);
+ buttonsForm.setDisabled(disabled);
+ }
+
private RemoteAccessInfo getRemoteAccessInfo() {
- String host = form.getValueAsString("host");
- String username = form.getValueAsString("username");
- String password = form.getValueAsString("password");
- RemoteAccessInfo info = new RemoteAccessInfo(host, username, password);
+ String host = connectionForm.getValueAsString("host");
+ String port = connectionForm.getValueAsString("port");
+ String username = connectionForm.getValueAsString("username");
+ String password = connectionForm.getValueAsString("password");
+
+ int portInt;
+ try {
+ portInt = Integer.parseInt(port);
+ } catch (NumberFormatException e) {
+ portInt = 22;
+ }
+ connectionForm.setValue("port", portInt);
+
+ RemoteAccessInfo info = new RemoteAccessInfo(host, portInt, username, password);
return info;
}
private String getAgentInstallPath() {
- return form.getValueAsString("agentInstallPath");
+ return connectionForm.getValueAsString("agentInstallPath");
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RemoteInstallGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RemoteInstallGWTServiceImpl.java
index 321cf77..f29598f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RemoteInstallGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RemoteInstallGWTServiceImpl.java
@@ -24,6 +24,7 @@ package org.rhq.enterprise.gui.coregui.server.gwt;
import org.rhq.core.domain.install.remote.AgentInstallInfo;
import org.rhq.core.domain.install.remote.RemoteAccessInfo;
+import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.RemoteInstallGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.install.remote.RemoteInstallManagerLocal;
@@ -38,37 +39,65 @@ public class RemoteInstallGWTServiceImpl extends AbstractGWTServiceImpl implemen
private RemoteInstallManagerLocal remoteInstallManager = LookupUtil.getRemoteInstallManager();
public boolean agentInstallCheck(RemoteAccessInfo remoteAccessInfo, String agentInstallPath) {
- return SerialUtility.prepare(remoteInstallManager.agentInstallCheck(getSessionSubject(), remoteAccessInfo,
- agentInstallPath), "RemoteInstallService.agentInstallCheck");
+ try {
+ return SerialUtility.prepare(remoteInstallManager.agentInstallCheck(getSessionSubject(), remoteAccessInfo,
+ agentInstallPath), "RemoteInstallService.agentInstallCheck");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
public AgentInstallInfo installAgent(RemoteAccessInfo remoteAccessInfo, String parentPath) {
- return SerialUtility.prepare(remoteInstallManager.installAgent(getSessionSubject(), remoteAccessInfo,
- parentPath), "RemoteInstallService.installAgent");
+ try {
+ return SerialUtility.prepare(remoteInstallManager.installAgent(getSessionSubject(), remoteAccessInfo,
+ parentPath), "RemoteInstallService.installAgent");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
public String startAgent(RemoteAccessInfo remoteAccessInfo, String agentInstallPath) {
- return SerialUtility.prepare(remoteInstallManager.startAgent(getSessionSubject(), remoteAccessInfo,
- agentInstallPath), "RemoteInstallService.startAgent");
+ try {
+ return SerialUtility.prepare(remoteInstallManager.startAgent(getSessionSubject(), remoteAccessInfo,
+ agentInstallPath), "RemoteInstallService.startAgent");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
public String stopAgent(RemoteAccessInfo remoteAccessInfo, String agentInstallPath) {
- return SerialUtility.prepare(remoteInstallManager.stopAgent(getSessionSubject(), remoteAccessInfo,
- agentInstallPath), "RemoteInstallService.stopAgent");
+ try {
+ return SerialUtility.prepare(remoteInstallManager.stopAgent(getSessionSubject(), remoteAccessInfo,
+ agentInstallPath), "RemoteInstallService.stopAgent");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
public String agentStatus(RemoteAccessInfo remoteAccessInfo, String agentInstallPath) {
- return SerialUtility.prepare(remoteInstallManager.agentStatus(getSessionSubject(), remoteAccessInfo,
- agentInstallPath), "RemoteInstallService.agentStatus");
+ try {
+ return SerialUtility.prepare(remoteInstallManager.agentStatus(getSessionSubject(), remoteAccessInfo,
+ agentInstallPath), "RemoteInstallService.agentStatus");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
public String findAgentInstallPath(RemoteAccessInfo remoteAccessInfo, String parentPath) {
- return SerialUtility.prepare((remoteInstallManager.findAgentInstallPath(getSessionSubject(), remoteAccessInfo,
- parentPath)), "RemoteInstallService.findAgentInstallPath");
+ try {
+ return SerialUtility.prepare((remoteInstallManager.findAgentInstallPath(getSessionSubject(),
+ remoteAccessInfo, parentPath)), "RemoteInstallService.findAgentInstallPath");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
public String[] remotePathDiscover(RemoteAccessInfo remoteAccessInfo, String parentPath) {
- return SerialUtility.prepare((remoteInstallManager.remotePathDiscover(getSessionSubject(), remoteAccessInfo,
- parentPath)), "RemoteInstallService.remotePathDiscover");
+ try {
+ return SerialUtility.prepare((remoteInstallManager.remotePathDiscover(getSessionSubject(),
+ remoteAccessInfo, parentPath)), "RemoteInstallService.remotePathDiscover");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java
index c81b478..2cc16b6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/install/remote/SSHInstallUtility.java
@@ -131,7 +131,9 @@ public class SSHInstallUtility {
public AgentInstallInfo installAgent(String parentPath) {
- AgentInstallInfo info = new AgentInstallInfo(parentPath, accessInfo.getUser(), agentVersion);
+ String serverAddress = LookupUtil.getServerManager().getServer().getAddress();
+ AgentInstallInfo info = new AgentInstallInfo(parentPath, accessInfo.getUser(), agentVersion, accessInfo
+ .getHost(), serverAddress);
executeCommand("uname -a", "Machine uname", info);
executeCommand("java -version", "Java Version Check", info);
@@ -151,18 +153,16 @@ public class SSHInstallUtility {
executeCommand("java -jar '" + parentPath + "/" + agentFile + "' '--install=" + parentPath + "'",
"Install Agent", info);
- String serverAddress = LookupUtil.getServerManager().getServer().getAddress();
-
log.info("Will start new agent @ [" + accessInfo.getHost() + "] pointing to server @ [" + serverAddress + "]");
String agentScript = parentPath + "/rhq-agent/bin/rhq-agent.sh"; // NOTE: NOT the wrapper script
- String properties = new AgentInstallInfo(serverAddress, accessInfo.getHost()).getConfigurationStartString();
+ String startStringArgs = info.getConfigurationStartString();
// Tell the script to store a pid file to make the wrapper script work
String envCmd1 = "RHQ_AGENT_IN_BACKGROUND='" + parentPath + "/rhq-agent/bin/rhq-agent.pid'";
String envCmd2 = "export RHQ_AGENT_IN_BACKGROUND";
- String startCommand = envCmd1 + " ; " + envCmd2 + " ; nohup '" + agentScript + "' " + properties + " &";
+ String startCommand = envCmd1 + " ; " + envCmd2 + " ; nohup '" + agentScript + "' " + startStringArgs + " &";
executeCommand(startCommand, "Start New Agent", info);
return info;
@@ -236,7 +236,7 @@ public class SSHInstallUtility {
}
private String executeCommand(String command, String description) {
- return executeCommand(command, description, new AgentInstallInfo(null, null));
+ return executeCommand(command, description, new AgentInstallInfo());
}
private String executeCommand(String command, String description, AgentInstallInfo info) {
13 years, 10 months
[rhq] modules/core modules/enterprise pom.xml
by Jay Shaughnessy
modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseTypeFactory.java | 2
modules/core/dbutils/src/main/java/org/rhq/core/db/H2v12DatabaseType.java | 42 ++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java | 62 +++++++++-
pom.xml | 2
4 files changed, 105 insertions(+), 3 deletions(-)
New commits:
commit 0ffb52081be378fcdcbbec84aea534a65969fe2d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Aug 5 15:18:07 2010 -0400
[BZ-618659] [BZ-621662] Work around the fact that H2 does not yet support
blob update. This amounts to special casing H2 in the PackageVersion
handling. Also, update H2 version from 1.1.117 to 1.2.139 to get relevant
bug fixes, move to H2's latest db format, and set ourselves up for moving
forward again when/if H2 adds blob update support.
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseTypeFactory.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseTypeFactory.java
index 896b396..ef66a51 100644
--- a/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseTypeFactory.java
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseTypeFactory.java
@@ -172,6 +172,8 @@ public class DatabaseTypeFactory {
} else if (db_name.indexOf("h2") != -1) {
if (db_version.startsWith("1.1")) {
database_type_class = H2v11DatabaseType.class;
+ } else if (db_version.startsWith("1.2")) {
+ database_type_class = H2v12DatabaseType.class;
}
} else if (db_name.indexOf("sql server") != -1) {
if (db_version.startsWith("09.00") || db_version.startsWith("9.00")) { // SQL Server 2005
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/H2v12DatabaseType.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/H2v12DatabaseType.java
new file mode 100644
index 0000000..42d164b
--- /dev/null
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/H2v12DatabaseType.java
@@ -0,0 +1,42 @@
+/*
+ * 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 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.db;
+
+/**
+ * H2 database version 1.2 which extends the abstract support for H2 database.
+ *
+ * @author Joseph Marques
+ */
+public class H2v12DatabaseType extends H2DatabaseType {
+ /**
+ * @see DatabaseType#getName()
+ */
+ @Override
+ public String getName() {
+ return H2DatabaseType.VENDOR_NAME + "v1.2";
+ }
+
+ /**
+ * @see DatabaseType#getVersion()
+ */
+ @Override
+ public String getVersion() {
+ return "1.2";
+ }
+}
\ No newline at end of file
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 54ccd3f..40c2886 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
@@ -59,6 +59,7 @@ import org.rhq.core.clientapi.server.content.ContentServiceResponse;
import org.rhq.core.clientapi.server.content.DeletePackagesRequest;
import org.rhq.core.clientapi.server.content.DeployPackagesRequest;
import org.rhq.core.clientapi.server.content.RetrievePackageBitsRequest;
+import org.rhq.core.db.DatabaseTypeFactory;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.configuration.Configuration;
@@ -1585,10 +1586,15 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
* @param contentDetails
* @return PackageBits ref populated.
*/
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
private PackageBits loadPackageBits(InputStream packageBitStream, int packageVersionId, String packageName,
String packageVersion, PackageBits existingBits, Map<String, String> contentDetails) {
+ // If/When H2 handles blob update/streaming blobs we can get rid of this conditional code
+ if (DatabaseTypeFactory.isH2(DatabaseTypeFactory.getDefaultDatabaseType())) {
+ return loadPackageBitsH2(packageBitStream, packageVersionId, packageName, packageVersion, existingBits,
+ contentDetails);
+ }
+
// use existing or instantiate PackageBits instance.
PackageBits bits = (null == existingBits) ? initializePackageBits(null) : existingBits;
@@ -1596,7 +1602,7 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
PackageVersion pv = entityManager.find(PackageVersion.class, packageVersionId);
//associate the two if located.
- if (pv != null) {//np check.
+ if (null != pv) {
pv.setPackageBits(bits);
entityManager.flush();
}
@@ -1607,6 +1613,58 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
return bits;
}
+ private PackageBits loadPackageBitsH2(InputStream packageBitStream, int packageVersionId, String packageName,
+ String packageVersion, PackageBits existingBits, Map<String, String> contentDetails) {
+
+ PackageBits bits = null;
+ PackageBitsBlob blob = null;
+
+ // The blob cannot be updated, so we'll need to create a whole new row.
+ if (null != existingBits) {
+ blob = entityManager.find(PackageBitsBlob.class, existingBits.getId());
+ entityManager.remove(blob);
+ entityManager.flush();
+ }
+
+ // We have to work backwards to avoid constraint violations. PackageBits requires a PackageBitsBlob,
+ // so create and persist that first, getting the ID
+ blob = new PackageBitsBlob();
+ // just set the blob now, no streaming. The assumption is that H2 (demo) will not be using large blobs
+ byte[] bytes = StreamUtil.slurp(packageBitStream);
+ blob.setBits(bytes);
+ entityManager.persist(blob);
+ entityManager.flush();
+
+ // Now create the PackageBits entity and assign the Id and blob. Note, do not persist the
+ // entity, the row already exists (due to the blob persist above). Just perform and flush the update.
+ bits = new PackageBits();
+ bits.setId(blob.getId());
+ bits.setBlob(blob);
+ entityManager.flush();
+
+ //locate related packageVersion
+ PackageVersion pv = entityManager.find(PackageVersion.class, packageVersionId);
+
+ //associate the two if packageVersion exists.
+ if (null != pv) {
+ pv.setPackageBits(bits);
+ entityManager.flush();
+ }
+
+ // update contentDetails in needed
+ if (null != contentDetails) {
+ contentDetails.put(UPLOAD_FILE_SIZE, String.valueOf(bytes.length));
+ try {
+ contentDetails.put(UPLOAD_SHA256, new MessageDigestGenerator(MessageDigestGenerator.SHA_256)
+ .calcDigestString(bytes));
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to calculate SHA256 for package bits: ", e);
+ }
+ }
+
+ return bits;
+ }
+
/**
* This creates a new PackageBits entity initialized to EMPTY_BLOB for the associated PackageBitsBlob.
* Note that PackageBits and PackageBitsBlob are two entities that *share* the same db row. This is
diff --git a/pom.xml b/pom.xml
index 2a0db1c..ed621bf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,7 +87,7 @@
<ojdbc5.version>11.2.0.1.0</ojdbc5.version>
<ems.version>1.2.14</ems.version>
<postgresql.version>8.4-701.jdbc3</postgresql.version>
- <h2.version>1.1.117</h2.version>
+ <h2.version>1.2.139</h2.version>
<jtds.version>1.2.2</jtds.version>
<richfaces.version>3.3.3.Final</richfaces.version>
<jline.version>0.9.94</jline.version>
13 years, 10 months
[rhq] 7 commits - modules/enterprise
by Greg Hinkle
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java | 18 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventDetailsView.java | 99 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java | 28 ++
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css | 10 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml | 2
7 files changed, 147 insertions(+), 22 deletions(-)
New commits:
commit cb5a73bc660ad40b8fca0b4c287b14aa89797237
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Aug 5 17:55:51 2010 -0400
default to summary tab when switch resources to a resource where the current selection is not relevant or allowed
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 798d4bc..a40f10a 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
@@ -261,6 +261,10 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
}
+ if (topTabSet.getSelectedTab().getDisabled()) {
+ topTabSet.selectTab(0);
+ }
+
}
commit b31ed6d9cb521f384da1bdb1d74245345dba8b85
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Aug 5 17:54:16 2010 -0400
Chop JSF menu from pages loaded with nomenu param (as embedded in jsf
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
index 2c4e779..d331d51 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
@@ -8,6 +8,7 @@
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:onc="http://jboss.org/on/component">
+<c:if test="${empty param.nomenu}">
<h:form>
@@ -688,5 +689,6 @@ v <rich:menuItem submitMode="none"
</a4j:form>
</a4j:region>
+</c:if>
</a4j:region>
commit 3b8e5db720d4ade81b52ba4522ce858c45825661
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 3 12:10:47 2010 -0400
Highlight improvement for tables with background graphs
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index d565834..bc48f18 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -345,3 +345,13 @@ a:hover {
padding: 5px;
border: 1px solid darkblue;
}
+
+
+/* This sets table mouse-over highlights to have an alpha component on browsers that support it.
+ It particularly helps with tables that have bar charts as a background component.
+ (e.g. problem metrics or call time)
+*/
+.tallCellOver, .tallCellOverDark {
+ background-color: rgb(230,230,230) !important; /* for browsers that don't like alpha */
+ background-color: rgba(230,230,230,0.6) !important;
+}
\ No newline at end of file
commit 546416b2bb34e9d712e19bc23fc8253daed181a5
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 2 15:46:29 2010 -0400
Event details view to see full log message text or other long event texts
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventDetailsView.java
new file mode 100644
index 0000000..13ab506
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventDetailsView.java
@@ -0,0 +1,99 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.event;
+
+import com.smartgwt.client.types.TitleOrientation;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.TextAreaItem;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+/**
+ * @author Greg Hinkle
+ */
+public class EventDetailsView extends VLayout {
+
+
+ private ListGridRecord eventRecord;
+
+
+ public EventDetailsView(ListGridRecord eventRecord) {
+ this.eventRecord = eventRecord;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+
+ DynamicForm form = new DynamicForm();
+ form.setWidth100();
+ form.setHeight100();
+
+ StaticTextItem id = new StaticTextItem("id","Id");
+ id.setValue(eventRecord.getAttribute("id"));
+
+ StaticTextItem severity = new StaticTextItem("severity","Severity");
+ severity.setValue(eventRecord.getAttribute("severity"));
+
+ StaticTextItem source = new StaticTextItem("sourceLocation","Source");
+ source.setValue(eventRecord.getAttribute("sourceLocation"));
+
+ StaticTextItem timestamp = new StaticTextItem("timestamp","Timestamp");
+ timestamp.setValue(eventRecord.getAttribute("timestamp"));
+
+ TextAreaItem detail = new TextAreaItem("detail", "Detail");
+ detail.setTitleOrientation(TitleOrientation.TOP);
+ detail.setColSpan(2);
+ detail.setWidth("100%");
+ detail.setHeight("100%");
+ detail.setValue(eventRecord.getAttribute("detail"));
+
+
+ form.setItems(id,severity,source,timestamp,detail);
+
+
+
+ addMember(form);
+
+ }
+
+ public void displayInDialog() {
+ Window window = new Window();
+ window.setTitle("Event Details");
+ window.setWidth(800);
+ window.setHeight(800);
+ window.setIsModal(true);
+ window.setShowModalMask(true);
+ window.setCanDragResize(true);
+ window.centerInPage();
+ window.addItem(this);
+ window.setDismissOnEscape(true);
+ window.setDismissOnOutsideClick(true);
+ window.show();
+ window.focus();
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java
index 492dc14..a876bfe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java
@@ -26,8 +26,11 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent;
+import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
/**
* @author Greg Hinkle
@@ -40,13 +43,6 @@ public class EventHistoryView extends Table {
setDataSource(new EventDatasource());
- }
-
-
-
- @Override
- protected void onDraw() {
- super.onDraw();
// getListGrid().getField("id").setWidth(60);
getListGrid().getField("severity").setWidth(120);
getListGrid().getField("severity").setCellFormatter(new CellFormatter() {
@@ -55,10 +51,28 @@ public class EventHistoryView extends Table {
}
});
+ getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
+ public void onCellDoubleClick(CellDoubleClickEvent cellDoubleClickEvent) {
+ // TODO: Implement this method.
+ showEventDetails(cellDoubleClickEvent.getRecord());
+ }
+ });
+
+ addTableAction("Details", SelectionEnablement.SINGLE, null,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ showEventDetails(selection[0]);
+ }
+ });
+
getListGrid().getField("sourceLocation").setWidth(200);
getListGrid().getField("timestamp").setWidth(160);
}
+ public static void showEventDetails(ListGridRecord record) {
+ new EventDetailsView(record).displayInDialog();
+ }
+
public static EventHistoryView createResourceHistoryView(int resourceId) {
Criteria criteria = new Criteria();
criteria.addCriteria("resourceId",resourceId);
commit 3cecd4c47e1e9a0dcbc4c0b040bda4b7d4f01248
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 2 15:45:30 2010 -0400
Fix resource tab history reselection (this broke on a change to smartgwt's tab selection api)
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 5e113ee..798d4bc 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
@@ -290,7 +290,7 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
TwoLevelTab tab = (TwoLevelTab) t;
if (tab.getTitle().equals(tabView.getPath())) {
- topTabSet.selectTab(tabView.getPath());
+ topTabSet.selectTab(tab); //tabView.getPath());
tab.getLayout().selectTab(subtabView.getPath());
commit 15c1dfd8527df0e88588a9dbb183f9aace21f2b0
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 2 15:44:47 2010 -0400
Point alerts quickview to the reports section
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 8a6fcc4..334a2aa 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
@@ -18,17 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client;
-import com.google.gwt.core.client.GWT;
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.widgets.Img;
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.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.toolbar.ToolStripSeparator;
@@ -112,7 +108,7 @@ public class Footer extends ToolStrip {
addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- History.newItem("Subsystems/Alerts");
+ History.newItem("Reports/Inventory/Recent Alerts");
}
});
}
commit 43722261cdf985203f6a0fda51e122b4cf8d7f0d
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Jul 29 23:51:48 2010 -0400
Fix dashboard history tab reselection
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 4444d39..a82393c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
@@ -48,7 +48,6 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.graph.GraphPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.RecentAlertsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.imported.RecentlyAddedView;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.InventorySummaryView;
@@ -139,7 +138,7 @@ public class DashboardsView extends VLayout implements BookmarkableView {
HLayout buttons = new HLayout(5);
buttons.addMember(editButton);
- buttons.addMember(newDashboardButton);
+ buttons.addMember(newDashboardButton);
tabSet.setTabBarControls(buttons);
@@ -149,7 +148,7 @@ public class DashboardsView extends VLayout implements BookmarkableView {
History.newItem("Dashboard/" + tabSelectedEvent.getTab().getTitle(), false);
selectedDashboardView = (DashboardView) tabSelectedEvent.getTab().getPane();
selectedDashboard = selectedDashboardView.getDashboard();
- selectedDashboardView.setEditMode(editMode);
+ selectedDashboardView.setEditMode(editMode);
}
});
@@ -159,7 +158,7 @@ public class DashboardsView extends VLayout implements BookmarkableView {
Tab tab = new Tab(dashboard.getName());
tab.setPane(dashboardView);
tab.setCanClose(true);
-
+
tabSet.addTab(tab);
if (dashboard.getName().equals(selectedTab)) {
@@ -193,7 +192,7 @@ public class DashboardsView extends VLayout implements BookmarkableView {
dashboard.setName("Default Dashboard");
dashboard.setColumns(2);
dashboard.setColumnWidths("32%", "68%");
- dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND,"#F1F2F3"));
+ dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
DashboardPortlet summary = new DashboardPortlet("Inventory Summary", InventorySummaryView.KEY, 230);
@@ -208,7 +207,7 @@ public class DashboardsView extends VLayout implements BookmarkableView {
DashboardPortlet welcome = new DashboardPortlet("Welcome To RHQ", MessagePortlet.KEY, 180);
- welcome.getConfiguration().put(new PropertySimple("message","<h1>Welcome to RHQ</h1>\n" +
+ welcome.getConfiguration().put(new PropertySimple("message", "<h1>Welcome to RHQ</h1>\n" +
"<p>The RHQ project is an abstraction and plug-in based systems management suite that provides " +
"extensible and integrated systems management for multiple products and platforms across a set " +
"of core features. The project is designed with layered modules that provide a flexible " +
@@ -290,12 +289,13 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
-
public void renderView(ViewPath viewPath) {
if (!viewPath.isEnd()) {
selectedTab = viewPath.getCurrent().getPath();
- if (tabSet != null) {
- tabSet.selectTab(selectedTab);
+ for (Tab tab : tabSet.getTabs()) {
+ if (selectedTab.equals(tab.getTitle())) {
+ tabSet.selectTab(tab);
+ }
}
}
}
13 years, 10 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 162744bec791b9dbcff1099cc93bee2cdabc1ebb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Aug 5 14:30:44 2010 -0400
if you ever call handleError(String), you will get an NPE - fixing it so that doesn't happen
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
index 6da2f0b..9491b8f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
@@ -38,7 +38,10 @@ public class ErrorHandler {
Message errorMessage = new Message(message, (t == null) ? null : t.toString(), Message.Severity.Error);
CoreGUI.getMessageCenter().notify(errorMessage);
- t.printStackTrace();
+ if (t != null) {
+ t.printStackTrace();
+ }
+
this.errors.add(message);
}
13 years, 10 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java | 11 +++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
New commits:
commit 273fc42aaab1f63d2cca9022ece89a98d02cf07a
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Aug 5 10:21:06 2010 -0400
ensure connections are closed after using them
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
index e69e1ff..d0a7092 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
@@ -140,12 +140,21 @@ public class StartupServlet extends HttpServlet {
private void initializeServer() {
// Ensure the class is loaded and the dbType is set for our current db
+ Connection conn = null;
try {
DataSource ds = LookupUtil.getDataSource();
- Connection conn = ds.getConnection();
+ conn = ds.getConnection();
DatabaseTypeFactory.setDefaultDatabaseType(DatabaseTypeFactory.getDatabaseType(conn));
} catch (Exception e) {
log("Could not initialize server: ", e);
+ } finally {
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (Exception e) {
+ log("Failed to close temporary connection used for server initialization: ", e);
+ }
+ }
}
// Ensure that this server is registered in the database.
13 years, 10 months