UI: Fixed notification table templates/rules were not updated after creating a copy template/rule
This commit is contained in:
parent
dfbc8f1cde
commit
16d00361a2
@ -55,7 +55,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);
|
||||
|
||||
@ -72,11 +72,7 @@ export class RecipientTableConfigResolver {
|
||||
|
||||
this.config.handleRowClick = ($event, target) => {
|
||||
$event?.stopPropagation();
|
||||
this.editTarget(target).subscribe((res) => {
|
||||
if (res) {
|
||||
this.config.updateData();
|
||||
}
|
||||
});
|
||||
this.notificationTargetDialog(target).subscribe(res => res ? this.config.updateData() : null);
|
||||
return true;
|
||||
};
|
||||
|
||||
@ -100,7 +96,7 @@ export class RecipientTableConfigResolver {
|
||||
return [];
|
||||
}
|
||||
|
||||
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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user