2018-09-25 23:45:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-27 06:08:57 -04: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'
|
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def retry
|
2017-07-20 11:12:06 -04:00
|
|
|
result = hook.execute(hook_log.request_data, hook_log.trigger)
|
2017-04-27 06:08:57 -04:00
|
|
|
|
2017-07-20 11:12:06 -04:00
|
|
|
set_hook_execution_notice(result)
|
2017-04-27 06:08:57 -04:00
|
|
|
|
2017-06-29 13:06:35 -04:00
|
|
|
redirect_to edit_project_hook_path(@project, @hook)
|
2017-04-27 06:08:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def hook
|
|
|
|
@hook ||= @project.hooks.find(params[:hook_id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def hook_log
|
|
|
|
@hook_log ||= hook.web_hook_logs.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|