blob: 7c71486a765a376a28d3877f5cf32144eda86377 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# frozen_string_literal: true
module Projects
module Settings
class OperationsController < Projects::ApplicationController
before_action :authorize_admin_operations!
helper_method :error_tracking_setting
def show
end
def update
result = ::Projects::Operations::UpdateService.new(project, current_user, update_params).execute
render_update_response(result)
end
private
# overridden in EE
def render_update_response(result)
respond_to do |format|
format.json do
render_update_json_response(result)
end
end
end
def render_update_json_response(result)
if result[:status] == :success
flash[:notice] = _('Your changes have been saved')
render json: {
status: result[:status]
}
else
render(
status: result[:http_status] || :bad_request,
json: {
status: result[:status],
message: result[:message]
}
)
end
end
def error_tracking_setting
@error_tracking_setting ||= project.error_tracking_setting ||
project.build_error_tracking_setting
end
def update_params
params.require(:project).permit(permitted_project_params)
end
# overridden in EE
def permitted_project_params
{
metrics_setting_attributes: [:external_dashboard_url],
error_tracking_setting_attributes: [
:enabled,
:api_host,
:token,
project: [:slug, :name, :organization_slug, :organization_name]
]
}
end
end
end
end
Projects::Settings::OperationsController.prepend_if_ee('::EE::Projects::Settings::OperationsController')
|