Commit b3659866 authored by Sarah Yasonik's avatar Sarah Yasonik Committed by Peter Leitzen

Enable alert management for configured http integrations

parent 0b30d88d
...@@ -27,7 +27,11 @@ module Projects::AlertManagementHelper ...@@ -27,7 +27,11 @@ module Projects::AlertManagementHelper
private private
def alert_management_enabled?(project) def alert_management_enabled?(project)
!!(project.alerts_service_activated? || project.prometheus_service_active?) !!(
project.alerts_service_activated? ||
project.prometheus_service_active? ||
AlertManagement::HttpIntegrationsFinder.new(project, active: true).execute.any?
)
end end
end end
......
---
title: Ensure Alerts list loads when only HTTP integrations are enabled
merge_request: 48247
author:
type: fixed
...@@ -18,7 +18,7 @@ RSpec.describe 'Alert Management index', :js do ...@@ -18,7 +18,7 @@ RSpec.describe 'Alert Management index', :js do
wait_for_requests wait_for_requests
end end
context 'when a developer displays the alert list and the alert service is not enabled' do context 'when a developer displays the alert list and alert integrations are not enabled' do
it 'shows the alert page title' do it 'shows the alert page title' do
expect(page).to have_content('Alerts') expect(page).to have_content('Alerts')
end end
...@@ -38,8 +38,8 @@ RSpec.describe 'Alert Management index', :js do ...@@ -38,8 +38,8 @@ RSpec.describe 'Alert Management index', :js do
end end
end end
context 'when a developer displays the alert list and the alert service is enabled' do context 'when a developer displays the alert list and an HTTP integration is enabled' do
let_it_be(:alerts_service) { create(:alerts_service, project: project) } let_it_be(:integration) { create(:alert_management_http_integration, project: project) }
it 'shows the alert page title' do it 'shows the alert page title' do
expect(page).to have_content('Alerts') expect(page).to have_content('Alerts')
......
...@@ -83,6 +83,28 @@ RSpec.describe Projects::AlertManagementHelper do ...@@ -83,6 +83,28 @@ RSpec.describe Projects::AlertManagementHelper do
end end
end end
context 'with http integration' do
let_it_be(:integration) { create(:alert_management_http_integration, project: project) }
context 'when integration is active' do
it 'enables alert management' do
expect(data).to include(
'alert-management-enabled' => 'true'
)
end
end
context 'when integration is inactive' do
it 'disables alert management' do
integration.update!(active: false)
expect(data).to include(
'alert-management-enabled' => 'false'
)
end
end
end
context 'when user does not have requisite enablement permissions' do context 'when user does not have requisite enablement permissions' do
let(:user_can_enable_alert_management) { false } let(:user_can_enable_alert_management) { false }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment