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
e44e8556
Commit
e44e8556
authored
Jul 22, 2020
by
Olena Horal-Koretska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Surface time passed in Incident list
parent
b28974de
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
12 deletions
+51
-12
app/assets/javascripts/incidents/components/incidents_list.vue
...ssets/javascripts/incidents/components/incidents_list.vue
+3
-1
changelogs/unreleased/229533-timeago-in-incidents-list.yml
changelogs/unreleased/229533-timeago-in-incidents-list.yml
+5
-0
spec/frontend/incidents/components/incidents_list_spec.js
spec/frontend/incidents/components/incidents_list_spec.js
+17
-11
spec/frontend/incidents/mocks/incidents.json
spec/frontend/incidents/mocks/incidents.json
+26
-0
No files found.
app/assets/javascripts/incidents/components/incidents_list.vue
View file @
e44e8556
<
script
>
<
script
>
import
{
GlLoadingIcon
,
GlTable
,
GlAlert
}
from
'
@gitlab/ui
'
;
import
{
GlLoadingIcon
,
GlTable
,
GlAlert
}
from
'
@gitlab/ui
'
;
import
TimeAgoTooltip
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
getIncidents
from
'
../graphql/queries/get_incidents.query.graphql
'
;
import
getIncidents
from
'
../graphql/queries/get_incidents.query.graphql
'
;
import
{
I18N
}
from
'
../constants
'
;
import
{
I18N
}
from
'
../constants
'
;
...
@@ -36,6 +37,7 @@ export default {
...
@@ -36,6 +37,7 @@ export default {
GlLoadingIcon
,
GlLoadingIcon
,
GlTable
,
GlTable
,
GlAlert
,
GlAlert
,
TimeAgoTooltip
,
},
},
inject
:
[
'
projectPath
'
],
inject
:
[
'
projectPath
'
],
apollo
:
{
apollo
:
{
...
@@ -108,7 +110,7 @@ export default {
...
@@ -108,7 +110,7 @@ export default {
</
template
>
</
template
>
<
template
#cell(createdAt)=
"{ item }"
>
<
template
#cell(createdAt)=
"{ item }"
>
{{
item
.
createdAt
}}
<time-ago-tooltip
:time=
"item.createdAt"
/>
</
template
>
</
template
>
<
template
#cell(assignees)=
"{ item }"
>
<
template
#cell(assignees)=
"{ item }"
>
...
...
changelogs/unreleased/229533-timeago-in-incidents-list.yml
0 → 100644
View file @
e44e8556
---
title
:
Surface timeafo for created date in Incidents List
merge_request
:
37567
author
:
type
:
added
spec/frontend/incidents/components/incidents_list_spec.js
View file @
e44e8556
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
GlAlert
,
GlLoadingIcon
,
GlTable
}
from
'
@gitlab/ui
'
;
import
{
GlAlert
,
GlLoadingIcon
,
GlTable
}
from
'
@gitlab/ui
'
;
import
IncidentsList
from
'
~/incidents/components/incidents_list.vue
'
;
import
IncidentsList
from
'
~/incidents/components/incidents_list.vue
'
;
import
TimeAgoTooltip
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
import
{
I18N
}
from
'
~/incidents/constants
'
;
import
{
I18N
}
from
'
~/incidents/constants
'
;
import
mockIncidents
from
'
../mocks/incidents.json
'
;
describe
(
'
Incidents List
'
,
()
=>
{
describe
(
'
Incidents List
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -10,6 +12,7 @@ describe('Incidents List', () => {
...
@@ -10,6 +12,7 @@ describe('Incidents List', () => {
const
findTableRows
=
()
=>
wrapper
.
findAll
(
'
table tbody tr
'
);
const
findTableRows
=
()
=>
wrapper
.
findAll
(
'
table tbody tr
'
);
const
findAlert
=
()
=>
wrapper
.
find
(
GlAlert
);
const
findAlert
=
()
=>
wrapper
.
find
(
GlAlert
);
const
findLoader
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
const
findLoader
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
const
findTimeAgo
=
()
=>
wrapper
.
findAll
(
TimeAgoTooltip
);
function
mountComponent
({
data
=
{
incidents
:
[]
},
loading
=
false
})
{
function
mountComponent
({
data
=
{
incidents
:
[]
},
loading
=
false
})
{
wrapper
=
mount
(
IncidentsList
,
{
wrapper
=
mount
(
IncidentsList
,
{
...
@@ -40,7 +43,6 @@ describe('Incidents List', () => {
...
@@ -40,7 +43,6 @@ describe('Incidents List', () => {
it
(
'
shows the loading state
'
,
()
=>
{
it
(
'
shows the loading state
'
,
()
=>
{
mountComponent
({
mountComponent
({
props
:
{
alertManagementEnabled
:
true
,
userCanEnableAlertManagement
:
true
},
loading
:
true
,
loading
:
true
,
});
});
expect
(
findLoader
().
exists
()).
toBe
(
true
);
expect
(
findLoader
().
exists
()).
toBe
(
true
);
...
@@ -63,16 +65,20 @@ describe('Incidents List', () => {
...
@@ -63,16 +65,20 @@ describe('Incidents List', () => {
expect
(
findAlert
().
exists
()).
toBe
(
true
);
expect
(
findAlert
().
exists
()).
toBe
(
true
);
});
});
it
(
'
displays basic list
'
,
()
=>
{
describe
(
'
Incident Management list
'
,
()
=>
{
const
incidents
=
[
beforeEach
(()
=>
{
{
title
:
1
,
assignees
:
[]
},
{
title
:
2
,
assignees
:
[]
},
{
title
:
3
,
assignees
:
[]
},
];
mountComponent
({
mountComponent
({
data
:
{
i
ncidents
},
data
:
{
incidents
:
mockI
ncidents
},
loading
:
false
,
loading
:
false
,
});
});
expect
(
findTableRows
().
length
).
toBe
(
incidents
.
length
);
});
it
(
'
renders rows based on provided data
'
,
()
=>
{
expect
(
findTableRows
().
length
).
toBe
(
mockIncidents
.
length
);
});
it
(
'
renders a createdAt with timeAgo component per row
'
,
()
=>
{
expect
(
findTimeAgo
().
length
).
toBe
(
mockIncidents
.
length
);
});
});
});
});
});
spec/frontend/incidents/mocks/incidents.json
0 → 100644
View file @
e44e8556
[
{
"iid"
:
"15"
,
"title"
:
"New: Incident"
,
"createdAt"
:
"2020-06-03T15:46:08Z"
,
"assignees"
:
{}
},
{
"iid"
:
"14"
,
"title"
:
"Create issue4"
,
"createdAt"
:
"2020-05-19T09:26:07Z"
,
"assignees"
:
{}
},
{
"iid"
:
"13"
,
"title"
:
"Create issue3"
,
"createdAt"
:
"2020-05-19T08:53:55Z"
,
"assignees"
:
{}
},
{
"iid"
:
"12"
,
"title"
:
"Create issue2"
,
"createdAt"
:
"2020-05-18T17:13:35Z"
,
"assignees"
:
{}
}
]
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