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

[45742] Fix missing injection in project time entries

Oliver Güntherf1d590fc6ef9
diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.html b/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.html
index 340c4be1984..d6fe6168d9d 100644
--- a/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.html
+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.html
@@ -92,7 +92,9 @@
<td class="buttons">
<a *ngIf="item.entry && item.entry.updateImmediately"
(click)="editTimeEntry(item.entry)"
- [title]="text.edit">
+ [title]="text.edit"
+ attr.data-qa-selector="edit-time-entry-{{ item.entry.id }}"
+ >
<op-icon icon-classes="icon-context icon-edit"></op-icon>
</a>
<a *ngIf="item.entry && item.entry.delete"
diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/project/time-entries-project.component.ts b/frontend/src/app/shared/components/grids/widgets/time-entries/project/time-entries-project.component.ts
index c7127dd9caa..32dd3d8bc88 100644
--- a/frontend/src/app/shared/components/grids/widgets/time-entries/project/time-entries-project.component.ts
+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/project/time-entries-project.component.ts
@@ -1,5 +1,8 @@
import {
- ChangeDetectorRef, Component, Injector, OnInit,
+ ChangeDetectorRef,
+ Component,
+ Injector,
+ OnInit,
} from '@angular/core';
import { WidgetTimeEntriesListComponent } from 'core-app/shared/components/grids/widgets/time-entries/list/time-entries-list.component';
import { I18nService } from 'core-app/core/i18n/i18n.service';
@@ -8,9 +11,15 @@ import { CurrentProjectService } from 'core-app/core/current-project/current-pro
import { FilterOperator } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import { ConfirmDialogService } from 'core-app/shared/components/modals/confirm-dialog/confirm-dialog.service';
+import { TimeEntryEditService } from 'core-app/shared/components/time_entries/edit/edit.service';
+import { HalResourceEditingService } from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';
@Component({
templateUrl: '../list/time-entries-list.component.html',
+ providers: [
+ HalResourceEditingService,
+ TimeEntryEditService,
+ ],
})
export class WidgetTimeEntriesProjectComponent extends WidgetTimeEntriesListComponent implements OnInit {
constructor(readonly injector:Injector,
diff --git a/frontend/src/app/shared/components/time_entries/openproject-time-entries.module.ts b/frontend/src/app/shared/components/time_entries/openproject-time-entries.module.ts
index 60c37a5a39b..c73271079f5 100644
--- a/frontend/src/app/shared/components/time_entries/openproject-time-entries.module.ts
+++ b/frontend/src/app/shared/components/time_entries/openproject-time-entries.module.ts
@@ -45,9 +45,6 @@ import { TriggerActionsEntryComponent } from 'core-app/shared/components/time_en
// Editable fields e.g. for modals
OpenprojectFieldsModule,
],
- providers: [
- TimeEntryEditService,
- ],
declarations: [
TimeEntryEditModalComponent,
TimeEntryCreateModalComponent,
diff --git a/modules/dashboards/spec/features/time_entries_spec.rb b/modules/dashboards/spec/features/time_entries_spec.rb
index e665018f01c..ed27f71feaa 100644
--- a/modules/dashboards/spec/features/time_entries_spec.rb
+++ b/modules/dashboards/spec/features/time_entries_spec.rb
@@ -68,6 +68,8 @@ describe 'Time entries widget on dashboard', type: :feature, js: true, with_mail
let(:role) do
create(:role,
permissions: %i[view_time_entries
+ view_work_packages
+ edit_time_entries
view_dashboards
manage_dashboards])
end
@@ -81,6 +83,8 @@ describe 'Time entries widget on dashboard', type: :feature, js: true, with_mail
end
end
+ let(:time_logging_modal) { ::Components::TimeLoggingModal.new }
+
let(:dashboard) do
Pages::Dashboard.new(project)
end
@@ -122,6 +126,27 @@ describe 'Time entries widget on dashboard', type: :feature, js: true, with_mail
.to have_selector('.comments', text: other_visible_time_entry.comments)
expect(page)
.to have_selector('.hours', text: other_visible_time_entry.hours)
+
+ # Allows to edit
+ page.find("[data-qa-selector='edit-time-entry-#{visible_time_entry.id}']").click
end
+
+ time_logging_modal.is_visible true
+
+ time_logging_modal.expect_work_package work_package.subject
+
+ time_logging_modal.update_field 'hours', 4
+
+ sleep(0.1)
+
+ time_logging_modal.perform_action 'Save'
+ time_logging_modal.is_visible false
+
+ within spent_time_widget.area do
+ expect(page).to have_selector('.hours', text: 4)
+ end
+
+ visible_time_entry.reload
+ expect(visible_time_entry.hours).to eq 4.0
end
end
diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rb
index be9d214795b..9a18f8a5c32 100644
--- a/spec/features/support/components/time_logging_modal.rb
+++ b/spec/features/support/components/time_logging_modal.rb
@@ -65,6 +65,12 @@ module Components
end
end
+ def expect_work_package(subject)
+ within modal_container do
+ expect(page).to have_selector('.ng-value', text: subject, wait: 10)
+ end
+ end
+
def shows_field(field, visible)
within modal_container do
if visible