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);
});
}
}
Aggregations