Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 274242ae authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Set warning message as "growl" and add 3s timeout on success messages

parent 662ac62f
No related branches found
No related tags found
No related merge requests found
.alert-message {
position: fixed;
max-width: 70%;
top: 3em;
left: 50%;
transform: translate(-50%, 0);
padding: 20px;
color: white;
opacity: 1;
......
<div #alertMessage
<div #alertMessage class="mat-elevation-z8"
*ngIf="message" [ngClass]="{ 'alert-message': message,
'alert-success': message.type === 'success',
'alert-error': message.type === 'error',
'stickyError':showSticky}"
'alert-error': message.type === 'error'}"
id="alertmessage_id"
>
......
......@@ -13,11 +13,13 @@ export class AlertMessageComponent implements OnInit {
showSticky:boolean = false;
message: any=null;
readonly successTimeout: number = 3000;
constructor(private alertService: AlertMessageService) { }
ngOnInit() {
this.alertService.getMessage().subscribe(message => { this.message = message; });
this.alertService.getMessage().subscribe(message => { this.showMessage(message); });
}
clearAlert():void {
......@@ -33,4 +35,14 @@ export class AlertMessageComponent implements OnInit {
return this.message.text;
}
}
showMessage(message: any) {
this.message = message;
if (message?.type==='success') {
setTimeout(() => {
this.clearAlert();
}, this.successTimeout);
}
}
}
......@@ -31,13 +31,11 @@
formControlName="new-password" required id="np_id" auto-focus-directive>
<mat-icon matSuffix
(click)="hideNewPwdFiled = !hideNewPwdFiled">{{hideNewPwdFiled ? 'visibility_off' : 'visibility'}}</mat-icon>
<smp-field-error *ngIf="passwordError('new-password', 'required')">New password is required</smp-field-error >
<smp-field-error *ngIf="passwordError('new-password', 'error')">New password must not be equal than old current
password!
</smp-field-error >
<smp-field-error *ngIf="passwordError('new-password', 'pattern')">{{passwordValidationMessage}}</smp-field-error>
</mat-form-field>
<mat-form-field style="width:100%">
<mat-label>Confirm New Password</mat-label>
<input matInput [type]="hideConfPwdFiled ? 'password' : 'text'"
......@@ -47,8 +45,6 @@
<smp-field-error *ngIf="passwordError('confirm-new-password', 'error')">Confirm valued does not match new
password!
</smp-field-error >
<smp-field-error *ngIf="passwordError('confirm-new-password', 'required')">Confirm New password is required
</smp-field-error >
</mat-form-field>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment