931ab01adb
* upstream/master: (34 commits) Revert "Merge branch 'karma-headless-chrome' into 'master'" Make small pipeline schedules UI enhancements. Remove js classes from vue component that are not needed in vue component Update tests and application Adds "Pipeline" to job's sidebar Change border color of job's scroll controllers to $border-color Add database helpers 'add_timestamps_with_timezone' and 'timestamps_with_timezone' Added Tectonic to the page. Always check read_issue permissions when loading issue Handle legacy jobs without name Do not expose internal artifacts hash in build entity Use wait_for_requests instead of sleep 0.3 Limit wiki container width Fix migrations testing support RSpec hooks order Rename BuildEntity to JobEntity Fix support for external_url for commit statuses Allow to access pipelines even if they are disabled, but only present jobs and commit statuses without giving ability to access them add CHANGELOG.md entry for !12036 remove phantomjs-specific test hacks update karma job to use chrome build image created by gitlab-build-images!41 ...
45 lines
1.4 KiB
Ruby
45 lines
1.4 KiB
Ruby
class BuildDetailsEntity < JobEntity
|
|
expose :coverage, :erased_at, :duration
|
|
expose :tag_list, as: :tags
|
|
expose :user, using: UserEntity
|
|
expose :runner, using: RunnerEntity
|
|
expose :pipeline, using: PipelineEntity
|
|
|
|
expose :erased_by, if: -> (*) { build.erased? }, using: UserEntity
|
|
expose :erase_path, if: -> (*) { build.erasable? && can?(current_user, :update_build, project) } do |build|
|
|
erase_namespace_project_job_path(project.namespace, project, build)
|
|
end
|
|
|
|
expose :merge_request, if: -> (*) { can?(current_user, :read_merge_request, build.merge_request) } do
|
|
expose :iid do |build|
|
|
build.merge_request.iid
|
|
end
|
|
|
|
expose :path do |build|
|
|
namespace_project_merge_request_path(project.namespace, project, build.merge_request)
|
|
end
|
|
end
|
|
|
|
expose :new_issue_path, if: -> (*) { can?(request.current_user, :create_issue, project) && build.failed? } do |build|
|
|
new_namespace_project_issue_path(project.namespace, project, issue: build_failed_issue_options)
|
|
end
|
|
|
|
expose :raw_path do |build|
|
|
raw_namespace_project_job_path(project.namespace, project, build)
|
|
end
|
|
|
|
private
|
|
|
|
def build_failed_issue_options
|
|
{ title: "Build Failed ##{build.id}",
|
|
description: namespace_project_job_path(project.namespace, project, build) }
|
|
end
|
|
|
|
def current_user
|
|
request.current_user
|
|
end
|
|
|
|
def project
|
|
build.project
|
|
end
|
|
end
|