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

Also fix time-entries-list to use entity instead of WP

Klaus Zandersecf3aa445e1d
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 e4c53d0f056..8e37a8ea862 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
@@ -38,7 +38,7 @@
<th>
<div class="generic-table--sort-header-outer">
<div class="generic-table--sort-header">
- <span [textContent]="schema.workPackage.name"></span>
+ <span [textContent]="schema.entity.name"></span>
</div>
</div>
</th>
@@ -70,11 +70,11 @@
<strong [textContent]="item.date"></strong>
</td>
<td class="subject"
- *ngIf="item.entry && item.entry.workPackage">
- {{projectName(item.entry)}} - <a [href]="workPackagePath(item.entry)" [textContent]="workPackageName(item.entry)"></a>
+ *ngIf="item.entry && item.entry.entity">
+ {{projectName(item.entry)}} - <a [href]="entityPath(item.entry)" [textContent]="entityName(item.entry)"></a>
</td>
<td class="subject"
- *ngIf="item.entry && !item.entry.workPackage"
+ *ngIf="item.entry && !item.entry.entity"
[textContent]="projectName(item.entry)">
</td>
<td class="comments"
diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.ts b/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.ts
index 18babf14424..4fbec0e5caa 100644
--- a/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.ts
+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.ts
@@ -22,6 +22,8 @@ import {
Observable,
} from 'rxjs';
import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';
+import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
+import { MeetingResource } from 'core-app/features/hal/resources/meeting-resource';
@Directive()
export abstract class WidgetTimeEntriesListComponent extends AbstractWidgetComponent implements OnInit, AfterViewInit, OnDestroy {
@@ -109,12 +111,12 @@ export abstract class WidgetTimeEntriesListComponent extends AbstractWidgetCompo
return entry.project.name;
}
- public workPackageName(entry:TimeEntryResource):string {
- return `#${entry.workPackage.id as string}: ${entry.workPackage.name}`;
+ public entityName(entry:TimeEntryResource):string {
+ return `#${entry.entity.id as string}: ${entry.entity.name}`;
}
- public workPackageId(entry:TimeEntryResource):string {
- return entry.workPackage.id as string;
+ public entityId(entry:TimeEntryResource):string {
+ return entry.entity.id as string;
}
public comment(entry:TimeEntryResource):string | undefined {
@@ -125,8 +127,14 @@ export abstract class WidgetTimeEntriesListComponent extends AbstractWidgetCompo
return this.formatNumber(this.timezone.toHours(entry.hours));
}
- public workPackagePath(entry:TimeEntryResource):string {
- return this.pathHelper.workPackagePath(idFromLink(entry.workPackage.href));
+ public entityPath(entry:TimeEntryResource):string {
+ if (entry.entity instanceof WorkPackageResource) {
+ return this.pathHelper.workPackagePath(idFromLink(entry.entity.href));
+ } if (entry.entity instanceof MeetingResource) {
+ return this.pathHelper.meetingPath(idFromLink(entry.entity.href));
+ }
+
+ return '';
}
public get isEditable():boolean {
diff --git a/modules/dashboards/spec/features/time_entries_spec.rb b/modules/dashboards/spec/features/time_entries_spec.rb
index c61c5ce15d5..9816b922cd8 100644
--- a/modules/dashboards/spec/features/time_entries_spec.rb
+++ b/modules/dashboards/spec/features/time_entries_spec.rb
@@ -73,10 +73,7 @@ RSpec.describe "Time entries widget on dashboard", :js do
create(:user)
end
let(:user) do
- create(:user).tap do |u|
- create(:member, project:, roles: [role], user: u)
- create(:member, project: other_project, roles: [role], user: u)
- end
+ create(:user, member_with_roles: { project => role, other_project => role })
end
let(:time_logging_modal) { Components::TimeLoggingModal.new }