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
32642d5e
Commit
32642d5e
authored
Mar 11, 2022
by
Sean Arnold
Committed by
Phil Hughes
Mar 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add link to incident title
Changelog: changed
parent
3235302b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
42 deletions
+61
-42
app/assets/javascripts/incidents/components/incidents_list.vue
...ssets/javascripts/incidents/components/incidents_list.vue
+11
-4
spec/frontend/incidents/components/incidents_list_spec.js
spec/frontend/incidents/components/incidents_list_spec.js
+50
-38
No files found.
app/assets/javascripts/incidents/components/incidents_list.vue
View file @
32642d5e
<
script
>
import
{
GlLink
,
GlLoadingIcon
,
GlTable
,
GlAvatarsInline
,
...
...
@@ -106,6 +107,7 @@ export default {
],
MAX_VISIBLE_ASSIGNEES
,
components
:
{
GlLink
,
GlLoadingIcon
,
GlTable
,
GlAvatarsInline
,
...
...
@@ -271,7 +273,7 @@ export default {
return
Boolean
(
assignees
.
nodes
?.
length
);
},
navigateToIncidentDetails
({
iid
})
{
return
visitUrl
(
joinPaths
(
this
.
issuePath
,
INCIDENT_DETAILS_PATH
,
iid
));
return
visitUrl
(
this
.
showIncidentLink
({
iid
}
));
},
navigateToCreateNewIncident
()
{
const
{
category
,
action
}
=
this
.
$options
.
trackIncidentCreateNewOptions
;
...
...
@@ -297,6 +299,9 @@ export default {
getEscalationStatus
(
escalationStatus
)
{
return
ESCALATION_STATUSES
[
escalationStatus
]
||
this
.
$options
.
i18n
.
noEscalationStatus
;
},
showIncidentLink
({
iid
})
{
return
joinPaths
(
this
.
issuePath
,
INCIDENT_DETAILS_PATH
,
iid
);
},
pageChanged
(
pagination
)
{
this
.
pagination
=
pagination
;
},
...
...
@@ -384,12 +389,14 @@ export default {
<
template
#cell(title)=
"{ item }"
>
<div
:class=
"
{ 'gl-display-flex gl-align-items-center': item.state === 'closed' }">
<tooltip-on-truncate
<gl-link
v-gl-tooltip
:title=
"item.title"
class=
"gl-max-w-full gl-text-truncate gl-display-block"
data-testid=
"incident-link"
:href=
"showIncidentLink(item)"
>
{{
item
.
title
}}
</
tooltip-on-truncate
>
</
gl-link
>
<gl-icon
v-if=
"item.state === 'closed'"
name=
"issue-close"
...
...
spec/frontend/incidents/components/incidents_list_spec.js
View file @
32642d5e
import
{
GlAlert
,
GlLoadingIcon
,
GlTable
,
GlAvatar
,
GlEmptyState
}
from
'
@gitlab/ui
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
IncidentsList
from
'
~/incidents/components/incidents_list.vue
'
;
import
{
I18N
,
...
...
@@ -19,7 +20,7 @@ import mockIncidents from '../mocks/incidents.json';
jest
.
mock
(
'
~/lib/utils/url_utility
'
,
()
=>
({
visitUrl
:
jest
.
fn
().
mockName
(
'
visitUrlMock
'
),
joinPaths
:
jest
.
fn
()
,
joinPaths
:
jest
.
requireActual
(
'
~/lib/utils/url_utility
'
).
joinPaths
,
mergeUrlParams
:
jest
.
fn
(),
setUrlParams
:
jest
.
fn
(),
updateHistory
:
jest
.
fn
(),
...
...
@@ -49,48 +50,51 @@ describe('Incidents List', () => {
const
findEmptyState
=
()
=>
wrapper
.
find
(
GlEmptyState
);
const
findSeverity
=
()
=>
wrapper
.
findAll
(
SeverityToken
);
const
findEscalationStatus
=
()
=>
wrapper
.
findAll
(
'
[data-testid="incident-escalation-status"]
'
);
const
findIncidentLink
=
()
=>
wrapper
.
findByTestId
(
'
incident-link
'
);
function
mountComponent
({
data
=
{},
loading
=
false
,
provide
=
{}
}
=
{})
{
wrapper
=
mount
(
IncidentsList
,
{
data
()
{
return
{
incidents
:
[],
incidentsCount
:
{},
...
data
,
};
},
mocks
:
{
$apollo
:
{
queries
:
{
incidents
:
{
loading
,
wrapper
=
extendedWrapper
(
mount
(
IncidentsList
,
{
data
()
{
return
{
incidents
:
[],
incidentsCount
:
{},
...
data
,
};
},
mocks
:
{
$apollo
:
{
queries
:
{
incidents
:
{
loading
,
},
},
},
},
},
provide
:
{
projectPath
:
'
/project/path
'
,
newIssuePath
,
incidentTemplateNam
e
,
incidentType
,
issuePath
:
'
/project/issues
'
,
publishedAvailable
:
true
,
emptyListSvgPath
,
text
Query
:
''
,
author
UsernameQuery
:
''
,
assigneeUsernameQuery
:
''
,
slaFeatureAvailable
:
true
,
canCreateIncident
:
true
,
incidentEscalationsAvailable
:
tru
e
,
...
provide
,
},
stubs
:
{
GlButton
:
true
,
GlAvatar
:
true
,
GlEmptyState
:
true
,
ServiceLevelAgreementCell
:
true
,
},
}
);
provide
:
{
projectPath
:
'
/project/path
'
,
newIssuePath
,
incidentTemplateName
,
incidentTyp
e
,
issuePath
:
'
/project/issues
'
,
publishedAvailable
:
true
,
emptyListSvgPath
,
textQuery
:
''
,
authorUsername
Query
:
''
,
assignee
UsernameQuery
:
''
,
slaFeatureAvailable
:
true
,
canCreateIncident
:
true
,
incidentEscalationsAvailable
:
true
,
...
provid
e
,
}
,
stubs
:
{
GlButton
:
true
,
GlAvatar
:
true
,
GlEmptyState
:
true
,
ServiceLevelAgreementCell
:
true
,
}
,
}
)
,
);
}
afterEach
(()
=>
{
...
...
@@ -160,6 +164,14 @@ describe('Incidents List', () => {
expect
(
findTimeAgo
().
length
).
toBe
(
mockIncidents
.
length
);
});
it
(
'
renders a link to the incident as the incident title
'
,
()
=>
{
const
{
title
,
iid
}
=
mockIncidents
[
0
];
const
link
=
findIncidentLink
();
expect
(
link
.
text
()).
toBe
(
title
);
expect
(
link
.
attributes
(
'
href
'
)).
toContain
(
`issues/incident/
${
iid
}
`
);
});
describe
(
'
Assignees
'
,
()
=>
{
it
(
'
shows Unassigned when there are no assignees
'
,
()
=>
{
expect
(
findAssignees
().
at
(
0
).
text
()).
toBe
(
I18N
.
unassigned
);
...
...
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