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
c278fe9e
Commit
c278fe9e
authored
Dec 04, 2020
by
syasonik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redunant/incorrect initial alert service values
parent
1588893c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
44 deletions
+8
-44
app/helpers/operations_helper.rb
app/helpers/operations_helper.rb
+0
-10
app/views/projects/settings/operations/show.html.haml
app/views/projects/settings/operations/show.html.haml
+1
-1
ee/app/helpers/ee/operations_helper.rb
ee/app/helpers/ee/operations_helper.rb
+6
-0
spec/helpers/operations_helper_spec.rb
spec/helpers/operations_helper_spec.rb
+1
-33
No files found.
app/helpers/operations_helper.rb
View file @
c278fe9e
...
...
@@ -9,24 +9,14 @@ module OperationsHelper
end
end
def
alerts_service
strong_memoize
(
:alerts_service
)
do
@project
.
find_or_initialize_service
(
::
AlertsService
.
to_param
)
end
end
def
alerts_settings_data
(
disabled:
false
)
{
'prometheus_activated'
=>
prometheus_service
.
manual_configuration?
.
to_s
,
'activated'
=>
alerts_service
.
activated?
.
to_s
,
'prometheus_form_path'
=>
scoped_integration_path
(
prometheus_service
),
'form_path'
=>
scoped_integration_path
(
alerts_service
),
'prometheus_reset_key_path'
=>
reset_alerting_token_project_settings_operations_path
(
@project
),
'prometheus_authorization_key'
=>
@project
.
alerting_setting
&
.
token
,
'prometheus_api_url'
=>
prometheus_service
.
api_url
,
'authorization_key'
=>
alerts_service
.
token
,
'prometheus_url'
=>
notify_project_prometheus_alerts_url
(
@project
,
format: :json
),
'url'
=>
alerts_service
.
url
,
'alerts_setup_url'
=>
help_page_path
(
'operations/incident_management/alert_integrations.md'
,
anchor:
'generic-http-endpoint'
),
'alerts_usage_url'
=>
project_alert_management_index_path
(
@project
),
'disabled'
=>
disabled
.
to_s
,
...
...
app/views/projects/settings/operations/show.html.haml
View file @
c278fe9e
...
...
@@ -2,7 +2,7 @@
-
page_title
_
(
'Operations Settings'
)
-
breadcrumb_title
_
(
'Operations Settings'
)
=
render
'projects/settings/operations/alert_management'
,
alerts_service:
alerts_service
,
prometheus_service:
prometheus_service
=
render
'projects/settings/operations/alert_management'
=
render
'projects/settings/operations/incidents'
=
render
'projects/settings/operations/error_tracking'
=
render
'projects/settings/operations/prometheus'
,
service:
prometheus_service
if
Feature
.
enabled?
(
:settings_operations_prometheus_service
)
...
...
ee/app/helpers/ee/operations_helper.rb
View file @
c278fe9e
...
...
@@ -47,6 +47,12 @@ module EE
private
def
alerts_service
strong_memoize
(
:alerts_service
)
do
@project
.
find_or_initialize_service
(
::
AlertsService
.
to_param
)
end
end
def
incident_sla_data
setting
=
project_incident_management_setting
...
...
spec/helpers/operations_helper_spec.rb
View file @
c278fe9e
...
...
@@ -21,20 +21,15 @@ RSpec.describe OperationsHelper do
end
context
'initial service configuration'
do
let_it_be
(
:alerts_service
)
{
AlertsService
.
new
(
project:
project
)
}
let_it_be
(
:prometheus_service
)
{
PrometheusService
.
new
(
project:
project
)
}
before
do
allow
(
project
).
to
receive
(
:find_or_initialize_service
).
with
(
'alerts'
).
and_return
(
alerts_service
)
allow
(
project
).
to
receive
(
:find_or_initialize_service
).
and_call_original
allow
(
project
).
to
receive
(
:find_or_initialize_service
).
with
(
'prometheus'
).
and_return
(
prometheus_service
)
end
it
'returns the correct values'
do
expect
(
subject
).
to
eq
(
'activated'
=>
'false'
,
'url'
=>
alerts_service
.
url
,
'authorization_key'
=>
nil
,
'form_path'
=>
project_service_path
(
project
,
alerts_service
),
'alerts_setup_url'
=>
help_page_path
(
'operations/incident_management/alert_integrations.md'
,
anchor:
'generic-http-endpoint'
),
'alerts_usage_url'
=>
project_alert_management_index_path
(
project
),
'prometheus_form_path'
=>
project_service_path
(
project
,
prometheus_service
),
...
...
@@ -104,33 +99,6 @@ RSpec.describe OperationsHelper do
end
end
end
context
'with generic alerts service configured'
do
let_it_be
(
:alerts_service
)
{
create
(
:alerts_service
,
project:
project
)
}
context
'with generic alerts enabled'
do
it
'returns the correct values'
do
expect
(
subject
).
to
include
(
'activated'
=>
'true'
,
'authorization_key'
=>
alerts_service
.
token
,
'url'
=>
alerts_service
.
url
)
end
end
context
'with generic alerts disabled'
do
before
do
alerts_service
.
update!
(
active:
false
)
end
it
'returns the correct values'
do
expect
(
subject
).
to
include
(
'activated'
=>
'false'
,
'authorization_key'
=>
alerts_service
.
token
)
end
end
end
end
describe
'#operations_settings_data'
do
...
...
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