2018-02-21 12:20:56 -05:00
|
|
|
import Vue from 'vue';
|
2021-12-13 07:12:59 -05:00
|
|
|
import { IssuableType } from '~/issues/constants';
|
2019-06-11 06:40:01 -04:00
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
2021-02-01 10:08:56 -05:00
|
|
|
import timeTracker from './components/time_tracking/time_tracker.vue';
|
2018-02-21 12:20:56 -05:00
|
|
|
|
|
|
|
export default class SidebarMilestone {
|
|
|
|
constructor() {
|
|
|
|
const el = document.getElementById('issuable-time-tracker');
|
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
2021-05-21 11:10:51 -04:00
|
|
|
const {
|
|
|
|
timeEstimate,
|
|
|
|
timeSpent,
|
|
|
|
humanTimeEstimate,
|
|
|
|
humanTimeSpent,
|
|
|
|
limitToHours,
|
2021-06-15 17:10:04 -04:00
|
|
|
iid,
|
2021-05-21 11:10:51 -04:00
|
|
|
} = el.dataset;
|
2018-10-03 04:34:13 -04:00
|
|
|
|
2018-02-21 12:20:56 -05:00
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-02-16 16:12:25 -05:00
|
|
|
name: 'SidebarMilestoneRoot',
|
2018-02-21 12:20:56 -05:00
|
|
|
components: {
|
|
|
|
timeTracker,
|
|
|
|
},
|
2021-05-21 11:10:51 -04:00
|
|
|
provide: {
|
|
|
|
issuableType: IssuableType.Milestone,
|
|
|
|
},
|
2020-12-23 19:10:25 -05:00
|
|
|
render: (createElement) =>
|
2018-10-10 02:53:35 -04:00
|
|
|
createElement('timeTracker', {
|
|
|
|
props: {
|
2019-06-11 06:40:01 -04:00
|
|
|
limitToHours: parseBoolean(limitToHours),
|
2021-06-15 17:10:04 -04:00
|
|
|
issuableIid: iid.toString(),
|
|
|
|
initialTimeTracking: {
|
|
|
|
timeEstimate: parseInt(timeEstimate, 10),
|
|
|
|
totalTimeSpent: parseInt(timeSpent, 10),
|
|
|
|
humanTimeEstimate,
|
|
|
|
humanTotalTimeSpent: humanTimeSpent,
|
|
|
|
},
|
2018-10-10 02:53:35 -04:00
|
|
|
},
|
|
|
|
}),
|
2018-02-21 12:20:56 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|