Skip to content

Commit 5a17032

Browse files
Redirect fiware and mqtt datatarget to right places.
1 parent 8564edd commit 5a17032

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ export class FiwareEditComponent implements DatatargetEdit, OnInit, OnDestroy {
226226
this.datatargetid = response.id;
227227
this.datatarget = response;
228228
this.showSavedSnack();
229+
this.routeToCreatedDatatarget();
229230
},
230231
(error: HttpErrorResponse) => {
231232
this.handleError(error);
@@ -271,9 +272,12 @@ export class FiwareEditComponent implements DatatargetEdit, OnInit, OnDestroy {
271272
this.scrollToTopService.scrollToTop();
272273
}
273274

274-
routeToDatatargets(): void {
275-
this.router.navigate(["applications", this.applicationId.toString()]);
276-
}
275+
routeToDatatargets = () => this.router.navigate(["applications", this.applicationId, "data-targets"]);
276+
277+
routeToCreatedDatatarget = () =>
278+
this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], {
279+
replaceUrl: true,
280+
});
277281

278282
onCoordinateKey(event: any) {
279283
if (event.target.value.length > event.target.maxLength) {

src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy {
9090
this.errorMessages = errors.errorMessages;
9191
this.scrollToTopService.scrollToTop();
9292
}
93+
routeToDatatargets = () => this.router.navigate(["applications", this.applicationId, "data-targets"]);
9394

94-
routeToDatatargets(): void {
95-
this.router.navigate(["applications", this.applicationId.toString()]);
96-
}
95+
routeToCreatedDatatarget = () =>
96+
this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], {
97+
replaceUrl: true,
98+
});
9799

98100
getDatatarget(id: number) {
99101
this.datatargetSubscription = this.datatargetService.get(id).subscribe((response: Datatarget) => {
@@ -214,7 +216,7 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy {
214216
this.datatargetId = response.id;
215217
this.datatarget = response;
216218
this.snackService.showSavedSnack();
217-
this.routeToDatatargets();
219+
this.routeToCreatedDatatarget();
218220
},
219221
(error: HttpErrorResponse) => {
220222
this.handleError(error);

0 commit comments

Comments
 (0)