summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2019-04-12 21:31:04 +0000
committerTim Zallmann <tzallmann@gitlab.com>2019-04-12 21:31:04 +0000
commit0a99e0220d9371423039f05f700af3675b26624f (patch)
treea0240a4518cbf2e40c3ecbded7b744564b0e5195
parentd2d9fb9a863909d1002029ddd19247b52264ab4d (diff)
parent214c1c7d94f89499185b201d0c68006be54822e5 (diff)
downloadgitlab-ce-0a99e0220d9371423039f05f700af3675b26624f.tar.gz
Merge branch '31331-add-time-tracking-issue-boards-sidebar' into 'master'
Add time tracking information to Issue Boards sidebar Closes #31331 See merge request gitlab-org/gitlab-ce!27166
-rw-r--r--app/assets/javascripts/boards/components/board_sidebar.js24
-rw-r--r--app/assets/javascripts/boards/index.js24
-rw-r--r--app/serializers/issue_board_entity.rb1
-rw-r--r--app/views/shared/boards/components/_sidebar.html.haml1
-rw-r--r--app/views/shared/boards/components/sidebar/_time_tracker.html.haml6
-rw-r--r--changelogs/unreleased/31331-add-time-tracking-issue-boards-sidebar.yml5
-rw-r--r--spec/features/boards/sidebar_spec.rb15
7 files changed, 63 insertions, 13 deletions
diff --git a/app/assets/javascripts/boards/components/board_sidebar.js b/app/assets/javascripts/boards/components/board_sidebar.js
index e637e1f1223..3c683e88cf3 100644
--- a/app/assets/javascripts/boards/components/board_sidebar.js
+++ b/app/assets/javascripts/boards/components/board_sidebar.js
@@ -2,18 +2,19 @@
import $ from 'jquery';
import Vue from 'vue';
-import Flash from '../../flash';
-import { sprintf, __ } from '../../locale';
-import Sidebar from '../../right_sidebar';
-import eventHub from '../../sidebar/event_hub';
-import AssigneeTitle from '../../sidebar/components/assignees/assignee_title.vue';
-import Assignees from '../../sidebar/components/assignees/assignees.vue';
-import DueDateSelectors from '../../due_date_select';
+import Flash from '~/flash';
+import { sprintf, __ } from '~/locale';
+import Sidebar from '~/right_sidebar';
+import eventHub from '~/sidebar/event_hub';
+import DueDateSelectors from '~/due_date_select';
+import IssuableContext from '~/issuable_context';
+import LabelsSelect from '~/labels_select';
+import AssigneeTitle from '~/sidebar/components/assignees/assignee_title.vue';
+import Assignees from '~/sidebar/components/assignees/assignees.vue';
+import Subscriptions from '~/sidebar/components/subscriptions/subscriptions.vue';
+import TimeTracker from '~/sidebar/components/time_tracking/time_tracker.vue';
+import MilestoneSelect from '~/milestone_select';
import RemoveBtn from './sidebar/remove_issue.vue';
-import IssuableContext from '../../issuable_context';
-import LabelsSelect from '../../labels_select';
-import Subscriptions from '../../sidebar/components/subscriptions/subscriptions.vue';
-import MilestoneSelect from '../../milestone_select';
import boardsStore from '../stores/boards_store';
export default Vue.extend({
@@ -22,6 +23,7 @@ export default Vue.extend({
Assignees,
RemoveBtn,
Subscriptions,
+ TimeTracker,
},
props: {
currentUser: {
diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js
index c4c5fedc615..009ae5dd331 100644
--- a/app/assets/javascripts/boards/index.js
+++ b/app/assets/javascripts/boards/index.js
@@ -24,7 +24,11 @@ import BoardSidebar from './components/board_sidebar';
import initNewListDropdown from './components/new_list_dropdown';
import BoardAddIssuesModal from './components/modal/index.vue';
import '~/vue_shared/vue_resource_interceptor';
-import { NavigationType, parseBoolean } from '~/lib/utils/common_utils';
+import {
+ NavigationType,
+ convertObjectPropsToCamelCase,
+ parseBoolean,
+} from '~/lib/utils/common_utils';
let issueBoardsApp;
@@ -133,9 +137,25 @@ export default () => {
BoardService.getIssueInfo(sidebarInfoEndpoint)
.then(res => res.data)
.then(data => {
+ const {
+ subscribed,
+ totalTimeSpent,
+ timeEstimate,
+ humanTimeEstimate,
+ humanTotalTimeSpent,
+ weight,
+ epic,
+ } = convertObjectPropsToCamelCase(data);
+
newIssue.setFetchingState('subscriptions', false);
newIssue.updateData({
- subscribed: data.subscribed,
+ humanTimeSpent: humanTotalTimeSpent,
+ timeSpent: totalTimeSpent,
+ humanTimeEstimate,
+ timeEstimate,
+ subscribed,
+ weight,
+ epic,
});
})
.catch(() => {
diff --git a/app/serializers/issue_board_entity.rb b/app/serializers/issue_board_entity.rb
index e0041eff6cc..2e1d7fb3f87 100644
--- a/app/serializers/issue_board_entity.rb
+++ b/app/serializers/issue_board_entity.rb
@@ -12,6 +12,7 @@ class IssueBoardEntity < Grape::Entity
expose :due_date
expose :project_id
expose :relative_position
+ expose :time_estimate
expose :project do |issue|
API::Entities::Project.represent issue.project, only: [:id, :path]
diff --git a/app/views/shared/boards/components/_sidebar.html.haml b/app/views/shared/boards/components/_sidebar.html.haml
index c9ff63f8c45..30e51ecc261 100644
--- a/app/views/shared/boards/components/_sidebar.html.haml
+++ b/app/views/shared/boards/components/_sidebar.html.haml
@@ -20,6 +20,7 @@
= render "shared/boards/components/sidebar/assignee"
= render_if_exists "shared/boards/components/sidebar/epic"
= render "shared/boards/components/sidebar/milestone"
+ = render "shared/boards/components/sidebar/time_tracker"
= render "shared/boards/components/sidebar/due_date"
= render "shared/boards/components/sidebar/labels"
= render_if_exists "shared/boards/components/sidebar/weight"
diff --git a/app/views/shared/boards/components/sidebar/_time_tracker.html.haml b/app/views/shared/boards/components/sidebar/_time_tracker.html.haml
new file mode 100644
index 00000000000..b76d44c5907
--- /dev/null
+++ b/app/views/shared/boards/components/sidebar/_time_tracker.html.haml
@@ -0,0 +1,6 @@
+.block.time-tracking
+ %time-tracker{ ":time-estimate" => "issue.timeEstimate || 0",
+ ":time-spent" => "issue.timeSpent || 0",
+ ":human-time-estimate" => "issue.humanTimeEstimate",
+ ":human-time-spent" => "issue.humanTimeSpent",
+ "root-path" => "#{root_url}" }
diff --git a/changelogs/unreleased/31331-add-time-tracking-issue-boards-sidebar.yml b/changelogs/unreleased/31331-add-time-tracking-issue-boards-sidebar.yml
new file mode 100644
index 00000000000..b3ffb77ccad
--- /dev/null
+++ b/changelogs/unreleased/31331-add-time-tracking-issue-boards-sidebar.yml
@@ -0,0 +1,5 @@
+---
+title: Add time tracking information to Issue Boards sidebar
+merge_request: 27166
+author:
+type: added
diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb
index b358c6b9c34..8f34fddbf06 100644
--- a/spec/features/boards/sidebar_spec.rb
+++ b/spec/features/boards/sidebar_spec.rb
@@ -222,6 +222,21 @@ describe 'Issue Boards', :js do
end
end
+ context 'time tracking' do
+ before do
+ issue2.timelogs.create(time_spent: 14400, user: user)
+ issue2.update!(time_estimate: 28800)
+ end
+
+ it 'shows time tracking progress bar' do
+ click_card(card)
+
+ page.within('.time-tracking') do
+ expect(find('.time-tracking-content .compare-meter')['data-original-title']).to eq('Time remaining: 4h')
+ end
+ end
+ end
+
context 'due date' do
it 'updates due date' do
click_card(card)