From 2477f32d0b3f7e6a3a159481dd1e9c1759686d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Mon, 13 Nov 2023 19:11:55 +0100 Subject: [PATCH 1/2] Fix order of navigation link list --- backend/.idea/workspace.xml | 22 ++++++++++++++----- .../core/entities/timemanager/Taskgroup.java | 4 +++- .../taskgroup-dashboard.component.ts | 1 - .../task-detail-overview.component.ts | 1 - 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/backend/.idea/workspace.xml b/backend/.idea/workspace.xml index 956826a..5c2bae0 100644 --- a/backend/.idea/workspace.xml +++ b/backend/.idea/workspace.xml @@ -6,6 +6,7 @@ + diff --git a/backend/src/main/java/core/entities/timemanager/Taskgroup.java b/backend/src/main/java/core/entities/timemanager/Taskgroup.java index 6fc92e1..bdf42ca 100644 --- a/backend/src/main/java/core/entities/timemanager/Taskgroup.java +++ b/backend/src/main/java/core/entities/timemanager/Taskgroup.java @@ -92,11 +92,13 @@ public class Taskgroup { public static List getAncestorList(Taskgroup taskgroup) { List ancestors = new ArrayList<>(); Taskgroup currentTaskgroup = taskgroup; + ancestors.add(taskgroup); while(currentTaskgroup.parent != null) { ancestors.add(currentTaskgroup.parent); currentTaskgroup = currentTaskgroup.parent; } - //ancestors.add(taskgroup); + + Collections.reverse(ancestors); return ancestors; } diff --git a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts index 5dafbf6..9ee49d0 100644 --- a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts +++ b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts @@ -46,7 +46,6 @@ export class TaskgroupDashboardComponent implements OnInit { this.taskgroups = resp.children this.taskgroupPath = resp.ancestors this.taskgroup = resp.taskgroupInfo; - this.navLinkListComponent!.addNavigationLink(this.taskgroup.taskgroupName, ['/taskgroups', this.taskgroup.taskgroupID.toString()]) this.taskgroupPath.forEach(taskgroupEntity => { this.navLinkListComponent!.addNavigationLink(taskgroupEntity.taskgroupName, ['/taskgroups', taskgroupEntity.taskgroupID.toString()]); }) diff --git a/frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.ts b/frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.ts index 70061af..0ee9eac 100644 --- a/frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.ts +++ b/frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.ts @@ -49,7 +49,6 @@ export class TaskDetailOverviewComponent implements OnInit { this.taskgroups = resp.children this.taskgroupPath = resp.ancestors this.taskgroup = resp.taskgroupInfo; - this.navLinkListComponent!.addNavigationLink(this.taskgroup.taskgroupName, ['/taskgroups', this.taskgroup.taskgroupID.toString()]) this.taskgroupPath.forEach(taskgroupEntity => { this.navLinkListComponent!.addNavigationLink(taskgroupEntity.taskgroupName, ['/taskgroups', taskgroupEntity.taskgroupID.toString()]); }) -- 2.34.1 From 1e492a9111af6d9aaf9b38b161df9e411751b307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Mon, 13 Nov 2023 19:20:28 +0100 Subject: [PATCH 2/2] Reset navigation link list when navigation back --- .../navigation-link-list.component.ts | 8 ++++++++ .../taskgroup-dashboard.component.ts | 12 ++++++++++++ .../task-detail-overview.component.ts | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/frontend/src/app/navigation-link-list/navigation-link-list.component.ts b/frontend/src/app/navigation-link-list/navigation-link-list.component.ts index 8387aee..21d6d78 100644 --- a/frontend/src/app/navigation-link-list/navigation-link-list.component.ts +++ b/frontend/src/app/navigation-link-list/navigation-link-list.component.ts @@ -11,6 +11,11 @@ export interface NavigationLink { styleUrls: ['./navigation-link-list.component.css'] }) export class NavigationLinkListComponent implements OnInit{ + resetComponent(defaultNavigationLinkPath: NavigationLink[]) { + this.navigationLinks = defaultNavigationLinkPath; + console.log("Navigation Links: ") + console.log(this.navigationLinks) + } @@ -27,7 +32,10 @@ export class NavigationLinkListComponent implements OnInit{ } if(this.navigationLinks.find(searchedLink => searchedLink.linkText === linkText) === undefined) { + console.log("Test") this.navigationLinks.push(navigationLink); + } else { + console.log(linkText) } } diff --git a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts index 9ee49d0..79835b5 100644 --- a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts +++ b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts @@ -40,12 +40,24 @@ export class TaskgroupDashboardComponent implements OnInit { ngOnInit(): void { this.activatedRoute.paramMap.subscribe(params => { if(params.has('taskgroupID')) { + console.log("Update of taskgroup") this.taskgroupID = Number(params.get('taskgroupID')); this.taskgroupService.taskgroupsTaskgroupIDGet(this.taskgroupID).subscribe({ next: resp => { this.taskgroups = resp.children this.taskgroupPath = resp.ancestors this.taskgroup = resp.taskgroupInfo; + this.navLinkListComponent!.resetComponent([ + { + linkText: "Dashboard", + routerLink: ['/'] + }, + { + linkText: "Taskgroups", + routerLink: ["/taskgroups"] + } + ]); + console.log(this.taskgroups) this.taskgroupPath.forEach(taskgroupEntity => { this.navLinkListComponent!.addNavigationLink(taskgroupEntity.taskgroupName, ['/taskgroups', taskgroupEntity.taskgroupID.toString()]); }) diff --git a/frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.ts b/frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.ts index 0ee9eac..bacadd5 100644 --- a/frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.ts +++ b/frontend/src/app/tasks/task-detail-overview/task-detail-overview.component.ts @@ -49,6 +49,16 @@ export class TaskDetailOverviewComponent implements OnInit { this.taskgroups = resp.children this.taskgroupPath = resp.ancestors this.taskgroup = resp.taskgroupInfo; + this.navLinkListComponent!.resetComponent([ + { + linkText: "Dashboard", + routerLink: ['/'] + }, + { + linkText: "Taskgroups", + routerLink: ["/taskgroups"] + } + ]); this.taskgroupPath.forEach(taskgroupEntity => { this.navLinkListComponent!.addNavigationLink(taskgroupEntity.taskgroupName, ['/taskgroups', taskgroupEntity.taskgroupID.toString()]); }) -- 2.34.1