2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
class Admin::HooksController < Admin::ApplicationController
|
2021-12-11 22:18:48 +05:30
|
|
|
include ::Integrations::HooksExecution
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
before_action :hook_logs, only: :edit
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
feature_category :integrations
|
2021-12-11 22:18:48 +05:30
|
|
|
urgency :low, [:test]
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
def test
|
2017-09-10 17:25:29 +05:30
|
|
|
result = TestHooks::SystemService.new(hook, current_user, params[:trigger]).execute
|
|
|
|
|
|
|
|
set_hook_execution_notice(result)
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2015-10-24 18:46:33 +05:30
|
|
|
redirect_back_or_default
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
private
|
|
|
|
|
2022-08-13 15:12:31 +05:30
|
|
|
def relation
|
|
|
|
SystemHook
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
def hook
|
|
|
|
@hook ||= SystemHook.find(params[:id])
|
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
def hook_logs
|
2018-11-08 19:23:39 +05:30
|
|
|
@hook_logs ||= hook.web_hook_logs.recent.page(params[:page])
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
2022-08-13 15:12:31 +05:30
|
|
|
def hook_param_names
|
|
|
|
%i[enable_ssl_verification token url]
|
|
|
|
end
|
|
|
|
|
|
|
|
def trigger_values
|
|
|
|
SystemHook.triggers.values
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|