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
a0a68df1
Commit
a0a68df1
authored
Feb 23, 2021
by
Alexander Turinske
Committed by
David O'Regan
Feb 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add event count column to threat alerts
- add event count column - update tests - add expanded wrapper to tests
parent
4caab3a8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
33 deletions
+62
-33
ee/app/assets/javascripts/threat_monitoring/components/alerts/alerts_list.vue
...ripts/threat_monitoring/components/alerts/alerts_list.vue
+6
-0
ee/app/assets/javascripts/threat_monitoring/components/alerts/constants.js
...ascripts/threat_monitoring/components/alerts/constants.js
+7
-0
ee/changelogs/unreleased/299031-alert-events-column.yml
ee/changelogs/unreleased/299031-alert-events-column.yml
+5
-0
ee/spec/frontend/threat_monitoring/components/alerts/alerts_list_spec.js
...d/threat_monitoring/components/alerts/alerts_list_spec.js
+37
-33
ee/spec/frontend/threat_monitoring/mock_data.js
ee/spec/frontend/threat_monitoring/mock_data.js
+4
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
ee/app/assets/javascripts/threat_monitoring/components/alerts/alerts_list.vue
View file @
a0a68df1
...
...
@@ -193,6 +193,12 @@ export default {
</gl-link>
</
template
>
<
template
#cell(eventCount)=
"{ item }"
>
<div
data-testid=
"threat-alerts-event-count"
>
{{
item
.
eventCount
}}
</div>
</
template
>
<
template
#cell(status)=
"{ item }"
>
<alert-status
:alert=
"item"
...
...
ee/app/assets/javascripts/threat_monitoring/components/alerts/constants.js
View file @
a0a68df1
...
...
@@ -34,6 +34,13 @@ export const FIELDS = [
label
:
s__
(
'
ThreatMonitoring|Name
'
),
thClass
:
`gl-bg-white! gl-pointer-events-none`
,
},
{
key
:
'
eventCount
'
,
label
:
s__
(
'
ThreatMonitoring|Events
'
),
thClass
:
`gl-bg-white! gl-w-10p gl-text-right`
,
tdClass
:
`gl-pl-6! gl-text-right`
,
sortable
:
true
,
},
{
key
:
'
status
'
,
label
:
s__
(
'
ThreatMonitoring|Status
'
),
...
...
ee/changelogs/unreleased/299031-alert-events-column.yml
0 → 100644
View file @
a0a68df1
---
title
:
Add event count column to threat alerts
merge_request
:
54616
author
:
type
:
added
ee/spec/frontend/threat_monitoring/components/alerts/alerts_list_spec.js
View file @
a0a68df1
...
...
@@ -4,6 +4,7 @@ import AlertFilters from 'ee/threat_monitoring/components/alerts/alert_filters.v
import
AlertStatus
from
'
ee/threat_monitoring/components/alerts/alert_status.vue
'
;
import
AlertsList
from
'
ee/threat_monitoring/components/alerts/alerts_list.vue
'
;
import
{
DEFAULT_FILTERS
}
from
'
ee/threat_monitoring/components/alerts/constants
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
mockAlerts
}
from
'
../../mock_data
'
;
const
alerts
=
mockAlerts
;
...
...
@@ -29,41 +30,43 @@ describe('AlertsList component', () => {
};
const
defaultProps
=
{
filters
:
DEFAULT_FILTERS
};
const
findAlertFilters
=
()
=>
wrapper
.
find
(
AlertFilters
);
const
findUnconfiguredAlert
=
()
=>
wrapper
.
find
(
"
[data-testid='threat-alerts-unconfigured']
"
);
const
findErrorAlert
=
()
=>
wrapper
.
find
(
"
[data-testid='threat-alerts-error']
"
);
const
findStartedAtColumn
=
()
=>
wrapper
.
find
(
"
[data-testid='threat-alerts-started-at']
"
);
const
findStartedAtColumnHeader
=
()
=>
wrapper
.
find
(
"
[data-testid='threat-alerts-started-at-header']
"
);
const
find
IdColumn
=
()
=>
wrapper
.
find
(
"
[data-testid='threat-alerts-id']
"
);
const
findStatusColumn
=
()
=>
wrapper
.
find
(
AlertStatus
);
const
findStatusColumnHeader
=
()
=>
wrapper
.
find
(
"
[data-testid='threat-alerts-status-header']
"
);
const
findEmptyState
=
()
=>
wrapper
.
find
(
"
[data-testid='threat-alerts-empty-state']
"
);
const
findGlIntersectionObserver
=
()
=>
wrapper
.
find
(
GlIntersectionObserver
);
const
findGlSkeletonLoading
=
()
=>
wrapper
.
find
(
GlSkeletonLoading
);
const
findAlertFilters
=
()
=>
wrapper
.
find
Component
(
AlertFilters
);
const
findUnconfiguredAlert
=
()
=>
wrapper
.
find
ByTestId
(
'
threat-alerts-unconfigured
'
);
const
findErrorAlert
=
()
=>
wrapper
.
find
ByTestId
(
'
threat-alerts-error
'
);
const
findStartedAtColumn
=
()
=>
wrapper
.
find
ByTestId
(
'
threat-alerts-started-at
'
);
const
findStartedAtColumnHeader
=
()
=>
wrapper
.
findByTestId
(
'
threat-alerts-started-at-header
'
);
const
findIdColumn
=
()
=>
wrapper
.
findByTestId
(
'
threat-alerts-id
'
);
const
find
EventCountColumn
=
()
=>
wrapper
.
findByTestId
(
'
threat-alerts-event-count
'
);
const
findStatusColumn
=
()
=>
wrapper
.
find
Component
(
AlertStatus
);
const
findStatusColumnHeader
=
()
=>
wrapper
.
find
ByTestId
(
'
threat-alerts-status-header
'
);
const
findEmptyState
=
()
=>
wrapper
.
find
ByTestId
(
'
threat-alerts-empty-state
'
);
const
findGlIntersectionObserver
=
()
=>
wrapper
.
find
Component
(
GlIntersectionObserver
);
const
findGlSkeletonLoading
=
()
=>
wrapper
.
find
Component
(
GlSkeletonLoading
);
const
createWrapper
=
({
$apollo
=
apolloMock
,
data
=
{},
stubs
=
{}
}
=
{})
=>
{
wrapper
=
mount
(
AlertsList
,
{
mocks
:
{
$apollo
,
},
propsData
:
defaultProps
,
provide
:
{
documentationPath
:
'
#
'
,
projectPath
:
'
#
'
,
},
stubs
:
{
AlertStatus
:
true
,
AlertFilters
:
true
,
GlAlert
:
true
,
GlLoadingIcon
:
true
,
GlIntersectionObserver
:
true
,
...
stubs
,
},
data
()
{
return
data
;
},
});
wrapper
=
extendedWrapper
(
mount
(
AlertsList
,
{
mocks
:
{
$apollo
,
},
propsData
:
defaultProps
,
provide
:
{
documentationPath
:
'
#
'
,
projectPath
:
'
#
'
,
},
stubs
:
{
AlertStatus
:
true
,
AlertFilters
:
true
,
GlAlert
:
true
,
GlLoadingIcon
:
true
,
GlIntersectionObserver
:
true
,
...
stubs
,
},
data
()
{
return
data
;
},
}),
);
};
afterEach
(()
=>
{
...
...
@@ -95,6 +98,7 @@ describe('AlertsList component', () => {
it
(
'
does show all columns
'
,
()
=>
{
expect
(
findStartedAtColumn
().
exists
()).
toBe
(
true
);
expect
(
findIdColumn
().
exists
()).
toBe
(
true
);
expect
(
findEventCountColumn
().
exists
()).
toBe
(
true
);
expect
(
findStatusColumn
().
exists
()).
toBe
(
true
);
});
...
...
ee/spec/frontend/threat_monitoring/mock_data.js
View file @
a0a68df1
...
...
@@ -94,24 +94,28 @@ export const formattedMockNetworkPolicyStatisticsResponse = {
export
const
mockAlerts
=
[
{
iid
:
'
01
'
,
eventCount
:
'
1
'
,
title
:
'
Issue 01
'
,
status
:
'
TRIGGERED
'
,
startedAt
:
'
2020-11-19T18:36:23Z
'
,
},
{
iid
:
'
02
'
,
eventCount
:
'
2
'
,
title
:
'
Issue 02
'
,
status
:
'
ACKNOWLEDGED
'
,
startedAt
:
'
2020-11-16T21:59:28Z
'
,
},
{
iid
:
'
03
'
,
eventCount
:
'
3
'
,
title
:
'
Issue 03
'
,
status
:
'
RESOLVED
'
,
startedAt
:
'
2020-11-13T20:03:04Z
'
,
},
{
iid
:
'
04
'
,
eventCount
:
'
4
'
,
title
:
'
Issue 04
'
,
status
:
'
IGNORED
'
,
startedAt
:
'
2020-10-29T13:37:55Z
'
,
...
...
locale/gitlab.pot
View file @
a0a68df1
...
...
@@ -30588,6 +30588,9 @@ msgstr ""
msgid "ThreatMonitoring|Environment"
msgstr ""
msgid "ThreatMonitoring|Events"
msgstr ""
msgid "ThreatMonitoring|Hide dismissed alerts"
msgstr ""
...
...
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