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 entity in time entry rendering

Klaus Zandersd6da96a4495a
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 5795b013af8..a8f53d1cc5a 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
@@ -59,7 +59,7 @@ import { PathHelperService } from 'core-app/core/path-helper/path-helper.service
interface TimeEntrySchema extends SchemaResource {
activity:IFieldSchema;
- workPackage:IFieldSchema;
+ entity:IFieldSchema;
project:IFieldSchema;
hours:IFieldSchema;
user:IFieldSchema;
@@ -608,16 +608,16 @@ export class TimeEntryCalendarComponent implements AfterViewInit, OnDestroy {
private entryName(entry:TimeEntryResource):string {
let { name } = entry.project;
- if (entry.workPackage) {
- name += ` - ${this.workPackageName(entry)}`;
+ if (entry.entity) {
+ name += ` - ${this.entityName(entry)}`;
}
return name || '-';
}
- private workPackageName(entry:TimeEntryResource):string {
- const workPackage = entry.workPackage;
- return `#${idFromLink(workPackage.href)}: ${workPackage.name}`;
+ private entityName(entry:TimeEntryResource):string {
+ const entity = entry.entity;
+ return `#${idFromLink(entity.href)}: ${entity.name}`;
}
private tooltipContentString(entry:TimeEntryResource, schema:TimeEntrySchema):string {
@@ -628,8 +628,8 @@ export class TimeEntryCalendarComponent implements AfterViewInit, OnDestroy {
<span class="tooltip--map--value">${this.sanitizedValue(entry.project.name)}</span>
</li>
<li class="tooltip--map--item">
- <span class="tooltip--map--key">${schema.workPackage.name}:</span>
- <span class="tooltip--map--value">${entry.workPackage ? this.sanitizedValue(this.workPackageName(entry)) : this.i18n.t('js.placeholders.default')}</span>
+ <span class="tooltip--map--key">${schema.entity.name}:</span>
+ <span class="tooltip--map--value">${entry.entity ? this.sanitizedValue(this.entityName(entry)) : this.i18n.t('js.placeholders.default')}</span>
</li>
<li class="tooltip--map--item">
<span class="tooltip--map--key">${schema.activity.name}:</span>
diff --git a/frontend/src/app/features/hal/resources/time-entry-resource.ts b/frontend/src/app/features/hal/resources/time-entry-resource.ts
index 328811b9245..48ab8009c75 100644
--- a/frontend/src/app/features/hal/resources/time-entry-resource.ts
+++ b/frontend/src/app/features/hal/resources/time-entry-resource.ts
@@ -31,6 +31,7 @@ import { ProjectResource } from 'core-app/features/hal/resources/project-resourc
import { InputState } from '@openproject/reactivestates';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import Formattable = api.v3.Formattable;
+import { MeetingResource } from 'core-app/features/hal/resources/meeting-resource';
export class TimeEntryResource extends HalResource {
project:ProjectResource;
@@ -39,7 +40,7 @@ export class TimeEntryResource extends HalResource {
comment:Formattable;
- workPackage:WorkPackageResource;
+ entity:WorkPackageResource|MeetingResource;
spentOn:string;
diff --git a/modules/dashboards/spec/features/time_entries_spec.rb b/modules/dashboards/spec/features/time_entries_spec.rb
index 99e80dded10..c61c5ce15d5 100644
--- a/modules/dashboards/spec/features/time_entries_spec.rb
+++ b/modules/dashboards/spec/features/time_entries_spec.rb
@@ -30,7 +30,7 @@ require "spec_helper"
require_relative "../support/pages/dashboard"
-RSpec.describe "Time entries widget on dashboard", :js, :with_cuprite do
+RSpec.describe "Time entries widget on dashboard", :js do
let!(:type) { create(:type) }
let!(:project) { create(:project, types: [type]) }
let!(:other_project) { create(:project, types: [type]) }