aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2023-12-04 18:49:31 -0500
committersrichman333 <sarah_n_richman@brown.edu>2023-12-04 18:49:31 -0500
commit791ca5ff760aa320c596da0d2cdee16d198aeeb6 (patch)
tree4538c2a8f2fc4ee80b50db225ce53750a323d816 /src/client/views/collections
parentac51767cba1a4694980ee26272b09194ddefb0a7 (diff)
dataviz as schema live updates
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 3a1ea766a..d53049e04 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1976,9 +1976,11 @@ ScriptingGlobals.add(function sendToBack(doc: Doc) {
});
ScriptingGlobals.add(function datavizFromSchema(doc: Doc) {
SelectionManager.Views().forEach(view => {
- var keys = Cast(view.layoutDoc.schema_columnKeys, listSpec('string'))?.filter(key => key!="text");
- const defaultColumnKeys: string[] = ['title', 'type', 'author', 'author_date'];
- if (!keys) keys = Cast(view.layoutDoc.schema_columnKeys, listSpec('string'), defaultColumnKeys);;
+ if (!view.layoutDoc.schema_columnKeys){
+ view.layoutDoc.schema_columnKeys = new List<string>(['title', 'type', 'author', 'author_date'])
+ }
+ const keys = Cast(view.layoutDoc.schema_columnKeys, listSpec('string'))?.filter(key => key!="text");
+ if (!keys) return;
const children = DocListCast(view.rootDoc[Doc.LayoutFieldKey(view.rootDoc)]);
let csvRows = [];
@@ -2000,8 +2002,10 @@ ScriptingGlobals.add(function datavizFromSchema(doc: Doc) {
DocUtils.uploadFileToDoc(file, {}, loading);
if (view.ComponentView?.addDocument) {
+ // loading.dataViz_fromSchema = true;
+ loading.dataViz_asSchema = view.layoutDoc;
SchemaCSVPopUp.Instance.setView(view);
- SchemaCSVPopUp.Instance.setTarget(view.rootDoc);
+ SchemaCSVPopUp.Instance.setTarget(view.layoutDoc);
SchemaCSVPopUp.Instance.setDataVizDoc(loading);
SchemaCSVPopUp.Instance.setVisible(true);
}