Search in sources :

Example 1 with LoadDeploymentsFromRunningServer

use of org.jboss.hal.client.deployment.DeploymentTasks.LoadDeploymentsFromRunningServer 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)));
            }
        }
    });
}
Also used : ReadServerGroupDeployments(org.jboss.hal.client.deployment.DeploymentTasks.ReadServerGroupDeployments) ServerGroupDeployment(org.jboss.hal.core.deployment.ServerGroupDeployment) Task(org.jboss.hal.flow.Task) ArrayList(java.util.ArrayList) LoadDeploymentsFromRunningServer(org.jboss.hal.client.deployment.DeploymentTasks.LoadDeploymentsFromRunningServer) ArrayList(java.util.ArrayList) List(java.util.List) FlowContext(org.jboss.hal.flow.FlowContext)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 LoadDeploymentsFromRunningServer (org.jboss.hal.client.deployment.DeploymentTasks.LoadDeploymentsFromRunningServer)1 ReadServerGroupDeployments (org.jboss.hal.client.deployment.DeploymentTasks.ReadServerGroupDeployments)1 ServerGroupDeployment (org.jboss.hal.core.deployment.ServerGroupDeployment)1 FlowContext (org.jboss.hal.flow.FlowContext)1 Task (org.jboss.hal.flow.Task)1