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
a259dcd4
Commit
a259dcd4
authored
Apr 16, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update startOffset calculation for epics with out-of-range endDate
parent
864aec60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
ee/app/assets/javascripts/roadmap/components/epic_item_timeline.vue
...ets/javascripts/roadmap/components/epic_item_timeline.vue
+12
-3
spec/javascripts/roadmap/components/epic_item_timeline_spec.js
...javascripts/roadmap/components/epic_item_timeline_spec.js
+10
-0
No files found.
ee/app/assets/javascripts/roadmap/components/epic_item_timeline.vue
View file @
a259dcd4
...
...
@@ -104,9 +104,18 @@
// Set offset to 0.
offset
=
'
left: 0;
'
;
}
else
{
// Calculate proportional offset based on startDate and total days in
// current month.
offset
=
`left:
${
Math
.
floor
((
startDate
/
daysInMonth
)
*
100
)}
%;`
;
// If Epic end date is out of range
const
lastTimeframeItem
=
this
.
timeframe
[
this
.
timeframe
.
length
-
1
];
// Check if Epic start date falls within last month of the timeframe
if
(
this
.
epic
.
startDate
.
getMonth
()
===
lastTimeframeItem
.
getMonth
()
&&
this
.
epic
.
startDate
.
getFullYear
()
===
lastTimeframeItem
.
getFullYear
())
{
// Compensate for triangle size
offset
=
`right:
${
TIMELINE_END_OFFSET_HALF
}
px;`
;
}
else
{
// Calculate proportional offset based on startDate and total days in
// current month.
offset
=
`left:
${(
startDate
/
daysInMonth
)
*
100
}
%;`
;
}
}
return
offset
;
...
...
spec/javascripts/roadmap/components/epic_item_timeline_spec.js
View file @
a259dcd4
...
...
@@ -108,6 +108,16 @@ describe('EpicItemTimelineComponent', () => {
expect
(
vm
.
getTimelineBarStartOffset
()).
toBe
(
'
left: 0;
'
);
});
it
(
'
returns `right: 8px;` when Epic startDate is in last timeframe month and endDate is out of range
'
,
()
=>
{
vm
=
createComponent
({
epic
:
Object
.
assign
({},
mockEpic
,
{
startDate
:
mockTimeframe
[
mockTimeframe
.
length
-
1
],
endDateOutOfRange
:
true
,
}),
});
expect
(
vm
.
getTimelineBarStartOffset
()).
toBe
(
'
right: 8px;
'
);
});
it
(
'
returns proportional `left` value based on Epic startDate and days in the month
'
,
()
=>
{
vm
=
createComponent
({
epic
:
Object
.
assign
({},
mockEpic
,
{
...
...
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