From e0ac27c3fd84b326a7f9192af103c34aa961f32e Mon Sep 17 00:00:00 2001 From: Alexis Hernandez Date: Sun, 11 Mar 2018 12:37:10 -0600 Subject: [PATCH] web-ui: Display field validation status on TransactionFinder --- web-ui/src/app/app.component.ts | 14 ++++++++++++++ .../transaction-finder.component.html | 7 ++++++- .../transaction-finder.component.ts | 7 ++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/web-ui/src/app/app.component.ts b/web-ui/src/app/app.component.ts index 99e38a8..06bc892 100644 --- a/web-ui/src/app/app.component.ts +++ b/web-ui/src/app/app.component.ts @@ -24,8 +24,22 @@ export class AppComponent { englishLang(): Object { return { + // default messages from angular + 'required': 'A value is required', + 'pattern': 'Invalid format', + 'email': 'Invalid email', + 'minlength': 'More characters are required', + 'maxlength': 'Too many characters', + 'min': 'The value is too small', + 'max': 'The value is too big', + + // messages 'message.serverUnavailable': 'The server unavailable, please try again in a minute', + + // actions 'action.find': 'Find', + + // labels 'label.transactionId': 'Transaction Id' }; } diff --git a/web-ui/src/app/components/transaction-finder/transaction-finder.component.html b/web-ui/src/app/components/transaction-finder/transaction-finder.component.html index d2d9e68..b6d8677 100644 --- a/web-ui/src/app/components/transaction-finder/transaction-finder.component.html +++ b/web-ui/src/app/components/transaction-finder/transaction-finder.component.html @@ -1,6 +1,8 @@
-
+
+
@@ -8,5 +10,8 @@
+
+ {{ errorService.getFieldError(form, 'transactionId') | translate }} +
diff --git a/web-ui/src/app/components/transaction-finder/transaction-finder.component.ts b/web-ui/src/app/components/transaction-finder/transaction-finder.component.ts index 7d6648b..c38a65d 100644 --- a/web-ui/src/app/components/transaction-finder/transaction-finder.component.ts +++ b/web-ui/src/app/components/transaction-finder/transaction-finder.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Observable } from 'rxjs/Observable'; +import { ErrorService } from '../../services/error.service'; + @Component({ selector: 'app-transaction-finder', templateUrl: './transaction-finder.component.html', @@ -11,7 +13,10 @@ export class TransactionFinderComponent implements OnInit { form: FormGroup; - constructor(private formBuilder: FormBuilder) { + constructor( + private formBuilder: FormBuilder, + public errorService: ErrorService) { + this.createForm(); }