Search in sources :

Example 6 with Host

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()));
    }
}
Also used : Host(org.jboss.hal.core.runtime.host.Host)

Example 7 with Host

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);
    }
}
Also used : Host(org.jboss.hal.core.runtime.host.Host)

Example 8 with Host

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();
            }
        });
    }
}
Also used : Messages(org.jboss.hal.resources.Messages) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Host(org.jboss.hal.core.runtime.host.Host) Operation(org.jboss.hal.dmr.Operation) Property(org.jboss.hal.dmr.Property)

Example 9 with Host

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("&rarr;").appendHtmlConstant("<br/>").appendEscaped(Names.HOSTS + " ").appendHtmlConstant("&darr;").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;
}
Also used : PreviewContent(org.jboss.hal.core.finder.PreviewContent) HostActions(org.jboss.hal.core.runtime.host.HostActions) ServerGroupActionEvent(org.jboss.hal.core.runtime.group.ServerGroupActionEvent) Constraint(org.jboss.hal.meta.security.Constraint) HostResultEvent(org.jboss.hal.core.runtime.host.HostResultEvent) TopologyTasks(org.jboss.hal.core.runtime.TopologyTasks) AuthorisationDecision(org.jboss.hal.meta.security.AuthorisationDecision) PreviewAttribute(org.jboss.hal.core.finder.PreviewAttributes.PreviewAttribute) Server(org.jboss.hal.core.runtime.server.Server) CSS.hostContainer(org.jboss.hal.resources.CSS.hostContainer) Places(org.jboss.hal.core.mvp.Places) Names(org.jboss.hal.resources.Names) HostActionEvent(org.jboss.hal.core.runtime.host.HostActionEvent) ServerActions(org.jboss.hal.core.runtime.server.ServerActions) ServerGroupResultEvent(org.jboss.hal.core.runtime.group.ServerGroupResultEvent) CSS.inactive(org.jboss.hal.resources.CSS.inactive) HTMLTableElement(elemental2.dom.HTMLTableElement) Set(java.util.Set) CSS(org.jboss.hal.resources.CSS) ServerGroup(org.jboss.hal.core.runtime.group.ServerGroup) ServerActionHandler(org.jboss.hal.core.runtime.server.ServerActionEvent.ServerActionHandler) Flow.series(org.jboss.hal.flow.Flow.series) CSS.fontAwesome(org.jboss.hal.resources.CSS.fontAwesome) CSS.spinnerLg(org.jboss.hal.resources.CSS.spinnerLg) CSS.withProgress(org.jboss.hal.resources.CSS.withProgress) Constraints(org.jboss.hal.meta.security.Constraints) Supplier(java.util.function.Supplier) FlowContext(org.jboss.hal.flow.FlowContext) Outcome(org.jboss.hal.flow.Outcome) ArrayList(java.util.ArrayList) ServerGroupResultHandler(org.jboss.hal.core.runtime.group.ServerGroupResultEvent.ServerGroupResultHandler) Strings(com.google.common.base.Strings) EventCallbackFn(org.jboss.gwt.elemento.core.EventCallbackFn) Progress(org.jboss.hal.flow.Progress) CSS.marginRight5(org.jboss.hal.resources.CSS.marginRight5) CSS.name(org.jboss.hal.resources.CSS.name) EventBus(com.google.web.bindery.event.shared.EventBus) MouseEvent(elemental2.dom.MouseEvent) ServerStatusSwitch(org.jboss.hal.client.runtime.server.ServerStatusSwitch) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) NameTokens(org.jboss.hal.meta.token.NameTokens) HTMLDivElement(elemental2.dom.HTMLDivElement) NamedNode(org.jboss.hal.dmr.NamedNode) Elements(org.jboss.gwt.elemento.core.Elements) CSS.rowHeader(org.jboss.hal.resources.CSS.rowHeader) Provider(javax.inject.Provider) Environment(org.jboss.hal.config.Environment) HTMLTableCellElement(elemental2.dom.HTMLTableCellElement) HtmlContentBuilder(org.jboss.gwt.elemento.core.builder.HtmlContentBuilder) HostPreviewAttributes(org.jboss.hal.core.runtime.host.HostPreviewAttributes) CSS.divider(org.jboss.hal.resources.CSS.divider) HostActionHandler(org.jboss.hal.core.runtime.host.HostActionEvent.HostActionHandler) CSS.serverGroupContainer(org.jboss.hal.resources.CSS.serverGroupContainer) HTMLElement(elemental2.dom.HTMLElement) Message(org.jboss.hal.spi.Message) NodeList(elemental2.dom.NodeList) PreviewAttributes(org.jboss.hal.core.finder.PreviewAttributes) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) Lists.asList(com.google.common.collect.Lists.asList) HTMLTableSectionElement(elemental2.dom.HTMLTableSectionElement) CSS.marginLeft5(org.jboss.hal.resources.CSS.marginLeft5) Predicate(java.util.function.Predicate) CSS.dropdownMenu(org.jboss.hal.resources.CSS.dropdownMenu) CSS.px(org.jboss.hal.resources.CSS.px) EventType.click(org.jboss.gwt.elemento.core.EventType.click) FinderPath(org.jboss.hal.core.finder.FinderPath) ServerGroupActions(org.jboss.hal.core.runtime.group.ServerGroupActions) ServerPreviewAttributes(org.jboss.hal.core.runtime.server.ServerPreviewAttributes) CSS.error(org.jboss.hal.resources.CSS.error) List(java.util.List) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) UIConstants(org.jboss.hal.resources.UIConstants) CSS.dropdownToggle(org.jboss.hal.resources.CSS.dropdownToggle) ServerResultEvent(org.jboss.hal.core.runtime.server.ServerResultEvent) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) SecurityContextRegistry(org.jboss.hal.meta.security.SecurityContextRegistry) HostResultHandler(org.jboss.hal.core.runtime.host.HostResultEvent.HostResultHandler) CSS.centerBlock(org.jboss.hal.resources.CSS.centerBlock) DomGlobal.setTimeout(elemental2.dom.DomGlobal.setTimeout) ModelNode(org.jboss.hal.dmr.ModelNode) Element(elemental2.dom.Element) CSS.selected(org.jboss.hal.resources.CSS.selected) MessageEvent(org.jboss.hal.spi.MessageEvent) ServerActionEvent(org.jboss.hal.core.runtime.server.ServerActionEvent) ServerResultHandler(org.jboss.hal.core.runtime.server.ServerResultEvent.ServerResultHandler) CSS.server(org.jboss.hal.resources.CSS.server) CSS.clickable(org.jboss.hal.resources.CSS.clickable) Function(java.util.function.Function) HashSet(java.util.HashSet) CSS.topology(org.jboss.hal.resources.CSS.topology) ServerGroupActionHandler(org.jboss.hal.core.runtime.group.ServerGroupActionEvent.ServerGroupActionHandler) AddressTemplate(org.jboss.hal.meta.AddressTemplate) Comparator.comparing(java.util.Comparator.comparing) CSS.spinner(org.jboss.hal.resources.CSS.spinner) CSS.ok(org.jboss.hal.resources.CSS.ok) CSS.warning(org.jboss.hal.resources.CSS.warning) DomGlobal.document(elemental2.dom.DomGlobal.document) CSS.suspended(org.jboss.hal.resources.CSS.suspended) Ids(org.jboss.hal.resources.Ids) HTMLTableColElement(elemental2.dom.HTMLTableColElement) FinderPathFactory(org.jboss.hal.core.finder.FinderPathFactory) CSS.disconnected(org.jboss.hal.resources.CSS.disconnected) PlaceRequest(com.gwtplatform.mvp.shared.proxy.PlaceRequest) Consumer(java.util.function.Consumer) DomGlobal.clearTimeout(elemental2.dom.DomGlobal.clearTimeout) Collectors.toList(java.util.stream.Collectors.toList) CSS.pullRight(org.jboss.hal.resources.CSS.pullRight) Resources(org.jboss.hal.resources.Resources) Format(org.jboss.hal.ballroom.Format) TopologyTasks.topology(org.jboss.hal.core.runtime.TopologyTasks.topology) CSS.height(org.jboss.hal.resources.CSS.height) CSS.empty(org.jboss.hal.resources.CSS.empty) Host(org.jboss.hal.core.runtime.host.Host) MEDIUM_TIMEOUT(org.jboss.hal.resources.UIConstants.MEDIUM_TIMEOUT) StaticItem(org.jboss.hal.core.finder.StaticItem) ServerGroup(org.jboss.hal.core.runtime.group.ServerGroup) HTMLElement(elemental2.dom.HTMLElement) Host(org.jboss.hal.core.runtime.host.Host) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) Constraint(org.jboss.hal.meta.security.Constraint) HTMLTableSectionElement(elemental2.dom.HTMLTableSectionElement) HTMLTableColElement(elemental2.dom.HTMLTableColElement) HTMLTableElement(elemental2.dom.HTMLTableElement)

Example 10 with Host

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));
        });
    }
}
Also used : Host(org.jboss.hal.core.runtime.host.Host)

Aggregations

Host (org.jboss.hal.core.runtime.host.Host)13 EventBus (com.google.web.bindery.event.shared.EventBus)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 Provider (javax.inject.Provider)5 Environment (org.jboss.hal.config.Environment)5 ModelNode (org.jboss.hal.dmr.ModelNode)5 Dispatcher (org.jboss.hal.dmr.dispatch.Dispatcher)5 Flow.series (org.jboss.hal.flow.Flow.series)5 FlowContext (org.jboss.hal.flow.FlowContext)5 Progress (org.jboss.hal.flow.Progress)5 AddressTemplate (org.jboss.hal.meta.AddressTemplate)5 Names (org.jboss.hal.resources.Names)5 Resources (org.jboss.hal.resources.Resources)5 Message (org.jboss.hal.spi.Message)5 MessageEvent (org.jboss.hal.spi.MessageEvent)5 HTMLElement (elemental2.dom.HTMLElement)4 Strings (com.google.common.base.Strings)3 Lists.asList (com.google.common.collect.Lists.asList)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)3