From c28390cedfc909ff8e96e4527b75699e1529410c Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:22:41 -0400 Subject: work on fields dashboard --- .../views/nodes/DataVizBox/DocCreatorMenu.tsx | 44 ++++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx') diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx index 19881f4d2..d3117da22 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx @@ -763,6 +763,29 @@ export class DocCreatorMenu extends ObservableReactComponent { + if (this._dataViz?.axes.includes(field.title)) { + this._dataViz.selectAxes(this._dataViz.axes.filter(col => col !== field.title)); + } else { + const toRemove = this._fields.filter(f => f.id === field.id); + if (!toRemove) return; + + if (toRemove.length > 1) { + while (toRemove.length > 1) { + toRemove.pop(); + } + } + + if (this._fields.length === 1) { + this._fields = [] + } else { + console.log(this._fields) + this._fields.splice(this._fields.indexOf(toRemove[0]), 1); + console.log(this._fields) + } + } + } + get dashboardContents(){ return (
@@ -771,16 +794,23 @@ export class DocCreatorMenu extends ObservableReactComponent
- {this.fieldsInfos.map(field => -
+ {this.fieldsInfos.map((field, index) => +
- - - {field.type === 'Text' ? - : null} + +
+ Type:  + {field.type ? field.type === 'text' ? 'Text' : 'File' : ''} +
+ {field.type = 'text'; this.forceUpdate()}}/> +
Text
+ {field.type = 'visual'; this.forceUpdate()}}/> +
File
+
+