From 2f3fa20bf91e20fdc4e2b94b2639fcdbd2d4cf89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 24 Oct 2018 09:30:30 +0200 Subject: [PATCH] Fix activity not updating --- .../src/app/components/angular/tracking-functions.ts | 9 +++++++++ .../activity-panel/activity-entry-info.ts | 4 ++++ .../activity-panel/activity-tab.component.ts | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/angular/tracking-functions.ts b/frontend/src/app/components/angular/tracking-functions.ts index b6e13b10f4..4ae5e13f63 100644 --- a/frontend/src/app/components/angular/tracking-functions.ts +++ b/frontend/src/app/components/angular/tracking-functions.ts @@ -24,6 +24,15 @@ export namespace AngularTrackingHelpers { return _.get(item, 'href'); } + export function trackByHrefAndProperty(propertyName:string) { + return (i:number, item:HalResource) => { + let href = _.get(item, 'href'); + let prop = _.get(item, propertyName, 'none'); + + return `${href}#${propertyName}=${prop}`; + }; + } + export function trackByTrackingIdentifier(i:number, item:any) { return _.get(item, 'trackingIdentifier', item && item.href); } diff --git a/frontend/src/app/components/wp-single-view-tabs/activity-panel/activity-entry-info.ts b/frontend/src/app/components/wp-single-view-tabs/activity-panel/activity-entry-info.ts index be9f093b3c..f63bbb2d9b 100644 --- a/frontend/src/app/components/wp-single-view-tabs/activity-panel/activity-entry-info.ts +++ b/frontend/src/app/components/wp-single-view-tabs/activity-panel/activity-entry-info.ts @@ -55,6 +55,10 @@ export class ActivityEntryInfo { return this.activity.href; } + public get version() { + return this.activity.version; + } + public get isNextDate() { return this.date !== this.dateOfPrevious; } diff --git a/frontend/src/app/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts b/frontend/src/app/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts index 556cb515cf..461acfd299 100644 --- a/frontend/src/app/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts +++ b/frontend/src/app/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts @@ -42,7 +42,7 @@ import {AngularTrackingHelpers} from "core-components/angular/tracking-functions export class WorkPackageActivityTabComponent extends ActivityPanelBaseController implements OnDestroy { public workPackage:WorkPackageResource; public tabName = this.I18n.t('js.work_packages.tabs.activity'); - public trackByHref = AngularTrackingHelpers.trackByHref; + public trackByHref = AngularTrackingHelpers.trackByHrefAndProperty('version'); constructor(readonly wpCacheService:WorkPackageCacheService, readonly $transition:Transition,