use of org.jboss.hal.spi.MessageEvent.fire in project console by hal.
the class ContentColumn method undeploy.
private void undeploy(Content content) {
if (!content.getServerGroupDeployments().isEmpty()) {
Set<String> serverGroupsWithContent = content.getServerGroupDeployments().stream().map(ServerGroupDeployment::getServerGroup).collect(toSet());
new DeployContentDialog1(content, serverGroupsWithContent, resources, (cnt, serverGroups) -> {
List<Operation> operations = serverGroups.stream().map(serverGroup -> {
ResourceAddress resourceAddress = new ResourceAddress().add(SERVER_GROUP, serverGroup).add(DEPLOYMENT, content.getName());
return new Operation.Builder(resourceAddress, REMOVE).build();
}).collect(toList());
dispatcher.execute(new Composite(operations), (CompositeResult cr) -> {
refresh(RESTORE_SELECTION);
MessageEvent.fire(eventBus, Message.success(resources.messages().contentUndeployed(content.getName())));
});
}).show();
} else {
MessageEvent.fire(eventBus, Message.warning(resources.messages().undeployedContent(content.getName())));
}
}
use of org.jboss.hal.spi.MessageEvent.fire in project console by hal.
the class ContentColumn method deploy.
void deploy(Content content) {
Operation operation = new Operation.Builder(ResourceAddress.root(), READ_CHILDREN_NAMES_OPERATION).param(CHILD_TYPE, SERVER_GROUP).build();
dispatcher.execute(operation, result -> {
Set<String> serverGroupsWithoutContent = result.asList().stream().map(ModelNode::asString).collect(toSet());
Set<String> serverGroupsWithContent = content.getServerGroupDeployments().stream().map(ServerGroupDeployment::getServerGroup).collect(toSet());
serverGroupsWithoutContent.removeAll(serverGroupsWithContent);
if (serverGroupsWithoutContent.isEmpty()) {
MessageEvent.fire(eventBus, Message.warning(resources.messages().contentAlreadyDeployedToAllServerGroups(content.getName())));
} else {
new DeployContentDialog1(content, serverGroupsWithoutContent, resources, (cnt, serverGroups, enable) -> {
List<Operation> operations = serverGroups.stream().map(serverGroup -> {
ResourceAddress resourceAddress = new ResourceAddress().add(SERVER_GROUP, serverGroup).add(DEPLOYMENT, content.getName());
return new Operation.Builder(resourceAddress, ADD).param(RUNTIME_NAME, content.getRuntimeName()).param(ENABLED, enable).build();
}).collect(toList());
if (enable) {
ItemMonitor.startProgress(Ids.content(cnt.getName()));
}
dispatcher.execute(new Composite(operations), (CompositeResult cr) -> {
if (enable) {
ItemMonitor.stopProgress(Ids.content(cnt.getName()));
}
refresh(RESTORE_SELECTION);
MessageEvent.fire(eventBus, Message.success(resources.messages().contentDeployed1(content.getName())));
});
}).show();
}
});
}
Aggregations