2018-08-18 07:19:57 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-10-13 15:59:23 -04:00
|
|
|
module BuildsHelper
|
2017-05-04 14:30:13 -04:00
|
|
|
def build_summary(build, skip: false)
|
2017-04-15 21:33:01 -04:00
|
|
|
if build.has_trace?
|
2017-05-04 14:30:13 -04:00
|
|
|
if skip
|
2019-10-21 11:05:58 -04:00
|
|
|
link_to _("View job log"), pipeline_job_url(build.pipeline, build)
|
2017-05-04 14:30:13 -04:00
|
|
|
else
|
|
|
|
build.trace.html(last_lines: 10).html_safe
|
|
|
|
end
|
2017-04-15 21:33:01 -04:00
|
|
|
else
|
2019-10-21 11:05:58 -04:00
|
|
|
_("No job log")
|
2017-04-15 21:33:01 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-10-13 15:59:23 -04:00
|
|
|
def sidebar_build_class(build, current_build)
|
2018-08-18 07:19:57 -04:00
|
|
|
build_class = []
|
|
|
|
build_class << 'active' if build.id === current_build.id
|
|
|
|
build_class << 'retried' if build.retried?
|
|
|
|
build_class.join(' ')
|
2016-10-13 15:59:23 -04:00
|
|
|
end
|
2016-09-08 11:50:36 -04:00
|
|
|
|
|
|
|
def javascript_build_options
|
|
|
|
{
|
2017-12-04 21:18:45 -05:00
|
|
|
page_path: project_job_path(@project, @build),
|
2016-09-08 11:50:36 -04:00
|
|
|
build_status: @build.status,
|
|
|
|
build_stage: @build.stage,
|
2017-02-10 13:40:25 -05:00
|
|
|
log_state: ''
|
2016-09-08 11:50:36 -04:00
|
|
|
}
|
|
|
|
end
|
2017-02-22 18:42:14 -05:00
|
|
|
|
|
|
|
def build_failed_issue_options
|
|
|
|
{
|
2019-04-04 13:05:25 -04:00
|
|
|
title: _("Job Failed #%{build_id}") % { build_id: @build.id },
|
2017-06-29 13:06:35 -04:00
|
|
|
description: project_job_url(@project, @build)
|
2017-02-22 18:42:14 -05:00
|
|
|
}
|
|
|
|
end
|
2016-10-13 15:59:23 -04:00
|
|
|
end
|