99053: Fixed previous page not always returning the correct value

- Fixed previousPage not correctly redirecting to urls with queryParams
- Fixed previousPage returning to wrong page because of ReviewersListComponent
This commit is contained in:
Alexandre Vryghem
2023-02-02 17:12:56 +01:00
parent 940c6281a2
commit bd152dc074
2 changed files with 17 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ import { NotificationsService } from '../../../shared/notifications/notification
import { TranslateService } from '@ngx-translate/core';
import { WorkflowActionDataService } from '../../../core/data/workflow-action-data.service';
import { ClaimedTaskDataService } from '../../../core/tasks/claimed-task-data.service';
import { ReviewersListComponent } from './reviewers-list/reviewers-list.component';
export const ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER = 'submit_select_reviewer';
export const ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER = 'selectrevieweraction';
@@ -130,4 +131,12 @@ export class AdvancedWorkflowActionSelectReviewerComponent extends AdvancedWorkf
};
}
/**
* Hardcoded the previous page url because the {@link ReviewersListComponent} changes the previous route when
* switching between the different pages
*/
previousPage(): void {
void this.router.navigate(['/mydspace'], { queryParams: { configuration: 'workflow' } });
}
}

View File

@@ -4,7 +4,7 @@ import { map, switchMap, take } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
import { WorkflowItem } from '../core/submission/models/workflowitem.model';
import { Item } from '../core/shared/item.model';
import { ActivatedRoute, Data, Router } from '@angular/router';
import { ActivatedRoute, Data, Router, Params } from '@angular/router';
import { WorkflowItemDataService } from '../core/submission/workflowitem-data.service';
import { RouteService } from '../core/services/route.service';
import { NotificationsService } from '../shared/notifications/notifications.service';
@@ -72,7 +72,13 @@ export abstract class WorkflowItemActionPageComponent implements OnInit {
if (isEmpty(url)) {
url = '/mydspace';
}
this.router.navigateByUrl(url);
const params: Params = {};
if (url.split('?').length > 1) {
for (const param of url.split('?')[1].split('&')) {
params[param.split('=')[0]] = param.split('=')[1];
}
}
void this.router.navigate([url.split('?')[0]], { queryParams: params });
}
);
}