debian-mirror-gitlab/app/helpers/builds_helper.rb

39 lines
904 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2016-11-03 12:29:30 +05:30
module BuildsHelper
2017-08-17 22:00:37 +05:30
def build_summary(build, skip: false)
if build.has_trace?
if skip
2019-05-18 00:54:41 +05:30
link_to _("View job trace"), pipeline_job_url(build.pipeline, build)
2017-08-17 22:00:37 +05:30
else
build.trace.html(last_lines: 10).html_safe
end
else
2019-05-18 00:54:41 +05:30
_("No job trace")
2017-08-17 22:00:37 +05:30
end
end
2016-11-03 12:29:30 +05:30
def sidebar_build_class(build, current_build)
2018-12-05 23:21:45 +05:30
build_class = []
build_class << 'active' if build.id === current_build.id
build_class << 'retried' if build.retried?
build_class.join(' ')
2016-11-03 12:29:30 +05:30
end
2017-08-17 22:00:37 +05:30
def javascript_build_options
{
2018-03-17 18:26:18 +05:30
page_path: project_job_path(@project, @build),
2017-08-17 22:00:37 +05:30
build_status: @build.status,
build_stage: @build.stage,
log_state: ''
}
end
def build_failed_issue_options
{
2019-05-18 00:54:41 +05:30
title: _("Job Failed #%{build_id}") % { build_id: @build.id },
2017-09-10 17:25:29 +05:30
description: project_job_url(@project, @build)
2017-08-17 22:00:37 +05:30
}
end
2016-11-03 12:29:30 +05:30
end