Commit 50b16e78 authored by Bryce Johnson's avatar Bryce Johnson

Update to use human readable values from server.

parent f8a09735
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
((global) => { ((global) => {
gl.IssuableTimeTracker = Vue.component('issuable-time-tracker', { gl.IssuableTimeTracker = Vue.component('issuable-time-tracker', {
name: 'issuable-time-tracker', name: 'issuable-time-tracker',
props: [ 'time_estimate', 'time_spent' ], props: [ 'time_estimate', 'time_spent', 'human_time_estimate', 'human_time_spent' ],
data: function() { data: function() {
return { return {
displayHelp: false, displayHelp: false,
...@@ -41,10 +41,10 @@ ...@@ -41,10 +41,10 @@
/* Human readable time values */ /* Human readable time values */
estimatedPretty() { estimatedPretty() {
return this.stringifyTime(this.parsedEstimate); return this.human_time_estimate || this.stringifyTime(this.parsedEstimate);
}, },
spentPretty() { spentPretty() {
return this.stringifyTime(this.parsedSpent); return this.human_time_spent || this.stringifyTime(this.parsedSpent);
}, },
remainingPretty() { remainingPretty() {
return this.stringifyTime(this.parsedRemaining); return this.stringifyTime(this.parsedRemaining);
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
initPolling() { initPolling() {
new gl.SmartInterval({ new gl.SmartInterval({
callback: this.fetchIssuable, callback: this.fetchIssuable,
startingInterval: 1000, startingInterval: 5000,
maxInterval: 10000, maxInterval: 20000,
incrementByFactorOf: 3, incrementByFactorOf: 3,
lazyStart: false, lazyStart: false,
}); });
...@@ -42,11 +42,14 @@ ...@@ -42,11 +42,14 @@
}, },
listenForSlashCommands() { listenForSlashCommands() {
$(document).on('ajax:success', '.gfm-form', (e) => { $(document).on('ajax:success', '.gfm-form', (e) => {
// TODO: check if slash command was updated. // TODO: check for slash command
this.fetchIssuable(); this.fetchIssuable();
}); });
}, },
}, },
created() {
this.fetchIssuable();
},
mounted() { mounted() {
this.initPolling(); this.initPolling();
this.subscribeToUpdates(); this.subscribeToUpdates();
......
...@@ -72,13 +72,15 @@ ...@@ -72,13 +72,15 @@
.selectbox.hide-collapsed .selectbox.hide-collapsed
= f.hidden_field 'milestone_id', value: issuable.milestone_id, id: nil = f.hidden_field 'milestone_id', value: issuable.milestone_id, id: nil
= dropdown_tag('Milestone', options: { title: 'Assign milestone', toggle_class: 'js-milestone-select js-extra-options', filter: true, dropdown_class: 'dropdown-menu-selectable', placeholder: 'Search milestones', data: { show_no: true, field_name: "#{issuable.to_ability_name}[milestone_id]", project_id: @project.id, issuable_id: issuable.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :json), ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable), use_id: true }}) = dropdown_tag('Milestone', options: { title: 'Assign milestone', toggle_class: 'js-milestone-select js-extra-options', filter: true, dropdown_class: 'dropdown-menu-selectable', placeholder: 'Search milestones', data: { show_no: true, field_name: "#{issuable.to_ability_name}[milestone_id]", project_id: @project.id, issuable_id: issuable.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :json), ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable), use_id: true }})
// TODO: Need to add check for time_estimated - if issuable.has_attribute?(:time_estimated) once hooked up to backend
- if issuable.has_attribute?(:time_estimate) - if issuable.has_attribute?(:time_estimate)
#issuable-time-tracker.block #issuable-time-tracker.block
%issuable-time-tracker{ ':time_estimate' => 'issuable.time_estimate', ':time_spent' => 'issuable.time_spent' } %issuable-time-tracker{ ':time_estimate' => 'issuable.time_estimate', ':time_spent' => 'issuable.total_time_spent', ':human_time_estimate' => 'issuable.human_time_estimate', ':human_time_spent' => 'issuable.human_total_time_spent' }
// Fallback while content is loading
.title.hide-collapsed .title.hide-collapsed
Time tracking Time tracking
= icon('spinner spin') = icon('spinner spin')
// TODO: Remove this when we have webpack/svg solution implemented
.hide
.stopwatch-svg{ slot:'stopwatch' } .stopwatch-svg{ slot:'stopwatch' }
= custom_icon('icon_stopwatch') = custom_icon('icon_stopwatch')
- if issuable.has_attribute?(:due_date) - if issuable.has_attribute?(:due_date)
......
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