@@ -7,8 +7,7 @@ import { ControlContainer, NgForm } from '@angular/forms';
77import { ScriptParameter } from '../scripts/script-parameter.model' ;
88import { NotificationsService } from '../../shared/notifications/notifications.service' ;
99import { TranslateService } from '@ngx-translate/core' ;
10- import { RequestService } from '../../core/data/request.service' ;
11- import { Router } from '@angular/router' ;
10+ import { Router , NavigationExtras } from '@angular/router' ;
1211import { getFirstCompletedRemoteData } from '../../core/shared/operators' ;
1312import { RemoteData } from '../../core/data/remote-data' ;
1413import { getProcessListRoute } from '../process-page-routing.paths' ;
@@ -57,7 +56,6 @@ export class ProcessFormComponent implements OnInit {
5756 private scriptService : ScriptDataService ,
5857 private notificationsService : NotificationsService ,
5958 private translationService : TranslateService ,
60- private requestService : RequestService ,
6159 private router : Router ) {
6260 }
6361
@@ -91,7 +89,7 @@ export class ProcessFormComponent implements OnInit {
9189 const title = this . translationService . get ( 'process.new.notification.success.title' ) ;
9290 const content = this . translationService . get ( 'process.new.notification.success.content' ) ;
9391 this . notificationsService . success ( title , content ) ;
94- this . sendBack ( ) ;
92+ this . sendBack ( rd . payload ) ;
9593 } else {
9694 const title = this . translationService . get ( 'process.new.notification.error.title' ) ;
9795 const content = this . translationService . get ( 'process.new.notification.error.content' ) ;
@@ -143,11 +141,17 @@ export class ProcessFormComponent implements OnInit {
143141 return this . missingParameters . length > 0 ;
144142 }
145143
146- private sendBack ( ) {
147- this . requestService . removeByHrefSubstring ( '/processes' ) ;
148- /* should subscribe on the previous method to know the action is finished and then navigate,
149- will fix this when the removeByHrefSubstring changes are merged */
150- this . router . navigateByUrl ( getProcessListRoute ( ) ) ;
144+ /**
145+ * Redirect the user to the processes overview page with the new process' ID,
146+ * so it can be highlighted in the overview table.
147+ * @param newProcess The newly created process
148+ * @private
149+ */
150+ private sendBack ( newProcess : Process ) {
151+ const extras : NavigationExtras = {
152+ queryParams : { new_process_id : newProcess . processId } ,
153+ } ;
154+ void this . router . navigate ( [ getProcessListRoute ( ) ] , extras ) ;
151155 }
152156}
153157
0 commit comments