2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
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
|
2020-01-01 13:55:28 +05:30
|
|
|
execute_hook
|
2017-09-10 17:25:29 +05:30
|
|
|
redirect_to edit_project_hook_path(@project, @hook)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
def execute_hook
|
|
|
|
result = hook.execute(hook_log.request_data, hook_log.trigger)
|
|
|
|
set_hook_execution_notice(result)
|
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
def hook
|
|
|
|
@hook ||= @project.hooks.find(params[:hook_id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def hook_log
|
|
|
|
@hook_log ||= hook.web_hook_logs.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|