2018-09-14 01:42:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-01-20 06:20:50 -05:00
|
|
|
class Admin::HooksController < Admin::ApplicationController
|
2022-08-18 08:13:06 -04:00
|
|
|
include ::WebHooks::HookActions
|
2017-04-27 06:08:57 -04:00
|
|
|
|
|
|
|
before_action :hook_logs, only: :edit
|
2017-04-20 04:31:37 -04:00
|
|
|
|
2020-10-05 17:08:47 -04:00
|
|
|
feature_category :integrations
|
2021-10-27 14:13:16 -04:00
|
|
|
urgency :low, [:test]
|
2020-10-05 17:08:47 -04:00
|
|
|
|
2012-07-12 15:10:34 -04:00
|
|
|
def test
|
2017-07-20 11:12:06 -04:00
|
|
|
result = TestHooks::SystemService.new(hook, current_user, params[:trigger]).execute
|
2017-04-27 06:08:57 -04:00
|
|
|
|
2017-07-20 11:12:06 -04:00
|
|
|
set_hook_execution_notice(result)
|
2012-07-12 15:10:34 -04:00
|
|
|
|
2015-10-20 03:28:28 -04:00
|
|
|
redirect_back_or_default
|
2012-07-12 15:10:34 -04:00
|
|
|
end
|
2014-06-26 11:51:11 -04:00
|
|
|
|
2017-04-20 04:31:37 -04:00
|
|
|
private
|
|
|
|
|
2022-06-21 23:08:59 -04:00
|
|
|
def relation
|
|
|
|
SystemHook
|
|
|
|
end
|
|
|
|
|
2017-04-20 04:31:37 -04:00
|
|
|
def hook
|
|
|
|
@hook ||= SystemHook.find(params[:id])
|
|
|
|
end
|
|
|
|
|
2017-04-27 06:08:57 -04:00
|
|
|
def hook_logs
|
2022-09-19 05:13:01 -04:00
|
|
|
@hook_logs ||= hook.web_hook_logs.recent.page(params[:page]).without_count
|
2017-04-27 06:08:57 -04:00
|
|
|
end
|
|
|
|
|
2022-06-21 23:08:59 -04:00
|
|
|
def hook_param_names
|
|
|
|
%i[enable_ssl_verification token url]
|
|
|
|
end
|
|
|
|
|
|
|
|
def trigger_values
|
|
|
|
SystemHook.triggers.values
|
2014-06-26 11:51:11 -04:00
|
|
|
end
|
2012-07-12 15:10:34 -04:00
|
|
|
end
|