Skip to content

Commit

Permalink
Merge branch 'rc'
Browse files Browse the repository at this point in the history
  • Loading branch information
ikulikov committed Jan 10, 2025
2 parents bfc8b87 + 2bb1930 commit 34bd41f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
///

import {
CellActionDescriptor,
DateEntityTableColumn,
EntityTableColumn,
EntityTableConfig
Expand Down Expand Up @@ -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);

Expand All @@ -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;
};

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
};

Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
};

Expand All @@ -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,
Expand Down

0 comments on commit 34bd41f

Please sign in to comment.