use of org.jboss.hal.client.deployment.DeploymentTasks.ReadServerGroupDeployments in project console by hal.
the class ServerGroupDeploymentPresenter method reload.
@Override
protected void reload() {
List<Task<FlowContext>> tasks = new ArrayList<>();
tasks.add(new ReadServerGroupDeployments(environment, dispatcher, serverGroup, deployment));
tasks.addAll(runningServers(environment, dispatcher, properties(SERVER_GROUP, serverGroup)));
tasks.add(new LoadDeploymentsFromRunningServer(environment, dispatcher));
series(new FlowContext(progress.get()), tasks).subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext context, Throwable error) {
MessageEvent.fire(getEventBus(), Message.error(resources.messages().deploymentReadError(deployment)));
}
@Override
public void onSuccess(FlowContext context) {
List<ServerGroupDeployment> serverGroupDeployments = context.get(DeploymentTasks.SERVER_GROUP_DEPLOYMENTS);
if (!serverGroupDeployments.isEmpty()) {
ServerGroupDeployment serverGroupDeployment = serverGroupDeployments.get(0);
getView().update(serverGroup, serverGroupDeployment);
} else {
MessageEvent.fire(getEventBus(), Message.error(resources.messages().deploymentReadError(deployment)));
}
}
});
}
Aggregations