UI: Add Mobile bundle validators (PROD-5516).

This commit is contained in:
deaflynx 2025-02-17 13:24:18 +02:00
parent c34574ae1a
commit b6a7c3231b
5 changed files with 19 additions and 2 deletions

View File

@ -46,6 +46,14 @@
class="tb-error">
warning
</mat-icon>
<mat-icon matSuffix
matTooltipPosition="above"
matTooltipClass="tb-error-tooltip"
matTooltip="{{ 'mobile.page-name-max-length' | translate }}"
*ngIf="customMobilePageForm.get('label').hasError('maxlength') && customMobilePageForm.get('label').touched"
class="tb-error">
warning
</mat-icon>
</mat-form-field>
</div>
<mat-form-field appearance="outline" subscriptSizing="dynamic">

View File

@ -65,7 +65,7 @@ export class CustomMobilePageComponent implements ControlValueAccessor, Validato
customMobilePageForm = this.fb.group({
visible: [true],
icon: ['star'],
label: ['', [Validators.required, Validators.pattern(/\S/)]],
label: ['', [Validators.required, Validators.pattern(/\S/), Validators.maxLength(255)]],
type: [MobilePageType.DASHBOARD],
dashboardId: this.fb.control<string>(null, Validators.required),
url: [{value:'', disabled: true}, [Validators.required, Validators.pattern(WEB_URL_REGEX)]],

View File

@ -44,6 +44,12 @@
<mat-error *ngIf="bundlesForms.get('title').hasError('required')">
{{ 'mobile.title-required' | translate }}
</mat-error>
<mat-error *ngIf="bundlesForms.get('title').hasError('pattern')">
{{ 'mobile.title-cannot-contain-only-spaces' | translate }}
</mat-error>
<mat-error *ngIf="bundlesForms.get('title').hasError('maxlength')">
{{ 'mobile.title-max-length' | translate }}
</mat-error>
</mat-form-field>
<tb-entity-autocomplete
allowCreateNew

View File

@ -64,7 +64,7 @@ export class MobileBundleDialogComponent extends DialogComponent<MobileBundleDia
platformType = PlatformType;
bundlesForms = this.fb.group({
title: ['', Validators.required],
title: ['', [Validators.required, Validators.pattern(/\S/), Validators.maxLength(255)]],
androidAppId: [null],
iosAppId: [null],
description: [''],

View File

@ -3640,6 +3640,8 @@
"add-bundle": "Add bundle",
"title": "Title",
"title-required": "Title is required",
"title-cannot-contain-only-spaces": "Title cannot contain only spaces",
"title-max-length": "Title should be less than 256",
"oauth-clients": "OAuth 2.0 clients",
"android-app": "Android App",
"android-application": "Android Application",
@ -3671,6 +3673,7 @@
"page-name": "Page name",
"page-name-required": "Page name is required.",
"page-name-cannot-contain-only-spaces": "Page name cannot contain only spaces.",
"page-name-max-length": "Page name should be less than 256",
"page-type": "Page type",
"pages-types": {
"dashboard": "Dashboard",