2018-09-26 03:45:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-27 10:08:57 +00:00
|
|
|
class Projects::HookLogsController < Projects::ApplicationController
|
|
|
|
include HooksExecution
|
|
|
|
|
|
|
|
before_action :authorize_admin_project!
|
|
|
|
|
|
|
|
before_action :hook, only: [:show, :retry]
|
|
|
|
before_action :hook_log, only: [:show, :retry]
|
|
|
|
|
|
|
|
respond_to :html
|
|
|
|
|
|
|
|
layout 'project_settings'
|
|
|
|
|
2020-10-08 18:08:32 +00:00
|
|
|
feature_category :integrations
|
|
|
|
|
2017-04-27 10:08:57 +00:00
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def retry
|
2019-12-17 15:08:15 +00:00
|
|
|
execute_hook
|
2017-06-29 17:06:35 +00:00
|
|
|
redirect_to edit_project_hook_path(@project, @hook)
|
2017-04-27 10:08:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2019-12-17 15:08:15 +00:00
|
|
|
def execute_hook
|
|
|
|
result = hook.execute(hook_log.request_data, hook_log.trigger)
|
|
|
|
set_hook_execution_notice(result)
|
|
|
|
end
|
|
|
|
|
2017-04-27 10:08:57 +00:00
|
|
|
def hook
|
|
|
|
@hook ||= @project.hooks.find(params[:hook_id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def hook_log
|
|
|
|
@hook_log ||= hook.web_hook_logs.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|