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
ae1c2a0f
Commit
ae1c2a0f
authored
May 14, 2020
by
Olena Horal-Koretska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Organize alerts by status in list view (BE integration)
parent
485ac579
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
29 deletions
+18
-29
app/assets/javascripts/alert_management/components/alert_management_list.vue
...pts/alert_management/components/alert_management_list.vue
+3
-8
app/assets/javascripts/alert_management/constants.js
app/assets/javascripts/alert_management/constants.js
+10
-5
app/assets/javascripts/alert_management/graphql/queries/getAlerts.query.graphql
.../alert_management/graphql/queries/getAlerts.query.graphql
+2
-2
spec/frontend/alert_management/components/alert_management_list_spec.js
...alert_management/components/alert_management_list_spec.js
+0
-11
spec/frontend/alert_management/mocks/alerts.json
spec/frontend/alert_management/mocks/alerts.json
+3
-3
No files found.
app/assets/javascripts/alert_management/components/alert_management_list.vue
View file @
ae1c2a0f
...
...
@@ -10,7 +10,6 @@ import {
GlDropdownItem
,
GlTabs
,
GlTab
,
GlBadge
,
}
from
'
@gitlab/ui
'
;
import
createFlash
from
'
~/flash
'
;
import
{
s__
}
from
'
~/locale
'
;
...
...
@@ -87,7 +86,6 @@ export default {
GlIcon
,
GlTabs
,
GlTab
,
GlBadge
,
},
mixins
:
[
glFeatureFlagsMixin
()],
props
:
{
...
...
@@ -118,7 +116,7 @@ export default {
variables
()
{
return
{
projectPath
:
this
.
projectPath
,
status
:
this
.
statusFilter
,
status
es
:
this
.
statusFilter
,
};
},
update
(
data
)
{
...
...
@@ -135,7 +133,7 @@ export default {
errored
:
false
,
isAlertDismissed
:
false
,
isErrorAlertDismissed
:
false
,
statusFilter
:
this
.
$options
.
statusTabs
[
0
].
statu
s
,
statusFilter
:
this
.
$options
.
statusTabs
[
4
].
filter
s
,
};
},
computed
:
{
...
...
@@ -151,7 +149,7 @@ export default {
},
methods
:
{
filterALertsByStatus
(
tabIndex
)
{
this
.
statusFilter
=
this
.
$options
.
statusTabs
[
tabIndex
].
statu
s
;
this
.
statusFilter
=
this
.
$options
.
statusTabs
[
tabIndex
].
filter
s
;
},
capitalizeFirstCharacter
,
updateAlertStatus
(
status
,
iid
)
{
...
...
@@ -190,9 +188,6 @@ export default {
<gl-tab
v-for=
"tab in $options.statusTabs"
:key=
"tab.status"
>
<template
slot=
"title"
>
<span>
{{
tab
.
title
}}
</span>
<gl-badge
v-if=
"alerts"
size=
"sm"
class=
"gl-tab-counter-badge"
>
{{
alerts
.
length
}}
</gl-badge>
</
template
>
</gl-tab>
</gl-tabs>
...
...
app/assets/javascripts/alert_management/constants.js
View file @
ae1c2a0f
...
...
@@ -10,32 +10,37 @@ export const ALERTS_SEVERITY_LABELS = {
};
export
const
ALERTS_STATUS
=
{
OPEN
:
'
open
'
,
TRIGGERED
:
'
triggered
'
,
ACKNOWLEDGED
:
'
acknowledged
'
,
RESOLVED
:
'
resolved
'
,
ALL
:
'
all
'
,
OPEN
:
'
OPEN
'
,
TRIGGERED
:
'
TRIGGERED
'
,
ACKNOWLEDGED
:
'
ACKNOWLEDGED
'
,
RESOLVED
:
'
RESOLVED
'
,
ALL
:
'
ALL
'
,
};
export
const
ALERTS_STATUS_TABS
=
[
{
title
:
s__
(
'
AlertManagement|Open
'
),
status
:
ALERTS_STATUS
.
OPEN
,
filters
:
[
ALERTS_STATUS
.
TRIGGERED
,
ALERTS_STATUS
.
ACKNOWLEDGED
],
},
{
title
:
s__
(
'
AlertManagement|Triggered
'
),
status
:
ALERTS_STATUS
.
TRIGGERED
,
filters
:
[
ALERTS_STATUS
.
TRIGGERED
],
},
{
title
:
s__
(
'
AlertManagement|Acknowledged
'
),
status
:
ALERTS_STATUS
.
ACKNOWLEDGED
,
filters
:
[
ALERTS_STATUS
.
ACKNOWLEDGED
],
},
{
title
:
s__
(
'
AlertManagement|Resolved
'
),
status
:
ALERTS_STATUS
.
RESOLVED
,
filters
:
[
ALERTS_STATUS
.
RESOLVED
],
},
{
title
:
s__
(
'
AlertManagement|All alerts
'
),
status
:
ALERTS_STATUS
.
ALL
,
filters
:
[
ALERTS_STATUS
.
TRIGGERED
,
ALERTS_STATUS
.
ACKNOWLEDGED
,
ALERTS_STATUS
.
RESOLVED
],
},
];
app/assets/javascripts/alert_management/graphql/queries/getAlerts.query.graphql
View file @
ae1c2a0f
#import "../fragments/listItem.fragment.graphql"
query
getAlerts
(
$projectPath
:
ID
!)
{
query
getAlerts
(
$projectPath
:
ID
!
,
$statuses
:
[
AlertManagementStatus
!]
)
{
project
(
fullPath
:
$projectPath
)
{
alertManagementAlerts
{
alertManagementAlerts
(
statuses
:
$statuses
)
{
nodes
{
...
AlertListItem
}
...
...
spec/frontend/alert_management/components/alert_management_list_spec.js
View file @
ae1c2a0f
...
...
@@ -5,7 +5,6 @@ import {
GlAlert
,
GlLoadingIcon
,
GlDropdown
,
GlBadge
,
GlIcon
,
GlTab
,
GlDropdownItem
,
...
...
@@ -28,7 +27,6 @@ describe('AlertManagementList', () => {
const
findLoader
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
const
findStatusDropdown
=
()
=>
wrapper
.
find
(
GlDropdown
);
const
findStatusFilterTabs
=
()
=>
wrapper
.
findAll
(
GlTab
);
const
findNumberOfAlertsBadge
=
()
=>
wrapper
.
findAll
(
GlBadge
);
const
findDateFields
=
()
=>
wrapper
.
findAll
(
TimeAgo
);
const
findFirstStatusOption
=
()
=>
findStatusDropdown
().
find
(
GlDropdownItem
);
const
findSeverityFields
=
()
=>
wrapper
.
findAll
(
'
[data-testid="severityField"]
'
);
...
...
@@ -106,15 +104,6 @@ describe('AlertManagementList', () => {
expect
(
tab
.
text
()).
toContain
(
ALERTS_STATUS_TABS
[
i
].
title
);
});
});
it
(
'
should have number of items badge along with status tab
'
,
()
=>
{
expect
(
findNumberOfAlertsBadge
().
length
).
toEqual
(
ALERTS_STATUS_TABS
.
length
);
expect
(
findNumberOfAlertsBadge
()
.
at
(
0
)
.
text
(),
).
toEqual
(
`
${
mockAlerts
.
length
}
`
);
});
});
describe
(
'
alertListStatusFilteringEnabled feature flag disabled
'
,
()
=>
{
...
...
spec/frontend/alert_management/mocks/alerts.json
View file @
ae1c2a0f
...
...
@@ -6,7 +6,7 @@
"eventCount"
:
7
,
"startedAt"
:
"2020-04-17T23:18:14.996Z"
,
"endedAt"
:
"2020-04-17T23:18:14.996Z"
,
"status"
:
"
triggered
"
"status"
:
"
TRIGGERED
"
},
{
"iid"
:
"1527543"
,
...
...
@@ -15,7 +15,7 @@
"eventCount"
:
1
,
"startedAt"
:
"2020-04-17T23:18:14.996Z"
,
"endedAt"
:
"2020-04-17T23:18:14.996Z"
,
"status"
:
"
acknowledged
"
"status"
:
"
ACKNOWLEDGED
"
},
{
"iid"
:
"1527544"
,
...
...
@@ -24,6 +24,6 @@
"eventCount"
:
4
,
"startedAt"
:
"2020-04-17T23:18:14.996Z"
,
"endedAt"
:
"2020-04-17T23:18:14.996Z"
,
"status"
:
"
resolved
"
"status"
:
"
RESOLVED
"
}
]
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