summaryrefslogtreecommitdiff
path: root/app/controllers/projects/artifacts_controller.rb
diff options
context:
space:
mode:
authorshampton <shampton@gitlab.com>2019-08-13 14:21:05 -0700
committershampton <shampton@gitlab.com>2019-08-13 14:21:05 -0700
commit7fc69369802614b28de9a46b9b7e10c7c6ea7710 (patch)
tree7d772ff1384d6faf5760e09868d15e5bf0b94e3d /app/controllers/projects/artifacts_controller.rb
parentdf35d772c655587eecbe7b3e387c8b8bc287b23c (diff)
downloadgitlab-ce-artifacts-management-contribution.tar.gz
Moving community fork to CE branchartifacts-management-contribution
Moving community contribution fork branch to CE so that I can work on it. Original MR: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18707
Diffstat (limited to 'app/controllers/projects/artifacts_controller.rb')
-rw-r--r--app/controllers/projects/artifacts_controller.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb
index da8a371acaa..c656fd96942 100644
--- a/app/controllers/projects/artifacts_controller.rb
+++ b/app/controllers/projects/artifacts_controller.rb
@@ -8,10 +8,25 @@ class Projects::ArtifactsController < Projects::ApplicationController
layout 'project'
before_action :authorize_read_build!
before_action :authorize_update_build!, only: [:keep]
+ before_action :authorize_destroy_artifacts!, only: [:destroy]
before_action :extract_ref_name_and_path
- before_action :validate_artifacts!, except: [:download]
+ before_action :validate_artifacts!, except: [:index, :download, :destroy]
+ before_action :set_request_format, only: [:file]
before_action :entry, only: [:file]
+ def index
+ finder = JobsWithArtifactsFinder.new(project: @project, params: params)
+ @jobs_with_artifacts = finder.execute
+ @total_size = finder.total_size
+ @sort = finder.sort_key
+ end
+
+ def destroy
+ build.erase_erasable_artifacts!
+
+ redirect_to project_artifacts_path(@project), status: :found, notice: _('Artifacts were successfully deleted.')
+ end
+
def download
return render_404 unless artifacts_file