Skip to content

Commit decf850

Browse files
authored
Merge pull request #638 from sipcapture/bugfix/notifications-in-preferences
Bugfix/notifications in preferences
2 parents ae47f13 + 04e15e9 commit decf850

File tree

11 files changed

+53
-20
lines changed

11 files changed

+53
-20
lines changed

src/app/components/preference/dialogs/dialog-users/dialog-users.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
{{ password?.errors?.['maxlength']?.requiredLength }} {{'validators.maxChars' | translate }}
8888
</mat-error>
8989
<mat-error *ngIf="password?.errors?.['missingCharacters'] && !password?.errors?.['maxlength'] && !password?.errors?.['minlength'] && !password?.errors?.['required']">
90-
{{'validators.pattern' | translate }} [aA-Zz], [0-9] and "~!@#$%^&*()_"]
90+
{{'validators.pattern' | translate }} [aA-zZ] and [0-9]
9191
</mat-error>
9292
<mat-icon matSuffix
9393
style="cursor: pointer"
@@ -117,7 +117,7 @@
117117
{{ password2?.errors?.['maxlength']?.requiredLength }} {{'validators.maxChars' | translate }}
118118
</mat-error>
119119
<mat-error *ngIf="password2?.errors?.['missingCharacters'] && !password2?.errors?.['maxlength'] && !password2?.errors?.['minlength'] && !password?.errors?.['required']">
120-
{{'validators.pattern' | translate }} [aA-Zz], [0-9] and "~!@#$%^&*()_"]
120+
{{'validators.pattern' | translate }} [aA-zZ] and [0-9]
121121
</mat-error>
122122
</mat-form-field>
123123
</div>

src/app/components/preference/pages/page-advanced-settings/page-advanced-settings.component.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,12 @@ export class PageAdvancedSettingsComponent implements OnInit, AfterViewInit, OnD
118118
result.isCopy = isCopy;
119119
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
120120
.toPromise()
121-
.then(() => this.updateData());
122-
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
121+
.then(() => {
122+
this.updateData();
123+
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
124+
}, () => {
125+
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
126+
})
123127
};
124128
if (item) {
125129
item.type = type;

src/app/components/preference/pages/page-agent-subscriptions/page-agent-subscriptions.component.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ export class PageAgentSubscriptionsComponent implements OnInit, AfterViewInit, O
123123
result.isCopy = isCopy;
124124
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
125125
.toPromise()
126-
.then(() => this.updateData());
127-
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
126+
.then(() => {
127+
this.updateData();
128+
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
129+
}, () => {
130+
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
131+
});
128132
};
129133

130134
this.openDialog(DialogAgentsubComponent, item, onOpenDialog, isCopy);

src/app/components/preference/pages/page-alias/page-alias.component.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ export class PageAliasComponent implements OnInit, OnDestroy, AfterViewInit {
133133
result.isCopy = isCopy;
134134
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
135135
.toPromise()
136-
.then(() => this.updateData());
137-
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
136+
.then(() => {
137+
this.updateData();
138+
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
139+
}, () => {
140+
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
141+
});
138142
};
139143
if (item) {
140144
item.actionType = type;

src/app/components/preference/pages/page-api-auth/page-api-auth.component.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export class PageApiAuthComponent implements OnInit, AfterViewInit, OnDestroy {
135135
);
136136
}
137137
this.updateData();
138+
this.alertService.success(`${this.page} Successfully ${(_result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
138139
};
139140

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

152154
this.openDialog(DialogAuthKeyComponent, item, onOpenDialog, isCopy);

src/app/components/preference/pages/page-mapping/page-mapping.component.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ export class PageMappingComponent implements OnInit, AfterViewInit, OnDestroy {
121121
result.isCopy = isCopy;
122122
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
123123
.toPromise()
124-
.then(() => this.updateData());
124+
.then(() => {
125+
this.updateData();
126+
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
127+
}, () => {
128+
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
129+
});
125130
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
126131
};
127132

src/app/components/preference/pages/page-profile/page-profile.component.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ export class PageProfileComponent implements OnInit {
206206
}
207207
this.alertService.success(`${this.page} Successfully Updated`);
208208

209-
});
209+
}, () => {
210+
this.alertService.error(`Failed to Update ${this.page}`)
211+
});
210212
} else {
211213
this.username.markAsTouched();
212214
this.usergroup.markAsTouched();

src/app/components/preference/pages/page-scripts/page-scripts.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ export class PageScriptsComponent implements OnInit, AfterViewInit, OnDestroy {
123123
result.isCopy = isCopy;
124124
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
125125
.toPromise()
126-
.then(() => this.updateData());
127-
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
126+
.then(() => this.updateData(), () => {
127+
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
128+
});
128129
};
129130

130131
this.openDialog(DialogScriptsComponent, Functions.cloneObject(item), onOpenDialog, isCopy);

src/app/components/preference/pages/page-system-overview/page-system-overview.component.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,12 @@ export class PageSystemOverviewComponent implements OnInit, AfterViewInit, OnDes
186186
result.isCopy = isCopy;
187187
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
188188
.toPromise()
189-
.then(() => this.updateData());
190-
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
189+
.then(() => {
190+
this.updateData();
191+
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
192+
}, () => {
193+
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
194+
});
191195
};
192196

193197
this.openDialog(DialogUsersComponent, item, onOpenDialog, isCopy);

src/app/components/preference/pages/page-user-settings/page-user-settings.component.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ export class PageUserSettingsComponent implements OnInit, OnDestroy, AfterViewIn
123123
result.isCopy = isCopy;
124124
this.service[result.isnew ? 'add' : (isCopy ? 'copy' : 'update')](result.data)
125125
.toPromise()
126-
.then(() => this.updateData());
127-
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
126+
.then(() => {
127+
this.updateData();
128+
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
129+
}, () => {
130+
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
131+
});
128132
};
129133

130134
if (item) {

src/app/components/preference/pages/page-users/page-users.component.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@ export class PageUsersComponent implements OnInit, OnDestroy, AfterViewInit {
135135
this.authenticationService.logout();
136136
this.router.navigate([{ outlets: { primary: null, system: 'login' } }]);
137137
}
138-
});
139-
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
138+
this.alertService.success(`${this.page} Successfully ${(result.isnew ? 'Added' : (isCopy ? 'Copied' : 'Updated'))}`);
139+
140+
}, () => {
141+
this.alertService.error(`Failed to ${(result.isnew ? 'Add' : (isCopy ? 'Copy' : 'Update'))} ${this.page}`)
142+
});
140143
};
141144

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

0 commit comments

Comments
 (0)