TSK-1612: Keep query parameter while routing

This commit is contained in:
Sofie Hofmann 2021-04-07 09:24:59 +02:00
parent 84c6cd37b7
commit 22293937a9
5 changed files with 16 additions and 9 deletions

View File

@ -33,7 +33,7 @@ export class MasterAndDetailComponent implements OnInit {
}
backClicked(): void {
this.router.navigate(['../'], { relativeTo: this.route });
this.router.navigate(['../'], { relativeTo: this.route, queryParamsHandling: 'merge' });
}
private showDetails(event?: RouterEvent): boolean {

View File

@ -75,7 +75,7 @@ describe('SidenavListComponent', () => {
component.historyAccess = true;
fixture.detectChanges();
const menuList = debugElement.queryAll(By.css('.navlist__item'));
expect(menuList.length).toBe(7);
expect(menuList.length).toBe(9);
fixture.detectChanges();
});

View File

@ -24,6 +24,9 @@ export class TaskListComponent implements OnInit {
selectTask(taskId: string) {
this.selectedId = taskId;
this.selectedIdChange.emit(taskId);
this.router.navigate([{ outlets: { detail: `taskdetail/${this.selectedId}` } }], { relativeTo: this.route });
this.router.navigate([{ outlets: { detail: `taskdetail/${this.selectedId}` } }], {
relativeTo: this.route,
queryParamsHandling: 'merge'
});
}
}

View File

@ -112,7 +112,8 @@ export class TaskComponent implements OnInit, OnDestroy {
navigateBack() {
this.router.navigate([{ outlets: { detail: `taskdetail/${this.task.taskId}` } }], {
relativeTo: this.route.parent
relativeTo: this.route.parent,
queryParamsHandling: 'merge'
});
}

View File

@ -53,7 +53,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
this.currentId = params.id;
// redirect if user enters through a deep-link
if (!this.currentWorkbasket && this.currentId === 'new-task') {
this.router.navigate(['']);
this.router.navigate([''], { queryParamsHandling: 'merge' });
}
this.getTask();
});
@ -99,7 +99,10 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
}
openTask() {
this.router.navigate([{ outlets: { detail: `task/${this.currentId}` } }], { relativeTo: this.route.parent });
this.router.navigate([{ outlets: { detail: `task/${this.currentId}` } }], {
relativeTo: this.route.parent,
queryParamsHandling: 'merge'
});
}
workOnTaskDisabled(): boolean {
@ -118,7 +121,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
() => {
this.taskService.publishTaskDeletion();
this.task = null;
this.router.navigate(['taskana/workplace/tasks']);
this.router.navigate(['taskana/workplace/tasks'], { queryParamsHandling: 'merge' });
},
(error) => {
this.notificationService.triggerError(NOTIFICATION_TYPES.DELETE_ERR_2, error);
@ -133,7 +136,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
backClicked(): void {
delete this.task;
this.taskService.selectTask(this.task);
this.router.navigate(['./'], { relativeTo: this.route.parent });
this.router.navigate(['./'], { relativeTo: this.route.parent, queryParamsHandling: 'merge' });
}
ngOnDestroy(): void {
@ -188,7 +191,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
this.task = task;
this.taskService.selectTask(this.task);
this.taskService.publishUpdatedTask(task);
this.router.navigate([`../${task.taskId}`], { relativeTo: this.route });
this.router.navigate([`../${task.taskId}`], { relativeTo: this.route, queryParamsHandling: 'merge' });
},
() => {
this.requestInProgressService.setRequestInProgress(false);