diff --git a/frontend/src/components/time-tracking/TaskTimeTracking.vue b/frontend/src/components/time-tracking/TaskTimeTracking.vue new file mode 100644 index 000000000..a05937ca2 --- /dev/null +++ b/frontend/src/components/time-tracking/TaskTimeTracking.vue @@ -0,0 +1,83 @@ + + + diff --git a/frontend/src/modelTypes/ITask.ts b/frontend/src/modelTypes/ITask.ts index f8504c30a..45b6de45a 100644 --- a/frontend/src/modelTypes/ITask.ts +++ b/frontend/src/modelTypes/ITask.ts @@ -51,6 +51,7 @@ export interface ITask extends IAbstract { reactions: IReactionPerEntity comments: ITaskComment[] commentCount?: number + timeEntriesCount?: number createdBy: IUser created: Date diff --git a/frontend/src/views/tasks/TaskDetailView.vue b/frontend/src/views/tasks/TaskDetailView.vue index 055e4f1ea..5396bc797 100644 --- a/frontend/src/views/tasks/TaskDetailView.vue +++ b/frontend/src/views/tasks/TaskDetailView.vue @@ -366,6 +366,15 @@ /> + +
+ +
+
{{ $t('task.detail.dateAndTime') }} + + {{ $t('task.detail.actions.timeTracking') }} + + configStore.isProFeatureEnabled(PRO_FEATURE.TIME_TRACKING)) const kanbanStore = useKanbanStore() const authStore = useAuthStore() const baseStore = useBaseStore() @@ -923,7 +947,12 @@ watch( } try { - const loaded = await taskService.get({id}, {expand: ['reactions', 'comments', 'is_unread', 'buckets']}) + const expand = ['reactions', 'comments', 'is_unread', 'buckets'] + if (timeTrackingEnabled.value) { + // Only request the (server-computed) count when the feature is on. + expand.push('time_entries_count') + } + const loaded = await taskService.get({id}, {expand}) Object.assign(task.value, loaded) taskColor.value = task.value.hexColor setActiveFields() @@ -967,6 +996,7 @@ type FieldType = | 'reminders' | 'repeatAfter' | 'startDate' + | 'timeTracking' const activeFields: { [type in FieldType]: boolean } = reactive({ assignees: false, @@ -982,6 +1012,7 @@ const activeFields: { [type in FieldType]: boolean } = reactive({ reminders: false, repeatAfter: false, startDate: false, + timeTracking: false, }) function setActiveFields() { @@ -992,6 +1023,7 @@ function setActiveFields() { // Set all active fields based on values in the model activeFields.assignees = task.value.assignees.length > 0 activeFields.attachments = task.value.attachments.length > 0 + activeFields.timeTracking = (task.value.timeEntriesCount ?? 0) > 0 activeFields.dueDate = task.value.dueDate !== null activeFields.endDate = task.value.endDate !== null activeFields.labels = task.value.labels.length > 0