From 4f0a38f1a833cab8c83e77a6c5d323057883188d Mon Sep 17 00:00:00 2001 From: Jeroen Nijhof Date: Wed, 21 Oct 2015 15:15:54 +0200 Subject: Added housekeeping for git repositories --- app/controllers/projects_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/controllers/projects_controller.rb') diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 82119022cf9..c3efdffe563 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -171,6 +171,14 @@ class ProjectsController < ApplicationController end end + def housekeeping + ::Projects::HousekeepingService.new(@project).execute + + respond_to do |format| + format.html { redirect_to project_path(@project) } + end + end + def toggle_star current_user.toggle_star(@project) @project.reload -- cgit v1.2.1 From 839aae0e473e85042f76391b44eaeb099235a813 Mon Sep 17 00:00:00 2001 From: Jeroen Nijhof Date: Thu, 19 Nov 2015 15:16:54 +0100 Subject: Added housekeeping status and moved path check to gitlab-shell --- app/controllers/projects_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app/controllers/projects_controller.rb') diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index c3efdffe563..27b723fae6a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -8,7 +8,7 @@ class ProjectsController < ApplicationController before_action :assign_ref_vars, :tree, only: [:show], if: :repo_exists? # Authorize - before_action :authorize_admin_project!, only: [:edit, :update] + before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping] before_action :event_filter, only: [:show, :activity] layout :determine_layout @@ -172,9 +172,14 @@ class ProjectsController < ApplicationController end def housekeeping - ::Projects::HousekeepingService.new(@project).execute + status = ::Projects::HousekeepingService.new(@project).execute respond_to do |format| + if status + flash[:notice] = "Housekeeping finished successfully." + else + flash[:alert] = "Housekeeping failed." + end format.html { redirect_to project_path(@project) } end end -- cgit v1.2.1 From d4690af8bc283c402e49cb8b3056c7de9d57e886 Mon Sep 17 00:00:00 2001 From: Jeroen Nijhof Date: Thu, 19 Nov 2015 16:04:07 +0100 Subject: Use GitlabShellWorker.perform_async for housekeeping --- app/controllers/projects_controller.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'app/controllers/projects_controller.rb') diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 27b723fae6a..ecaf4476246 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -172,14 +172,10 @@ class ProjectsController < ApplicationController end def housekeeping - status = ::Projects::HousekeepingService.new(@project).execute + ::Projects::HousekeepingService.new(@project).execute respond_to do |format| - if status - flash[:notice] = "Housekeeping finished successfully." - else - flash[:alert] = "Housekeeping failed." - end + flash[:notice] = "Housekeeping successfully started." format.html { redirect_to project_path(@project) } end end -- cgit v1.2.1