From 5a17032a63fdc1b8a896f23475d9b5a8dafa4e6c Mon Sep 17 00:00:00 2001 From: August Andersen Date: Tue, 17 Sep 2024 12:53:22 +0200 Subject: [PATCH 1/2] Redirect fiware and mqtt datatarget to right places. --- .../fiware/fiware-edit/fiware-edit.component.ts | 10 +++++++--- .../datatarget/mqtt-edit/mqtt-edit.component.ts | 10 ++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts b/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts index 8985d326..5e919f2b 100644 --- a/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts +++ b/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts @@ -226,6 +226,7 @@ export class FiwareEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.datatargetid = response.id; this.datatarget = response; this.showSavedSnack(); + this.routeToCreatedDatatarget(); }, (error: HttpErrorResponse) => { this.handleError(error); @@ -271,9 +272,12 @@ export class FiwareEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.scrollToTopService.scrollToTop(); } - routeToDatatargets(): void { - this.router.navigate(["applications", this.applicationId.toString()]); - } + routeToDatatargets = () => this.router.navigate(["applications", this.applicationId, "data-targets"]); + + routeToCreatedDatatarget = () => + this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], { + replaceUrl: true, + }); onCoordinateKey(event: any) { if (event.target.value.length > event.target.maxLength) { diff --git a/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts b/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts index 7b85d9c8..855e6ea3 100644 --- a/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts +++ b/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts @@ -90,10 +90,12 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.errorMessages = errors.errorMessages; this.scrollToTopService.scrollToTop(); } + routeToDatatargets = () => this.router.navigate(["applications", this.applicationId, "data-targets"]); - routeToDatatargets(): void { - this.router.navigate(["applications", this.applicationId.toString()]); - } + routeToCreatedDatatarget = () => + this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], { + replaceUrl: true, + }); getDatatarget(id: number) { this.datatargetSubscription = this.datatargetService.get(id).subscribe((response: Datatarget) => { @@ -214,7 +216,7 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.datatargetId = response.id; this.datatarget = response; this.snackService.showSavedSnack(); - this.routeToDatatargets(); + this.routeToCreatedDatatarget(); }, (error: HttpErrorResponse) => { this.handleError(error); From 31250925f7b57c453db7d12eaa46d9c77ee6a16f Mon Sep 17 00:00:00 2001 From: August Andersen Date: Tue, 17 Sep 2024 13:45:20 +0200 Subject: [PATCH 2/2] PR changes. --- .../fiware/fiware-edit/fiware-edit.component.ts | 8 +++++--- .../httppush/httppush-edit/httppush-edit.component.ts | 8 ++++++-- .../datatarget/mqtt-edit/mqtt-edit.component.ts | 7 +++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts b/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts index 5e919f2b..3e361ce9 100644 --- a/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts +++ b/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts @@ -272,13 +272,15 @@ export class FiwareEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.scrollToTopService.scrollToTop(); } - routeToDatatargets = () => this.router.navigate(["applications", this.applicationId, "data-targets"]); + routeToDatatargets() { + this.router.navigate(["applications", this.applicationId, "data-targets"]); + } - routeToCreatedDatatarget = () => + routeToCreatedDatatarget() { this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], { replaceUrl: true, }); - + } onCoordinateKey(event: any) { if (event.target.value.length > event.target.maxLength) { event.target.value = event.target.value.slice(0, event.target.maxLength); diff --git a/src/app/applications/datatarget/httppush/httppush-edit/httppush-edit.component.ts b/src/app/applications/datatarget/httppush/httppush-edit/httppush-edit.component.ts index df0d12c3..7287283c 100644 --- a/src/app/applications/datatarget/httppush/httppush-edit/httppush-edit.component.ts +++ b/src/app/applications/datatarget/httppush/httppush-edit/httppush-edit.component.ts @@ -282,11 +282,15 @@ export class HttppushEditComponent implements DatatargetEdit, OnInit, OnDestroy this.scrollToTopService.scrollToTop(); } - routeToDatatargets = () => this.router.navigate(["applications", this.applicationId, "data-targets"]); - routeToCreatedDatatarget = () => + routeToDatatargets() { + this.router.navigate(["applications", this.applicationId, "data-targets"]); + } + + routeToCreatedDatatarget() { this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], { replaceUrl: true, }); + } onCoordinateKey(event: any) { if (event.target.value.length > event.target.maxLength) { diff --git a/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts b/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts index 855e6ea3..189b6f71 100644 --- a/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts +++ b/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts @@ -90,12 +90,15 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.errorMessages = errors.errorMessages; this.scrollToTopService.scrollToTop(); } - routeToDatatargets = () => this.router.navigate(["applications", this.applicationId, "data-targets"]); + routeToDatatargets() { + this.router.navigate(["applications", this.applicationId, "data-targets"]); + } - routeToCreatedDatatarget = () => + routeToCreatedDatatarget() { this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], { replaceUrl: true, }); + } getDatatarget(id: number) { this.datatargetSubscription = this.datatargetService.get(id).subscribe((response: Datatarget) => {