Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/build_artifact_entity.rb')
-rw-r--r--app/serializers/build_artifact_entity.rb34
1 files changed, 16 insertions, 18 deletions
diff --git a/app/serializers/build_artifact_entity.rb b/app/serializers/build_artifact_entity.rb
index fac0fbd14b9..7a030372591 100644
--- a/app/serializers/build_artifact_entity.rb
+++ b/app/serializers/build_artifact_entity.rb
@@ -4,30 +4,28 @@ class BuildArtifactEntity < Grape::Entity
include RequestAwareEntity
include GitlabRoutingHelper
- expose :name do |job|
- job.name
- end
-
- expose :artifacts_expired?, as: :expired
- expose :artifacts_expire_at, as: :expire_at
+ alias_method :artifact, :object
- expose :path do |job|
- fast_download_project_job_artifacts_path(project, job)
+ expose :name do |artifact|
+ "#{artifact.job.name}:#{artifact.file_type}"
end
- expose :keep_path, if: -> (*) { job.has_expiring_archive_artifacts? } do |job|
- fast_keep_project_job_artifacts_path(project, job)
- end
+ expose :expire_at
+ expose :expired?, as: :expired
- expose :browse_path do |job|
- fast_browse_project_job_artifacts_path(project, job)
+ expose :path do |artifact|
+ fast_download_project_job_artifacts_path(
+ artifact.project,
+ artifact.job,
+ file_type: artifact.file_type
+ )
end
- private
-
- alias_method :job, :object
+ expose :keep_path, if: -> (*) { artifact.expiring? } do |artifact|
+ fast_keep_project_job_artifacts_path(artifact.project, artifact.job)
+ end
- def project
- job.project
+ expose :browse_path do |artifact|
+ fast_browse_project_job_artifacts_path(artifact.project, artifact.job)
end
end