Commit e47f8abd authored by Stan Hu's avatar Stan Hu

Merge branch 'tr-show-alert-management-splash-page' into 'master'

Show Alerts list when Alert Service is enabled

Closes #215573

See merge request gitlab-org/gitlab!31177
parents 0ba3099a a8943143
......@@ -7,7 +7,7 @@ module Projects::AlertManagementHelper
'enable-alert-management-path' => edit_project_service_path(project, AlertsService),
'empty-alert-svg-path' => image_path('illustrations/alert-management-empty-state.svg'),
'user-can-enable-alert-management' => can?(current_user, :admin_project, project).to_s,
'alert-management-enabled' => Feature.enabled?(:alert_management_minimal, project).to_s
'alert-management-enabled' => (!!project.alerts_service_activated?).to_s
}
end
......
......@@ -13,6 +13,8 @@ describe Projects::AlertManagementHelper do
let(:user_can_enable_alert_management) { true }
let(:setting_path) { edit_project_service_path(project, AlertsService) }
subject(:data) { helper.alert_management_data(current_user, project) }
before do
allow(helper)
.to receive(:can?)
......@@ -27,11 +29,33 @@ describe Projects::AlertManagementHelper do
'enable-alert-management-path' => setting_path,
'empty-alert-svg-path' => match_asset_path('/assets/illustrations/alert-management-empty-state.svg'),
'user-can-enable-alert-management' => 'true',
'alert-management-enabled' => 'true'
'alert-management-enabled' => 'false'
)
end
end
context 'with alerts service' do
let_it_be(:alerts_service) { create(:alerts_service, project: project) }
context 'when alerts service is active' do
it 'enables alert management' do
expect(data).to include(
'alert-management-enabled' => 'true'
)
end
end
context 'when alerts service is inactive' do
it 'disables alert management' do
alerts_service.update(active: false)
expect(data).to include(
'alert-management-enabled' => 'false'
)
end
end
end
context 'when user does not have requisite enablement permissions' do
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