Commit 7611ec4e authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'refactor/move-issuable-time-tracker-vue-component' into 'master'

Move IssuableTimeTracker vue component

See merge request gitlab-org/gitlab-ce!16948
parents 0a5041a3 525d5830
...@@ -2,7 +2,7 @@ import _ from 'underscore'; ...@@ -2,7 +2,7 @@ import _ from 'underscore';
import '~/smart_interval'; import '~/smart_interval';
import timeTracker from './time_tracker'; import IssuableTimeTracker from './time_tracker.vue';
import Store from '../../stores/sidebar_store'; import Store from '../../stores/sidebar_store';
import Mediator from '../../sidebar_mediator'; import Mediator from '../../sidebar_mediator';
...@@ -16,7 +16,7 @@ export default { ...@@ -16,7 +16,7 @@ export default {
}; };
}, },
components: { components: {
'issuable-time-tracker': timeTracker, IssuableTimeTracker,
}, },
methods: { methods: {
listenForQuickActions() { listenForQuickActions() {
......
<script>
import timeTrackingHelpState from './help_state'; import timeTrackingHelpState from './help_state';
import timeTrackingCollapsedState from './collapsed_state'; import timeTrackingCollapsedState from './collapsed_state';
import timeTrackingSpentOnlyPane from './spent_only_pane'; import timeTrackingSpentOnlyPane from './spent_only_pane';
...@@ -8,7 +9,15 @@ import timeTrackingComparisonPane from './comparison_pane'; ...@@ -8,7 +9,15 @@ import timeTrackingComparisonPane from './comparison_pane';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
export default { export default {
name: 'issuable-time-tracker', name: 'IssuableTimeTracker',
components: {
'time-tracking-collapsed-state': timeTrackingCollapsedState,
'time-tracking-estimate-only-pane': timeTrackingEstimateOnlyPane,
'time-tracking-spent-only-pane': timeTrackingSpentOnlyPane,
'time-tracking-no-tracking-pane': timeTrackingNoTrackingPane,
'time-tracking-comparison-pane': timeTrackingComparisonPane,
'time-tracking-help-state': timeTrackingHelpState,
},
props: { props: {
time_estimate: { time_estimate: {
type: Number, type: Number,
...@@ -38,14 +47,6 @@ export default { ...@@ -38,14 +47,6 @@ export default {
showHelp: false, showHelp: false,
}; };
}, },
components: {
'time-tracking-collapsed-state': timeTrackingCollapsedState,
'time-tracking-estimate-only-pane': timeTrackingEstimateOnlyPane,
'time-tracking-spent-only-pane': timeTrackingSpentOnlyPane,
'time-tracking-no-tracking-pane': timeTrackingNoTrackingPane,
'time-tracking-comparison-pane': timeTrackingComparisonPane,
'time-tracking-help-state': timeTrackingHelpState,
},
computed: { computed: {
timeSpent() { timeSpent() {
return this.time_spent; return this.time_spent;
...@@ -81,6 +82,9 @@ export default { ...@@ -81,6 +82,9 @@ export default {
return !!this.showHelp; return !!this.showHelp;
}, },
}, },
created() {
eventHub.$on('timeTracker:updateData', this.update);
},
methods: { methods: {
toggleHelpState(show) { toggleHelpState(show) {
this.showHelp = show; this.showHelp = show;
...@@ -92,10 +96,10 @@ export default { ...@@ -92,10 +96,10 @@ export default {
this.human_time_spent = data.human_time_spent; this.human_time_spent = data.human_time_spent;
}, },
}, },
created() { };
eventHub.$on('timeTracker:updateData', this.update); </script>
},
template: ` <template>
<div <div
class="time_tracker time-tracking-component-wrap" class="time_tracker time-tracking-component-wrap"
v-cloak v-cloak
...@@ -119,7 +123,8 @@ export default { ...@@ -119,7 +123,8 @@ export default {
<i <i
class="fa fa-question-circle" class="fa fa-question-circle"
aria-hidden="true" aria-hidden="true"
/> >
</i>
</div> </div>
<div <div
class="close-help-button pull-right" class="close-help-button pull-right"
...@@ -129,7 +134,8 @@ export default { ...@@ -129,7 +134,8 @@ export default {
<i <i
class="fa fa-close" class="fa fa-close"
aria-hidden="true" aria-hidden="true"
/> >
</i>
</div> </div>
</div> </div>
<div class="time-tracking-content hide-collapsed"> <div class="time-tracking-content hide-collapsed">
...@@ -154,10 +160,9 @@ export default { ...@@ -154,10 +160,9 @@ export default {
<transition name="help-state-toggle"> <transition name="help-state-toggle">
<time-tracking-help-state <time-tracking-help-state
v-if="showHelpState" v-if="showHelpState"
:rootPath="rootPath" :root-path="rootPath"
/> />
</transition> </transition>
</div> </div>
</div> </div>
`, </template>
};
---
title: Move IssuableTimeTracker vue component
merge_request: 16948
author: George Tsiolis
type: performance
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import Vue from 'vue'; import Vue from 'vue';
import timeTracker from '~/sidebar/components/time_tracking/time_tracker'; import timeTracker from '~/sidebar/components/time_tracking/time_tracker.vue';
function initTimeTrackingComponent(opts) { function initTimeTrackingComponent(opts) {
setFixtures(` setFixtures(`
......
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