use of org.guvnor.ala.ui.model.Pipeline 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.Pipeline in project kie-wb-common by kiegroup.
the class RuntimePresenterTest method mockPipeline.
protected Pipeline mockPipeline(String pipelineId, int stages) {
PipelineKey pipelineKey = new PipelineKey(pipelineId);
Pipeline pipeline = new Pipeline(pipelineKey);
for (int i = 0; i < stages; i++) {
Stage stage = new Stage(pipelineKey, "Stage.name." + Integer.toString(i));
pipeline.addStage(stage);
}
return pipeline;
}
use of org.guvnor.ala.ui.model.Pipeline in project kie-wb-common by kiegroup.
the class RuntimePresenterTest method preparePipelineExecutionTraceSetup.
protected void preparePipelineExecutionTraceSetup() {
Pipeline pipeline = mockPipeline(PIPELINE_NAME, STAGE_NUMBER);
trace = mockPipelineExecutionTrace(EXECUTION_ID, pipeline, PipelineStatus.RUNNING, PipelineStatus.SCHEDULED);
// set an arbitrary number of consecutive stages as finished and the last as running.
displayableStages = new ArrayList<>();
int finishedStages = 5;
for (int i = 0; i < finishedStages; i++) {
trace.setStageStatus(pipeline.getStages().get(i).getName(), PipelineStatus.FINISHED);
displayableStages.add(pipeline.getStages().get(i));
}
trace.setStageStatus(pipeline.getStages().get(finishedStages).getName(), PipelineStatus.RUNNING);
displayableStages.add(pipeline.getStages().get(finishedStages));
}
use of org.guvnor.ala.ui.model.Pipeline in project kie-wb-common by kiegroup.
the class RuntimeListItemBuilder method build.
public RuntimeListItem build() {
RuntimeListItem result;
PipelineExecutionTrace pipelineTrace;
String runtimeName;
if (item.getRuntimeName() != null) {
runtimeName = item.getRuntimeName();
} else {
runtimeName = item.getRuntimeId();
}
if (item.getPipelineExecutionId() != null) {
final Pipeline pipeline = new Pipeline(new PipelineKey(item.getPipelineId()));
pipelineTrace = new PipelineExecutionTrace(new PipelineExecutionTraceKey(item.getPipelineExecutionId()));
pipelineTrace.setPipelineStatus(transformToPipelineStatus(item.getPipelineStatus()));
pipelineTrace.setPipelineError(new PipelineError(item.getPipelineError(), item.getPipelineErrorDetail()));
item.getPipelineStageItems().getItems().forEach(stage -> {
pipeline.addStage(new Stage(pipeline.getKey(), stage.getName()));
pipelineTrace.setStageStatus(stage.getName(), transformToPipelineStatus(stage.getStatus()));
pipelineTrace.setStageError(stage.getName(), new PipelineError(stage.getStageError(), stage.getStageErrorDetail()));
});
pipelineTrace.setPipeline(pipeline);
} else {
pipelineTrace = null;
}
if (item.getRuntimeId() != null) {
final Runtime runtime = new Runtime(new RuntimeKey(new ProviderKey(new ProviderTypeKey(item.getProviderTypeName(), item.getProviderVersion()), item.getProviderId()), item.getRuntimeId()), item.getRuntimeStatus(), item.getRuntimeEndpoint(), item.getStartedAt());
runtime.setPipelineTrace(pipelineTrace);
result = new RuntimeListItem(runtimeName, runtime);
} else {
result = new RuntimeListItem(runtimeName, pipelineTrace);
}
return result;
}
Aggregations