From 3ffa0bfd9b6c0cbed359ae8114c558de9711cdee Mon Sep 17 00:00:00 2001
From: naji <naji@cines.fr>
Date: Thu, 27 May 2021 07:36:41 +0200
Subject: [PATCH] feat: changement dynamic de css file tree

---
 .../edit-profile/file-tree/file-tree.component.html   |  3 ++-
 .../edit-profile/file-tree/file-tree.component.ts     | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree/file-tree.component.html b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree/file-tree.component.html
index 6dd168d41..9864ec447 100644
--- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree/file-tree.component.html
+++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree/file-tree.component.html
@@ -50,7 +50,8 @@
                   <mat-icon>{{nestedTreeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}</mat-icon>
               </button>
               <span class="pastis-tree-node-name">
-                <span class="text text-medium">{{onResolveName(node)}}</span>
+                <span class="text text-medium"
+                [ngStyle]="{'color': selectedItem(node) }">{{onResolveName(node)}}</span>
                 <span *ngIf="node.name === 'ArchiveUnit'"
                               style="float: right;"
                               tooltip="Ajouter une UA"
diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree/file-tree.component.ts b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree/file-tree.component.ts
index e4e6118a1..d4870d9dc 100644
--- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree/file-tree.component.ts
+++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree/file-tree.component.ts
@@ -88,6 +88,7 @@ export class FileTreeComponent {
   dataChange = new BehaviorSubject<FileNode>(null);
   rulesChange: string[][] = [];
   rootMetadataName: string;
+  selectedItemList: FileNode;
 
 
 
@@ -328,6 +329,8 @@ export class FileTreeComponent {
   }
 
   updateMedataTable(node: FileNode) {
+    console.error(this.selectedItemList);
+    this.selectedItemList = node;
     let rulesFromService = this.fileService.tabChildrenRulesChange.getValue()
     let tabChildrenToInclude = rulesFromService[0];
     let tabChildrenToExclude = rulesFromService[1];
@@ -552,5 +555,13 @@ export class FileTreeComponent {
       this.loggingService.showSuccess('La métadonnée ArchiveUnit a été ajoutée');
     }
   }
+  selectedItem(node: FileNode){
+    if(this.selectedItemList && node){
+      if(this.selectedItemList.id == node.id){
+        return "var(--vitamui-primary)";
+      }
+    }
+    return "none";
+  }
 
 }
-- 
GitLab