crmShowInProgress = true;
final JTextArea ta = new JTextArea(Tools.getString("HostInfo.crmShellLoading"));
ta.setEditable(false);
ta.setFont(f);
final MyButton crmConfigureCommitButton =
widgetFactory.createButton(Tools.getString("HostInfo.crmShellCommitButton"), Browser.APPLY_ICON);
registerComponentEnableAccessMode(crmConfigureCommitButton,
new AccessMode(AccessMode.ADMIN, AccessMode.NORMAL));
final MyButton hostInfoButton = widgetFactory.createButton(Tools.getString("HostInfo.crmShellStatusButton"));
application.makeMiniButton(hostInfoButton);
final MyButton crmConfigureShowButton =
widgetFactory.createButton(Tools.getString("HostInfo.crmShellShowButton"));
application.makeMiniButton(crmConfigureShowButton);
crmConfigureCommitButton.setEnabled(false);
final ExecCallback execCallback =
new ExecCallback() {
@Override
public void done(final String answer) {
ta.setText(answer);
application.invokeLater(new Runnable() {
@Override
public void run() {
crmConfigureShowButton.setEnabled(true);
hostInfoButton.setEnabled(true);
crmShowInProgress = false;
}
});
}
@Override
public void doneError(final String answer, final int errorCode) {
ta.setText(answer);
LOG.sshError(host, "", answer, "", errorCode);
application.invokeLater(new Runnable() {
@Override
public void run() {
crmConfigureCommitButton.setEnabled(false);
}
});
}
};
hostInfoButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
registerComponentEditAccessMode(ta, new AccessMode(AccessMode.GOD, AccessMode.NORMAL));
crmInfoShowing = true;
hostInfoButton.setEnabled(false);
crmConfigureCommitButton.setEnabled(false);
String command = "HostBrowser.getHostInfo";
if (!host.hasCorosyncInitScript()) {
command = "HostBrowser.getHostInfoHeartbeat";
}
host.execCommand(new ExecCommandConfig().commandString(command)
.execCallback(execCallback)
.silentCommand()
.silentOutput()
.sshCommandTimeout(Ssh.DEFAULT_COMMAND_TIMEOUT));
}
});
host.registerEnableOnConnect(hostInfoButton);
crmConfigureShowButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
registerComponentEditAccessMode(ta, new AccessMode(AccessMode.ADMIN, AccessMode.NORMAL));
updateAdvancedPanels();
crmShowInProgress = true;
crmInfoShowing = false;
crmConfigureShowButton.setEnabled(false);
crmConfigureCommitButton.setEnabled(false);
host.execCommand(new ExecCommandConfig().commandString("HostBrowser.getCrmConfigureShow")
.execCallback(execCallback)
.sshCommandTimeout(Ssh.DEFAULT_COMMAND_TIMEOUT));
}