From 8fb9a7db06b4f317ce893b3b06704c4803cf45b5 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Tue, 16 Jun 2020 09:43:32 +0200
Subject: [PATCH] FEAT #10034 TIME 10 fix issues

---
 .../tag/tag-administration.component.html           |  4 ++--
 .../tag/tag-administration.component.ts             | 13 +++++++------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/frontend/app/administration/tag/tag-administration.component.html b/src/frontend/app/administration/tag/tag-administration.component.html
index d5f9f60ab64..3afd9d57103 100644
--- a/src/frontend/app/administration/tag/tag-administration.component.html
+++ b/src/frontend/app/administration/tag/tag-administration.component.html
@@ -38,7 +38,7 @@
                                     [matAutocomplete]="auto" [matChipInputFor]="chipList">
                             </mat-chip-list>
                             <mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)">
-                                <mat-option *ngFor="let tag of filteredOptions | async" [value]="tag"  [disabled]="isSelected(tag)">
+                                <mat-option *ngFor="let tag of filteredOptions | async" [value]="tag"  [disabled]="isSelected(tag) || tag.id == id">
                                     {{tag.label}}
                                 </mat-option>
                             </mat-autocomplete>
@@ -77,4 +77,4 @@
             </div>
         </mat-list>
     </mat-sidenav>
-</mat-sidenav-container>
\ No newline at end of file
+</mat-sidenav-container>
diff --git a/src/frontend/app/administration/tag/tag-administration.component.ts b/src/frontend/app/administration/tag/tag-administration.component.ts
index 0fe0c778b48..00bc215cdeb 100644
--- a/src/frontend/app/administration/tag/tag-administration.component.ts
+++ b/src/frontend/app/administration/tag/tag-administration.component.ts
@@ -63,19 +63,19 @@ export class TagAdministrationComponent implements OnInit {
     ) {
     }
 
-    async ngOnInit(): Promise<void> {
+    ngOnInit(): void {
         this.loading = true;
 
-        await this.getTags();
 
-        this.route.params.subscribe((params) => {
+        this.route.params.subscribe(async (params) => {
+            this.id = params['id'];
+            await this.getTags();
             if (typeof params['id'] === 'undefined') {
                 this.headerService.setHeader(this.lang.tagCreation);
                 this.creationMode = true;
                 this.loading = false;
             } else {
                 this.creationMode = false;
-                this.id = params['id'];
                 this.http.get(`../../rest/tags/${this.id}`).pipe(
                     tap((data: any) => {
                         Object.keys(this.tag).forEach(element => {
@@ -148,12 +148,13 @@ export class TagAdministrationComponent implements OnInit {
         return new Promise((resolve) => {
             this.http.get('../../rest/tags').pipe(
                 tap((data: any) => {
-                    this.tags = data.tags.filter((tag: any) => tag.id !== this.id).map((tag: any) => {
+                    this.tags = data.tags.map((tag: any) => {
                         return {
                             id: tag.id,
                             label: tag.label,
                             parentId: tag.parentId,
-                            countResources: tag.countResources
+                            countResources: tag.countResources,
+                            disabled: tag.id == this.id
                         };
                     });
                     resolve(true);
-- 
GitLab