Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Correct the calculation of updated time entries && reload cost reports page after changing a time entry

Henriette Darge7eac61ee31f1
diff --git a/frontend/src/app/modules/grids/widgets/time-entries/list/time-entries-list.component.ts b/frontend/src/app/modules/grids/widgets/time-entries/list/time-entries-list.component.ts
index 5c95ec0f7fe..53f1ef4fb98 100644
--- a/frontend/src/app/modules/grids/widgets/time-entries/list/time-entries-list.component.ts
+++ b/frontend/src/app/modules/grids/widgets/time-entries/list/time-entries-list.component.ts
@@ -101,7 +101,9 @@ export abstract class WidgetTimeEntriesListComponent extends AbstractWidgetCompo
this.timeEntryEditService
.edit(loadedEntry)
.then((changedEntry) => {
- let newEntries = Object.assign(this.entries, [changedEntry.entry]);
+ let oldEntryIndex:number = this.entries.findIndex(el => el.id == changedEntry.entry.id);
+ let newEntries = this.entries;
+ newEntries[oldEntryIndex] = changedEntry.entry;
this.buildEntries(newEntries);
})
diff --git a/frontend/src/app/modules/grids/widgets/time-entries/project/time-entries-project.component.ts b/frontend/src/app/modules/grids/widgets/time-entries/project/time-entries-project.component.ts
index 07702369b2e..efe5fc5ab2d 100644
--- a/frontend/src/app/modules/grids/widgets/time-entries/project/time-entries-project.component.ts
+++ b/frontend/src/app/modules/grids/widgets/time-entries/project/time-entries-project.component.ts
@@ -13,7 +13,7 @@ import {CurrentProjectService} from "core-components/projects/current-project.se
})
export class WidgetTimeEntriesProjectComponent extends WidgetTimeEntriesListComponent implements OnInit {
constructor(readonly timeEntryDm:TimeEntryDmService,
- readonly injector:Injector,
+ protected readonly injector:Injector,
readonly timezone:TimezoneService,
readonly i18n:I18nService,
readonly pathHelper:PathHelperService,
diff --git a/frontend/src/app/modules/time_entries/edit/trigger-edit-entry.component.ts b/frontend/src/app/modules/time_entries/edit/trigger-edit-entry.component.ts
index 3260638d52b..46684339c14 100644
--- a/frontend/src/app/modules/time_entries/edit/trigger-edit-entry.component.ts
+++ b/frontend/src/app/modules/time_entries/edit/trigger-edit-entry.component.ts
@@ -58,7 +58,7 @@ export class TriggerEditEntryComponent implements OnInit {
this.timeEntryEditService
.edit(entry)
.then(() => {
- // ToDO: reload page
+ window.location.reload();
})
.catch(() => {
// User canceled the modal
diff --git a/modules/reporting/lib/widget/table/entry_table.rb b/modules/reporting/lib/widget/table/entry_table.rb
index 9614f681b95..b6358e7c864 100644
--- a/modules/reporting/lib/widget/table/entry_table.rb
+++ b/modules/reporting/lib/widget/table/entry_table.rb
@@ -157,10 +157,8 @@ class ::Widget::Table::EntryTable < ::Widget::Table
if entry_for(result).editable_by? User.current
icons = content_tag(:'time-entry--trigger-edit-entry',
'',
- {
- title: l(:button_edit),
- data: { entry: result['id'] }
- })
+ title: l(:button_edit),
+ data: { entry: result['id'] })
icons << link_to(icon_wrapper('icon-context icon-delete', l(:button_delete)),
(action_for(result, action: 'destroy')
.reverse_merge(authenticity_token: form_authenticity_token)),
@@ -168,7 +166,6 @@ class ::Widget::Table::EntryTable < ::Widget::Table
method: :delete,
class: 'no-decoration-on-hover',
title: l(:button_delete))
-
end
end
icons