Skip to content
Snippets Groups Projects
Commit 8471ffc4 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FEAT #16992 TIME 1:28 admin: check selected modes of each connector

parent ca7217db
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<ion-title>{{title}}</ion-title> <ion-title>{{title}}</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<form style="display: contents;" id="adminForm" (ngSubmit)="onSubmit()" #adminForm="ngForm"> <form *ngIf="!loading" style="display: contents;" id="adminForm" (ngSubmit)="onSubmit()" #adminForm="ngForm">
<ion-content> <ion-content>
<ion-item> <ion-item>
<ion-label color="secondary" position="floating">{{'lang.label' | translate}} *</ion-label> <ion-label color="secondary" position="floating">{{'lang.label' | translate}} *</ion-label>
......
...@@ -76,7 +76,7 @@ export class OtpComponent implements OnInit { ...@@ -76,7 +76,7 @@ export class OtpComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.route.params.subscribe((params: any) => { this.route.params.subscribe(async (params: any) => {
if (params['id'] === undefined) { if (params['id'] === undefined) {
this.creationMode = true; this.creationMode = true;
this.title = this.translate.instant('lang.otpConnectorCreation'); this.title = this.translate.instant('lang.otpConnectorCreation');
...@@ -84,28 +84,33 @@ export class OtpComponent implements OnInit { ...@@ -84,28 +84,33 @@ export class OtpComponent implements OnInit {
this.connectorClone = JSON.parse(JSON.stringify(this.connector)); this.connectorClone = JSON.parse(JSON.stringify(this.connector));
} else { } else {
this.creationMode = false; this.creationMode = false;
await this.getConfig(params['id']);
this.http.get('../rest/connectors/' + params['id'])
.pipe(
map((data: any) => data.otp),
tap((data: any) => {
this.connector = data;
this.connectorClone = JSON.parse(JSON.stringify(this.connector));
this.title = this.connector.label;
}),
finalize(() => {
this.loading = false;
}),
catchError((err: any) => {
this.notificationService.handleErrors(err);
return of(false);
})
)
.subscribe();
} }
}); });
} }
getConfig(id: any) {
return new Promise((resolve) => {
this.http.get('../rest/connectors/' + id)
.pipe(
map((data: any) => data.otp),
tap((data: any) => {
this.connector = data;
this.connectorClone = JSON.parse(JSON.stringify(this.connector));
this.title = this.connector.label;
}),
finalize(() => {
this.loading = false;
}),
catchError((err: any) => {
this.notificationService.handleErrors(err);
return of(false);
})
)
.subscribe();
});
}
getConnectorTypes() { getConnectorTypes() {
this.connectorTypes = this.otpService.getConnectorTypes().map((item: any) => ({ this.connectorTypes = this.otpService.getConnectorTypes().map((item: any) => ({
id: item, id: item,
......
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