2019-01-11 22:52:26 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Projects::ErrorTrackingHelper
|
2019-09-05 21:17:36 +00:00
|
|
|
def error_tracking_data(current_user, project)
|
2019-01-11 22:52:26 +00:00
|
|
|
error_tracking_enabled = !!project.error_tracking_setting&.enabled?
|
|
|
|
|
|
|
|
{
|
|
|
|
'index-path' => project_error_tracking_index_path(project,
|
|
|
|
format: :json),
|
2019-09-05 21:17:36 +00:00
|
|
|
'user-can-enable-error-tracking' => can?(current_user, :admin_operations, project).to_s,
|
2019-01-11 22:52:26 +00:00
|
|
|
'enable-error-tracking-link' => project_settings_operations_path(project),
|
|
|
|
'error-tracking-enabled' => error_tracking_enabled.to_s,
|
2020-01-17 03:09:17 +00:00
|
|
|
'project-path' => project.full_path,
|
|
|
|
'list-path' => project_error_tracking_index_path(project),
|
2019-01-11 22:52:26 +00:00
|
|
|
'illustration-path' => image_path('illustrations/cluster_popover.svg')
|
|
|
|
}
|
|
|
|
end
|
2019-11-08 21:06:38 +00:00
|
|
|
|
2019-11-19 03:06:07 +00:00
|
|
|
def error_details_data(project, issue_id)
|
|
|
|
opts = [project, issue_id, { format: :json }]
|
2019-11-08 21:06:38 +00:00
|
|
|
|
|
|
|
{
|
2020-01-14 12:07:41 +00:00
|
|
|
'issue-id' => issue_id,
|
|
|
|
'project-path' => project.full_path,
|
2019-11-19 03:06:07 +00:00
|
|
|
'issue-details-path' => details_project_error_tracking_index_path(*opts),
|
2020-01-09 21:07:48 +00:00
|
|
|
'issue-update-path' => update_project_error_tracking_index_path(*opts),
|
2020-01-14 12:07:41 +00:00
|
|
|
'project-issues-path' => project_issues_path(project),
|
2019-11-19 03:06:07 +00:00
|
|
|
'issue-stack-trace-path' => stack_trace_project_error_tracking_index_path(*opts)
|
2019-11-08 21:06:38 +00:00
|
|
|
}
|
|
|
|
end
|
2019-01-11 22:52:26 +00:00
|
|
|
end
|