aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/DataVizBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DataVizBox.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/DataVizBox.tsx14
1 files changed, 11 insertions, 3 deletions
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;
}
}