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
c8995168
Commit
c8995168
authored
May 08, 2020
by
Olena Horal-Koretska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle empty endDate case
parent
62ab5a53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
app/assets/javascripts/alert_management/components/alert_management_list.vue
...pts/alert_management/components/alert_management_list.vue
+2
-2
spec/frontend/alert_management/components/alert_management_list_spec.js
...alert_management/components/alert_management_list_spec.js
+42
-0
No files found.
app/assets/javascripts/alert_management/components/alert_management_list.vue
View file @
c8995168
...
...
@@ -197,11 +197,11 @@ export default {
</
template
>
<
template
#cell(startedAt)=
"{ item }"
>
<time-ago
:time=
"item.startedAt"
/>
<time-ago
v-if=
"item.startedAt"
:time=
"item.startedAt"
/>
</
template
>
<
template
#cell(endedAt)=
"{ item }"
>
<time-ago
:time=
"item.endedAt"
/>
<time-ago
v-if=
"item.endedAt"
:time=
"item.endedAt"
/>
</
template
>
<
template
#cell(title)=
"{ item }"
>
...
...
spec/frontend/alert_management/components/alert_management_list_spec.js
View file @
c8995168
...
...
@@ -9,6 +9,7 @@ import {
GlIcon
,
GlTab
,
}
from
'
@gitlab/ui
'
;
import
TimeAgo
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
import
AlertManagementList
from
'
~/alert_management/components/alert_management_list.vue
'
;
import
{
ALERTS_STATUS_TABS
}
from
'
../../../../app/assets/javascripts/alert_management/constants
'
;
...
...
@@ -24,6 +25,7 @@ describe('AlertManagementList', () => {
const
findStatusDropdown
=
()
=>
wrapper
.
find
(
GlNewDropdown
);
const
findStatusFilterTabs
=
()
=>
wrapper
.
findAll
(
GlTab
);
const
findNumberOfAlertsBadge
=
()
=>
wrapper
.
findAll
(
GlBadge
);
const
findDateFields
=
()
=>
wrapper
.
findAll
(
TimeAgo
);
function
mountComponent
({
props
=
{
...
...
@@ -198,5 +200,45 @@ describe('AlertManagementList', () => {
).
toBe
(
true
);
});
});
describe
(
'
handle date fields
'
,
()
=>
{
it
(
'
should display time ago dates when values provided
'
,
()
=>
{
mountComponent
({
props
:
{
alertManagementEnabled
:
true
,
userCanEnableAlertManagement
:
true
},
data
:
{
alerts
:
[
{
iid
:
1
,
startedAt
:
'
2020-03-17T23:18:14.996Z
'
,
endedAt
:
'
2020-04-17T23:18:14.996Z
'
,
severity
:
'
high
'
,
},
],
errored
:
false
,
},
loading
:
false
,
});
expect
(
findDateFields
().
length
).
toBe
(
2
);
});
it
(
'
should not display time ago dates when values not provided
'
,
()
=>
{
mountComponent
({
props
:
{
alertManagementEnabled
:
true
,
userCanEnableAlertManagement
:
true
},
data
:
{
alerts
:
[
{
iid
:
1
,
startedAt
:
null
,
endedAt
:
null
,
severity
:
'
high
'
,
},
],
errored
:
false
,
},
loading
:
false
,
});
expect
(
findDateFields
().
exists
()).
toBe
(
false
);
});
});
});
});
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