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
d944db54
Commit
d944db54
authored
Apr 08, 2020
by
Gilang Gumilar
Committed by
Natalia Tepluhina
Apr 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pre-populate prometheus alert modal
parent
6a933340
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
0 deletions
+24
-0
ee/app/assets/javascripts/monitoring/components/alert_widget.vue
...assets/javascripts/monitoring/components/alert_widget.vue
+4
-0
ee/app/assets/javascripts/monitoring/components/alert_widget_form.vue
...s/javascripts/monitoring/components/alert_widget_form.vue
+6
-0
ee/changelogs/unreleased/212596-pre-populate-prometheus-alert-modal.yml
...unreleased/212596-pre-populate-prometheus-alert-modal.yml
+5
-0
ee/spec/frontend/monitoring/components/alert_widget_form_spec.js
.../frontend/monitoring/components/alert_widget_form_spec.js
+9
-0
No files found.
ee/app/assets/javascripts/monitoring/components/alert_widget.vue
View file @
d944db54
...
...
@@ -104,6 +104,9 @@ export default {
formattedFiringAlerts
()
{
return
this
.
firingAlerts
.
map
(
alert
=>
this
.
formatAlertSummary
(
alert
.
alert_path
));
},
configuredAlert
()
{
return
this
.
hasAlerts
?
values
(
this
.
alertsToManage
)[
0
].
metricId
:
''
;
},
},
created
()
{
this
.
service
=
new
AlertsService
({
alertsEndpoint
:
this
.
alertsEndpoint
});
...
...
@@ -271,6 +274,7 @@ export default {
:alerts-to-manage=
"alertsToManage"
:relevant-queries=
"relevantQueries"
:error-message=
"errorMessage"
:configured-alert=
"configuredAlert"
:modal-id=
"modalId"
@
create=
"handleCreate"
@
update=
"handleUpdate"
...
...
ee/app/assets/javascripts/monitoring/components/alert_widget_form.vue
View file @
d944db54
...
...
@@ -61,6 +61,11 @@ export default {
required
:
false
,
default
:
''
,
},
configuredAlert
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
alertsToManage
:
{
type
:
Object
,
required
:
false
,
...
...
@@ -207,6 +212,7 @@ export default {
:ok-disabled=
"formDisabled"
@
ok=
"handleSubmit"
@
hidden=
"handleHidden"
@
shown=
"selectQuery(configuredAlert)"
>
<div
v-if=
"errorMessage"
class=
"alert-modal-message danger_message"
>
{{
errorMessage
}}
</div>
<div
class=
"alert-form"
>
...
...
ee/changelogs/unreleased/212596-pre-populate-prometheus-alert-modal.yml
0 → 100644
View file @
d944db54
---
title
:
Pre-populate prometheus alert modal
merge_request
:
28291
author
:
Gilang Gumilar
type
:
added
ee/spec/frontend/monitoring/components/alert_widget_form_spec.js
View file @
d944db54
...
...
@@ -26,6 +26,7 @@ describe('AlertWidgetForm', () => {
alertsToManage
:
{
alert
:
{
alert_path
:
alertPath
,
operator
:
'
<
'
,
threshold
:
5
,
metricId
},
},
configuredAlert
:
metricId
,
};
function
createComponent
(
props
=
{})
{
...
...
@@ -118,6 +119,14 @@ describe('AlertWidgetForm', () => {
expect
(
wrapper
.
vm
.
prometheusMetricId
).
toBe
(
null
);
});
it
(
'
sets selectedAlert to the provided configuredAlert on modal show
'
,
()
=>
{
createComponent
(
propsWithAlertData
);
modal
().
vm
.
$emit
(
'
shown
'
);
expect
(
wrapper
.
vm
.
selectedAlert
).
toEqual
(
propsWithAlertData
.
alertsToManage
[
alertPath
]);
});
describe
(
'
with existing alert
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
(
propsWithAlertData
);
...
...
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