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
bd0b294f
Commit
bd0b294f
authored
Jul 16, 2019
by
syasonik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move parsing to alert
parent
b0e8eb82
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
4 deletions
+16
-4
ee/app/presenters/projects/prometheus/alert_presenter.rb
ee/app/presenters/projects/prometheus/alert_presenter.rb
+0
-4
ee/lib/gitlab/alerting/alert.rb
ee/lib/gitlab/alerting/alert.rb
+10
-0
ee/spec/lib/gitlab/alerting/alert_spec.rb
ee/spec/lib/gitlab/alerting/alert_spec.rb
+6
-0
No files found.
ee/app/presenters/projects/prometheus/alert_presenter.rb
View file @
bd0b294f
...
...
@@ -42,10 +42,6 @@ module Projects
MARKDOWN
end
def
alert_markdown
annotations
.
find
{
|
annotation
|
annotation
.
label
==
'gitlab_incident_markdown'
}
&
.
value
end
private
def
alert_title
...
...
ee/lib/gitlab/alerting/alert.rb
View file @
bd0b294f
...
...
@@ -49,6 +49,12 @@ module Gitlab
end
end
def
alert_markdown
strong_memoize
(
:alert_markdown
)
do
parse_alert_markdown_from_payload
end
end
def
valid?
project
&&
title
&&
starts_at
end
...
...
@@ -105,6 +111,10 @@ module Gitlab
Rack
::
Utils
.
parse_query
(
uri
.
query
).
fetch
(
'g0.expr'
)
rescue
URI
::
InvalidURIError
,
KeyError
end
def
parse_alert_markdown_from_payload
payload
&
.
dig
(
'annotations'
,
'gitlab_incident_markdown'
)
end
end
end
end
ee/spec/lib/gitlab/alerting/alert_spec.rb
View file @
bd0b294f
...
...
@@ -189,6 +189,12 @@ describe Gitlab::Alerting::Alert do
end
end
describe
'#alert_markdown'
do
subject
{
alert
.
alert_markdown
}
it_behaves_like
'parse payload'
,
'annotations/gitlab_incident_markdown'
end
describe
'#valid?'
do
before
do
payload
.
update
(
...
...
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