Search in sources :

Example 1 with SERVER_GROUP_DEPLOYMENT_TEMPLATE

use of org.jboss.hal.client.deployment.ServerGroupDeploymentColumn.SERVER_GROUP_DEPLOYMENT_TEMPLATE in project console by hal.

the class ContentPreview method update.

@Override
public void update(Content content) {
    attributes.refresh(content);
    boolean undeployed = content.getServerGroupDeployments().isEmpty();
    boolean unmanaged = !content.isManaged();
    boolean exploded = content.isExploded();
    Elements.setVisible(deploymentsDiv, !undeployed);
    Elements.setVisible(undeployedContentDiv, undeployed);
    Elements.setVisible(infoExplodedDiv, !unmanaged && exploded);
    if (!undeployed) {
        Elements.removeChildrenFrom(deploymentsUl);
        content.getServerGroupDeployments().forEach(sgd -> {
            String serverGroup = sgd.getServerGroup();
            PlaceRequest serverGroupPlaceRequest = places.finderPlace(NameTokens.DEPLOYMENTS, new FinderPath().append(Ids.DEPLOYMENT_BROWSE_BY, Ids.asId(Names.SERVER_GROUPS)).append(Ids.DEPLOYMENT_SERVER_GROUP, Ids.serverGroup(serverGroup)).append(Ids.SERVER_GROUP_DEPLOYMENT, Ids.serverGroupDeployment(serverGroup, content.getName()))).build();
            String serverGroupToken = places.historyToken(serverGroupPlaceRequest);
            HTMLElement li = li().add(a(serverGroupToken).textContent(serverGroup)).element();
            if (authorisationDecision.isAllowed(Constraint.executable(SERVER_GROUP_DEPLOYMENT_TEMPLATE, ADD))) {
                li.appendChild(span().textContent(" (").element());
                li.appendChild(a().css(clickable).on(click, event -> column.undeploy(content, serverGroup)).textContent(resources.constants().undeploy()).element());
                li.appendChild(span().textContent(")").element());
            }
            deploymentsUl.appendChild(li);
        });
    }
}
Also used : PlaceRequest(com.gwtplatform.mvp.shared.proxy.PlaceRequest) PreviewContent(org.jboss.hal.core.finder.PreviewContent) Alert(org.jboss.hal.ballroom.Alert) Environment(org.jboss.hal.config.Environment) Constraint(org.jboss.hal.meta.security.Constraint) CSS.clickable(org.jboss.hal.resources.CSS.clickable) Icons(org.jboss.hal.resources.Icons) AuthorisationDecision(org.jboss.hal.meta.security.AuthorisationDecision) HTMLElement(elemental2.dom.HTMLElement) Arrays.asList(java.util.Arrays.asList) PreviewAttribute(org.jboss.hal.core.finder.PreviewAttributes.PreviewAttribute) CSS.marginRight5(org.jboss.hal.resources.CSS.marginRight5) PreviewAttributes(org.jboss.hal.core.finder.PreviewAttributes) Metadata(org.jboss.hal.meta.Metadata) Places(org.jboss.hal.core.mvp.Places) Names(org.jboss.hal.resources.Names) CSS.marginLeft5(org.jboss.hal.resources.CSS.marginLeft5) ModelNodeHelper.failSafeBoolean(org.jboss.hal.dmr.ModelNodeHelper.failSafeBoolean) Ids(org.jboss.hal.resources.Ids) EventType.click(org.jboss.gwt.elemento.core.EventType.click) SERVER_GROUP_DEPLOYMENT_TEMPLATE(org.jboss.hal.client.deployment.ServerGroupDeploymentColumn.SERVER_GROUP_DEPLOYMENT_TEMPLATE) FinderPath(org.jboss.hal.core.finder.FinderPath) PlaceRequest(com.gwtplatform.mvp.shared.proxy.PlaceRequest) Content(org.jboss.hal.core.deployment.Content) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) NameTokens(org.jboss.hal.meta.token.NameTokens) Resources(org.jboss.hal.resources.Resources) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) Elements(org.jboss.gwt.elemento.core.Elements) Icons.flag(org.jboss.hal.resources.Icons.flag) HTMLElement(elemental2.dom.HTMLElement) FinderPath(org.jboss.hal.core.finder.FinderPath)

Aggregations

PlaceRequest (com.gwtplatform.mvp.shared.proxy.PlaceRequest)1 HTMLElement (elemental2.dom.HTMLElement)1 Arrays.asList (java.util.Arrays.asList)1 Elements (org.jboss.gwt.elemento.core.Elements)1 EventType.click (org.jboss.gwt.elemento.core.EventType.click)1 Alert (org.jboss.hal.ballroom.Alert)1 LabelBuilder (org.jboss.hal.ballroom.LabelBuilder)1 SERVER_GROUP_DEPLOYMENT_TEMPLATE (org.jboss.hal.client.deployment.ServerGroupDeploymentColumn.SERVER_GROUP_DEPLOYMENT_TEMPLATE)1 Environment (org.jboss.hal.config.Environment)1 Content (org.jboss.hal.core.deployment.Content)1 FinderPath (org.jboss.hal.core.finder.FinderPath)1 PreviewAttributes (org.jboss.hal.core.finder.PreviewAttributes)1 PreviewAttribute (org.jboss.hal.core.finder.PreviewAttributes.PreviewAttribute)1 PreviewContent (org.jboss.hal.core.finder.PreviewContent)1 Places (org.jboss.hal.core.mvp.Places)1 ModelDescriptionConstants (org.jboss.hal.dmr.ModelDescriptionConstants)1 ModelNodeHelper.failSafeBoolean (org.jboss.hal.dmr.ModelNodeHelper.failSafeBoolean)1 Metadata (org.jboss.hal.meta.Metadata)1 AuthorisationDecision (org.jboss.hal.meta.security.AuthorisationDecision)1 Constraint (org.jboss.hal.meta.security.Constraint)1