From 35724d24821132ab5c6df398447db4e9760155cb Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:25:22 -0400
Subject: dashbord updates properly

---
 src/client/views/nodes/DataVizBox/DataVizBox.tsx | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

(limited to 'src/client/views/nodes/DataVizBox/DataVizBox.tsx')

diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
index eaf5c1758..cef7f62b1 100644
--- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx
+++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
@@ -64,6 +64,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
     @observable _savedAnnotations = new ObservableMap<number, HTMLDivElement[]>();
     @observable _specialHighlightedRow: number | undefined = undefined;
     @observable GPTSummary: ObservableMap<string, string> | undefined = undefined;
+    @observable colDescriptions: ObservableMap<string, string> = new ObservableMap();
     @observable fieldTypes: ObservableMap<string, string> = new ObservableMap();
     @observable _GPTLoading: boolean = false;
 
@@ -150,12 +151,20 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
         this.fieldTypes?.set(field, type);
     }
 
+    @action setFieldDesc = (field: string, desc: string) => {
+        if (!desc) { 
+            this.colDescriptions.set(field, this.GPTSummary?.get(field) ?? '');
+        } else {
+            this.colDescriptions.set(field, desc);
+        }
+    }
+
     getFieldType = (field: string): string => {
         return this.fieldTypes?.get(field) ?? '';
     }
 
     getFieldDescription = (field: string): string => {
-        return this.GPTSummary?.get(field) ?? '';
+        return this.colDescriptions?.get(field) ?? '';
     }
 
     @action // pinned / linked anchor doc includes selected rows, graph titles, and graph colors
@@ -533,9 +542,9 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
                 const descs: {[col: string]: string} = JSON.parse(res);
                 for (const [key, val] of Object.entries(descs)) {
                     this.GPTSummary.set(key, val);
+                    if (!this.colDescriptions.get(key)) this.colDescriptions.set(key, val);
                 }
 
-                console.log(res, descs);
             }
         } catch (err) {
             console.error(err);
@@ -549,7 +558,6 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
             const colTitles: string[] = Object.keys(this.records[0]);
             for (let i = 0; i < colTitles.length; ++i){
                 if (colTitles[i] === title) {
-                    console.log(true); 
                     return true;
                 }
             }
-- 
cgit v1.2.3-70-g09d2

