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
86ef6baa
Commit
86ef6baa
authored
Jul 03, 2020
by
Tristan Read
Committed by
Jacques Erasmus
Jul 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add issue column to alert list
parent
ef2ce0f3
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
0 deletions
+58
-0
app/assets/javascripts/alert_management/components/alert_management_list.vue
...pts/alert_management/components/alert_management_list.vue
+17
-0
changelogs/unreleased/tr-alert-issue-link.yml
changelogs/unreleased/tr-alert-issue-link.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/alert_management/components/alert_management_list_spec.js
...alert_management/components/alert_management_list_spec.js
+32
-0
spec/frontend/alert_management/mocks/alerts.json
spec/frontend/alert_management/mocks/alerts.json
+1
-0
No files found.
app/assets/javascripts/alert_management/components/alert_management_list.vue
View file @
86ef6baa
...
...
@@ -84,6 +84,13 @@ export default {
tdClass
:
`
${
tdClass
}
text-md-right`
,
sortable
:
true
,
},
{
key
:
'
issue
'
,
label
:
s__
(
'
AlertManagement|Issue
'
),
thClass
:
'
gl-w-12 gl-pointer-events-none
'
,
tdClass
,
sortable
:
false
,
},
{
key
:
'
assignees
'
,
label
:
s__
(
'
AlertManagement|Assignees
'
),
...
...
@@ -278,6 +285,9 @@ export default {
?
assignees
.
nodes
[
0
]?.
username
:
s__
(
'
AlertManagement|Unassigned
'
);
},
getIssueLink
(
item
)
{
return
joinPaths
(
'
/
'
,
this
.
projectPath
,
'
-
'
,
'
issues
'
,
item
.
issueIid
);
},
handlePageChange
(
page
)
{
const
{
startCursor
,
endCursor
}
=
this
.
alerts
.
pageInfo
;
...
...
@@ -402,6 +412,13 @@ export default {
<div
class=
"gl-max-w-full text-truncate"
:title=
"item.title"
>
{{
item
.
title
}}
</div>
</
template
>
<
template
#cell(issue)=
"{ item }"
>
<gl-link
v-if=
"item.issueIid"
data-testid=
"issueField"
:href=
"getIssueLink(item)"
>
#
{{
item
.
issueIid
}}
</gl-link>
<div
v-else
data-testid=
"issueField"
>
{{
s__
(
'
AlertManagement|None
'
)
}}
</div>
</
template
>
<
template
#cell(assignees)=
"{ item }"
>
<div
class=
"gl-max-w-full text-truncate"
data-testid=
"assigneesField"
>
{{
getAssignees
(
item
.
assignees
)
}}
...
...
changelogs/unreleased/tr-alert-issue-link.yml
0 → 100644
View file @
86ef6baa
---
title
:
Add issue column to alert list
merge_request
:
35291
author
:
type
:
added
locale/gitlab.pot
View file @
86ef6baa
...
...
@@ -1966,6 +1966,9 @@ msgstr ""
msgid "AlertManagement|Info"
msgstr ""
msgid "AlertManagement|Issue"
msgstr ""
msgid "AlertManagement|Low"
msgstr ""
...
...
spec/frontend/alert_management/components/alert_management_list_spec.js
View file @
86ef6baa
...
...
@@ -48,6 +48,7 @@ describe('AlertManagementList', () => {
const
findSeverityColumnHeader
=
()
=>
wrapper
.
findAll
(
'
th
'
).
at
(
0
);
const
findPagination
=
()
=>
wrapper
.
find
(
GlPagination
);
const
findSearch
=
()
=>
wrapper
.
find
(
GlSearchBoxByType
);
const
findIssueFields
=
()
=>
wrapper
.
findAll
(
'
[data-testid="issueField"]
'
);
const
alertsCount
=
{
open
:
14
,
triggered
:
10
,
...
...
@@ -278,6 +279,37 @@ describe('AlertManagementList', () => {
expect
(
visitUrl
).
toHaveBeenCalledWith
(
'
/1527542/details
'
);
});
describe
(
'
alert issue links
'
,
()
=>
{
beforeEach
(()
=>
{
mountComponent
({
props
:
{
alertManagementEnabled
:
true
,
userCanEnableAlertManagement
:
true
},
data
:
{
alerts
:
{
list
:
mockAlerts
},
alertsCount
,
errored
:
false
},
loading
:
false
,
});
});
it
(
'
shows "None" when no link exists
'
,
()
=>
{
expect
(
findIssueFields
()
.
at
(
0
)
.
text
(),
).
toBe
(
'
None
'
);
});
it
(
'
renders a link when one exists
'
,
()
=>
{
expect
(
findIssueFields
()
.
at
(
1
)
.
text
(),
).
toBe
(
'
#1
'
);
expect
(
findIssueFields
()
.
at
(
1
)
.
attributes
(
'
href
'
),
).
toBe
(
'
/gitlab-org/gitlab/-/issues/1
'
);
});
});
describe
(
'
handle date fields
'
,
()
=>
{
it
(
'
should display time ago dates when values provided
'
,
()
=>
{
mountComponent
({
...
...
spec/frontend/alert_management/mocks/alerts.json
View file @
86ef6baa
...
...
@@ -20,6 +20,7 @@
"endedAt"
:
"2020-04-17T23:18:14.996Z"
,
"status"
:
"ACKNOWLEDGED"
,
"assignees"
:
{
"nodes"
:
[{
"username"
:
"root"
}]
},
"issueIid"
:
"1"
,
"notes"
:
{
"nodes"
:
[
{
...
...
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