UI: Synchronize validation rules for the mobile app configuration form with the API

This commit is contained in:
Vladyslav_Prykhodko 2025-01-15 15:41:16 +02:00
parent e9036f8aa8
commit 6d76d32882
2 changed files with 5 additions and 5 deletions

View File

@ -107,7 +107,7 @@
<mat-label translate>mobile.latest-version</mat-label> <mat-label translate>mobile.latest-version</mat-label>
<input matInput formControlName="latestVersion"> <input matInput formControlName="latestVersion">
<mat-hint> </mat-hint> <mat-hint> </mat-hint>
<mat-error *ngIf="entityForm.get('versionInfo.minVersion').hasError('pattern')"> <mat-error *ngIf="entityForm.get('versionInfo.latestVersion').hasError('pattern')">
{{ 'mobile.invalid-version-pattern' | translate }} {{ 'mobile.invalid-version-pattern' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
@ -130,7 +130,7 @@
<mat-label>{{ <mat-label>{{
(entityForm.get('platformType').value === PlatformType.ANDROID ? 'mobile.google-play-link' : 'mobile.app-store-link') | translate (entityForm.get('platformType').value === PlatformType.ANDROID ? 'mobile.google-play-link' : 'mobile.app-store-link') | translate
}}</mat-label> }}</mat-label>
<input matInput [required]="entityForm.get('status').value === 'PUBLISHED'" formControlName="storeLink"> <input matInput [required]="entityForm.get('status').value === MobileAppStatus.PUBLISHED" formControlName="storeLink">
<tb-copy-button <tb-copy-button
matSuffix matSuffix
miniButton="false" miniButton="false"
@ -148,7 +148,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field appearance="outline" *ngIf="entityForm.get('platformType').value === PlatformType.ANDROID"> <mat-form-field appearance="outline" *ngIf="entityForm.get('platformType').value === PlatformType.ANDROID">
<mat-label translate>mobile.sha256-certificate-fingerprints</mat-label> <mat-label translate>mobile.sha256-certificate-fingerprints</mat-label>
<input matInput [required]="entityForm.get('status').value !== MobileAppStatus.DRAFT" formControlName="sha256CertFingerprints"> <input matInput [required]="entityForm.get('status').value === MobileAppStatus.PUBLISHED" formControlName="sha256CertFingerprints">
<tb-copy-button <tb-copy-button
matSuffix matSuffix
miniButton="false" miniButton="false"
@ -166,7 +166,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field appearance="outline" *ngIf="entityForm.get('platformType').value === PlatformType.IOS"> <mat-form-field appearance="outline" *ngIf="entityForm.get('platformType').value === PlatformType.IOS">
<mat-label translate>mobile.app-id</mat-label> <mat-label translate>mobile.app-id</mat-label>
<input matInput [required]="entityForm.get('status').value !== MobileAppStatus.DRAFT" formControlName="appId"> <input matInput [required]="entityForm.get('status').value === MobileAppStatus.PUBLISHED" formControlName="appId">
<tb-copy-button <tb-copy-button
matSuffix matSuffix
miniButton="false" miniButton="false"

View File

@ -101,7 +101,7 @@ export class MobileAppComponent extends EntityComponent<MobileApp> {
form.get('status').valueChanges.pipe( form.get('status').valueChanges.pipe(
takeUntilDestroyed() takeUntilDestroyed()
).subscribe((value: MobileAppStatus) => { ).subscribe((value: MobileAppStatus) => {
if (value !== MobileAppStatus.DRAFT) { if (value === MobileAppStatus.PUBLISHED) {
form.get('storeInfo.storeLink').addValidators(Validators.required); form.get('storeInfo.storeLink').addValidators(Validators.required);
form.get('storeInfo.sha256CertFingerprints') form.get('storeInfo.sha256CertFingerprints')
.addValidators(Validators.required); .addValidators(Validators.required);