export function updateUnexecutedSteps()

in src/pages/pipeline-details/components/Details/components/MenuAccordion/index.tsx [25:41]


export function updateUnexecutedSteps(steps) {
  if (!steps) {
    return steps;
  }
  let errorIndex = steps.length - 1;
  return steps.map((step, index) => {
    if (!step.terminated || step.terminated.reason !== 'Completed') {
      errorIndex = Math.min(index, errorIndex);
    }
    if (index > errorIndex) {
      // eslint-disable-next-line no-unused-vars
      const { running, terminated, ...rest } = step;
      return { ...rest };
    }
    return step;
  });
}