Merge branch 'rc'

This commit is contained in:
Igor Kulikov 2025-01-10 19:32:02 +02:00
commit 34bd41ff4e
4 changed files with 24 additions and 30 deletions

View File

@ -23,7 +23,7 @@ import { Router } from '@angular/router';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { FormGroupDirective, NgForm, UntypedFormControl } from '@angular/forms';
import { MobileApp } from '@shared/models/mobile-app.models';
import { MobileAppComponent } from '@home/pages/mobile/applications/mobile-app.component';
import type { MobileAppComponent } from '@home/pages/mobile/applications/mobile-app.component';
import { PlatformType } from '@shared/models/oauth2.models';
import { MobileAppService } from '@core/http/mobile-app.service';
@ -57,6 +57,7 @@ export class MobileAppDialogComponent extends DialogComponent<MobileAppDialogCom
this.mobileAppComponent.entityForm.markAsDirty();
this.mobileAppComponent.entityForm.patchValue({platformType: this.data.platformType});
this.mobileAppComponent.entityForm.get('platformType').disable({emitEvent: false});
this.mobileAppComponent.isEdit = true;
}, 0);
}

View File

@ -15,7 +15,6 @@
///
import {
CellActionDescriptor,
DateEntityTableColumn,
EntityTableColumn,
EntityTableConfig
@ -55,7 +54,7 @@ export class RecipientTableConfigResolver {
this.config.entityTranslations = entityTypeTranslations.get(EntityType.NOTIFICATION_TARGET);
this.config.entityResources = {} as EntityTypeResource<NotificationTarget>;
this.config.addEntity = () => this.editTarget(null, true);
this.config.addEntity = () => this.notificationTargetDialog(null, true);
this.config.entitiesFetchFunction = pageLink => this.notificationService.getNotificationTargets(pageLink);
@ -66,17 +65,10 @@ export class RecipientTableConfigResolver {
this.config.deleteEntity = id => this.notificationService.deleteNotificationTarget(id.id);
this.config.cellActionDescriptors = this.configureCellActions();
this.config.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC};
this.config.handleRowClick = ($event, target) => {
$event?.stopPropagation();
this.editTarget(target).subscribe((res) => {
if (res) {
this.config.updateData();
}
});
this.editTarget($event, target);
return true;
};
@ -96,11 +88,12 @@ export class RecipientTableConfigResolver {
return this.config;
}
private configureCellActions(): Array<CellActionDescriptor<NotificationTarget>> {
return [];
private editTarget($event: Event, target: NotificationTarget): void {
$event?.stopPropagation();
this.notificationTargetDialog(target).subscribe(res => res ? this.config.updateData() : null);
}
private editTarget(target: NotificationTarget, isAdd = false): Observable<NotificationTarget> {
private notificationTargetDialog(target: NotificationTarget, isAdd = false): Observable<NotificationTarget> {
return this.dialog.open<RecipientNotificationDialogComponent, RecipientNotificationDialogData,
NotificationTarget>(RecipientNotificationDialogComponent, {
disableClose: true,

View File

@ -55,7 +55,7 @@ export class RuleTableConfigResolver {
this.config.entityTranslations = entityTypeTranslations.get(EntityType.NOTIFICATION_RULE);
this.config.entityResources = {} as EntityTypeResource<NotificationRule>;
this.config.addEntity = () => this.editRule(null, null, true);
this.config.addEntity = () => this.notificationRuleDialog(null, true);
this.config.entitiesFetchFunction = pageLink => this.notificationService.getNotificationRules(pageLink);
@ -70,11 +70,7 @@ export class RuleTableConfigResolver {
this.config.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC};
this.config.handleRowClick = ($event, rule) => {
this.editRule($event, rule).subscribe((res) => {
if (res) {
this.config.updateData();
}
});
this.editRule($event, rule);
return true;
};
@ -109,12 +105,16 @@ export class RuleTableConfigResolver {
name: this.translate.instant('notification.copy-rule'),
icon: 'content_copy',
isEnabled: () => true,
onAction: ($event, entity) => this.editRule($event, entity, false, true)
onAction: ($event, entity) => this.editRule($event, entity, true)
}];
}
private editRule($event: Event, rule: NotificationRule, isAdd = false, isCopy = false): Observable<NotificationRule> {
private editRule($event: Event, rule: NotificationRule, isCopy = false): void{
$event?.stopPropagation();
this.notificationRuleDialog(rule, false, isCopy).subscribe(res => res ? this.config.updateData() : null);
}
private notificationRuleDialog(rule: NotificationRule, isAdd = false, isCopy = false): Observable<NotificationRule> {
return this.dialog.open<RuleNotificationDialogComponent, RuleNotificationDialogData,
NotificationRule>(RuleNotificationDialogComponent, {
disableClose: true,

View File

@ -53,7 +53,7 @@ export class TemplateTableConfigResolver {
this.config.entityTranslations = entityTypeTranslations.get(EntityType.NOTIFICATION_TEMPLATE);
this.config.entityResources = {} as EntityTypeResource<NotificationTemplate>;
this.config.addEntity = () => this.editTemplate(null, null, true);
this.config.addEntity = () => this.notificationTemplateDialog(null, true);
this.config.entitiesFetchFunction = pageLink => this.notificationService.getNotificationTemplates(pageLink);
@ -68,11 +68,7 @@ export class TemplateTableConfigResolver {
this.config.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC};
this.config.handleRowClick = ($event, template) => {
this.editTemplate($event, template).subscribe((res) => {
if (res) {
this.config.updateData();
}
});
this.editTemplate($event, template);
return true;
};
@ -94,13 +90,17 @@ export class TemplateTableConfigResolver {
name: this.translate.instant('notification.copy-template'),
icon: 'content_copy',
isEnabled: () => true,
onAction: ($event, entity) => this.editTemplate($event, entity, false, true)
onAction: ($event, entity) => this.editTemplate($event, entity, true)
}
];
}
private editTemplate($event: Event, template: NotificationTemplate, isAdd = false, isCopy = false): Observable<NotificationTemplate> {
private editTemplate($event: Event, template: NotificationTemplate, isCopy = false) {
$event?.stopPropagation();
this.notificationTemplateDialog(template, false, isCopy).subscribe((res) => res ? this.config.updateData() : null);
}
private notificationTemplateDialog(template: NotificationTemplate, isAdd = false, isCopy = false): Observable<NotificationTemplate> {
return this.dialog.open<TemplateNotificationDialogComponent, TemplateNotificationDialogData,
NotificationTemplate>(TemplateNotificationDialogComponent, {
disableClose: true,