Module: Projects::PipelineHelper

Extended by:
Ci::BuildsHelper
Defined in:
app/helpers/projects/pipeline_helper.rb

Instance Method Summary collapse

Methods included from Ci::BuildsHelper

build_failed_issue_options

Instance Method Details

#js_pipeline_header_data(project, pipeline) ⇒ Object



35
36
37
38
39
40
41
42
# File 'app/helpers/projects/pipeline_helper.rb', line 35

def js_pipeline_header_data(project, pipeline)
  {
    full_path: project.full_path,
    graphql_resource_etag: graphql_etag_pipeline_path(pipeline),
    pipeline_iid: pipeline.iid,
    pipelines_path: project_pipelines_path(project)
  }
end

#js_pipeline_tabs_data(project, pipeline, _user) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/projects/pipeline_helper.rb', line 7

def js_pipeline_tabs_data(project, pipeline, _user)
  data = {
    failed_jobs_count: pipeline.failed_builds.count,
    project_path: project.full_path,
    graphql_resource_etag: graphql_etag_pipeline_path(pipeline),
    metrics_path: namespace_project_ci_prometheus_metrics_histograms_path(
      namespace_id: project.namespace,
      project_id: project,
      format: :json
    ),
    pipeline_iid: pipeline.iid,
    pipeline_path: pipeline_path(pipeline),
    pipeline_project_path: project.full_path,
    total_job_count: pipeline.total_size,
    summary_endpoint: summary_project_pipeline_tests_path(project, pipeline, format: :json),
    suite_endpoint: project_pipeline_test_path(project, pipeline, suite_name: 'suite', format: :json),
    blob_path: project_blob_path(project, pipeline.sha),
    has_test_report: pipeline.has_test_reports?,
    empty_state_image_path: image_path('illustrations/empty-todos-md.svg'),
    artifacts_expired_image_path: image_path('illustrations/empty-state/empty-pipeline-md.svg'),
    tests_count: pipeline.test_report_summary.total[:count]
  }

  data.merge!(manual_variables_data(pipeline)) if ::Feature.enabled?(:ci_show_manual_variables_in_pipeline, project)

  data
end

#manual_variables_data(pipeline) ⇒ Object



44
45
46
47
48
49
# File 'app/helpers/projects/pipeline_helper.rb', line 44

def manual_variables_data(pipeline)
  {
    manual_variables_count: pipeline.variables.count,
    can_read_variables: can?(current_user, :read_pipeline_variable, pipeline).to_s
  }
end