From f1c94c0d34b49e4cda0bf359f6761ce2565ec273 Mon Sep 17 00:00:00 2001 From: Chris Johansen Date: Tue, 2 May 2023 17:49:38 +0200 Subject: [PATCH] Fixed bug where HTTP Datatarget updates did not save correctly (IOT-1462). Made minor adjustments to layout of ODDK creation-form (IOT-1464 + IOT-1465) and redirect (IOT-1463), as suggested by feedback after test.. --- .../httppush-edit/httppush-edit.component.ts | 18 +++++----- .../opendatadk-edit.component.html | 33 +++++++++++-------- .../opendatadk-edit.component.scss | 7 ++++ .../opendatadk-edit.component.ts | 15 +++++---- src/assets/i18n/da.json | 3 +- 5 files changed, 46 insertions(+), 30 deletions(-) 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 3bf2d40e..9c05dca7 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 @@ -167,14 +167,11 @@ export class HttppushEditComponent updateDatatarget() { this.resetErrors(); - this.counter = - 1 + - (this.payloadDeviceDatatarget?.length - ? this.payloadDeviceDatatarget?.length - : 0); + this.counter = 1 + (this.payloadDeviceDatatarget?.length ?? 0); this.datatargetService.update(this.datatarget).subscribe( (response: Datatarget) => { this.datatarget = response; + this.countToRedirect(); }, (error: HttpErrorResponse) => { this.handleError(error); @@ -236,7 +233,7 @@ export class HttppushEditComponent this.datatargetid = response.id; this.datatarget = response; this.showSavedSnack(); - this.routeToDatatargets(); + this.routeToCreatedDatatarget(); }, (error: HttpErrorResponse) => { this.handleError(error); @@ -288,9 +285,12 @@ export class HttppushEditComponent 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/opendatadk/opendatadk-edit/opendatadk-edit.component.html b/src/app/applications/datatarget/opendatadk/opendatadk-edit/opendatadk-edit.component.html index f7ff7355..f548a85a 100644 --- a/src/app/applications/datatarget/opendatadk/opendatadk-edit/opendatadk-edit.component.html +++ b/src/app/applications/datatarget/opendatadk/opendatadk-edit/opendatadk-edit.component.html @@ -4,17 +4,9 @@ [canEdit]="canEdit"> -
-
-
    -
  • {{ error | translate }}
  • -
-
- - + +
+

{{'GUIDE' | translate}}

@@ -31,12 +23,12 @@ {{ 'OPENDATADK.INTRO.GUIDE3' | translate }}

{{ 'OPENDATADK.INTRO.GUIDE4' | translate }} - {{ 'OPENDATADK.INTRO.GUIDE5' | translate }} + {{ 'OPENDATADK.INTRO.GUIDE5' | translate }}

- +

@@ -57,9 +49,22 @@

+
+ + +

{{'FORM.CREATE-NEW-DATATARGET' | translate}}

+ +
+
    +
  • {{ error | translate }}
  • +
+
-
+