2020-04-21 11:21:10 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Projects::AlertManagementHelper
|
2020-04-27 14:09:41 -04:00
|
|
|
def alert_management_data(current_user, project)
|
2020-04-21 11:21:10 -04:00
|
|
|
{
|
2020-04-30 08:09:45 -04:00
|
|
|
'project-path' => project.full_path,
|
2020-05-07 20:09:56 -04:00
|
|
|
'enable-alert-management-path' => edit_project_service_path(project, AlertsService),
|
2020-04-27 14:09:41 -04:00
|
|
|
'empty-alert-svg-path' => image_path('illustrations/alert-management-empty-state.svg'),
|
2020-05-07 20:09:56 -04:00
|
|
|
'user-can-enable-alert-management' => can?(current_user, :admin_project, project).to_s,
|
2020-05-08 05:09:39 -04:00
|
|
|
'alert-management-enabled' => (!!project.alerts_service_activated?).to_s
|
2020-04-21 11:21:10 -04:00
|
|
|
}
|
|
|
|
end
|
2020-05-06 11:09:42 -04:00
|
|
|
|
2020-05-08 14:09:55 -04:00
|
|
|
def alert_management_detail_data(project, alert_id)
|
2020-05-06 11:09:42 -04:00
|
|
|
{
|
|
|
|
'alert-id' => alert_id,
|
2020-05-08 14:09:55 -04:00
|
|
|
'project-path' => project.full_path,
|
2020-05-20 20:08:06 -04:00
|
|
|
'project-issues-path' => project_issues_path(project)
|
2020-05-06 11:09:42 -04:00
|
|
|
}
|
|
|
|
end
|
2020-04-21 11:21:10 -04:00
|
|
|
end
|