summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 15:08:15 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 15:08:15 +0000
commitc2b98d3dbd47ab92c79c702276fe9130d9a28036 (patch)
treebf4071f551fdc12c22b23b2bb66483064e7b9ea9 /app/controllers/projects
parentbadb9c1deacbea601b02f88811b7e123589d9251 (diff)
downloadgitlab-ce-c2b98d3dbd47ab92c79c702276fe9130d9a28036.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/hook_logs_controller.rb10
-rw-r--r--app/controllers/projects/service_hook_logs_controller.rb20
-rw-r--r--app/controllers/projects/services_controller.rb7
3 files changed, 33 insertions, 4 deletions
diff --git a/app/controllers/projects/hook_logs_controller.rb b/app/controllers/projects/hook_logs_controller.rb
index a7afc3d77a5..ed7e7b68acb 100644
--- a/app/controllers/projects/hook_logs_controller.rb
+++ b/app/controllers/projects/hook_logs_controller.rb
@@ -16,15 +16,17 @@ class Projects::HookLogsController < Projects::ApplicationController
end
def retry
- result = hook.execute(hook_log.request_data, hook_log.trigger)
-
- set_hook_execution_notice(result)
-
+ execute_hook
redirect_to edit_project_hook_path(@project, @hook)
end
private
+ def execute_hook
+ result = hook.execute(hook_log.request_data, hook_log.trigger)
+ set_hook_execution_notice(result)
+ end
+
def hook
@hook ||= @project.hooks.find(params[:hook_id])
end
diff --git a/app/controllers/projects/service_hook_logs_controller.rb b/app/controllers/projects/service_hook_logs_controller.rb
new file mode 100644
index 00000000000..5c814ea139f
--- /dev/null
+++ b/app/controllers/projects/service_hook_logs_controller.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class Projects::ServiceHookLogsController < Projects::HookLogsController
+ before_action :service, only: [:show, :retry]
+
+ def retry
+ execute_hook
+ redirect_to edit_project_service_path(@project, @service)
+ end
+
+ private
+
+ def hook
+ @hook ||= service.service_hook
+ end
+
+ def service
+ @service ||= @project.find_or_initialize_service(params[:service_id])
+ end
+end
diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb
index c9f680a4696..daaca9e1268 100644
--- a/app/controllers/projects/services_controller.rb
+++ b/app/controllers/projects/services_controller.rb
@@ -7,6 +7,7 @@ class Projects::ServicesController < Projects::ApplicationController
before_action :authorize_admin_project!
before_action :ensure_service_enabled
before_action :service
+ before_action :web_hook_logs, only: [:edit, :update]
respond_to :html
@@ -77,6 +78,12 @@ class Projects::ServicesController < Projects::ApplicationController
@service ||= @project.find_or_initialize_service(params[:id])
end
+ def web_hook_logs
+ return unless @service.service_hook.present?
+
+ @web_hook_logs ||= @service.service_hook.web_hook_logs.recent.page(params[:page])
+ end
+
def ensure_service_enabled
render_404 unless service
end