use of org.jboss.hal.core.runtime.host.Host in project console by hal.
the class HostPatchesColumn method onHostAction.
@Override
public void onHostAction(HostActionEvent event) {
if (isVisible()) {
Host host = event.getHost();
ItemMonitor.startProgress(Ids.host(host.getAddressName()));
event.getServers().forEach(server -> ItemMonitor.startProgress(server.getId()));
}
}
use of org.jboss.hal.core.runtime.host.Host in project console by hal.
the class HostPatchesColumn method onHostResult.
@Override
public void onHostResult(HostResultEvent event) {
if (isVisible()) {
Host host = event.getHost();
ItemMonitor.stopProgress(Ids.host(host.getAddressName()));
event.getServers().forEach(server -> ItemMonitor.stopProgress(server.getId()));
refresh(RESTORE_SELECTION);
}
}
use of org.jboss.hal.core.runtime.host.Host in project console by hal.
the class PatchesColumn method checkHostState.
/**
* Checks if the host or standalone server is in restart mode, if yes then asks user to restart host/server, as it must be
* restarted before a patch can be installed or to call a rollback on an installed patch.
*/
private void checkHostState(Callback callback) {
Messages messages = resources.messages();
if (environment.isStandalone()) {
Operation operation = new Operation.Builder(ResourceAddress.root(), READ_RESOURCE_OPERATION).param(INCLUDE_RUNTIME, true).param(ATTRIBUTES_ONLY, true).build();
dispatcher.execute(operation, result -> {
Server.STANDALONE.addServerAttributes(result);
if (Server.STANDALONE.needsRestart()) {
serverActions.restartStandalone(Server.STANDALONE, messages.patchRestartStandaloneQuestion());
} else {
callback.execute();
}
});
} else {
ResourceAddress address = new ResourceAddress().add(HOST, statementContext.selectedHost());
Operation operation = new Operation.Builder(address, READ_RESOURCE_OPERATION).param(INCLUDE_RUNTIME, true).param(ATTRIBUTES_ONLY, true).build();
dispatcher.execute(operation, result -> {
Property prop = new Property(statementContext.selectedHost(), result);
Host host = new Host(prop);
if (host.needsRestart()) {
SafeHtml question = host.isDomainController() ? messages.patchRestartDomainControllerQuestion(host.getName()) : messages.patchRestartHostControllerQuestion(host.getName());
hostActions.restart(host, question);
} else {
callback.execute();
}
});
}
}
use of org.jboss.hal.core.runtime.host.Host in project console by hal.
the class TopologyPreview method buildTable.
// ------------------------------------------------------ UI methods
private HTMLElement buildTable(List<Host> hosts, List<ServerGroup> serverGroups, List<Server> servers) {
HTMLTableElement table = table().css(topology).element();
// <colgroup>
double width = 100.0 / (serverGroups.size() + 1);
HtmlContentBuilder<HTMLTableColElement> colgroup = colgroup().add(col().attr("width", width + "%"));
for (int i = 0; i < serverGroups.size(); i++) {
colgroup.add(col().attr("width", width + "%"));
}
table.appendChild(colgroup.element());
// </colgroup>
// <thead>
HtmlContentBuilder<HTMLTableSectionElement> thead = thead().add(tr().add(th().css(empty).innerHtml(new SafeHtmlBuilder().appendEscaped(Names.SERVER_GROUPS + " ").appendHtmlConstant("→").appendHtmlConstant("<br/>").appendEscaped(Names.HOSTS + " ").appendHtmlConstant("↓").toSafeHtml())).addAll(serverGroups.stream().map(this::serverGroupElement).collect(toList())));
table.appendChild(thead.element());
// </thead>
// <tbody>
HTMLElement tbody = tbody().element();
for (Host host : hosts) {
HTMLElement tr;
tbody.appendChild(tr = tr().element());
tr.appendChild(hostElement(host));
for (ServerGroup serverGroup : serverGroups) {
List<HTMLElement> matchingServers = servers.stream().filter(sc -> host.getName().equals(sc.getHost()) && serverGroup.getName().equals(sc.getServerGroup())).sorted(comparing(Server::getName)).map(this::serverElement).collect(toList());
if (matchingServers.isEmpty()) {
tr.appendChild(td().css(empty).element());
} else {
tr.appendChild(td().add(div().css(CSS.servers).addAll(matchingServers)).element());
}
}
}
table.appendChild(tbody);
return table;
}
use of org.jboss.hal.core.runtime.host.Host in project console by hal.
the class TopologyPreview method onHostAction.
@Override
public void onHostAction(HostActionEvent event) {
if (isVisible()) {
Host host = event.getHost();
disableDropdown(Ids.host(host.getAddressName()), host.getName());
startProgress(hostSelector(host));
event.getServers().forEach(server -> {
disableDropdown(server.getId(), server.getName());
startProgress(serverSelector(server));
});
}
}
Aggregations