Commit 0a99e022 authored by Tim Zallmann's avatar Tim Zallmann

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
parents d2d9fb9a 214c1c7d
......@@ -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: {
......
......@@ -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(() => {
......
......@@ -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]
......
......@@ -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"
......
.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}" }
---
title: Add time tracking information to Issue Boards sidebar
merge_request: 27166
author:
type: added
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment