Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bd1261cb
Commit
bd1261cb
authored
Dec 08, 2020
by
Sarah Yasonik
Committed by
Michael Kozono
Dec 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show alert management list when there are active alerts
parent
ecc20f06
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
50 deletions
+44
-50
app/helpers/projects/alert_management_helper.rb
app/helpers/projects/alert_management_helper.rb
+1
-1
changelogs/unreleased/sy-ensure-alerts-viewable-if-present.yml
...elogs/unreleased/sy-ensure-alerts-viewable-if-present.yml
+6
-0
spec/features/alert_management/alert_management_list_spec.rb
spec/features/alert_management/alert_management_list_spec.rb
+27
-27
spec/helpers/projects/alert_management_helper_spec.rb
spec/helpers/projects/alert_management_helper_spec.rb
+10
-22
No files found.
app/helpers/projects/alert_management_helper.rb
View file @
bd1261cb
...
...
@@ -28,7 +28,7 @@ module Projects::AlertManagementHelper
def
alert_management_enabled?
(
project
)
!!
(
project
.
alert
s_service_activated
?
||
project
.
alert
_management_alerts
.
any
?
||
project
.
prometheus_service_active?
||
AlertManagement
::
HttpIntegrationsFinder
.
new
(
project
,
active:
true
).
execute
.
any?
)
...
...
changelogs/unreleased/sy-ensure-alerts-viewable-if-present.yml
0 → 100644
View file @
bd1261cb
---
title
:
Allow alert list to be visible when alerts exist, even if alerting integrations
are disabled
merge_request
:
49257
author
:
type
:
changed
spec/features/alert_management/alert_management_list_spec.rb
View file @
bd1261cb
...
...
@@ -5,54 +5,54 @@ require 'spec_helper'
RSpec
.
describe
'Alert Management index'
,
:js
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:developer
)
{
create
(
:user
)
}
let_it_be
(
:alert
)
{
create
(
:alert_management_alert
,
project:
project
,
status:
'triggered'
)
}
before_all
do
project
.
add_developer
(
developer
)
end
before
do
sign_in
(
developer
)
context
'when a developer displays the alert list'
do
before
do
sign_in
(
developer
)
visit
project_alert_management_index_path
(
project
)
wait_for_requests
end
context
'when a developer displays the alert list and alert integrations are not enabled'
do
it
'shows the alert page title'
do
expect
(
page
).
to
have_content
(
'Alerts'
)
visit
project_alert_management_index_path
(
project
)
wait_for_requests
end
it
'shows the empty state by default'
do
it
'shows the alert page title and empty state without filtered search or alert table'
do
expect
(
page
).
to
have_content
(
'Alerts'
)
expect
(
page
).
to
have_content
(
'Surface alerts in GitLab'
)
end
it
'does not show the filtered search'
do
expect
(
page
).
not_to
have_selector
(
'.gl-table'
)
page
.
within
(
'.layout-page'
)
do
expect
(
page
).
not_to
have_css
(
'[data-testid="search-icon"]'
)
end
end
it
'does not show the alert table'
do
expect
(
page
).
not_to
have_selector
(
'.gl-table'
)
shared_examples
'alert page with title, filtered search, and table'
do
it
'renders correctly'
do
expect
(
page
).
to
have_content
(
'Alerts'
)
expect
(
page
).
to
have_selector
(
'.gl-table'
)
page
.
within
(
'.layout-page'
)
do
expect
(
page
).
to
have_css
(
'[data-testid="search-icon"]'
)
end
end
end
end
context
'when a developer displays the alert list and an HTTP integration is enabl
ed'
do
let_it_be
(
:integration
)
{
create
(
:alert_management_http_integration
,
project:
project
)
}
context
'when alerts have already been creat
ed'
do
let_it_be
(
:alert
)
{
create
(
:alert_management_alert
,
project:
project
)
}
it
'shows the alert page title'
do
expect
(
page
).
to
have_content
(
'Alerts'
)
it_behaves_like
'alert page with title, filtered search, and table'
end
it
'shows the filtered search
'
do
page
.
within
(
'.layout-page'
)
do
expect
(
page
).
to
have_css
(
'[data-testid="search-icon"]'
)
end
context
'when an HTTP integration is enabled
'
do
let_it_be
(
:integration
)
{
create
(
:alert_management_http_integration
,
project:
project
)
}
it_behaves_like
'alert page with title, filtered search, and table'
end
it
'shows the alert table'
do
expect
(
page
).
to
have_selector
(
'.gl-table'
)
context
'when the prometheus integration is enabled'
do
let_it_be
(
:integration
)
{
create
(
:prometheus_service
,
project:
project
)
}
it_behaves_like
'alert page with title, filtered search, and table'
end
end
end
spec/helpers/projects/alert_management_helper_spec.rb
View file @
bd1261cb
...
...
@@ -39,28 +39,6 @@ RSpec.describe Projects::AlertManagementHelper do
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
'with prometheus service'
do
let_it_be
(
:prometheus_service
)
{
create
(
:prometheus_service
,
project:
project
)
}
...
...
@@ -105,6 +83,16 @@ RSpec.describe Projects::AlertManagementHelper do
end
end
context
'with an alert'
do
let_it_be
(
:alert
)
{
create
(
:alert_management_alert
,
project:
project
)
}
it
'enables alert management'
do
expect
(
data
).
to
include
(
'alert-management-enabled'
=>
'true'
)
end
end
context
'when user does not have requisite enablement permissions'
do
let
(
:user_can_enable_alert_management
)
{
false
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment