From 05690fce5d2972df74e5d9a9a1c830cd6b2639d1 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 28 Nov 2024 13:14:57 +0200 Subject: [PATCH 1/3] UI: Fixed mobile center bugs --- .../mobile-app-table-config.resolver.ts | 30 +++++++++++-------- .../applications/mobile-app.component.html | 4 +-- .../applications/mobile-app.component.ts | 5 ++-- .../remove-app-dialog.component.html | 2 +- .../remove-app-dialog.component.ts | 13 ++++++++ .../layout/custom-mobile-page.component.ts | 2 +- ...le-app-configuration-dialog.component.html | 12 +++++++- ...le-app-configuration-dialog.component.scss | 9 +++--- ...bile-app-configuration-dialog.component.ts | 26 +++++++++++++--- .../mobile-bundle-table-config.resolve.ts | 3 +- .../assets/locale/locale.constant-en_US.json | 8 ++++- 11 files changed, 85 insertions(+), 29 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app-table-config.resolver.ts index 543ab89078..20ac575b2c 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app-table-config.resolver.ts @@ -114,6 +114,8 @@ export class MobileAppTableConfigResolver { this.config.entitiesFetchFunction = pageLink => this.mobileAppService.getTenantMobileAppInfos(pageLink); this.config.loadEntity = id => this.mobileAppService.getMobileAppInfoById(id.id); this.config.saveEntity = (mobileApp) => this.mobileAppService.saveMobileApp(mobileApp); + this.config.deleteEntityTitle = (mobileApp) => this.translate.instant('mobile.delete-application-title-short', {name: mobileApp.name}); + this.config.deleteEntityContent = () => this.translate.instant('mobile.delete-application-text-short'); this.config.deleteEntity = id => this.mobileAppService.deleteMobileApp(id.id); this.config.cellActionDescriptors = this.configureCellActions(); @@ -138,19 +140,23 @@ export class MobileAppTableConfigResolver { if ($event) { $event.stopPropagation(); } - this.dialog.open(RemoveAppDialogComponent, { - disableClose: true, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], - data: { - id: entity.id.id - } - }).afterClosed() - .subscribe((res) => { - if (res) { - this.config.updateData(); + if(entity.status === MobileAppStatus.PUBLISHED) { + this.dialog.open(RemoveAppDialogComponent, { + disableClose: true, + panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], + data: { + id: entity.id.id } - }); + }).afterClosed() + .subscribe((res) => { + if (res) { + this.config.updateData(); + } + }); + } else { + this.config.getTable().deleteEntity($event, entity); + } } private mobileStatus(status: MobileAppStatus): string { diff --git a/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.html b/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.html index e74fb25b0b..36f52e8b71 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.html +++ b/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.html @@ -148,7 +148,7 @@ mobile.sha256-certificate-fingerprints - + mobile.app-id - + { Validators.pattern(/^https?:\/\/play\.google\.com\/store\/apps\/details\?id=[a-zA-Z0-9._]+$/)], sha256CertFingerprints: [entity?.storeInfo?.sha256CertFingerprints ? entity.storeInfo.sha256CertFingerprints : '', Validators.pattern(/^[A-Fa-f0-9]{2}(:[A-Fa-f0-9]{2}){1,31}$/)], - appId: [entity?.storeInfo?.appId ? entity.storeInfo.appId : '', Validators.pattern(/^\d{7,10}$/)], + appId: [entity?.storeInfo?.appId ? entity.storeInfo.appId : '', Validators.pattern(/^[A-Z0-9]{10}\.[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*$/)], }), }); @@ -126,7 +126,8 @@ export class MobileAppComponent extends EntityComponent { override updateFormState(): void { super.updateFormState(); if (this.isEdit && this.entityForm && !this.isAdd) { - this.entityForm.get('status').updateValueAndValidity({onlySelf: false}); + this.entityForm.get('status').updateValueAndValidity({onlySelf: true}); + this.entityForm.get('platformType').updateValueAndValidity({onlySelf: true}); this.entityForm.get('platformType').disable({emitEvent: false}); if (this.entityForm.get('platformType').value === PlatformType.ANDROID) { this.entityForm.get('storeInfo.appId').disable({emitEvent: false}); diff --git a/ui-ngx/src/app/modules/home/pages/mobile/applications/remove-app-dialog.component.html b/ui-ngx/src/app/modules/home/pages/mobile/applications/remove-app-dialog.component.html index faca470cdf..4f1569468f 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/applications/remove-app-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/mobile/applications/remove-app-dialog.component.html @@ -36,7 +36,7 @@