CHE-2775 Amount of machines is not correctly displayed in process tree (#2885)

Signed-off-by: Vitaliy Guliy <vguliy@codenvy.com>
6.19.x
Vitaliy Guliy 2016-10-25 16:57:48 +03:00 committed by GitHub
parent 2ba7984367
commit d4ea175aab
1 changed files with 36 additions and 0 deletions

View File

@ -180,6 +180,42 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
eventBus.addHandler(DownloadWorkspaceOutputEvent.TYPE, this);
}
/**
* Updates list of the machines from application context.
*/
public void updateMachineList() {
if (appContext.getWorkspace() == null) {
return;
}
List<MachineEntity> machines = getMachines(appContext.getWorkspace());
if (machines.isEmpty()) {
return;
}
ProcessTreeNode machineToSelect = null;
for (MachineEntity machine : machines) {
if (machine.isDev()) {
provideMachineNode(machine, true);
machines.remove(machine);
break;
}
}
for (MachineEntity machine : machines) {
provideMachineNode(machine, true);
}
if (machineToSelect == null) {
machineToSelect = machineNodes.entrySet().iterator().next().getValue();
}
view.selectNode(machineToSelect);
workspaceAgent.setActivePart(ProcessesPanelPresenter.this);
}
@Override
public void go(AcceptsOneWidget container) {
container.setWidget(view);