All files / app/assets/javascripts/ide/stores/modules/pipelines getters.js

37.5% Statements 6/16
50% Branches 2/4
9.09% Functions 1/11
46.15% Lines 6/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24    48x 4x   48x     48x               48x           48x  
import { states } from './constants';
 
export const hasLatestPipeline = (state) =>
  !state.isLoadingPipeline && Boolean(state.latestPipeline);
 
export const pipelineFailed = (state) =>
  state.latestPipeline && state.latestPipeline.details.status.text === states.failed;
 
export const failedStages = (state) =>
  state.stages
    .filter((stage) => stage.status.text.toLowerCase() === states.failed)
    .map((stage) => ({
      ...stage,
      jobs: stage.jobs.filter((job) => job.status.text.toLowerCase() === states.failed),
    }));
 
export const failedJobsCount = (state) =>
  state.stages.reduce(
    (acc, stage) => acc + stage.jobs.filter((j) => j.status.text === states.failed).length,
    0,
  );
 
export const jobsCount = (state) => state.stages.reduce((acc, stage) => acc + stage.jobs.length, 0);