Skip to content

Commit

Permalink
Merge pull request #638 from sipcapture/bugfix/notifications-in-prefe…
Browse files Browse the repository at this point in the history
…rences

Bugfix/notifications in preferences
  • Loading branch information
adubovikov authored Jun 28, 2024
2 parents ae47f13 + 04e15e9 commit decf850
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
{{ password?.errors?.['maxlength']?.requiredLength }} {{'validators.maxChars' | translate }}
</mat-error>
<mat-error *ngIf="password?.errors?.['missingCharacters'] && !password?.errors?.['maxlength'] && !password?.errors?.['minlength'] && !password?.errors?.['required']">
{{'validators.pattern' | translate }} [aA-Zz], [0-9] and "~!@#$%^&*()_"]
{{'validators.pattern' | translate }} [aA-zZ] and [0-9]
</mat-error>
<mat-icon matSuffix
style="cursor: pointer"
Expand Down Expand Up @@ -117,7 +117,7 @@
{{ password2?.errors?.['maxlength']?.requiredLength }} {{'validators.maxChars' | translate }}
</mat-error>
<mat-error *ngIf="password2?.errors?.['missingCharacters'] && !password2?.errors?.['maxlength'] && !password2?.errors?.['minlength'] && !password?.errors?.['required']">
{{'validators.pattern' | translate }} [aA-Zz], [0-9] and "~!@#$%^&*()_"]
{{'validators.pattern' | translate }} [aA-zZ] and [0-9]
</mat-error>
</mat-form-field>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ export class PageAdvancedSettingsComponent implements OnInit, AfterViewInit, OnD
result.isCopy = isCopy;
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
.toPromise()
.then(() => this.updateData());
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
.then(() => {
this.updateData();
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
}, () => {
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
})
};
if (item) {
item.type = type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ export class PageAgentSubscriptionsComponent implements OnInit, AfterViewInit, O
result.isCopy = isCopy;
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
.toPromise()
.then(() => this.updateData());
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
.then(() => {
this.updateData();
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
}, () => {
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
});
};

this.openDialog(DialogAgentsubComponent, item, onOpenDialog, isCopy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ export class PageAliasComponent implements OnInit, OnDestroy, AfterViewInit {
result.isCopy = isCopy;
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
.toPromise()
.then(() => this.updateData());
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
.then(() => {
this.updateData();
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
}, () => {
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
});
};
if (item) {
item.actionType = type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class PageApiAuthComponent implements OnInit, AfterViewInit, OnDestroy {
);
}
this.updateData();
this.alertService.success(`${this.page} Successfully ${(_result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
};

const onOpenDialog = (result) => {
Expand All @@ -145,8 +146,9 @@ export class PageApiAuthComponent implements OnInit, AfterViewInit, OnDestroy {
result.isCopy = isCopy;
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
.toPromise()
.then(onServiceRes);
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
.then(onServiceRes, () => {
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
});
};

this.openDialog(DialogAuthKeyComponent, item, onOpenDialog, isCopy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ export class PageMappingComponent implements OnInit, AfterViewInit, OnDestroy {
result.isCopy = isCopy;
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
.toPromise()
.then(() => this.updateData());
.then(() => {
this.updateData();
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
}, () => {
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
});
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ export class PageProfileComponent implements OnInit {
}
this.alertService.success(`${this.page} Successfully Updated`);

});
}, () => {
this.alertService.error(`Failed to Update ${this.page}`)
});
} else {
this.username.markAsTouched();
this.usergroup.markAsTouched();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ export class PageScriptsComponent implements OnInit, AfterViewInit, OnDestroy {
result.isCopy = isCopy;
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
.toPromise()
.then(() => this.updateData());
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
.then(() => this.updateData(), () => {
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
});
};

this.openDialog(DialogScriptsComponent, Functions.cloneObject(item), onOpenDialog, isCopy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,12 @@ export class PageSystemOverviewComponent implements OnInit, AfterViewInit, OnDes
result.isCopy = isCopy;
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
.toPromise()
.then(() => this.updateData());
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
.then(() => {
this.updateData();
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
}, () => {
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
});
};

this.openDialog(DialogUsersComponent, item, onOpenDialog, isCopy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ export class PageUserSettingsComponent implements OnInit, OnDestroy, AfterViewIn
result.isCopy = isCopy;
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
.toPromise()
.then(() => this.updateData());
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
.then(() => {
this.updateData();
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
}, () => {
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
});
};

if (item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ export class PageUsersComponent implements OnInit, OnDestroy, AfterViewInit {
this.authenticationService.logout();
this.router.navigate([{ outlets: { primary: null, system: 'login' } }]);
}
});
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);

}, () => {
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
});
};

this.openDialog(DialogUsersComponent, Functions.cloneObject(item), onOpenDialog, isCopy);
Expand Down

0 comments on commit decf850

Please sign in to comment.