Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion models/tracker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ function defineFilters (builder: Builder): void {
getVisibleFilters: tracker.function.GetVisibleFilters
})

builder.mixin(tracker.class.TimeSpendReport, core.class.Class, view.mixin.ClassFilters, {
filters: ['employee', 'space', 'attachedTo', 'date'],
ignoreKeys: ['value']
})

builder.mixin(tracker.class.Issue, core.class.Class, view.mixin.ObjectIdentifier, {
provider: tracker.function.IssueIdentifierProvider
})
Expand Down Expand Up @@ -339,6 +344,7 @@ function defineApplication (
opt: {
myIssuesId: string
allIssuesId: string
timeReportsId: string
issuesId: string
componentsId: string
milestonesId: string
Expand Down Expand Up @@ -392,6 +398,18 @@ function defineApplication (
allProjectsTypes: true
}
},
{
id: opt.timeReportsId,
position: 'top',
label: tracker.string.TimeReports,
icon: tracker.icon.TimeReport,
component: workbench.component.SpecialView,
componentProps: {
_class: tracker.class.TimeSpendReport,
icon: tracker.icon.TimeReport,
label: tracker.string.TimeReports
}
},
{
id: 'all-projects',
component: workbench.component.SpecialView,
Expand Down Expand Up @@ -540,6 +558,7 @@ export function createModel (builder: Builder): void {
const templatesId = 'templates'
const myIssuesId = 'my-issues'
const allIssuesId = 'all-issues'
const timeReportsId = 'time-reports'
const labelsId = 'labels'
// const scrumsId = 'scrums'

Expand All @@ -553,6 +572,10 @@ export function createModel (builder: Builder): void {
presenters: [tracker.component.IssueStatistics]
})

builder.mixin(tracker.class.TimeSpendReport, core.class.Class, view.mixin.ListHeaderExtra, {
presenters: [tracker.component.TimeSpendReportTotal]
})

defineSortAndGrouping(builder)

builder.createDoc<ClassCollaborators<Issue>>(core.class.ClassCollaborators, core.space.Model, {
Expand Down Expand Up @@ -689,7 +712,16 @@ export function createModel (builder: Builder): void {
tracker.ids.IssueTemplateUpdatedActivityViewlet
)

defineApplication(builder, { myIssuesId, allIssuesId, issuesId, componentsId, milestonesId, templatesId, labelsId })
defineApplication(builder, {
myIssuesId,
allIssuesId,
timeReportsId,
issuesId,
componentsId,
milestonesId,
templatesId,
labelsId
})

defineActions(builder, issuesId, componentsId, myIssuesId)

Expand Down
5 changes: 4 additions & 1 deletion models/tracker/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default mergeIds(trackerId, tracker, {
component: {
MilestoneSelector: '' as AnyComponent,
IssueStatistics: '' as AnyComponent,
TimeSpendReportTotal: '' as AnyComponent,
TimeSpendReportPopup: '' as AnyComponent,
NotificationIssuePresenter: '' as AnyComponent,
MilestoneFilter: '' as AnyComponent,
Expand All @@ -75,7 +76,9 @@ export default mergeIds(trackerId, tracker, {
MilestoneList: '' as Ref<Viewlet>,
ComponentList: '' as Ref<Viewlet>,
ProjectList: '' as Ref<Viewlet>,
ProjectListGrouped: '' as Ref<Viewlet>
ProjectListGrouped: '' as Ref<Viewlet>,
TimeSpendReportTable: '' as Ref<Viewlet>,
TimeSpendReportList: '' as Ref<Viewlet>
},
ids: {
TrackerNotificationGroup: '' as Ref<NotificationGroup>,
Expand Down
3 changes: 3 additions & 0 deletions models/tracker/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ export class TTimeSpendReport extends TAttachedDoc implements TimeSpendReport {
@Prop(TypeRef(tracker.class.Issue), tracker.string.Issue)
declare attachedTo: Ref<Issue>

@Prop(TypeRef(tracker.class.Project), tracker.string.Project)
declare space: Ref<Project>

@Prop(TypeRef(contact.mixin.Employee), contact.string.Employee)
employee!: Ref<Employee>

Expand Down
59 changes: 59 additions & 0 deletions models/tracker/src/viewlets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1063,4 +1063,63 @@ export function defineViewlets (builder: Builder): void {
},
tracker.viewlet.MilestoneList
)

const timeSpendReportOptions = (grouping: boolean): ViewOptionsModel => ({
groupBy: grouping ? ['employee', 'space', 'createdBy'] : [],
orderBy: [
['date', SortingOrder.Descending],
['value', SortingOrder.Descending],
['modifiedOn', SortingOrder.Descending],
['createdOn', SortingOrder.Descending]
],
other: []
})

builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.TimeSpendReport,
descriptor: view.viewlet.Table,
viewOptions: timeSpendReportOptions(false),
configOptions: {
hiddenKeys: ['value'],
sortable: true
},
config: [
'date',
'employee',
'$lookup.attachedTo',
'$lookup.attachedTo.title',
'space',
{ key: '', sortingKey: 'value' },
'description'
]
},
tracker.viewlet.TimeSpendReportTable
)

builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.TimeSpendReport,
descriptor: view.viewlet.List,
viewOptions: timeSpendReportOptions(true),
configOptions: {
strict: true,
hiddenKeys: ['value']
},
config: [
{ key: '$lookup.attachedTo', displayProps: { key: 'issue', fixed: 'left' } },
{ key: '$lookup.attachedTo.title', displayProps: { grow: true } },
{ key: 'description', displayProps: { key: 'description', compression: true } },
{ key: 'space', displayProps: { key: 'space', compression: true } },
{ key: 'employee', displayProps: { key: 'employee' } },
{ key: 'date', displayProps: { key: 'date', fixed: 'right' } },
{ key: '', displayProps: { key: 'value', fixed: 'right', dividerBefore: true } }
]
},
tracker.viewlet.TimeSpendReportList
)
}
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
"ReportedTime": "Strávený čas",
"RemainingTime": "Zbývající čas",
"TimeSpendReports": "Zprávy o stráveném čase",
"TimeReports": "Výkazy času",
"TimeSpendReport": "Čas",
"TimeSpendReportAdd": "Přidat zprávu o čase",
"TimeSpendReportDate": "Datum",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
"ReportedTime": "Aufgewendete Zeit",
"RemainingTime": "Verbleibende Zeit",
"TimeSpendReports": "Zeiterfassungsberichte",
"TimeReports": "Zeiterfassung",
"TimeSpendReport": "Zeit",
"TimeSpendReportAdd": "Zeiterfassung hinzufügen",
"TimeSpendReportDate": "Datum",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"ReportedTime": "Spent time",
"RemainingTime": "Remaining time",
"TimeSpendReports": "Time spent reports",
"TimeReports": "Time reports",
"TimeSpendReport": "Time",
"TimeSpendReportAdd": "Add time report",
"TimeSpendReportDate": "Date",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
"ReportedTime": "Tiempo empleado",
"RemainingTime": "Tiempo restante",
"TimeSpendReports": "Informes de tiempo empleado",
"TimeReports": "Informes de tiempo",
"TimeSpendReport": "Tiempo",
"TimeSpendReportAdd": "Agregar informe de tiempo",
"TimeSpendReportDate": "Fecha",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
"ReportedTime": "Temps passé",
"RemainingTime": "Temps restant",
"TimeSpendReports": "Rapports de temps passé",
"TimeReports": "Rapports de temps",
"TimeSpendReport": "Temps",
"TimeSpendReportAdd": "Ajouter un rapport de temps",
"TimeSpendReportDate": "Date",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
"ReportedTime": "Tempo trascorso",
"RemainingTime": "Tempo rimanente",
"TimeSpendReports": "Rapporti sul tempo trascorso",
"TimeReports": "Rapporti sui tempi",
"TimeSpendReport": "Tempo",
"TimeSpendReportAdd": "Aggiungi rapporto sul tempo",
"TimeSpendReportDate": "Data",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
"ReportedTime": "消費時間",
"RemainingTime": "残り時間",
"TimeSpendReports": "時間消費レポート",
"TimeReports": "時間レポート",
"TimeSpendReport": "時間",
"TimeSpendReportAdd": "時間レポートを追加",
"TimeSpendReportDate": "日付",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
"ReportedTime": "사용 시간",
"RemainingTime": "남은 시간",
"TimeSpendReports": "시간 사용 보고서",
"TimeReports": "시간 보고서",
"TimeSpendReport": "시간",
"TimeSpendReportAdd": "시간 보고서 추가",
"TimeSpendReportDate": "날짜",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
"ReportedTime": "Czas poświęcony",
"RemainingTime": "Pozostały czas",
"TimeSpendReports": "Raporty poświęconego czasu",
"TimeReports": "Raporty czasu",
"TimeSpendReport": "Czas",
"TimeSpendReportAdd": "Dodaj raport",
"TimeSpendReportDate": "Data",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
"ReportedTime": "Tempo gasto",
"RemainingTime": "Tempo restante",
"TimeSpendReports": "Relatórios de tempo gasto",
"TimeReports": "Relatórios de tempo",
"TimeSpendReport": "Tempo",
"TimeSpendReportAdd": "Adicionar relatório de tempo",
"TimeSpendReportDate": "Data",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
"ReportedTime": "Tempo gasto",
"RemainingTime": "Tempo restante",
"TimeSpendReports": "Relatórios de tempo gasto",
"TimeReports": "Relatórios de tempo",
"TimeSpendReport": "Tempo",
"TimeSpendReportAdd": "Adicionar relatório de tempo",
"TimeSpendReportDate": "Data",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"ReportedTime": "Потраченное времени",
"RemainingTime": "Осталось времени",
"TimeSpendReports": "Отчеты по времени",
"TimeReports": "Отчеты по времени",
"TimeSpendReport": "Время",
"TimeSpendReportAdd": "Добавить затраченное время",
"TimeSpendReportDate": "Дата",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
"ReportedTime": "Harcanan zaman",
"RemainingTime": "Kalan zaman",
"TimeSpendReports": "Harcanan zaman raporları",
"TimeReports": "Zaman raporları",
"TimeSpendReport": "Zaman",
"TimeSpendReportAdd": "Zaman raporu ekle",
"TimeSpendReportDate": "Tarih",
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-assets/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
"ReportedTime": "花费时间",
"RemainingTime": "剩余时间",
"TimeSpendReports": "花费时间报告",
"TimeReports": "时间报告",
"TimeSpendReport": "时间",
"TimeSpendReportAdd": "添加时间报告",
"TimeSpendReportDate": "日期",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!--
// Copyright © 2026 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import { Doc, DocumentQuery } from '@hcengineering/core'
import { createQuery } from '@hcengineering/presentation'
import { TimeSpendReport } from '@hcengineering/tracker'
import { floorFractionDigits } from '@hcengineering/ui'
import tracker from '../../../plugin'
import TimePresenter from './TimePresenter.svelte'

// Query of the list category (view query + group keys), provided by the list header.
export let categoryQuery: DocumentQuery<Doc> | undefined = undefined

const query = createQuery()
let total: number | undefined = undefined

$: if (categoryQuery !== undefined) {
query.query(
tracker.class.TimeSpendReport,
categoryQuery as DocumentQuery<TimeSpendReport>,
(res) => {
total = floorFractionDigits(
res.reduce((sum, it) => sum + (it.value ?? 0), 0),
3
)
},
{ projection: { _id: 1, value: 1 } }
)
} else {
query.unsubscribe()
total = undefined
}
</script>

{#if total !== undefined}
<TimePresenter value={total} accent />
{/if}
2 changes: 2 additions & 0 deletions plugins/tracker-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ import SubIssuesSelector from './components/issues/edit/SubIssuesSelector.svelte
import EstimationEditor from './components/issues/timereport/EstimationEditor.svelte'
import ReportedTimeEditor from './components/issues/timereport/ReportedTimeEditor.svelte'
import TimeSpendReport from './components/issues/timereport/TimeSpendReport.svelte'
import TimeSpendReportTotal from './components/issues/timereport/TimeSpendReportTotal.svelte'

import RelatedIssues from './components/issues/related/RelatedIssues.svelte'
import RelatedIssueTemplates from './components/issues/related/RelatedIssueTemplates.svelte'
Expand Down Expand Up @@ -457,6 +458,7 @@ export default async (): Promise<Resources> => ({
MilestoneEditor,
ReportedTimeEditor,
TimeSpendReport,
TimeSpendReportTotal,
EstimationEditor,
SubIssuesSelector,
RelatedIssues,
Expand Down
1 change: 1 addition & 0 deletions plugins/tracker-resources/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export default mergeIds(trackerId, tracker, {
TimeSpendReport: '' as IntlString,
TimeSpendReportAdd: '' as IntlString,
TimeSpendReports: '' as IntlString,
TimeReports: '' as IntlString,
TimeSpendReportDate: '' as IntlString,
TimeSpendReportValue: '' as IntlString,
TimeSpendReportDescription: '' as IntlString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
docsQuery.unsubscribe()
}

$: categoryQuery = { ...resultQuery, ...docKeys }

$: categoryCollapseKey = `list_collapsing_${location.pathname}_${groupPersistKey}`
$: storedCollapseState = localStorage.getItem(categoryCollapseKey)

Expand Down Expand Up @@ -477,6 +479,7 @@
{lastCat}
{viewOptions}
{loading}
{categoryQuery}
on:collapse={() => {
collapsed = !collapsed
if (collapsed) {
Expand Down
Loading