Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions web/src/components/deployments-detail-page/pipeline/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,27 @@ const findDefaultActiveStage = (
return stages[stages.length - 1];
};

const isStartedStage = (stage: Stage): boolean => {
return stage.status !== StageStatus.STAGE_NOT_STARTED_YET;
};

const createStagesForRendering = (
deployment: Deployment.AsObject | undefined
): Stage[][] => {
if (!deployment) {
return [];
}

const stages: Stage[][] = [];
const visibleStages = deployment.stagesList.filter((stage) => stage.visible);
let visibleStages: Stage[] = [];
if (deployment.deployTargetsByPluginMap?.length) {
visibleStages = deployment.stagesList.filter(
(stage) => !stage.rollback || isStartedStage(stage)
);
} else {
visibleStages = deployment.stagesList.filter((stage) => stage.visible);
}

const stages: Stage[][] = [];
stages[0] = visibleStages.filter((stage) => stage.requiresList.length === 0);

let index = 0;
Expand All @@ -74,6 +85,7 @@ const createStagesForRendering = (
stage.requiresList.some((id) => previousIds.includes(id))
);
}

return stages;
};

Expand Down