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

use the new dialog in the costs report as well

Klaus Zanders7c4d7fb41136
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.ts
index 919c86e38c8..1cb5e378435 100644
--- a/frontend/src/app/core/path-helper/path-helper.service.ts
+++ b/frontend/src/app/core/path-helper/path-helper.service.ts
@@ -342,6 +342,10 @@ export class PathHelperService {
return `${this.staticBase}/time_entries/dialog`;
}
+ public timeEntryEditDialog(timeEntryId:string) {
+ return `${this.timeEntryDialog()}?time_entry_id=${timeEntryId}`;
+ }
+
public timeEntryWorkPackageDialog(workPackageId:string) {
return `${this.workPackagePath(workPackageId)}/time_entries/dialog`;
}
diff --git a/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts
index 7f03a1212b0..5f11bf178f8 100644
--- a/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts
+++ b/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts
@@ -35,8 +35,6 @@ import { TimeEntryResource } from 'core-app/features/hal/resources/time-entry-re
import { CollectionResource } from 'core-app/features/hal/resources/collection-resource';
import interactionPlugin from '@fullcalendar/interaction';
import { HalResourceEditingService } from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';
-import { TimeEntryEditService } from 'core-app/shared/components/time_entries/edit/edit.service';
-import { TimeEntryCreateService } from 'core-app/shared/components/time_entries/create/create.service';
import { ColorsService } from 'core-app/shared/components/colors/colors.service';
import { BrowserDetector } from 'core-app/core/browser/browser-detector.service';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
@@ -106,8 +104,6 @@ const ADD_ENTRY_PROHIBITED_CLASS_NAME = '-prohibited';
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
OpCalendarService,
- TimeEntryEditService,
- TimeEntryCreateService,
HalResourceEditingService,
TurboRequestsService,
PathHelperService,
@@ -214,8 +210,6 @@ export class TimeEntryCalendarComponent {
private sanitizer:DomSanitizer,
private configuration:ConfigurationService,
private timezone:TimezoneService,
- private timeEntryEdit:TimeEntryEditService,
- private timeEntryCreate:TimeEntryCreateService,
private schemaCache:SchemaCacheService,
private colors:ColorsService,
private browserDetector:BrowserDetector,
@@ -485,7 +479,7 @@ export class TimeEntryCalendarComponent {
private editEvent(entry:TimeEntryResource):void {
void this.turboRequests.request(
- `${this.pathHelper.timeEntryDialog()}?time_entry_id=${entry.id}`,
+ `${this.pathHelper.timeEntryEditDialog(entry.id as string)}`,
{ method: 'GET' },
);
}
diff --git a/frontend/src/app/shared/components/time_entries/edit/trigger-actions-entry.component.ts b/frontend/src/app/shared/components/time_entries/edit/trigger-actions-entry.component.ts
index 8f8a6b83795..421a082af51 100644
--- a/frontend/src/app/shared/components/time_entries/edit/trigger-actions-entry.component.ts
+++ b/frontend/src/app/shared/components/time_entries/edit/trigger-actions-entry.component.ts
@@ -1,6 +1,5 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Injector } from '@angular/core';
import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
-import { TimeEntryEditService } from 'core-app/shared/components/time_entries/edit/edit.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
import {
@@ -9,6 +8,8 @@ import {
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { TimeEntryResource } from 'core-app/features/hal/resources/time-entry-resource';
import { Observable, switchMap } from 'rxjs';
+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
+import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';
@Component({
selector: 'opce-time-entry-trigger-actions',
@@ -27,12 +28,11 @@ import { Observable, switchMap } from 'rxjs';
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
HalResourceEditingService,
- TimeEntryEditService,
+ PathHelperService,
+ TurboRequestsService,
],
})
export class TriggerActionsEntryComponent {
- @InjectField() readonly timeEntryEditService:TimeEntryEditService;
-
@InjectField() readonly apiv3Service:ApiV3Service;
@InjectField() readonly toastService:ToastService;
@@ -43,6 +43,10 @@ export class TriggerActionsEntryComponent {
@InjectField() readonly cdRef:ChangeDetectorRef;
+ @InjectField() readonly pathHelper:PathHelperService;
+
+ @InjectField() readonly turboRequestService:TurboRequestsService;
+
public text = {
edit: this.i18n.t('js.button_edit'),
delete: this.i18n.t('js.button_delete'),
@@ -54,18 +58,13 @@ export class TriggerActionsEntryComponent {
}
editTimeEntry() {
- void this
- .loadEntry()
- .subscribe((entry) => {
- this.timeEntryEditService
- .edit(entry)
- .then(() => {
- window.location.reload();
- })
- .catch(() => {
- // User canceled the modal
- });
- });
+ void this.loadEntry().subscribe((entry:TimeEntryResource) => {
+ // TODO: We need to reload here when the dialog is submitted ... How should we do this?
+ void this.turboRequestService.request(
+ this.pathHelper.timeEntryEditDialog(entry.id as string),
+ { method: 'GET' },
+ );
+ });
}
deleteTimeEntry() {