From 3ae548d896a4c597d9e7dc2dbccee60736b649c4 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Tue, 23 Mar 2021 16:59:54 +0100
Subject: [PATCH 01/10] feat: add user deletion in admin pannel

---
 src/app/admin/admin.module.ts                 |  3 +-
 .../delete-user/delete-user.component.html    |  9 ++++++
 .../delete-user/delete-user.component.spec.ts | 24 +++++++++++++++
 .../delete-user/delete-user.component.ts      | 30 +++++++++++++++++++
 .../components/panel/panel.component.html     |  1 +
 src/app/admin/services/admin.service.ts       | 10 +++++++
 6 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 src/app/admin/components/delete-user/delete-user.component.html
 create mode 100644 src/app/admin/components/delete-user/delete-user.component.spec.ts
 create mode 100644 src/app/admin/components/delete-user/delete-user.component.ts

diff --git a/src/app/admin/admin.module.ts b/src/app/admin/admin.module.ts
index 80f80da23..05b87149d 100644
--- a/src/app/admin/admin.module.ts
+++ b/src/app/admin/admin.module.ts
@@ -2,10 +2,11 @@ import { NgModule } from '@angular/core';
 import { CommonModule } from '@angular/common';
 import { PanelComponent } from './components/panel/panel.component';
 import { ClaimStructureComponent } from './components/claim-structure/claim-structure.component';
+import { DeleteUserComponent } from './components/delete-user/delete-user.component';
 import { SharedModule } from '../shared/shared.module';
 
 @NgModule({
-  declarations: [PanelComponent, ClaimStructureComponent],
+  declarations: [PanelComponent, ClaimStructureComponent, DeleteUserComponent],
   imports: [CommonModule, SharedModule],
 })
 export class AdminModule {}
diff --git a/src/app/admin/components/delete-user/delete-user.component.html b/src/app/admin/components/delete-user/delete-user.component.html
new file mode 100644
index 000000000..4acbee5b6
--- /dev/null
+++ b/src/app/admin/components/delete-user/delete-user.component.html
@@ -0,0 +1,9 @@
+<div fxLayout="column" fxLayoutAlign="center center">
+  <span>SUPRESSION D'UTILISATEUR</span>
+  <tr *ngFor="let user of users">
+    <td>{{user.name}}</td>
+    <td>
+      <button (click)="deleteUser(user)">Supprimer</button>
+    </td>
+  </tr>
+</div>
\ No newline at end of file
diff --git a/src/app/admin/components/delete-user/delete-user.component.spec.ts b/src/app/admin/components/delete-user/delete-user.component.spec.ts
new file mode 100644
index 000000000..c05e3e296
--- /dev/null
+++ b/src/app/admin/components/delete-user/delete-user.component.spec.ts
@@ -0,0 +1,24 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DeleteUserComponent } from './delete-user.component';
+
+describe('ClaimStructureComponent', () => {
+  let component: DeleteUserComponent;
+  let fixture: ComponentFixture<DeleteUserComponent>;
+
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      declarations: [DeleteUserComponent],
+    }).compileComponents();
+  });
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(DeleteUserComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/src/app/admin/components/delete-user/delete-user.component.ts b/src/app/admin/components/delete-user/delete-user.component.ts
new file mode 100644
index 000000000..f7c10bb3a
--- /dev/null
+++ b/src/app/admin/components/delete-user/delete-user.component.ts
@@ -0,0 +1,30 @@
+import { Component, OnInit } from '@angular/core';
+import { User } from '../../../models/user.model';
+import { DemandAttachment } from '../../models/demandAttachment.model';
+import { AdminService } from '../../services/admin.service';
+
+@Component({
+  selector: 'app-admin-delete-user',
+  templateUrl: './delete-user.component.html',
+})
+export class DeleteUserComponent implements OnInit {
+  public users: User[];
+  constructor(private adminService: AdminService) {}
+
+  ngOnInit(): void {
+    this.adminService.getUsers().subscribe((users) => {
+      this.users = users;
+      console.log("get users");
+    });
+  }
+
+  public deleteUser(user: User): void {
+    this.adminService
+      .deleteUser(user.email)
+      .subscribe((data) => {
+        this.users = this.users.filter(function( obj ) {
+          return obj.email !== data.email;
+        });
+      });
+  }
+}
diff --git a/src/app/admin/components/panel/panel.component.html b/src/app/admin/components/panel/panel.component.html
index 2d2501106..b8fcecb0d 100644
--- a/src/app/admin/components/panel/panel.component.html
+++ b/src/app/admin/components/panel/panel.component.html
@@ -1,4 +1,5 @@
 <div fxLayout="column" class="content-container full-screen">
   <div fxLayout="row" fxLayoutAlign="center center"><h1>Administration</h1></div>
   <app-admin-claim-structure></app-admin-claim-structure>
+  <app-admin-delete-user></app-admin-delete-user>
 </div>
diff --git a/src/app/admin/services/admin.service.ts b/src/app/admin/services/admin.service.ts
index cdea9a41b..c047ed748 100644
--- a/src/app/admin/services/admin.service.ts
+++ b/src/app/admin/services/admin.service.ts
@@ -1,6 +1,8 @@
 import { HttpClient } from '@angular/common/http';
+import { stringify } from '@angular/compiler/src/util';
 import { Injectable } from '@angular/core';
 import { Observable } from 'rxjs';
+import { User } from '../../models/user.model';
 import { DemandAttachment } from '../models/demandAttachment.model';
 
 @Injectable({
@@ -15,6 +17,14 @@ export class AdminService {
     return this.http.get<DemandAttachment[]>(`${this.baseUrl}/pendingStructures`);
   }
 
+  public getUsers(): Observable<User[]> {
+    return this.http.get<User[]>(`api/users`);
+  }
+
+  public deleteUser(email: string): Observable<User> {
+    return this.http.post<User>(`api/users/delete-user`, { email });
+  }
+
   public acceptStructureClaim(
     userEmail: string,
     structureId: number,
-- 
GitLab


From 34cd4645f08cf1dcd434e9742a9f52e34606ae2e Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Wed, 24 Mar 2021 16:53:54 +0100
Subject: [PATCH 02/10] feat: updating delete user component

---
 .../delete-user/delete-user.component.html    | 22 ++++++++++++-------
 .../delete-user/delete-user.component.scss    |  9 ++++++++
 .../delete-user/delete-user.component.spec.ts |  2 +-
 .../delete-user/delete-user.component.ts      | 19 ++++++++++++----
 .../components/panel/panel.component.html     | 16 ++++++++++----
 .../admin/components/panel/panel.component.ts |  9 +++++++-
 src/app/admin/services/admin.service.ts       |  5 +++++
 7 files changed, 64 insertions(+), 18 deletions(-)
 create mode 100644 src/app/admin/components/delete-user/delete-user.component.scss

diff --git a/src/app/admin/components/delete-user/delete-user.component.html b/src/app/admin/components/delete-user/delete-user.component.html
index 4acbee5b6..23adc2ec0 100644
--- a/src/app/admin/components/delete-user/delete-user.component.html
+++ b/src/app/admin/components/delete-user/delete-user.component.html
@@ -1,9 +1,15 @@
-<div fxLayout="column" fxLayoutAlign="center center">
-  <span>SUPRESSION D'UTILISATEUR</span>
-  <tr *ngFor="let user of users">
-    <td>{{user.name}}</td>
-    <td>
-      <button (click)="deleteUser(user)">Supprimer</button>
-    </td>
-  </tr>
+<div fxLayout="column" fxLayoutGap="5px" fxLayoutAlign="center center" class="userblock">
+  <h4>Suppression d'utilisateurs</h4>
+  <div fxLayout="row">
+    <input #searchstring (keyup)="0">
+    <button  (click)="searchUsers(searchstring.value)">Rechercher</button>
+  </div>
+  <div class="userlist">
+    <tr *ngFor="let user of users">
+      <td>{{user.email}}</td>
+      <td>
+        <button (click)="clickMethod(user)">Supprimer</button>
+      </td>
+    </tr>
+  </div>
 </div>
\ No newline at end of file
diff --git a/src/app/admin/components/delete-user/delete-user.component.scss b/src/app/admin/components/delete-user/delete-user.component.scss
new file mode 100644
index 000000000..d13aab9f2
--- /dev/null
+++ b/src/app/admin/components/delete-user/delete-user.component.scss
@@ -0,0 +1,9 @@
+.userlist {
+    max-width: 50%;
+    
+}
+
+.userblock {
+    max-width: 50%;
+    margin: 0 auto;
+}
\ No newline at end of file
diff --git a/src/app/admin/components/delete-user/delete-user.component.spec.ts b/src/app/admin/components/delete-user/delete-user.component.spec.ts
index c05e3e296..ebf1555b4 100644
--- a/src/app/admin/components/delete-user/delete-user.component.spec.ts
+++ b/src/app/admin/components/delete-user/delete-user.component.spec.ts
@@ -2,7 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { DeleteUserComponent } from './delete-user.component';
 
-describe('ClaimStructureComponent', () => {
+describe('DeleteUserComponent', () => {
   let component: DeleteUserComponent;
   let fixture: ComponentFixture<DeleteUserComponent>;
 
diff --git a/src/app/admin/components/delete-user/delete-user.component.ts b/src/app/admin/components/delete-user/delete-user.component.ts
index f7c10bb3a..2ebaabff4 100644
--- a/src/app/admin/components/delete-user/delete-user.component.ts
+++ b/src/app/admin/components/delete-user/delete-user.component.ts
@@ -6,16 +6,14 @@ import { AdminService } from '../../services/admin.service';
 @Component({
   selector: 'app-admin-delete-user',
   templateUrl: './delete-user.component.html',
+  styleUrls: ['./delete-user.component.scss']
 })
 export class DeleteUserComponent implements OnInit {
   public users: User[];
   constructor(private adminService: AdminService) {}
 
   ngOnInit(): void {
-    this.adminService.getUsers().subscribe((users) => {
-      this.users = users;
-      console.log("get users");
-    });
+
   }
 
   public deleteUser(user: User): void {
@@ -27,4 +25,17 @@ export class DeleteUserComponent implements OnInit {
         });
       });
   }
+
+  public clickMethod(user: User) {
+    if(confirm("Are you sure to delete "+ user.email)) {
+      this.deleteUser(user)
+    }
+  }
+
+  public searchUsers(searchString: string) {
+    console.log("searching for: ", searchString)
+    this.adminService.searchUsers(searchString).subscribe((users) => {
+      this.users = users;
+    });
+  }
 }
diff --git a/src/app/admin/components/panel/panel.component.html b/src/app/admin/components/panel/panel.component.html
index b8fcecb0d..7a528bbce 100644
--- a/src/app/admin/components/panel/panel.component.html
+++ b/src/app/admin/components/panel/panel.component.html
@@ -1,5 +1,13 @@
-<div fxLayout="column" class="content-container full-screen">
+<div fxLayout="column" fxLayoutGap="20px" class="content-container full-screen">
   <div fxLayout="row" fxLayoutAlign="center center"><h1>Administration</h1></div>
-  <app-admin-claim-structure></app-admin-claim-structure>
-  <app-admin-delete-user></app-admin-delete-user>
-</div>
+  <div fxLayout="row" fxLayoutGap="20px" fxLayoutAlign="center center">
+    <button  (click)="changeActiveFeature('structure')">Gestion structure</button>
+    <button  (click)="changeActiveFeature('userDeletion')">Suppression d'utilisateurs</button>
+  </div>
+  <div *ngIf="activeFeature == 'userDeletion'">
+    <app-admin-delete-user></app-admin-delete-user>
+  </div>
+  <div *ngIf="activeFeature == 'structure'">
+    <app-admin-claim-structure></app-admin-claim-structure>
+  </div>
+</div>
\ No newline at end of file
diff --git a/src/app/admin/components/panel/panel.component.ts b/src/app/admin/components/panel/panel.component.ts
index c4a216409..b69b87c6a 100644
--- a/src/app/admin/components/panel/panel.component.ts
+++ b/src/app/admin/components/panel/panel.component.ts
@@ -5,7 +5,14 @@ import { Component, OnInit } from '@angular/core';
   templateUrl: './panel.component.html',
 })
 export class PanelComponent implements OnInit {
+  public activeFeature: string;
   constructor() {}
 
-  ngOnInit(): void {}
+  ngOnInit(): void {
+    this.activeFeature = "structure";
+  }
+
+  public changeActiveFeature(newFeature: string) {
+    this.activeFeature = newFeature;
+  }
 }
diff --git a/src/app/admin/services/admin.service.ts b/src/app/admin/services/admin.service.ts
index c047ed748..d2c004dc9 100644
--- a/src/app/admin/services/admin.service.ts
+++ b/src/app/admin/services/admin.service.ts
@@ -21,6 +21,11 @@ export class AdminService {
     return this.http.get<User[]>(`api/users`);
   }
 
+  public searchUsers(searchString: string): Observable<User[]> {
+    return this.http.post<User[]>(`api/users/searchUsers`, { searchString });
+  }
+  
+
   public deleteUser(email: string): Observable<User> {
     return this.http.post<User>(`api/users/delete-user`, { email });
   }
-- 
GitLab


From f55bbcca7a9fe8518ff0844db845a5ef603580f3 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Thu, 25 Mar 2021 17:11:21 +0100
Subject: [PATCH 03/10] feat: test for deleteComponent and fix some other tests

---
 src/app/map/services/map.service.spec.ts       |  8 ++++----
 .../structure-details.component.spec.ts        | 12 ++++++------
 .../structure-list.component.spec.ts           | 18 +++++++++---------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/app/map/services/map.service.spec.ts b/src/app/map/services/map.service.spec.ts
index e4d405c3f..cd06fb3f4 100644
--- a/src/app/map/services/map.service.spec.ts
+++ b/src/app/map/services/map.service.spec.ts
@@ -33,14 +33,14 @@ describe('MapService', () => {
   });
 
   it('should get marker', () => {
-    const marker = service.createMarker(45.764043, 4.835659, 1, 53, '<p>Hello <br/>World !</p>');
-    expect(marker).toEqual(service.getMarker(53));
+    const marker = service.createMarker(45.764043, 4.835659, 1, "53", '<p>Hello <br/>World !</p>');
+    expect(marker).toEqual(service.getMarker("53"));
   });
   it('should not get marker, with missing id', () => {
     service.createMarker(45.764043, 4.835659, 1, null, '<p>Hello <br/>World !</p>');
-    expect(service.getMarker(2)).toEqual(null);
+    expect(service.getMarker("2")).toEqual(null);
   });
   it('should not get marker, empty', () => {
-    expect(service.getMarker(2)).toEqual(null);
+    expect(service.getMarker("2")).toEqual(null);
   });
 });
diff --git a/src/app/structure-list/components/structure-details/structure-details.component.spec.ts b/src/app/structure-list/components/structure-details/structure-details.component.spec.ts
index d1e70665c..b4b524f10 100644
--- a/src/app/structure-list/components/structure-details/structure-details.component.spec.ts
+++ b/src/app/structure-list/components/structure-details/structure-details.component.spec.ts
@@ -39,12 +39,12 @@ describe('StructureDetailsComponent', () => {
   });
 
   it('should return icon name with a string input', () => {
-    const iconNameGroup = component.getAccessIcon(AccessModality.free);
-    const iconNameCalendar = component.getAccessIcon(AccessModality.meeting);
-    const iconNameTel = component.getAccessIcon(AccessModality.numeric);
-    expect(iconNameGroup).toEqual('group');
-    expect(iconNameCalendar).toEqual('calendar');
-    expect(iconNameTel).toEqual('tel');
+    // const iconNameGroup = component.getAccessIcon(AccessModality.free);
+    // const iconNameCalendar = component.getAccessIcon(AccessModality.meeting);
+    // const iconNameTel = component.getAccessIcon(AccessModality.numeric);
+    // expect(iconNameGroup).toEqual('group');
+    // expect(iconNameCalendar).toEqual('calendar');
+    // expect(iconNameTel).toEqual('tel');
   });
 
   it('should update array with right modules', () => {
diff --git a/src/app/structure-list/structure-list.component.spec.ts b/src/app/structure-list/structure-list.component.spec.ts
index 793f39969..bb4601e5f 100644
--- a/src/app/structure-list/structure-list.component.spec.ts
+++ b/src/app/structure-list/structure-list.component.spec.ts
@@ -180,7 +180,7 @@ describe('StructureListComponent', () => {
     spyOn(component.selectedMarkerId, 'emit');
     component.showDetails(structure);
     expect(component.selectedMarkerId.emit).toHaveBeenCalled();
-    expect(component.selectedMarkerId.emit).toHaveBeenCalledWith(structure.id);
+    expect(component.selectedMarkerId.emit).toHaveBeenCalledWith(structure._id);
     expect(component.showStructureDetails).toBe(true);
     expect(component.structure).toBe(structure);
   });
@@ -194,16 +194,16 @@ describe('StructureListComponent', () => {
   });
 
   it('should emit id structure to display map marker', () => {
-    spyOn(component.displayMapMarkerId, 'emit');
-    component.handleCardHover(structure);
-    expect(component.displayMapMarkerId.emit).toHaveBeenCalled();
-    expect(component.displayMapMarkerId.emit).toHaveBeenCalledWith([structure.id]);
+    // spyOn(component.displayMapMarkerId, 'emit');
+    // component.handleCardHover(structure);
+    // expect(component.displayMapMarkerId.emit).toHaveBeenCalled();
+    // expect(component.displayMapMarkerId.emit).toHaveBeenCalledWith([structure._id]);
   });
 
   it('should emit undefined id structure to remove map marker', () => {
-    spyOn(component.displayMapMarkerId, 'emit');
-    component.mouseLeave();
-    expect(component.displayMapMarkerId.emit).toHaveBeenCalled();
-    expect(component.displayMapMarkerId.emit).toHaveBeenCalledWith([undefined]);
+    // spyOn(component.displayMapMarkerId, 'emit');
+    // component.mouseLeave();
+    // expect(component.displayMapMarkerId.emit).toHaveBeenCalled();
+    // expect(component.displayMapMarkerId.emit).toHaveBeenCalledWith([undefined]);
   });
 });
-- 
GitLab


From bcea697de12a198ddf2bd8ca913145ce1194a232 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Fri, 26 Mar 2021 11:11:43 +0100
Subject: [PATCH 04/10] feat: update modal and finish unit tests

---
 .../delete-user/delete-user.component.html    |  7 +++-
 .../delete-user/delete-user.component.spec.ts | 37 +++++++++++++++++++
 .../delete-user/delete-user.component.ts      | 30 +++++++++------
 3 files changed, 62 insertions(+), 12 deletions(-)

diff --git a/src/app/admin/components/delete-user/delete-user.component.html b/src/app/admin/components/delete-user/delete-user.component.html
index 23adc2ec0..96fede389 100644
--- a/src/app/admin/components/delete-user/delete-user.component.html
+++ b/src/app/admin/components/delete-user/delete-user.component.html
@@ -8,8 +8,13 @@
     <tr *ngFor="let user of users">
       <td>{{user.email}}</td>
       <td>
-        <button (click)="clickMethod(user)">Supprimer</button>
+        <button (click)="toggleDeleteModal()">Supprimer</button>
       </td>
+      <app-modal-confirmation
+  [openned]="deleteModalOpenned"
+  [content]="'Voulez-vous vraiment supprimer cet utilisateur&nbsp;? (' + user.email + ')'"
+  (closed)="deleteUser(user, $event)"
+></app-modal-confirmation>
     </tr>
   </div>
 </div>
\ No newline at end of file
diff --git a/src/app/admin/components/delete-user/delete-user.component.spec.ts b/src/app/admin/components/delete-user/delete-user.component.spec.ts
index ebf1555b4..4f1ef1189 100644
--- a/src/app/admin/components/delete-user/delete-user.component.spec.ts
+++ b/src/app/admin/components/delete-user/delete-user.component.spec.ts
@@ -1,13 +1,24 @@
+import { HttpClientModule } from '@angular/common/http';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { of } from 'rxjs';
+import { AdminService } from '../../services/admin.service';
 
 import { DeleteUserComponent } from './delete-user.component';
 
 describe('DeleteUserComponent', () => {
   let component: DeleteUserComponent;
   let fixture: ComponentFixture<DeleteUserComponent>;
+  let USERS;
+  let service;
 
   beforeEach(async () => {
+    USERS = [
+      {email: "paula@test.com", name: "paula"},
+      {email: "jeanpaul@test.com", name: "jeanpaul"},
+      {email: "admin@test.com", name: "admin"},
+    ];
     await TestBed.configureTestingModule({
+      imports: [HttpClientModule],
       declarations: [DeleteUserComponent],
     }).compileComponents();
   });
@@ -16,9 +27,35 @@ describe('DeleteUserComponent', () => {
     fixture = TestBed.createComponent(DeleteUserComponent);
     component = fixture.componentInstance;
     fixture.detectChanges();
+
+    service = jasmine.createSpyObj(['searchUsers', 'deleteUser'])
+    component = new DeleteUserComponent(service);
   });
 
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+
+  it('should searchUsers', () => {
+    let searchString = "paula"
+    service.searchUsers.and.returnValue(of(USERS.filter(item => item.email.indexOf(searchString) !== -1)));
+    component.users = USERS;
+    component.searchUsers(searchString);
+    expect(component.users.length).toBe(1);
+  });
+
+  it('should searchUsers all users', () => {
+    let searchString = ""
+    service.searchUsers.and.returnValue(of(USERS.filter(item => item.email.indexOf(searchString) !== -1)));
+    component.users = USERS;
+    component.searchUsers(searchString);
+    expect(component.users.length).toBe(USERS.length);
+  });
+
+  it('should delete user', () => {
+    component.users = USERS;
+    service.deleteUser.and.returnValue(of(USERS.splice(USERS.findIndex(e => e.email === USERS[0].email),1)));
+    component.deleteUser(component.users[0]);
+    expect(component.users.length).toBe(2);
+  });
 });
diff --git a/src/app/admin/components/delete-user/delete-user.component.ts b/src/app/admin/components/delete-user/delete-user.component.ts
index 2ebaabff4..7d5e49be6 100644
--- a/src/app/admin/components/delete-user/delete-user.component.ts
+++ b/src/app/admin/components/delete-user/delete-user.component.ts
@@ -10,26 +10,34 @@ import { AdminService } from '../../services/admin.service';
 })
 export class DeleteUserComponent implements OnInit {
   public users: User[];
+  public deleteModalOpenned = false;
   constructor(private adminService: AdminService) {}
 
   ngOnInit(): void {
 
   }
 
-  public deleteUser(user: User): void {
-    this.adminService
-      .deleteUser(user.email)
-      .subscribe((data) => {
-        this.users = this.users.filter(function( obj ) {
-          return obj.email !== data.email;
+  public deleteUser(user: User, shouldDelete: boolean): void {
+    this.toggleDeleteModal();
+    if (shouldDelete) {
+      this.adminService
+        .deleteUser(user.email)
+        .subscribe((data) => {
+          this.users = this.users.filter(function( obj ) {
+            return obj.email !== data.email;
+          });
         });
-      });
+    }
   }
 
-  public clickMethod(user: User) {
-    if(confirm("Are you sure to delete "+ user.email)) {
-      this.deleteUser(user)
-    }
+  // public clickMethod(user: User) {
+  //   if(confirm("Are you sure to delete "+ user.email)) {
+  //     this.deleteUser(user)
+  //   }
+  // }
+
+  public toggleDeleteModal(): void {
+    this.deleteModalOpenned = !this.deleteModalOpenned;
   }
 
   public searchUsers(searchString: string) {
-- 
GitLab


From 21f3d2a2d9b80c23fc25937e2be0544032189271 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Fri, 26 Mar 2021 11:14:37 +0100
Subject: [PATCH 05/10] feat: remove debuging console log

---
 .../admin/components/delete-user/delete-user.component.ts  | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/app/admin/components/delete-user/delete-user.component.ts b/src/app/admin/components/delete-user/delete-user.component.ts
index 7d5e49be6..a0acef58d 100644
--- a/src/app/admin/components/delete-user/delete-user.component.ts
+++ b/src/app/admin/components/delete-user/delete-user.component.ts
@@ -30,18 +30,11 @@ export class DeleteUserComponent implements OnInit {
     }
   }
 
-  // public clickMethod(user: User) {
-  //   if(confirm("Are you sure to delete "+ user.email)) {
-  //     this.deleteUser(user)
-  //   }
-  // }
-
   public toggleDeleteModal(): void {
     this.deleteModalOpenned = !this.deleteModalOpenned;
   }
 
   public searchUsers(searchString: string) {
-    console.log("searching for: ", searchString)
     this.adminService.searchUsers(searchString).subscribe((users) => {
       this.users = users;
     });
-- 
GitLab


From f965710d48c7e3056c03f250d77a5fc32425ea90 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Fri, 26 Mar 2021 11:18:13 +0100
Subject: [PATCH 06/10] feat: remove other testing fix

---
 .../structure-details.component.spec.ts          | 12 ++++++------
 .../structure-list.component.spec.ts             | 16 ++++++++--------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/app/structure-list/components/structure-details/structure-details.component.spec.ts b/src/app/structure-list/components/structure-details/structure-details.component.spec.ts
index b4b524f10..d1e70665c 100644
--- a/src/app/structure-list/components/structure-details/structure-details.component.spec.ts
+++ b/src/app/structure-list/components/structure-details/structure-details.component.spec.ts
@@ -39,12 +39,12 @@ describe('StructureDetailsComponent', () => {
   });
 
   it('should return icon name with a string input', () => {
-    // const iconNameGroup = component.getAccessIcon(AccessModality.free);
-    // const iconNameCalendar = component.getAccessIcon(AccessModality.meeting);
-    // const iconNameTel = component.getAccessIcon(AccessModality.numeric);
-    // expect(iconNameGroup).toEqual('group');
-    // expect(iconNameCalendar).toEqual('calendar');
-    // expect(iconNameTel).toEqual('tel');
+    const iconNameGroup = component.getAccessIcon(AccessModality.free);
+    const iconNameCalendar = component.getAccessIcon(AccessModality.meeting);
+    const iconNameTel = component.getAccessIcon(AccessModality.numeric);
+    expect(iconNameGroup).toEqual('group');
+    expect(iconNameCalendar).toEqual('calendar');
+    expect(iconNameTel).toEqual('tel');
   });
 
   it('should update array with right modules', () => {
diff --git a/src/app/structure-list/structure-list.component.spec.ts b/src/app/structure-list/structure-list.component.spec.ts
index bb4601e5f..f7e967fcd 100644
--- a/src/app/structure-list/structure-list.component.spec.ts
+++ b/src/app/structure-list/structure-list.component.spec.ts
@@ -194,16 +194,16 @@ describe('StructureListComponent', () => {
   });
 
   it('should emit id structure to display map marker', () => {
-    // spyOn(component.displayMapMarkerId, 'emit');
-    // component.handleCardHover(structure);
-    // expect(component.displayMapMarkerId.emit).toHaveBeenCalled();
-    // expect(component.displayMapMarkerId.emit).toHaveBeenCalledWith([structure._id]);
+    spyOn(component.displayMapMarkerId, 'emit');
+    component.handleCardHover(structure);
+    expect(component.displayMapMarkerId.emit).toHaveBeenCalled();
+    expect(component.displayMapMarkerId.emit).toHaveBeenCalledWith([structure._id]);
   });
 
   it('should emit undefined id structure to remove map marker', () => {
-    // spyOn(component.displayMapMarkerId, 'emit');
-    // component.mouseLeave();
-    // expect(component.displayMapMarkerId.emit).toHaveBeenCalled();
-    // expect(component.displayMapMarkerId.emit).toHaveBeenCalledWith([undefined]);
+    spyOn(component.displayMapMarkerId, 'emit');
+    component.mouseLeave();
+    expect(component.displayMapMarkerId.emit).toHaveBeenCalled();
+    expect(component.displayMapMarkerId.emit).toHaveBeenCalledWith([undefined]);
   });
 });
-- 
GitLab


From 63c761ad73d2a5f531e290323d5c6c3401d7af0f Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Fri, 26 Mar 2021 17:44:24 +0100
Subject: [PATCH 07/10] fix: MR feedback part 1

---
 .../delete-user/delete-user.component.html    |  7 +++++--
 .../delete-user/delete-user.component.scss    |  5 ++---
 .../delete-user/delete-user.component.ts      | 21 ++++++++++---------
 .../admin/components/panel/panel.component.ts |  6 ++++--
 4 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/app/admin/components/delete-user/delete-user.component.html b/src/app/admin/components/delete-user/delete-user.component.html
index 96fede389..16062ed92 100644
--- a/src/app/admin/components/delete-user/delete-user.component.html
+++ b/src/app/admin/components/delete-user/delete-user.component.html
@@ -8,13 +8,16 @@
     <tr *ngFor="let user of users">
       <td>{{user.email}}</td>
       <td>
-        <button (click)="toggleDeleteModal()">Supprimer</button>
+        <button (click)="toggleDeleteModal(user.email)">Supprimer</button>
       </td>
       <app-modal-confirmation
   [openned]="deleteModalOpenned"
-  [content]="'Voulez-vous vraiment supprimer cet utilisateur&nbsp;? (' + user.email + ')'"
+  [content]="'Voulez-vous vraiment supprimer cet utilisateur&nbsp;? (' + emailToDelete + ')'"
   (closed)="deleteUser(user, $event)"
 ></app-modal-confirmation>
     </tr>
+    <div *ngIf="users.length == 0">
+      Aucun résultat
+    </div>
   </div>
 </div>
\ No newline at end of file
diff --git a/src/app/admin/components/delete-user/delete-user.component.scss b/src/app/admin/components/delete-user/delete-user.component.scss
index d13aab9f2..39b7a0741 100644
--- a/src/app/admin/components/delete-user/delete-user.component.scss
+++ b/src/app/admin/components/delete-user/delete-user.component.scss
@@ -1,9 +1,8 @@
-.userlist {
+.userList {
     max-width: 50%;
-    
 }
 
-.userblock {
+.userBlock {
     max-width: 50%;
     margin: 0 auto;
 }
\ No newline at end of file
diff --git a/src/app/admin/components/delete-user/delete-user.component.ts b/src/app/admin/components/delete-user/delete-user.component.ts
index a0acef58d..c2efa7d86 100644
--- a/src/app/admin/components/delete-user/delete-user.component.ts
+++ b/src/app/admin/components/delete-user/delete-user.component.ts
@@ -1,6 +1,6 @@
 import { Component, OnInit } from '@angular/core';
 import { User } from '../../../models/user.model';
-import { DemandAttachment } from '../../models/demandAttachment.model';
+import { ProfileService } from '../../../profile/services/profile.service';
 import { AdminService } from '../../services/admin.service';
 
 @Component({
@@ -11,32 +11,33 @@ import { AdminService } from '../../services/admin.service';
 export class DeleteUserComponent implements OnInit {
   public users: User[];
   public deleteModalOpenned = false;
-  constructor(private adminService: AdminService) {}
+  emailToDelete: string;
+  constructor(private adminService: AdminService, private profileService: ProfileService) {}
 
   ngOnInit(): void {
-
   }
 
   public deleteUser(user: User, shouldDelete: boolean): void {
-    this.toggleDeleteModal();
+    this.toggleDeleteModal(user.email);
     if (shouldDelete) {
       this.adminService
         .deleteUser(user.email)
         .subscribe((data) => {
-          this.users = this.users.filter(function( obj ) {
-            return obj.email !== data.email;
-          });
+          this.users = this.users.filter(( obj ) => obj.email !== data.email);
         });
     }
   }
 
-  public toggleDeleteModal(): void {
+  public toggleDeleteModal(emailToDelete: string): void {
+    this.emailToDelete = emailToDelete;
     this.deleteModalOpenned = !this.deleteModalOpenned;
   }
 
-  public searchUsers(searchString: string) {
+  public searchUsers(searchString: string): void {
     this.adminService.searchUsers(searchString).subscribe((users) => {
-      this.users = users;
+      this.profileService.getProfile().then((profile) => {
+        this.users = users.filter((obj ) => obj.email != profile.email);
+      });
     });
   }
 }
diff --git a/src/app/admin/components/panel/panel.component.ts b/src/app/admin/components/panel/panel.component.ts
index b69b87c6a..496e0d0af 100644
--- a/src/app/admin/components/panel/panel.component.ts
+++ b/src/app/admin/components/panel/panel.component.ts
@@ -1,4 +1,5 @@
 import { Component, OnInit } from '@angular/core';
+import { AdminPannelEnum } from '../../../shared/enum/adminPanel.enum';
 
 @Component({
   selector: 'app-admin-panel',
@@ -6,13 +7,14 @@ import { Component, OnInit } from '@angular/core';
 })
 export class PanelComponent implements OnInit {
   public activeFeature: string;
+  
   constructor() {}
 
   ngOnInit(): void {
-    this.activeFeature = "structure";
+    this.activeFeature = AdminPannelEnum.pendingStructures;
   }
 
-  public changeActiveFeature(newFeature: string) {
+  public changeActiveFeature(newFeature: AdminPannelEnum) {
     this.activeFeature = newFeature;
   }
 }
-- 
GitLab


From 356b44015bb77399371cbc71024a6afb94071203 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Mon, 29 Mar 2021 11:01:54 +0200
Subject: [PATCH 08/10] update after MR

---
 .../components/delete-user/delete-user.component.html    | 2 +-
 .../components/delete-user/delete-user.component.ts      | 5 +----
 src/app/admin/components/panel/panel.component.html      | 8 ++++----
 src/app/admin/components/panel/panel.component.ts        | 9 ++++++---
 src/app/shared/enum/adminPanel.enum.ts                   | 4 ++++
 5 files changed, 16 insertions(+), 12 deletions(-)
 create mode 100644 src/app/shared/enum/adminPanel.enum.ts

diff --git a/src/app/admin/components/delete-user/delete-user.component.html b/src/app/admin/components/delete-user/delete-user.component.html
index 16062ed92..e7f3adc18 100644
--- a/src/app/admin/components/delete-user/delete-user.component.html
+++ b/src/app/admin/components/delete-user/delete-user.component.html
@@ -16,7 +16,7 @@
   (closed)="deleteUser(user, $event)"
 ></app-modal-confirmation>
     </tr>
-    <div *ngIf="users.length == 0">
+    <div *ngIf="users && users.length == 0">
       Aucun résultat
     </div>
   </div>
diff --git a/src/app/admin/components/delete-user/delete-user.component.ts b/src/app/admin/components/delete-user/delete-user.component.ts
index c2efa7d86..dde3dbe2f 100644
--- a/src/app/admin/components/delete-user/delete-user.component.ts
+++ b/src/app/admin/components/delete-user/delete-user.component.ts
@@ -8,15 +8,12 @@ import { AdminService } from '../../services/admin.service';
   templateUrl: './delete-user.component.html',
   styleUrls: ['./delete-user.component.scss']
 })
-export class DeleteUserComponent implements OnInit {
+export class DeleteUserComponent {
   public users: User[];
   public deleteModalOpenned = false;
   emailToDelete: string;
   constructor(private adminService: AdminService, private profileService: ProfileService) {}
 
-  ngOnInit(): void {
-  }
-
   public deleteUser(user: User, shouldDelete: boolean): void {
     this.toggleDeleteModal(user.email);
     if (shouldDelete) {
diff --git a/src/app/admin/components/panel/panel.component.html b/src/app/admin/components/panel/panel.component.html
index 7a528bbce..59fd4410a 100644
--- a/src/app/admin/components/panel/panel.component.html
+++ b/src/app/admin/components/panel/panel.component.html
@@ -1,13 +1,13 @@
 <div fxLayout="column" fxLayoutGap="20px" class="content-container full-screen">
   <div fxLayout="row" fxLayoutAlign="center center"><h1>Administration</h1></div>
   <div fxLayout="row" fxLayoutGap="20px" fxLayoutAlign="center center">
-    <button  (click)="changeActiveFeature('structure')">Gestion structure</button>
-    <button  (click)="changeActiveFeature('userDeletion')">Suppression d'utilisateurs</button>
+    <button  (click)="changeActiveFeature(features.pendingStructures)">Gestion structure</button>
+    <button  (click)="changeActiveFeature(features.deleteUsers)">Suppression d'utilisateurs</button>
   </div>
-  <div *ngIf="activeFeature == 'userDeletion'">
+  <div *ngIf="selectedFeature === features.deleteUsers">
     <app-admin-delete-user></app-admin-delete-user>
   </div>
-  <div *ngIf="activeFeature == 'structure'">
+  <div *ngIf="selectedFeature === features.pendingStructures">
     <app-admin-claim-structure></app-admin-claim-structure>
   </div>
 </div>
\ No newline at end of file
diff --git a/src/app/admin/components/panel/panel.component.ts b/src/app/admin/components/panel/panel.component.ts
index 496e0d0af..2fa982173 100644
--- a/src/app/admin/components/panel/panel.component.ts
+++ b/src/app/admin/components/panel/panel.component.ts
@@ -1,4 +1,5 @@
 import { Component, OnInit } from '@angular/core';
+import { TestBed } from '@angular/core/testing';
 import { AdminPannelEnum } from '../../../shared/enum/adminPanel.enum';
 
 @Component({
@@ -6,15 +7,17 @@ import { AdminPannelEnum } from '../../../shared/enum/adminPanel.enum';
   templateUrl: './panel.component.html',
 })
 export class PanelComponent implements OnInit {
-  public activeFeature: string;
+  
+  public features = AdminPannelEnum;
+  public selectedFeature;
   
   constructor() {}
 
   ngOnInit(): void {
-    this.activeFeature = AdminPannelEnum.pendingStructures;
+    this.selectedFeature = this.features.pendingStructures;
   }
 
   public changeActiveFeature(newFeature: AdminPannelEnum) {
-    this.activeFeature = newFeature;
+    this.selectedFeature = newFeature;
   }
 }
diff --git a/src/app/shared/enum/adminPanel.enum.ts b/src/app/shared/enum/adminPanel.enum.ts
new file mode 100644
index 000000000..39dbc605f
--- /dev/null
+++ b/src/app/shared/enum/adminPanel.enum.ts
@@ -0,0 +1,4 @@
+export enum AdminPannelEnum {
+  deleteUsers,
+  pendingStructures,
+}
-- 
GitLab


From 21462da9a7ae6d322465855a7fac5c67bd95c7d9 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Mon, 29 Mar 2021 11:28:56 +0200
Subject: [PATCH 09/10] second update after MR

---
 .../admin/components/delete-user/delete-user.component.ts | 2 +-
 src/app/admin/services/admin.service.ts                   | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/app/admin/components/delete-user/delete-user.component.ts b/src/app/admin/components/delete-user/delete-user.component.ts
index dde3dbe2f..5bb548118 100644
--- a/src/app/admin/components/delete-user/delete-user.component.ts
+++ b/src/app/admin/components/delete-user/delete-user.component.ts
@@ -18,7 +18,7 @@ export class DeleteUserComponent {
     this.toggleDeleteModal(user.email);
     if (shouldDelete) {
       this.adminService
-        .deleteUser(user.email)
+        .deleteUser(user._id)
         .subscribe((data) => {
           this.users = this.users.filter(( obj ) => obj.email !== data.email);
         });
diff --git a/src/app/admin/services/admin.service.ts b/src/app/admin/services/admin.service.ts
index d2c004dc9..689fdc668 100644
--- a/src/app/admin/services/admin.service.ts
+++ b/src/app/admin/services/admin.service.ts
@@ -18,16 +18,16 @@ export class AdminService {
   }
 
   public getUsers(): Observable<User[]> {
-    return this.http.get<User[]>(`api/users`);
+    return this.http.get<User[]>(`api/admin/searchUsers`);
   }
 
   public searchUsers(searchString: string): Observable<User[]> {
-    return this.http.post<User[]>(`api/users/searchUsers`, { searchString });
+    return this.http.post<User[]>(`api/admin/searchUsers`, { searchString });
   }
   
 
-  public deleteUser(email: string): Observable<User> {
-    return this.http.post<User>(`api/users/delete-user`, { email });
+  public deleteUser(id: string): Observable<User> {
+    return this.http.delete<User>(`api/admin/user/` + id);
   }
 
   public acceptStructureClaim(
-- 
GitLab


From 97f2b0b4a81d1f25cd6868a10387ad402182e284 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 29 Mar 2021 16:39:48 +0200
Subject: [PATCH 10/10] fix: user delete for admin

---
 .../delete-user/delete-user.component.html    | 29 +++++++++----------
 .../delete-user/delete-user.component.ts      | 23 +++++++--------
 .../components/panel/panel.component.html     |  7 +++--
 .../modal-confirmation.component.ts           |  8 ++---
 4 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/src/app/admin/components/delete-user/delete-user.component.html b/src/app/admin/components/delete-user/delete-user.component.html
index e7f3adc18..5649bff29 100644
--- a/src/app/admin/components/delete-user/delete-user.component.html
+++ b/src/app/admin/components/delete-user/delete-user.component.html
@@ -1,23 +1,22 @@
-<div fxLayout="column" fxLayoutGap="5px" fxLayoutAlign="center center" class="userblock">
+<div fxLayout="column" fxLayoutGap="5px" fxLayoutAlign="center center" class="userBlock">
   <h4>Suppression d'utilisateurs</h4>
   <div fxLayout="row">
-    <input #searchstring (keyup)="0">
-    <button  (click)="searchUsers(searchstring.value)">Rechercher</button>
+    <input #searchstring (keyup)="(0)" />
+    <button (click)="searchUsers(searchstring.value)">Rechercher</button>
   </div>
-  <div class="userlist">
+  <div class="userList">
     <tr *ngFor="let user of users">
-      <td>{{user.email}}</td>
+      <td>{{ user.email }}</td>
       <td>
-        <button (click)="toggleDeleteModal(user.email)">Supprimer</button>
+        <button (click)="toggleDeleteModal(user)">Supprimer</button>
       </td>
-      <app-modal-confirmation
-  [openned]="deleteModalOpenned"
-  [content]="'Voulez-vous vraiment supprimer cet utilisateur&nbsp;? (' + emailToDelete + ')'"
-  (closed)="deleteUser(user, $event)"
-></app-modal-confirmation>
     </tr>
-    <div *ngIf="users && users.length == 0">
-      Aucun résultat
-    </div>
+    <app-modal-confirmation
+      *ngIf="userToDelete"
+      [openned]="deleteModalOpenned"
+      [content]="'Voulez-vous vraiment supprimer cet utilisateur&nbsp;? (' + userToDelete.email + ')'"
+      (closed)="deleteUser(userToDelete, $event)"
+    ></app-modal-confirmation>
+    <div *ngIf="users && users.length == 0">Aucun résultat</div>
   </div>
-</div>
\ No newline at end of file
+</div>
diff --git a/src/app/admin/components/delete-user/delete-user.component.ts b/src/app/admin/components/delete-user/delete-user.component.ts
index 5bb548118..00e5c943b 100644
--- a/src/app/admin/components/delete-user/delete-user.component.ts
+++ b/src/app/admin/components/delete-user/delete-user.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit } from '@angular/core';
+import { Component } from '@angular/core';
 import { User } from '../../../models/user.model';
 import { ProfileService } from '../../../profile/services/profile.service';
 import { AdminService } from '../../services/admin.service';
@@ -6,34 +6,33 @@ import { AdminService } from '../../services/admin.service';
 @Component({
   selector: 'app-admin-delete-user',
   templateUrl: './delete-user.component.html',
-  styleUrls: ['./delete-user.component.scss']
+  styleUrls: ['./delete-user.component.scss'],
 })
 export class DeleteUserComponent {
   public users: User[];
   public deleteModalOpenned = false;
-  emailToDelete: string;
+  public userToDelete: User = null;
+
   constructor(private adminService: AdminService, private profileService: ProfileService) {}
 
   public deleteUser(user: User, shouldDelete: boolean): void {
-    this.toggleDeleteModal(user.email);
+    this.toggleDeleteModal(user);
     if (shouldDelete) {
-      this.adminService
-        .deleteUser(user._id)
-        .subscribe((data) => {
-          this.users = this.users.filter(( obj ) => obj.email !== data.email);
-        });
+      this.adminService.deleteUser(user._id).subscribe((data) => {
+        this.users = this.users.filter((obj) => obj.email !== data.email);
+      });
     }
   }
 
-  public toggleDeleteModal(emailToDelete: string): void {
-    this.emailToDelete = emailToDelete;
+  public toggleDeleteModal(userToDelete: User): void {
+    this.userToDelete = userToDelete;
     this.deleteModalOpenned = !this.deleteModalOpenned;
   }
 
   public searchUsers(searchString: string): void {
     this.adminService.searchUsers(searchString).subscribe((users) => {
       this.profileService.getProfile().then((profile) => {
-        this.users = users.filter((obj ) => obj.email != profile.email);
+        this.users = users.filter((obj) => obj.email != profile.email);
       });
     });
   }
diff --git a/src/app/admin/components/panel/panel.component.html b/src/app/admin/components/panel/panel.component.html
index 59fd4410a..783642e99 100644
--- a/src/app/admin/components/panel/panel.component.html
+++ b/src/app/admin/components/panel/panel.component.html
@@ -1,8 +1,9 @@
 <div fxLayout="column" fxLayoutGap="20px" class="content-container full-screen">
   <div fxLayout="row" fxLayoutAlign="center center"><h1>Administration</h1></div>
   <div fxLayout="row" fxLayoutGap="20px" fxLayoutAlign="center center">
-    <button  (click)="changeActiveFeature(features.pendingStructures)">Gestion structure</button>
-    <button  (click)="changeActiveFeature(features.deleteUsers)">Suppression d'utilisateurs</button>
+    <button (click)="changeActiveFeature(features.pendingStructures)">Gestion structure</button>
+    <button (click)="changeActiveFeature(features.deleteUsers)">Suppression d'utilisateurs</button>
+    <button routerLink="/blog/ghost/">Ghost</button>
   </div>
   <div *ngIf="selectedFeature === features.deleteUsers">
     <app-admin-delete-user></app-admin-delete-user>
@@ -10,4 +11,4 @@
   <div *ngIf="selectedFeature === features.pendingStructures">
     <app-admin-claim-structure></app-admin-claim-structure>
   </div>
-</div>
\ No newline at end of file
+</div>
diff --git a/src/app/shared/components/modal-confirmation/modal-confirmation.component.ts b/src/app/shared/components/modal-confirmation/modal-confirmation.component.ts
index a143aa820..2232792d2 100644
--- a/src/app/shared/components/modal-confirmation/modal-confirmation.component.ts
+++ b/src/app/shared/components/modal-confirmation/modal-confirmation.component.ts
@@ -1,16 +1,16 @@
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { Component, EventEmitter, Input, Output } from '@angular/core';
 
 @Component({
   selector: 'app-modal-confirmation',
   templateUrl: './modal-confirmation.component.html',
   styleUrls: ['./modal-confirmation.component.scss'],
 })
-export class ModalConfirmationComponent implements OnInit {
-  constructor() {}
+export class ModalConfirmationComponent {
   @Input() public openned: boolean;
   @Input() public content: string;
   @Output() closed = new EventEmitter<boolean>();
-  ngOnInit(): void {}
+
+  constructor() {}
 
   public closeModal(value: boolean): void {
     this.closed.emit(value);
-- 
GitLab