mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Merge pull request #23563 from opf/bug/stc-757-numeric-id-instead-of-semantic-one-in-the-spent-time-calendar-2
[STC-757] Support semantic IDs in the spent time calendar
This commit is contained in:
@@ -19,8 +19,7 @@ import {
|
||||
SlotLaneContentArg,
|
||||
} from '@fullcalendar/core';
|
||||
import { ConfigurationService } from 'core-app/core/config/configuration.service';
|
||||
import { TimeEntryResource } from 'core-app/features/hal/resources/time-entry-resource';
|
||||
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
|
||||
import { TimeEntryResource, formatTimeEntryEntityName } from 'core-app/features/hal/resources/time-entry-resource';
|
||||
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';
|
||||
@@ -31,7 +30,6 @@ import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';
|
||||
import { FilterOperator } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';
|
||||
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
|
||||
import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';
|
||||
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
|
||||
import { OpCalendarService } from 'core-app/features/calendar/op-calendar.service';
|
||||
import { SchemaResource } from 'core-app/features/hal/resources/schema-resource';
|
||||
import { IFieldSchema } from 'core-app/shared/components/fields/field.base';
|
||||
@@ -619,11 +617,7 @@ export class TimeEntryCalendarComponent implements AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
private entityName(entry:TimeEntryResource):string {
|
||||
const entity = entry.entity;
|
||||
const formattedId = entity instanceof WorkPackageResource
|
||||
? entity.formattedId
|
||||
: `#${idFromLink(entity.href)}`;
|
||||
return `${formattedId}: ${entity.name}`;
|
||||
return formatTimeEntryEntityName(entry.entity);
|
||||
}
|
||||
|
||||
private popoverHtml(
|
||||
|
||||
@@ -32,6 +32,8 @@ 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';
|
||||
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
|
||||
import { formatWorkPackageId } from 'core-app/shared/helpers/work-package-id-pattern';
|
||||
|
||||
export class TimeEntryResource extends HalResource {
|
||||
project:ProjectResource;
|
||||
@@ -61,3 +63,9 @@ export class TimeEntryResource extends HalResource {
|
||||
export interface TimeEntryResource {
|
||||
delete():Promise<unknown>;
|
||||
}
|
||||
|
||||
export function formatTimeEntryEntityName(entity:WorkPackageResource|MeetingResource):string {
|
||||
const displayId = entity.$link?.displayId;
|
||||
const formattedId = displayId ? formatWorkPackageId(displayId) : `#${idFromLink(entity.href)}`;
|
||||
return `${formattedId}: ${entity.name}`;
|
||||
}
|
||||
|
||||
+2
-6
@@ -7,7 +7,7 @@ import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
|
||||
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 { TimeEntryResource } from 'core-app/features/hal/resources/time-entry-resource';
|
||||
import { TimeEntryResource, formatTimeEntryEntityName } from 'core-app/features/hal/resources/time-entry-resource';
|
||||
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
|
||||
import { SchemaResource } from 'core-app/features/hal/resources/schema-resource';
|
||||
import {
|
||||
@@ -101,11 +101,7 @@ export abstract class WidgetTimeEntriesListComponent extends AbstractWidgetCompo
|
||||
}
|
||||
|
||||
public entityName(entry:TimeEntryResource):string {
|
||||
const entity = entry.entity;
|
||||
const formattedId = entity instanceof WorkPackageResource
|
||||
? entity.formattedId
|
||||
: `#${idFromLink(entity.href)}`;
|
||||
return `${formattedId}: ${entity.name}`;
|
||||
return formatTimeEntryEntityName(entry.entity);
|
||||
}
|
||||
|
||||
public entityId(entry:TimeEntryResource):string {
|
||||
|
||||
@@ -86,11 +86,7 @@ module API
|
||||
title_attribute:,
|
||||
getter:))
|
||||
|
||||
if link.is_a?(Hash) && entity.is_a?(WorkPackage)
|
||||
link.merge(displayId: entity.display_id.to_s)
|
||||
else
|
||||
link
|
||||
end
|
||||
entity.is_a?(WorkPackage) ? link.merge(displayId: entity.display_id.to_s) : link
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user