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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Simplify tracking, removing unnecessary functions
Alexander Brandon Colescfb665a3f6a9
diff --git a/frontend/src/app/features/boards/board/add-list-modal/add-list-modal.component.ts b/frontend/src/app/features/boards/board/add-list-modal/add-list-modal.component.tsindex 35850e06485..585510250fc 100644--- a/frontend/src/app/features/boards/board/add-list-modal/add-list-modal.component.ts+++ b/frontend/src/app/features/boards/board/add-list-modal/add-list-modal.component.ts@@ -38,7 +38,6 @@ import { StateService } from '@uirouter/core';import { BoardService } from 'core-app/features/boards/board/board.service';import { BoardActionsRegistryService } from 'core-app/features/boards/board/board-actions/board-actions-registry.service';import { BoardActionService } from 'core-app/features/boards/board/board-actions/board-action.service';-import { trackByHref } from 'core-app/shared/helpers/angular/tracking-functions';import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';import { tap } from 'rxjs/operators';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';@@ -88,8 +87,6 @@ export class AddListModalComponent extends OpModalComponent implements OnInit {/** avoid double click */public inFlight = false;- public trackByHref = trackByHref;-public warningText:string|undefined;public text:any = {diff --git a/frontend/src/app/features/work-packages/components/filters/query-filter/query-filter.component.ts b/frontend/src/app/features/work-packages/components/filters/query-filter/query-filter.component.tsindex 8774d2eea6c..69664ad43aa 100644--- a/frontend/src/app/features/work-packages/components/filters/query-filter/query-filter.component.ts+++ b/frontend/src/app/features/work-packages/components/filters/query-filter/query-filter.component.ts@@ -74,8 +74,6 @@ export class QueryFilterComponent implements OnInit {public baselineIncompatibleFilter = false;- public trackByHref = halHref;-public compareByHref = compareByHref;public text = {diff --git a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.html b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.htmlindex a1968720f9b..2f3c961a399 100644--- a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.html+++ b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.html@@ -23,7 +23,7 @@</div></li><li class="advanced-filters--spacer"></li>- @for (filter of filters; track trackByName(index, filter); let index = $index) {+ @for (filter of filters; track filter.name; let index = $index) {@if (isFilterAvailable(filter)) {<liid="filter_{{filter.id}}"diff --git a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.tsindex d0d178e2a35..2321aadd3d1 100644--- a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts+++ b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts@@ -38,7 +38,6 @@ import {} from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';import { DebouncedEventEmitter } from 'core-app/shared/helpers/rxjs/debounced-event-emitter';-import { trackByName } from 'core-app/shared/helpers/angular/tracking-functions';import { NgSelectComponent } from '@ng-select/ng-select';import { WorkPackageViewFiltersService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-filters.service';import { WorkPackageFiltersService } from 'core-app/features/work-packages/components/filters/wp-filters/wp-filters.service';@@ -77,8 +76,6 @@ export class QueryFiltersComponent extends UntilDestroyedMixin implements OnInitpublic baselineIncompatibleFilters:string[] = [];- public trackByName = trackByName;-public text = {open_filter: this.I18n.t('js.filter.description.text_open_filter'),label_filter_add: this.I18n.t('js.work_packages.label_filter_add'),diff --git a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.html b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.htmlindex d9e8b29cb08..102f0d5f0b7 100644--- a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.html+++ b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.html@@ -1,5 +1,5 @@@if (available) {- @for (action of actions; track trackByHref($index, action)) {+ @for (action of actions; track action.href) {<wp-custom-action[workPackage]="workPackage"[action]="action"diff --git a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.ts b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.tsindex ab154b92103..8f94d5129b2 100644--- a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.ts@@ -33,7 +33,6 @@ import { WorkPackageResource } from 'core-app/features/hal/resources/work-packagimport { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';import { CustomActionResource } from 'core-app/features/hal/resources/custom-action-resource';import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';-import { trackByHref } from 'core-app/shared/helpers/angular/tracking-functions';import { BannersService } from 'core-app/core/enterprise/banners.service';@Component({@@ -45,8 +44,6 @@ import { BannersService } from 'core-app/core/enterprise/banners.service';export class WpCustomActionsComponent extends UntilDestroyedMixin implements OnInit {@Input() workPackage:WorkPackageResource;- trackByHref = trackByHref;-actions:CustomActionResource[] = [];available = this.bannersService.allowsTo('custom_actions');diff --git a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.ts b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.tsindex 73d6ac8bbeb..84263bebc70 100644--- a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.ts@@ -59,10 +59,6 @@ export class WorkPackageFormAttributeGroupComponent extends UntilDestroyedMixinsuper();}- public trackByName(_index:number, elem:{ name:string }) {- return elem.name;- }-/*** Hide read-only fields, but only when in the create mode* @param {FieldDescriptor} fielddiff --git a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.template.html b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.template.htmlindex 62288f1694c..9e552f6d9e3 100644--- a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.template.html+++ b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.template.html@@ -1,4 +1,4 @@-@for (descriptor of group.members; track trackByName($index, descriptor)) {+@for (descriptor of group.members; track descriptor.name) {<divclass="wp-attribute-group--attribute attributes-key-value"[ngClass]="{'wp-attribute-group--attribute_span-all': descriptor.spanAll }"diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-tab.component.tsindex 03afebb4dc7..55047d6156d 100644--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts@@ -28,7 +28,6 @@import { ChangeDetectionStrategy, Component, ElementRef, Input, ViewChild } from '@angular/core';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';-import { trackByProperty } from 'core-app/shared/helpers/angular/tracking-functions';import {ActivityPanelBaseController,} from 'core-app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller';@@ -44,8 +43,6 @@ export class WorkPackageActivityTabComponent extends ActivityPanelBaseControllerpublic tabName = this.I18n.t('js.work_packages.tabs.activity');- public trackByIdentifier = trackByProperty('identifier');-@ViewChild('activitiesTabContent', { static: true }) public activitiesTabContentElement!:ElementRef<HTMLElement>;ngOnInit() {diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.component.tsindex a296aa1e037..7a5e26908d3 100644--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.component.ts@@ -36,7 +36,6 @@ import {WorkPackageWatchersService,} from 'core-app/features/work-packages/components/wp-single-view-tabs/watchers-tab/wp-watchers.service';import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';-import { trackByHref } from 'core-app/shared/helpers/angular/tracking-functions';import {WorkPackageNotificationService,} from 'core-app/features/work-packages/services/notifications/work-package-notification.service';@@ -55,8 +54,6 @@ export class WorkPackageWatchersTabComponent extends UntilDestroyedMixin implemepublic workPackageId:string;- public trackByHref = trackByHref;-public error = false;public noResults = false;diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.html b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.htmlindex ac06c654d75..fd660a8f3f6 100644--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.html+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.html@@ -11,7 +11,7 @@<div class="work-package--watchers form--selected-value--list"[ngClass]="{'-read-only': !allowedToRemove}">- @for (watcher of watching; track trackByHref($index, watcher)) {+ @for (watcher of watching; track watcher.href) {<op-wp-watcher-entry[watcher]="watcher"></op-wp-watcher-entry>diff --git a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.html b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.htmlindex 1a613b31cf8..45b488a20a2 100644--- a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.html+++ b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.html@@ -46,7 +46,7 @@data-overflowing-identifier=".__overflowing_project_context"><div><p class="wp-project-context--warning" [textContent]="text.project.required"></p>- @for (descriptor of projectContext.field; track trackByName($index, descriptor)) {+ @for (descriptor of projectContext.field; track descriptor.name) {<div class="attributes-key-value"[ngClass]="{'-span-all-columns': descriptor.spanAll }">@@ -93,7 +93,7 @@</op-editable-attribute-field></div></div>- @for (group of groupedFields; track trackByName($index, group)) {+ @for (group of groupedFields; track group.name) {<div[hidden]="shouldHideGroup(group)"[attr.data-group-name]="group.name"diff --git a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.tsindex 9c33fd0ffb8..6e2a145dda8 100644--- a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts@@ -264,16 +264,6 @@ export class WorkPackageSingleViewComponent extends UntilDestroyedMixin implemenreturn isEmpty || queryInNew;}- /**- * angular 2 doesn't support track by property any more but requires a custom function- * https://github.com/angular/angular/issues/12969- * @param _index- * @param elem- */- public trackByName(_index:number, elem:{ name:string }):string {- return elem.name;- }-/*** Allow other modules to register groups to insert into the single view*/diff --git a/frontend/src/app/features/work-packages/components/wp-table/wp-table.component.html b/frontend/src/app/features/work-packages/components/wp-table/wp-table.component.htmlindex 96f25371398..1e22d512945 100644--- a/frontend/src/app/features/work-packages/components/wp-table/wp-table.component.html+++ b/frontend/src/app/features/work-packages/components/wp-table/wp-table.component.html@@ -47,7 +47,7 @@</div></th>}- @for (column of columns; track trackByHref($index, column)) {+ @for (column of columns; track column.href) {<th[ngClass]="{'-max': column.id === 'subject', '-min-200': ['estimatedTime', 'remainingTime'].includes(column.id) }"class="wp-table--table-header">diff --git a/frontend/src/app/features/work-packages/components/wp-table/wp-table.component.ts b/frontend/src/app/features/work-packages/components/wp-table/wp-table.component.tsindex 265101b496b..dbe8d000662 100644--- a/frontend/src/app/features/work-packages/components/wp-table/wp-table.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-table/wp-table.component.ts@@ -49,7 +49,6 @@ import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/qimport { combineLatest } from 'rxjs';import { QueryColumn } from 'core-app/features/work-packages/components/wp-query/query-column';import { WorkPackageViewSortByService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-sort-by.service';-import { trackByHref } from 'core-app/shared/helpers/angular/tracking-functions';import { WorkPackageCollectionResource } from 'core-app/features/hal/resources/wp-collection-resource';import { WorkPackageViewGroupByService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-group-by.service';import { WorkPackageViewColumnsService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service';@@ -94,8 +93,6 @@ export class WorkPackagesTableComponent extends UntilDestroyedMixin implements O@Output() stateLinkClicked = new EventEmitter<{ workPackageId:string, requestedState:string }>();- public trackByHref = trackByHref;-public configuration:WorkPackageTableConfiguration;private $element:JQuery;diff --git a/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.html b/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.htmlindex 0937d526478..5b500bd8a32 100644--- a/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.html+++ b/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.html@@ -8,7 +8,7 @@class="op-tab-row"(scroll)="onScroll()">- @for (tab of tabs; track trackById($index, tab)) {+ @for (tab of tabs; track tab.id) {<liclass="op-tab-row--tab"(dragenter)="startDebouncedTabActivation(tab)"diff --git a/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.ts b/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.tsindex 65a2c580573..72da4ff6226 100644--- a/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.ts+++ b/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.ts@@ -13,7 +13,6 @@ import {ViewChild,} from '@angular/core';import { TabDefinition } from 'core-app/shared/components/tabs/tab.interface';-import { trackByProperty } from 'core-app/shared/helpers/angular/tracking-functions';import {RawParams,StateService,@@ -54,8 +53,6 @@ export class ScrollableTabsComponent extends UntilDestroyedMixin implements Afte@InjectField() uiRouterGlobals:UIRouterGlobals;- trackById = trackByProperty('id');-counters:Record<string, Observable<number>> = {};private container:Element;diff --git a/frontend/src/app/shared/helpers/angular/tracking-functions.ts b/frontend/src/app/shared/helpers/angular/tracking-functions.tsindex d2104201945..ac1c4a5157e 100644--- a/frontend/src/app/shared/helpers/angular/tracking-functions.ts+++ b/frontend/src/app/shared/helpers/angular/tracking-functions.ts@@ -17,18 +17,6 @@ export function compareByName<T extends HalResource>(a:T|undefined|null, b:T|undreturn compareByAttribute('name')(a, b);}-export function trackByName(i:number, item:any) {- return _.get(item, 'name');-}--export function trackByHref(i:number, item:{ href?:unknown }) {- return _.get(item, 'href');-}--export function trackByProperty(prop:string) {- return (i:number, item:unknown) => _.get(item, prop);-}-export function trackByHrefAndProperty(propertyName:string) {return (i:number, item:HalResource) => {const href:string = _.get(item, 'href') || '';