diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index f1a0671a52..4c7a241931 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -27,13 +27,14 @@ import { serverErrorCodesTranslations } from '@shared/models/constants'; import { SubscriptionEntityInfo } from '@core/api/widget-api.models'; import { CompiledTbFunction, - compileTbFunction, GenericFunction, + compileTbFunction, + GenericFunction, isNotEmptyTbFunction, TbFunction } from '@shared/models/js-function.models'; import { DomSanitizer } from '@angular/platform-browser'; import { SecurityContext } from '@angular/core'; -import { AbstractControl, ValidationErrors, Validators } from '@angular/forms'; +import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; const varsRegex = /\${([^}]*)}/g; const emailRegex = /^[A-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i; @@ -998,3 +999,12 @@ export const validateEmail = (control: AbstractControl): ValidationErrors | null return emailRegex.test(control.value) ? null : {email: true}; }; +export const objectRequired = (): ValidatorFn => { + return (control: AbstractControl): ValidationErrors | null => { + const value = control.value; + if (value && !isObject(value)) { + return { objectRequired: true }; + } + return null; + }; +} diff --git a/ui-ngx/src/app/shared/components/country-autocomplete.component.html b/ui-ngx/src/app/shared/components/country-autocomplete.component.html index 9b3857cafb..befb160df6 100644 --- a/ui-ngx/src/app/shared/components/country-autocomplete.component.html +++ b/ui-ngx/src/app/shared/components/country-autocomplete.component.html @@ -15,14 +15,19 @@ limitations under the License. --> - + {{ labelText }} + @if (countryFormGroup.get('country').value?.flag) { + + {{ countryFormGroup.get('country').value.flag }} + + }