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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
99b96a7b
Commit
99b96a7b
authored
Feb 21, 2018
by
Riccardo Padovani
Committed by
Clement Ho
Feb 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#28481: Display time tracking totals on milestone page
parent
576dd646
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
22 deletions
+62
-22
app/assets/javascripts/pages/dashboard/milestones/show/index.js
...sets/javascripts/pages/dashboard/milestones/show/index.js
+2
-0
app/assets/javascripts/pages/milestones/shared/init_milestones_show.js
...vascripts/pages/milestones/shared/init_milestones_show.js
+2
-0
app/assets/javascripts/sidebar/mount_milestone_sidebar.js
app/assets/javascripts/sidebar/mount_milestone_sidebar.js
+27
-0
app/models/concerns/milestoneish.rb
app/models/concerns/milestoneish.rb
+8
-0
app/views/shared/milestones/_sidebar.html.haml
app/views/shared/milestones/_sidebar.html.haml
+8
-15
changelogs/unreleased/feature--2848-display-time-tracking-totals-milestone-page.yml
...ure--2848-display-time-tracking-totals-milestone-page.yml
+5
-0
config/webpack.config.js
config/webpack.config.js
+1
-1
spec/features/milestone_spec.rb
spec/features/milestone_spec.rb
+9
-6
No files found.
app/assets/javascripts/pages/dashboard/milestones/show/index.js
View file @
99b96a7b
import
Milestone
from
'
~/milestone
'
;
import
Milestone
from
'
~/milestone
'
;
import
Sidebar
from
'
~/right_sidebar
'
;
import
Sidebar
from
'
~/right_sidebar
'
;
import
MountMilestoneSidebar
from
'
~/sidebar/mount_milestone_sidebar
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
new
Milestone
();
// eslint-disable-line no-new
new
Milestone
();
// eslint-disable-line no-new
new
Sidebar
();
// eslint-disable-line no-new
new
Sidebar
();
// eslint-disable-line no-new
new
MountMilestoneSidebar
();
// eslint-disable-line no-new
});
});
app/assets/javascripts/pages/milestones/shared/init_milestones_show.js
View file @
99b96a7b
...
@@ -2,8 +2,10 @@
...
@@ -2,8 +2,10 @@
import
Milestone
from
'
~/milestone
'
;
import
Milestone
from
'
~/milestone
'
;
import
Sidebar
from
'
~/right_sidebar
'
;
import
Sidebar
from
'
~/right_sidebar
'
;
import
MountMilestoneSidebar
from
'
~/sidebar/mount_milestone_sidebar
'
;
export
default
()
=>
{
export
default
()
=>
{
new
Milestone
();
new
Milestone
();
new
Sidebar
();
new
Sidebar
();
new
MountMilestoneSidebar
();
};
};
app/assets/javascripts/sidebar/mount_milestone_sidebar.js
0 → 100644
View file @
99b96a7b
import
Vue
from
'
vue
'
;
import
timeTracker
from
'
./components/time_tracking/time_tracker.vue
'
;
export
default
class
SidebarMilestone
{
constructor
()
{
const
el
=
document
.
getElementById
(
'
issuable-time-tracker
'
);
if
(
!
el
)
return
;
// eslint-disable-next-line no-new
new
Vue
({
el
,
components
:
{
timeTracker
,
},
render
:
createElement
=>
createElement
(
'
timeTracker
'
,
{
props
:
{
time_estimate
:
parseInt
(
el
.
dataset
.
timeEstimate
,
10
),
time_spent
:
parseInt
(
el
.
dataset
.
timeSpent
,
10
),
human_time_estimate
:
el
.
dataset
.
humanTimeEstimate
,
human_time_spent
:
el
.
dataset
.
humanTimeSpent
,
rootPath
:
'
/
'
,
},
}),
});
}
}
app/models/concerns/milestoneish.rb
View file @
99b96a7b
...
@@ -94,6 +94,14 @@ module Milestoneish
...
@@ -94,6 +94,14 @@ module Milestoneish
Gitlab
::
TimeTrackingFormatter
.
output
(
total_issue_time_spent
)
Gitlab
::
TimeTrackingFormatter
.
output
(
total_issue_time_spent
)
end
end
def
total_issue_time_estimate
@total_issue_time_estimate
||=
issues
.
sum
(
:time_estimate
)
end
def
human_total_issue_time_estimate
Gitlab
::
TimeTrackingFormatter
.
output
(
total_issue_time_estimate
)
end
private
private
def
count_issues_by_state
(
user
)
def
count_issues_by_state
(
user
)
...
...
app/views/shared/milestones/_sidebar.html.haml
View file @
99b96a7b
-
affix_offset
=
local_assigns
.
fetch
(
:affix_offset
,
"50"
)
-
affix_offset
=
local_assigns
.
fetch
(
:affix_offset
,
"50"
)
-
project
=
local_assigns
[
:project
]
-
project
=
local_assigns
[
:project
]
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_bundle_tag
(
'common_vue'
)
%aside
.right-sidebar.js-right-sidebar
{
data:
{
"offset-top"
=>
affix_offset
,
"spy"
=>
"affix"
,
"always-show-toggle"
=>
true
},
class:
sidebar_gutter_collapsed_class
,
'aria-live'
=>
'polite'
}
%aside
.right-sidebar.js-right-sidebar
{
data:
{
"offset-top"
=>
affix_offset
,
"spy"
=>
"affix"
,
"always-show-toggle"
=>
true
},
class:
sidebar_gutter_collapsed_class
,
'aria-live'
=>
'polite'
}
.issuable-sidebar.milestone-sidebar
.issuable-sidebar.milestone-sidebar
...
@@ -85,21 +87,12 @@
...
@@ -85,21 +87,12 @@
Closed:
Closed:
=
milestone
.
issues_visible_to_user
(
current_user
).
closed
.
count
=
milestone
.
issues_visible_to_user
(
current_user
).
closed
.
count
.block.time_spent
.block
.sidebar-collapsed-icon
#issuable-time-tracker
{
data:
{
time_estimate:
@milestone
.
total_issue_time_estimate
,
time_spent:
@milestone
.
total_issue_time_spent
,
human_time_estimate:
@milestone
.
human_total_issue_time_estimate
,
human_time_spent:
@milestone
.
human_total_issue_time_spent
}
}
=
custom_icon
(
'icon_hourglass'
)
// Fallback while content is loading
%span
.collapsed-milestone-total-time-spent
.title.hide-collapsed
-
if
milestone
.
human_total_issue_time_spent
=
_
(
'Time tracking'
)
=
milestone
.
human_total_issue_time_spent
=
icon
(
'spinner spin'
)
-
else
=
_
(
"None"
)
.title.hide-collapsed
=
_
(
"Total issue time spent"
)
.value.hide-collapsed
-
if
milestone
.
human_total_issue_time_spent
%span
.bold
=
milestone
.
human_total_issue_time_spent
-
else
%span
.no-value
=
_
(
"No time spent"
)
.block.merge-requests
.block.merge-requests
.sidebar-collapsed-icon
.sidebar-collapsed-icon
...
...
changelogs/unreleased/feature--2848-display-time-tracking-totals-milestone-page.yml
0 → 100644
View file @
99b96a7b
---
title
:
"
#28481:
Display
time
tracking
totals
on
milestone
page"
merge_request
:
16753
author
:
Riccardo Padovani
type
:
added
config/webpack.config.js
View file @
99b96a7b
...
@@ -78,7 +78,7 @@ var config = {
...
@@ -78,7 +78,7 @@ var config = {
protected_branches
:
'
./protected_branches
'
,
protected_branches
:
'
./protected_branches
'
,
protected_tags
:
'
./protected_tags
'
,
protected_tags
:
'
./protected_tags
'
,
registry_list
:
'
./registry/index.js
'
,
registry_list
:
'
./registry/index.js
'
,
ide
:
'
./ide/index.js
'
,
ide
:
'
./ide/index.js
'
,
sidebar
:
'
./sidebar/sidebar_bundle.js
'
,
sidebar
:
'
./sidebar/sidebar_bundle.js
'
,
snippet
:
'
./snippet/snippet_bundle.js
'
,
snippet
:
'
./snippet/snippet_bundle.js
'
,
sketch_viewer
:
'
./blob/sketch_viewer.js
'
,
sketch_viewer
:
'
./blob/sketch_viewer.js
'
,
...
...
spec/features/milestone_spec.rb
View file @
99b96a7b
...
@@ -66,15 +66,16 @@ feature 'Milestone' do
...
@@ -66,15 +66,16 @@ feature 'Milestone' do
end
end
end
end
feature
'Open a milestone'
do
feature
'Open a milestone'
,
:js
do
scenario
'shows total issue time spent correctly when no time has been logged'
do
scenario
'shows total issue time spent correctly when no time has been logged'
do
milestone
=
create
(
:milestone
,
project:
project
,
title:
8.7
)
milestone
=
create
(
:milestone
,
project:
project
,
title:
8.7
)
visit
project_milestone_path
(
project
,
milestone
)
visit
project_milestone_path
(
project
,
milestone
)
page
.
within
(
'.block.time_spent'
)
do
wait_for_requests
expect
(
page
).
to
have_content
'No time spent'
expect
(
page
).
to
have_content
'None'
page
.
within
(
'.time-tracking-no-tracking-pane'
)
do
expect
(
page
).
to
have_content
'No estimate or time spent'
end
end
end
end
...
@@ -89,8 +90,10 @@ feature 'Milestone' do
...
@@ -89,8 +90,10 @@ feature 'Milestone' do
visit
project_milestone_path
(
project
,
milestone
)
visit
project_milestone_path
(
project
,
milestone
)
page
.
within
(
'.block.time_spent'
)
do
wait_for_requests
expect
(
page
).
to
have_content
'3h'
page
.
within
(
'.time-tracking-spend-only-pane'
)
do
expect
(
page
).
to
have_content
'Spent: 3h'
end
end
end
end
end
end
...
...
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