UI: Add mobile custom page validation
This commit is contained in:
parent
7398508c35
commit
a0e4a7738e
@ -57,12 +57,20 @@
|
||||
<mat-form-field class="flex-1" appearance="outline" subscriptSizing="dynamic">
|
||||
<mat-label translate>mobile.url</mat-label>
|
||||
<input required matInput formControlName="url">
|
||||
<mat-hint></mat-hint>
|
||||
<mat-error *ngIf="customMobilePageForm.get('url').hasError('pattern')">
|
||||
{{ 'mobile.url-pattern' | translate }}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="customMobilePageForm.get('type').value === MobilePageType.CUSTOM">
|
||||
<mat-form-field class="flex-1" appearance="outline" subscriptSizing="dynamic">
|
||||
<mat-label translate>mobile.path</mat-label>
|
||||
<input required matInput formControlName="path">
|
||||
<mat-hint></mat-hint>
|
||||
<mat-error *ngIf="customMobilePageForm.get('path').hasError('pattern')">
|
||||
{{ 'mobile.path-pattern' | translate }}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</ng-container>
|
||||
</section>
|
||||
|
||||
@ -63,8 +63,8 @@ export class CustomMobilePageComponent implements ControlValueAccessor, Validato
|
||||
label: ['', Validators.required],
|
||||
type: [MobilePageType.DASHBOARD],
|
||||
dashboardId: ['', Validators.required],
|
||||
url: [{value:'', disabled: true}, [Validators.required]],
|
||||
path: [{value:'', disabled: true}, [Validators.required, Validators.pattern(/^((?!\s).)*$/)]]
|
||||
url: [{value:'', disabled: true}, [Validators.required, Validators.pattern(/^(https?:\/\/)?(localhost|([\w\-]+\.)+[\w\-]+)(:\d+)?(\/[\w\-._~:\/?#[\]@!$&'()*+,;=%]*)?$/)]],
|
||||
path: [{value:'', disabled: true}, [Validators.required, Validators.pattern(/^(\/[\w\-._~:\/?#[\]@!$&'()*+,;=%]*)?$/)]]
|
||||
});
|
||||
|
||||
private propagateChange = (_val: any) => {};
|
||||
|
||||
@ -53,7 +53,7 @@ export class MobileAppConfigurationDialogComponent extends DialogComponent<Mobil
|
||||
|
||||
this.showDontShowAgain = this.data.afterAdd;
|
||||
|
||||
this.configureApi.push(`static final thingsBoardApiEndpoint = '${window.location.origin}';`);
|
||||
this.configureApi.push(`static const thingsBoardApiEndpoint = '${window.location.origin}';`);
|
||||
this.configureApi.push(`static const thingsboardOAuth2AppSecret = '${this.data.appSecret}';`);
|
||||
}
|
||||
|
||||
|
||||
@ -3477,7 +3477,9 @@
|
||||
"custom": "Custom"
|
||||
},
|
||||
"url": "URL",
|
||||
"url-pattern": "Invalid URL",
|
||||
"path": "Path",
|
||||
"path-pattern": "Path pattern",
|
||||
"custom-page": "Custom page",
|
||||
"edit-page": "Edit page",
|
||||
"edit-custom-page": "Edit custom page",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user