use of org.guvnor.ala.ui.model.PipelineStatus in project kie-wb-common by kiegroup.
the class RuntimePresenter method setupPipeline.
private void setupPipeline(final PipelineExecutionTrace trace) {
clearPipeline();
boolean showStep = true;
Pipeline pipeline = trace.getPipeline();
for (int i = 0; showStep && i < pipeline.getStages().size(); i++) {
Stage stage = pipeline.getStages().get(i);
PipelineStatus stageStatus = trace.getStageStatus(stage.getName());
showStep = showStage(stageStatus);
if (showStep) {
if (i > 0) {
TransitionPresenter transitionPresenter = newTransitionPresenter();
currentTransitions.add(transitionPresenter);
pipelinePresenter.addStage(transitionPresenter.getView());
}
final StagePresenter stagePresenter = newStagePresenter();
stagePresenter.setup(stage);
stagePresenter.setState(buildStageState(stageStatus));
pipelinePresenter.addStage(stagePresenter.getView());
currentStages.add(stage);
stagePresenters.put(stage, stagePresenter);
}
}
}
use of org.guvnor.ala.ui.model.PipelineStatus in project kie-wb-common by kiegroup.
the class RuntimePresenter method onStageStatusChange.
public void onStageStatusChange(@Observes final StageStatusChangeEvent event) {
if (isFromCurrentPipeline(event.getPipelineExecutionTraceKey())) {
PipelineExecutionTrace trace = item.getPipelineTrace();
Stage currentStage = currentStages.stream().filter(step -> event.getStage().equals(step.getName())).findFirst().orElse(null);
if (currentStage != null) {
StagePresenter stagePresenter = stagePresenters.get(currentStage);
stagePresenter.setState(buildStageState(event.getStatus()));
} else {
Stage stage = new Stage(item.getPipelineTrace().getPipeline().getKey(), event.getStage());
PipelineStatus stageStatus = event.getStatus();
StagePresenter stagePresenter = newStagePresenter();
stagePresenter.setup(stage);
stagePresenter.setState(buildStageState(stageStatus));
if (!currentStages.isEmpty()) {
TransitionPresenter transitionPresenter = newTransitionPresenter();
currentTransitions.add(transitionPresenter);
pipelinePresenter.addStage(transitionPresenter.getView());
}
pipelinePresenter.addStage(stagePresenter.getView());
currentStages.add(stage);
stagePresenters.put(stage, stagePresenter);
}
trace.setStageStatus(event.getStage(), event.getStatus());
}
}
Aggregations