Skip to content
Snippets Groups Projects
Commit e26afa2f authored by nicolas lebozec's avatar nicolas lebozec
Browse files

FIX #19031 TIME 1:15 Add title to CAS configuration when no conf and add...

FIX #19031 TIME 1:15 Add title to CAS configuration when no conf and add button delete to clear the CAS configuration
parent 47ca6adc
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,10 @@
[disabled]="!adminForm.form.valid || !canValidate()">
<ion-label style="font-size: 13px;">{{'lang.validate' | translate}}</ion-label>
</ion-button>
<ion-button *ngIf="!creationMode" type="button" shape="round" size="large"
fill="outline" color="danger" (click)="delete()" >
<ion-label style="font-size: 13px;">{{'lang.delete' | translate}}</ion-label>
</ion-button>
</div>
</ion-item>
</ion-content>
......
......@@ -77,7 +77,6 @@ export class CasComponent implements OnInit {
ngOnInit(): void {
this.casTest.login = this.authService.user.login;
this.creationMode = false;
this.http.get('../rest/configurations?identifier=casServer')
.pipe(
map((data: any) => data.configurations[0]),
......@@ -98,9 +97,13 @@ export class CasComponent implements OnInit {
};
this.casClone = JSON.parse(JSON.stringify(this.cas));
this.title = this.cas.label;
this.creationMode = false;
} else {
this.creationMode = true;
this.title = this.translate.instant('lang.casCreation');
this.loading = false;
}
}),
finalize(() => this.loading = false)
).subscribe();
}
......@@ -149,6 +152,30 @@ export class CasComponent implements OnInit {
).subscribe();
}
delete() {
const dialogRef = this.dialog.open(ConfirmComponent, { autoFocus: false, data: { mode: '', title: 'lang.confirmMsg', msg: '' } });
dialogRef.afterClosed().subscribe(result => {
if (result === 'yes') {
this.creationMode = false;
this.loading = true;
this.http.delete('../rest/configurations/' + this.cas.id)
.pipe(
finalize(() => this.loading = false),
tap(() => {
this.router.navigate(['/administration/connections']);
this.notificationService.success('lang.casDeleted');
}),
catchError((err: any) => {
this.notificationService.handleErrors(err);
return of(false);
})
)
.subscribe();
}
});
}
cancel() {
this.router.navigate(['/administration/connections']);
}
......
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