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
935b2655
Commit
935b2655
authored
Oct 04, 2019
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change alert list type
Change the type of alert details list from bulleted to description list
parent
98344b6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
ee/app/presenters/projects/prometheus/alert_presenter.rb
ee/app/presenters/projects/prometheus/alert_presenter.rb
+8
-7
ee/spec/presenters/projects/prometheus/alert_presenter_spec.rb
...ec/presenters/projects/prometheus/alert_presenter_spec.rb
+4
-6
No files found.
ee/app/presenters/projects/prometheus/alert_presenter.rb
View file @
935b2655
...
...
@@ -4,6 +4,7 @@ module Projects
module
Prometheus
class
AlertPresenter
<
Gitlab
::
View
::
Presenter
::
Delegated
RESERVED_ANNOTATIONS
=
%w(gitlab_incident_markdown)
.
freeze
MARKDOWN_LINE_BREAK
=
"
\n
"
.
freeze
def
full_title
[
environment_name
,
alert_title
].
compact
.
join
(
': '
)
...
...
@@ -57,10 +58,10 @@ module Projects
def
metadata_list
metadata
=
[]
metadata
<<
bullet
(
'starts_at'
,
starts_at
)
if
starts_at
metadata
<<
bullet
(
'full_query'
,
backtick
(
full_query
))
if
full_query
metadata
<<
list_item
(
'starts_at'
,
starts_at
)
if
starts_at
metadata
<<
list_item
(
'full_query'
,
backtick
(
full_query
))
if
full_query
metadata
.
join
(
"
\n
"
)
metadata
.
join
(
MARKDOWN_LINE_BREAK
)
end
def
alert_details
...
...
@@ -78,13 +79,13 @@ module Projects
strong_memoize
(
:annotation_list
)
do
annotations
.
reject
{
|
annotation
|
RESERVED_ANNOTATIONS
.
include?
(
annotation
.
label
)
}
.
map
{
|
annotation
|
bullet
(
annotation
.
label
,
annotation
.
value
)
}
.
join
(
"
\n
"
)
.
map
{
|
annotation
|
list_item
(
annotation
.
label
,
annotation
.
value
)
}
.
join
(
MARKDOWN_LINE_BREAK
)
end
end
def
bullet
(
key
,
value
)
"*
#{
key
}
:
#{
value
}
"
def
list_item
(
key
,
value
)
"*
*
#{
key
}
:**
#{
value
}
"
.
strip
end
def
backtick
(
value
)
...
...
ee/spec/presenters/projects/prometheus/alert_presenter_spec.rb
View file @
935b2655
...
...
@@ -45,7 +45,7 @@ describe Projects::Prometheus::AlertPresenter do
<<~
MARKDOWN
.
chomp
#### Summary
*
starts_at:
#{
presenter
.
starts_at
}
*
*starts_at:**
#{
presenter
.
starts_at
}
MARKDOWN
)
...
...
@@ -62,12 +62,11 @@ describe Projects::Prometheus::AlertPresenter do
<<~
MARKDOWN
.
chomp
#### Summary
*
starts_at:
#{
presenter
.
starts_at
}
*
*starts_at:**
#{
presenter
.
starts_at
}
#### Alert Details
* foo: value1
* bar: value2
**foo:** value1
\n
**bar:** value2
MARKDOWN
)
end
...
...
@@ -83,8 +82,7 @@ describe Projects::Prometheus::AlertPresenter do
<<~
MARKDOWN
.
chomp
#### Summary
* starts_at:
#{
presenter
.
starts_at
}
* full_query: `query`
**starts_at:**
#{
presenter
.
starts_at
}
\n
**full_query:** `query`
MARKDOWN
)
...
...
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