Browse Source

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

pull/12704/head
deaflynx 1 year ago
parent
commit
b6a7c3231b
  1. 8
      ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.html
  2. 2
      ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.ts
  3. 6
      ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-dialog.component.html
  4. 2
      ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-dialog.component.ts
  5. 3
      ui-ngx/src/assets/locale/locale.constant-en_US.json

8
ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.html

@ -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">

2
ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.ts

@ -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)]],

6
ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-dialog.component.html

@ -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

2
ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-dialog.component.ts

@ -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: [''],

3
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -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",

Loading…
Cancel
Save