2018-03-27 19:54:05 +05:30
|
|
|
import Vue from 'vue';
|
2022-01-26 12:08:38 +05:30
|
|
|
import { IssuableType } from '~/issues/constants';
|
2019-09-30 21:07:59 +05:30
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
2022-10-11 01:57:18 +05:30
|
|
|
import TimeTracker from './components/time_tracking/time_tracker.vue';
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
export default class SidebarMilestone {
|
|
|
|
constructor() {
|
2023-01-13 00:05:48 +05:30
|
|
|
const el = document.querySelector('.js-sidebar-time-tracking-root');
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
const {
|
|
|
|
timeEstimate,
|
|
|
|
timeSpent,
|
|
|
|
humanTimeEstimate,
|
|
|
|
humanTimeSpent,
|
|
|
|
limitToHours,
|
|
|
|
iid,
|
|
|
|
} = el.dataset;
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarMilestoneRoot',
|
2018-03-27 19:54:05 +05:30
|
|
|
components: {
|
2022-10-11 01:57:18 +05:30
|
|
|
TimeTracker,
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
2021-09-04 01:27:46 +05:30
|
|
|
provide: {
|
|
|
|
issuableType: IssuableType.Milestone,
|
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
render: (createElement) =>
|
2022-10-11 01:57:18 +05:30
|
|
|
createElement('time-tracker', {
|
2018-12-13 13:39:08 +05:30
|
|
|
props: {
|
2019-09-30 21:07:59 +05:30
|
|
|
limitToHours: parseBoolean(limitToHours),
|
2021-09-04 01:27:46 +05:30
|
|
|
issuableIid: iid.toString(),
|
|
|
|
initialTimeTracking: {
|
|
|
|
timeEstimate: parseInt(timeEstimate, 10),
|
|
|
|
totalTimeSpent: parseInt(timeSpent, 10),
|
|
|
|
humanTimeEstimate,
|
|
|
|
humanTotalTimeSpent: humanTimeSpent,
|
|
|
|
},
|
2023-03-04 22:38:38 +05:30
|
|
|
canAddTimeEntries: false,
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
}),
|
2018-03-27 19:54:05 +05:30
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|