2020-07-09 14:10:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
module JobsHelper
|
|
|
|
def jobs_data
|
|
|
|
{
|
|
|
|
"endpoint" => project_job_path(@project, @build, format: :json),
|
|
|
|
"project_path" => @project.full_path,
|
2020-09-07 02:08:35 -04:00
|
|
|
"artifact_help_url" => help_page_path('user/gitlab_com/index.html', anchor: 'gitlab-cicd'),
|
2021-09-23 08:11:29 -04:00
|
|
|
"deployment_help_url" => help_page_path('user/project/clusters/deploy_to_cluster.html', anchor: 'troubleshooting'),
|
2020-07-09 14:10:09 -04:00
|
|
|
"runner_settings_url" => project_runners_path(@build.project, anchor: 'js-runners-settings'),
|
|
|
|
"page_path" => project_job_path(@project, @build),
|
|
|
|
"build_status" => @build.status,
|
|
|
|
"build_stage" => @build.stage,
|
|
|
|
"log_state" => '',
|
2020-11-10 07:08:57 -05:00
|
|
|
"build_options" => javascript_build_options,
|
2022-03-09 16:07:04 -05:00
|
|
|
"retry_outdated_job_docs_url" => help_page_path('ci/pipelines/settings', anchor: 'retry-outdated-jobs')
|
2020-07-09 14:10:09 -04:00
|
|
|
}
|
|
|
|
end
|
2021-04-19 14:09:09 -04:00
|
|
|
|
2022-01-10 07:15:34 -05:00
|
|
|
def bridge_data(build, project)
|
2021-12-10 13:14:42 -05:00
|
|
|
{
|
2022-01-10 07:15:34 -05:00
|
|
|
"build_id" => build.id,
|
|
|
|
"empty-state-illustration-path" => image_path('illustrations/job-trigger-md.svg'),
|
|
|
|
"pipeline_iid" => build.pipeline.iid,
|
|
|
|
"project_full_path" => project.full_path
|
2021-12-10 13:14:42 -05:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2021-04-19 14:09:09 -04:00
|
|
|
def job_counts
|
|
|
|
{
|
|
|
|
"all" => limited_counter_with_delimiter(@all_builds),
|
|
|
|
"pending" => limited_counter_with_delimiter(@all_builds.pending),
|
|
|
|
"running" => limited_counter_with_delimiter(@all_builds.running),
|
|
|
|
"finished" => limited_counter_with_delimiter(@all_builds.finished)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def job_statuses
|
|
|
|
statuses = Ci::HasStatus::AVAILABLE_STATUSES
|
|
|
|
|
|
|
|
statuses.to_h { |status| [status, status.upcase] }
|
|
|
|
end
|
2020-07-09 14:10:09 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-05-11 17:10:21 -04:00
|
|
|
Ci::JobsHelper.prepend_mod_with('Ci::JobsHelper')
|